Index: openacs-4/contrib/packages/room-reservation/tcl/calendar-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/calendar-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/room-reservation/tcl/calendar-procs-postgresql.xql 15 Mar 2004 03:39:30 -0000 1.1 +++ openacs-4/contrib/packages/room-reservation/tcl/calendar-procs-postgresql.xql 19 Oct 2005 17:36:29 -0000 1.2 @@ -13,15 +13,19 @@ to_char(start_date, 'HH24') as start_hour, to_char(start_date, 'HH24:MI') as start_date, to_char(end_date, 'HH24:MI') as end_date, - e.name + e.name, + fr.name as room_name from acs_events e join timespans s on (e.timespan_id = s.timespan_id) join time_intervals t on (s.interval_id = t.interval_id) join rr_reservations r on (e.event_id = r.reservation_id) - where r.room_id = :room_id and - start_date >= to_date(:current_date,:date_format) and + inner join rr_rooms fr + on (r.room_id = fr.room_id) + WHERE 1=1 + $where_clause + and start_date >= to_date(:current_date,:date_format) and start_date < to_date(:current_date,:date_format) + 1 @@ -37,15 +41,19 @@ to_char(start_date, 'Day') as pretty_weekday, to_char(start_date, 'HH:MIpm') as pretty_start_date, to_char(end_date, 'HH:MIpm') as pretty_end_date, - e.name + e.name, + fr.name as room_name from acs_events e join timespans s on (e.timespan_id = s.timespan_id) join time_intervals t on (s.interval_id = t.interval_id) join rr_reservations r on (e.event_id = r.reservation_id) - where r.room_id = :room_id and - (start_date > to_date(:start_date,:date_format) or :start_date is null) and + inner join rr_rooms fr + on (r.room_id = fr.room_id) + WHERE 1=1 + $where_clause + and (start_date > to_date(:start_date,:date_format) or :start_date is null) and (start_date < to_date(:end_date,:date_format) or :end_date is null) @@ -56,7 +64,7 @@ select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'D') as day_of_the_week, - to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')- '1 week'::timespan, 'Sunday'), 'YYYY-MM-DD') + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')- '1 week'::interval, 'Sunday'), 'YYYY-MM-DD') as sunday_of_the_week, to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'), 'YYYY-MM-DD') as saturday_of_the_week @@ -75,15 +83,19 @@ to_char(end_date, 'HH:MIpm') as pretty_end_date, to_char(start_date,'HH24:MI') as start_date, to_char(end_date,'HH24:MI') as end_date, - e.name + e.name, + fr.name as room_name from acs_events e join timespans s on (e.timespan_id = s.timespan_id) join time_intervals t on (s.interval_id = t.interval_id) join rr_reservations r on (e.event_id = r.reservation_id) - where r.room_id = :room_id and - start_date between + inner join rr_rooms fr + on (r.room_id = fr.room_id) + WHERE 1=1 + $where_clause + and start_date between to_date(:sunday_of_the_week,'YYYY-MM-DD') and to_date(:saturday_of_the_week,'YYYY-MM-DD') @@ -99,14 +111,18 @@ to_char(start_date, 'J') as start_date, to_char(start_date, 'HH:MIpm') as start_time, to_char(end_date, 'HH:MIpm') as end_time, - e.name + e.name, + fr.name as room_name from acs_events e join timespans s on (e.timespan_id = s.timespan_id) join time_intervals t on (s.interval_id = t.interval_id) join rr_reservations r on (e.event_id = r.reservation_id) - where r.room_id = :room_id + inner join rr_rooms fr + on (r.room_id = fr.room_id) + + $where_clause order by start_date,end_date Index: openacs-4/contrib/packages/room-reservation/tcl/calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/calendar-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/room-reservation/tcl/calendar-procs.tcl 18 Oct 2005 23:32:34 -0000 1.3 +++ openacs-4/contrib/packages/room-reservation/tcl/calendar-procs.tcl 19 Oct 2005 17:36:29 -0000 1.4 @@ -29,6 +29,12 @@ set date [dt_sysdate] } + if {[info exists room_id]} { + set where_clause "and r.room_id = :room_id" + } else { + set where_clause "" + } + set current_date $date set items [ns_set create] @@ -74,6 +80,12 @@ set current_date $date set items [ns_set create] + if {[info exists room_id]} { + set where_clause "and r.room_id = :room_id" + } else { + set where_clause "" + } + db_foreach select_list_reservations {} { set item "$name" set item [subst $item_template] @@ -108,6 +120,12 @@ set items [ns_set create] + if {[info exists room_id]} { + set where_clause "and r.room_id = :room_id" + } else { + set where_clause "" + } + db_1row select_weekday_info {} # Loop through the calendars