Index: openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl 22 Aug 2005 23:15:00 -0000 1.4 +++ openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl 25 Aug 2005 19:07:48 -0000 1.5 @@ -106,3 +106,50 @@ } } } + +ad_proc -public dotlrn_ecommerce::check_expired_orders { +} { + Check recently expired orders in shopping cart and flush the cache + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-08-18 + + @return + + @error +} { + # Loop thru recently expired orders + db_foreach expired_orders { + select order_id + from ec_orders + where order_state = 'expired' + and expired_date > (current_timestamp - '10 minutes'::interval) + } { + # Loop thru recently expired items, and flush the cached section + db_foreach expired_items { + select s.section_id + from ec_items i, dotlrn_ecommerce_section s + where i.product_id = s.product_id + and item_state = 'expired' + and expired_date > (current_timestamp - '10 minutes'::interval) + } { + util_memoize_flush [list dotlrn_ecommerce::section::attendees $section_id] + } + } +} + +ad_proc -public dotlrn_ecommerce::check_expired_orders_once { +} { + Reschedule checking of expired orders + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-08-18 + + @return + + @error +} { + dotlrn_ecommerce::check_expired_orders + + ad_schedule_proc -thread t 600 dotlrn_ecommerce::check_expired_orders +} \ No newline at end of file