Index: openacs-4/packages/acs-events/acs-events.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/acs-events.info,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-events/acs-events.info 15 May 2007 20:14:14 -0000 1.17 +++ openacs-4/packages/acs-events/acs-events.info 29 Aug 2008 15:13:49 -0000 1.18 @@ -7,16 +7,16 @@ f t - + OpenACS API support for relationships between intervals in time, activities, and parties. 2006-02-18 OpenACS The events service is primarily intended for use by writers of application packages and other service packages. The service allows developers to specify and manipulate relationships (possibly recurring) between an object and another object. 0 - - + + Index: openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql 27 Sep 2007 13:21:22 -0000 1.16 +++ openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql 29 Aug 2008 15:13:49 -0000 1.17 @@ -818,8 +818,8 @@ and (p_edit_past_events_p = ''t'' or start_date >= v_one_start_date) LOOP PERFORM time_interval__edit(v_timespan.interval_id, - v_timespan.start_date + (p_start_date - v_one_start_date), - v_timespan.end_date + (p_end_date - v_one_end_date)); + (to_char(v_timespan.start_date,''yyyy-mm-dd'') || '' '' || to_char(p_start_date,''hh24:mi:ss'')) :: timestamptz, + (to_char(v_timespan.end_date,''yyyy-mm-dd'') || '' '' || to_char(p_end_date,''hh24:mi:ss'')) :: timestamptz); END LOOP; return p_event_id; Index: openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d2-0.6d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d2-0.6d3.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d2-0.6d3.sql 27 Sep 2007 13:21:22 -0000 1.1 +++ openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d2-0.6d3.sql 29 Aug 2008 15:13:49 -0000 1.2 @@ -246,3 +246,48 @@ return 0; end;' language 'plpgsql'; + +create or replace function acs_event__recurrence_timespan_edit ( + integer, + timestamptz, + timestamptz, + boolean +) returns integer as ' +DECLARE + p_event_id alias for $1; + p_start_date alias for $2; + p_end_date alias for $3; + p_edit_past_events_p alias for $4; + v_timespan RECORD; + v_one_start_date timestamptz; + v_one_end_date timestamptz; +BEGIN + -- get the initial offsets + select start_date, + end_date into v_one_start_date, + v_one_end_date + from time_intervals, + timespans, + acs_events + where time_intervals.interval_id = timespans.interval_id + and timespans.timespan_id = acs_events.timespan_id + and event_id=p_event_id; + FOR v_timespan in + select * + from time_intervals + where interval_id in (select interval_id + from timespans + where timespan_id in (select timespan_id + from acs_events + where recurrence_id = (select recurrence_id + from acs_events where event_id = p_event_id))) + and (p_edit_past_events_p = ''t'' or start_date >= v_one_start_date) + LOOP + PERFORM time_interval__edit(v_timespan.interval_id, + (to_char(v_timespan.start_date,''yyyy-mm-dd'') || '' '' || to_char(p_start_date,''hh24:mi:ss'')) :: timestamptz, + (to_char(v_timespan.end_date,''yyyy-mm-dd'') || '' '' || to_char(p_end_date,''hh24:mi:ss'')) :: timestamptz); + END LOOP; + + return p_event_id; +END; +' language 'plpgsql';