Index: openacs-4/packages/dotlrn-ecommerce/www/application-confirm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/application-confirm.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/www/application-confirm.tcl 7 Aug 2005 13:28:59 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/www/application-confirm.tcl 16 Aug 2005 16:09:25 -0000 1.2 @@ -3,10 +3,42 @@ {product_id:notnull} } -set section_name [db_string get_name { - select c.course_name||': '||s.section_name +if { [db_0or1row get_name { + select c.course_name||': '||s.section_name as section_name, s.community_id from dotlrn_ecommerce_section s, dotlrn_catalogi c, cr_items i where product_id = :product_id and c.item_id = s.course_id - and i.live_revision = c.revision_id -} -default ""] \ No newline at end of file + and i.live_revision = c.revision_id +}] } { + + set user_id [ad_conn user_id] + + if { ! [dotlrn::user_p -user_id $user_id] } { + db_transaction { + # This is a newly created user and if this page is reached, that + # means a new user answered a course application and should be put + # on the approval list + dotlrn::user_add -user_id $user_id + + # Adding a user removes an existing entry in member_rels and + # creates a new one with the default member_state so set the + # proper member state here + if { [db_0or1row get_rel { + select rel_id + from dotlrn_member_rels_full + where user_id = :user_id + and community_id = :community_id + limit 1 + }] } { + db_dml set_member_state { + update membership_rels + set member_state = 'awaiting payment' + where rel_id = :rel_id + } + } + } + } + +} else { + set section_name "" +} \ No newline at end of file