xo::ical::VCALITEM method edit_recurrence (public)

 <instance of xo::ical::VCALITEM[i]> edit_recurrence \
    [ -cal_item_id cal_item_id ] [ -recurrence_id recurrence_id ]

Defined in packages/xotcl-core/tcl/ical-procs.tcl

We might or might not have a recurrence on the old entry. In case we have one, the old one might have started earlier, so we try to terminate it.

Switches:
-cal_item_id (optional, integer)
-recurrence_id (optional, integer, accept empty)

Testcases:
No testcase defined.
Source code:
:debug "do we have a recurrence? [info exists :recurrence_options]"
if { [info exists :recurrence_options] } {
  if {$recurrence_id ne ""} {

    #
    # The current implementation of calendar::item::edit_recurrence is
    # just built for the interface of the calendar package, which does
    # not allow one to change multiple attributes. We have to assume, that a
    # calendar client allows this.
    #
    # When the old start date is the same as the new start date,
    # we could delete the recurrence and add a new one.
    #
    # calendar::item::delete_recurrence -recurrence_id $recurrence_id

    lassign [::xo::dc list -prepare integer get_old_start_date_and_event_id {
      select start_date,
      from  acs_events e, timespans t, time_intervals i
      where recurrence_id = :recurrence_id
      and   e.timespan_id = t.timespan_id
      and   i.interval_id = t.interval_id
      order by 1 limit 1
    }] old_start_date old_event_id

    :debug "recurrence_id $recurrence_id old_event_id $old_event_id cal_item_id $cal_item_id  old_start_date $old_start_date new start_date ${:dtstart} opts ${:recurrence_options}"

    ::xo::db::sql::acs_event recurrence_timespan_edit  -event_id $old_event_id  -start_date $old_start_date  -end_date ${:dtstart}
  }
  calendar::item::add_recurrence  -cal_item_id $cal_item_id  {*}${:recurrence_options}
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: