Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl 16 Jul 2005 12:51:07 -0000 1.2 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl 7 Aug 2005 13:34:45 -0000 1.3 @@ -36,14 +36,30 @@ } if { [exists_and_not_null patron_id] && [exists_and_not_null participant_id] } { - set process_purchase_clause [db_map delete_item_from_cart_purchase_process] + if { [acs_object_type $participant_id] == "group" } { + set process_purchase_clause [db_map delete_item_from_cart_purchase_process_group] + } else { + set process_purchase_clause [db_map delete_item_from_cart_purchase_process] + } } else { set process_purchase_clause "" } db_dml delete_item_from_cart "delete from ec_items where order_id=:order_id and product_id=:product_id and color_choice [ec_decode $color_choice "" "is null" "= :color_choice"] and size_choice [ec_decode $size_choice "" "is null" "= :size_choice"] and style_choice [ec_decode $style_choice "" "is null" "= :style_choice"]" db_release_unused_handles +if { [acs_object_type $participant_id] == "group" } { + # we also remove the last member from the group + set user_id_to_remove [db_string get_uid_to_remove { + select max(member_id) + from group_member_map + where group_id = :participant_id + } -default 0] + if {$user_id_to_remove} { + group::remove_member -group_id $participant_id -user_id $user_id_to_remove + } +} + # DEDS # at this point if user is deleting # a member product then we probably need to adjust Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.xql 23 Jun 2005 12:28:21 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.xql 7 Aug 2005 13:34:45 -0000 1.2 @@ -34,4 +34,15 @@ and participant_id = :participant_id) + + + + and item_id = (select max(item_id) + from dotlrn_ecommerce_orders + where order_id = :order_id + and product_id = :product_id + and patron_id = :patron_id + and participant_id = :participant_id) + +