Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl 8 Jul 2005 11:03:52 -0000 1.1 @@ -0,0 +1,34 @@ +# packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl + +ad_page_contract { + + Hold slot and request for approval + + @author (mgh@localhost.localdomain) + @creation-date 2005-07-08 + @arch-tag: 5e4b382d-9d71-4e7a-90e2-47948170d6a7 + @cvs-id $Id: application-request.tcl,v 1.1 2005/07/08 11:03:52 roelc Exp $ +} { + participant_id:integer,notnull + community_id:integer,notnull +} -properties { +} -validate { +} -errors { +} + +set extra_vars [ns_set create] +ns_set put $extra_vars user_id $participant_id +ns_set put $extra_vars community_id $community_id +if {[catch {set rel_id [relation_add \ + -member_state "request approval" \ + -extra_vars $extra_vars \ + dotlrn_member_rel \ + $community_id \ + $participant_id \ + ]} errmsg]} { + ad_return_complaint "There was a problem with your request" $errmsg +} else { + ns_log notice "DEBUG:: RELATION $participant_id, $community_id, $rel_id" +} + +ad_returnredirect ".." Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change-2.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change-2.adp 8 Jul 2005 11:03:52 -0000 1.1 @@ -0,0 +1,4 @@ + + #dotlrn-ecommerce.Your_Relationship# + + Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change-2.tcl 8 Jul 2005 11:03:52 -0000 1.1 @@ -0,0 +1,62 @@ +# packages/dotlrn-ecommerce/www/ecommerce/participant-change-2.tcl + +ad_page_contract { + + Set participant + + @author (mgh@localhost.localdomain) + @creation-date 2005-07-08 + @arch-tag: f8ed6d0a-9e08-4afa-bef7-7202518b36f2 + @cvs-id $Id: participant-change-2.tcl,v 1.1 2005/07/08 11:03:52 roelc Exp $ +} { + user_id:integer,notnull + patron_id:integer,notnull + item_id:integer,notnull +} -properties { +} -validate { +} -errors { +} + +# Add some security checks here + +if { ! [dotlrn::user_p -user_id $user_id] } { + dotlrn::user_add -user_id $user_id +} + +db_dml update_participant { + update dotlrn_ecommerce_orders + set participant_id = :user_id + where item_id = :item_id +} + +set rel_id [relation::get_id -object_id_one $patron_id -object_id_two $user_id -rel_type "patron_rel"] +if { ![empty_string_p $rel_id] || $user_id == $patron_id } { + ad_returnredirect [export_vars -base shopping-cart { {user_id $patron_id} }] + ad_script_abort +} else { + set participant_name [person::name -person_id $user_id] + set tree_id [parameter::get -package_id [ad_conn package_id] -parameter PatronRelationshipCategoryTree -default 0] + set tree_options [list {}] + foreach tree [category_tree::get_tree $tree_id] { + lappend tree_options [list [lindex $tree 1] [lindex $tree 0]] + } + + ad_form -name relationship -export { user_id patron_id item_id } -form { + {relationship:text(select) {label "[_ dotlrn-ecommerce.lt_How_are_you_related_t]"} + {options {$tree_options}}} + } -on_submit { + set rel_id [db_exec_plsql relate_patron { + select acs_rel__new (null, + 'patron_rel', + :patron_id, + :user_id, + null, + null, + null) + }] + category::map_object -remove_old -object_id $rel_id [list $relationship] + + ad_returnredirect [export_vars -base [ad_conn url] { user_id patron_id item_id}] + ad_script_abort + } +} Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change.adp 8 Jul 2005 11:03:52 -0000 1.1 @@ -0,0 +1,30 @@ + + #dotlrn-ecommerce.Change_Participant# + + +

+ + #dotlrn-ecommerce.lt_Users_related_to_the_# + + + #dotlrn-ecommerce.Users_related_to_you# + +

+

+ +

+ + #dotlrn-ecommerce.lt_patron_name_also_pays# +     + + #dotlrn-ecommerce.lt_Back_to_shopping_cart# +

+

#dotlrn-ecommerce.lt_Or_create_an_account_#

+

+ + + + +

+ #dotlrn-ecommerce.lt_Back_to_shopping_cart# Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/participant-change.tcl 8 Jul 2005 11:03:52 -0000 1.1 @@ -0,0 +1,82 @@ +# packages/dotlrn-ecommerce/www/ecommerce/participant-change.tcl + +ad_page_contract { + + Select participant for ordinary users + + @author (mgh@localhost.localdomain) + @creation-date 2005-07-08 + @arch-tag: f24b7927-abe0-463d-bcd0-a96b6c6b5cdb + @cvs-id $Id: participant-change.tcl,v 1.1 2005/07/08 11:03:52 roelc Exp $ +} { + item_id:integer,notnull,optional +} -properties { +} -validate { +} -errors { +} + +if { [exists_and_not_null item_id] } { + db_1row order { + select patron_id, + participant_id + from dotlrn_ecommerce_orders + where item_id = :item_id + } + + template::list::create \ + -name "relations" \ + -multirow "relations" \ + -no_data "No related users" \ + -pass_properties participant_id \ + -elements { + ruser { + label "Related User" + } + email { + label "Email" + } + actions { + label "" + display_template { + + [_ dotlrn-ecommerce.Currently_Selected] + + + [_ dotlrn-ecommerce.Choose_Participant] + + } + } + } + + set locale [ad_conn locale] + db_multirow -extend { participant_change_url } relations relations { + select * + from ( + select u.first_names||' '||u.last_name as ruser, u.user_id, u.email + from acs_rels r, dotlrn_users u + where r.object_id_two = u.user_id + and r.rel_type = 'patron_rel' + and r.object_id_one = :patron_id + + union + + select u.first_names||' '||u.last_name as ruser, u.user_id, u.email + from acs_rels r, dotlrn_users u + where r.object_id_one = u.user_id + and r.rel_type = 'patron_rel' + and r.object_id_two = :patron_id + and not r.object_id_one in (select object_id_two + from acs_rels r + where rel_type = 'patron_rel' + and object_id_one = :patron_id) + ) r + where not ruser is null + } { + set participant_change_url [export_vars -base participant-change-2 { item_id user_id patron_id }] + } +} + +set next_url [export_vars -base participant-change-2 { item_id patron_id }] +set patron_name [person::name -person_id $patron_id] +set participant_pays_url [export_vars -base participant-change-2 { item_id {user_id $patron_id} patron_id}] +set admin_p [permission::permission_p -object_id [ad_conn package_id] -privilege "admin"] Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.adp,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.adp 7 Jul 2005 18:26:32 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.adp 8 Jul 2005 11:03:52 -0000 1.2 @@ -10,10 +10,10 @@ - +

- Continue     + #dotlrn-ecommerce.Continue#     - Hold slot and wait for confirmation     + #dotlrn-ecommerce.lt_Hold_slot_and_wait_fo#     - Cancel + #dotlrn-ecommerce.Cancel# Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl 7 Jul 2005 18:26:32 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl 8 Jul 2005 11:03:52 -0000 1.2 @@ -23,11 +23,12 @@ set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] set admin_p [permission::permission_p -object_id $cc_package_id -privilege "admin"] -set section_id [db_string section { - select section_id +db_1row section { + select section_id, community_id from dotlrn_ecommerce_section where product_id = :product_id -}] +} + if { $participant_id == 0 } { set participant_id $user_id } @@ -75,3 +76,5 @@ ad_returnredirect $shopping_cart_add_url ad_script_abort } + +set request_url [export_vars -base application-request { participant_id community_id }] Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl 28 Jun 2005 22:04:20 -0000 1.2 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl 8 Jul 2005 11:03:52 -0000 1.3 @@ -152,9 +152,17 @@ insert into dotlrn_ecommerce_orders (item_id, patron_id, participant_id) values (:item_id, :user_id, :participant_id) } + } else { + # Update the order + db_dml update_item_order_dotlrn_ecommerce { + update dotlrn_ecommerce_orders + set patron_id = :user_id, + participant_id = :participant_id + where item_id = :item_id + } } } } db_release_unused_handles -ad_returnredirect [export_vars -base shopping-cart { user_id product_id }] \ No newline at end of file +ad_returnredirect [export_vars -base shopping-cart { user_id product_id }] Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-postgresql.xql 23 Jun 2005 12:28:21 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-postgresql.xql 8 Jul 2005 11:03:52 -0000 1.2 @@ -20,17 +20,18 @@ - select p.product_name, p.one_line_description, p.no_shipping_avail_p, p.shipping, p.shipping_additional, p.weight, p.product_id, count(*) as quantity, u.offer_code, i.color_choice, i.size_choice, i.style_choice, '' as price, deo.patron_id, deo.participant_id + select p.product_name, p.one_line_description, p.no_shipping_avail_p, p.shipping, p.shipping_additional, p.weight, p.product_id, count(*) as quantity, u.offer_code, i.color_choice, i.size_choice, i.style_choice, '' as price, deo.patron_id, deo.participant_id, deo.item_id, s.section_id from ec_orders o join ec_items i on (o.order_id=i.order_id) join ec_products p on (i.product_id=p.product_id) left join (select product_id, offer_code from ec_user_session_offer_codes usoc where usoc.user_session_id=:user_session_id) u on (p.product_id=u.product_id) left join dotlrn_ecommerce_orders deo on (i.item_id = deo.item_id) + left join dotlrn_ecommerce_section s on (p.product_id = s.product_id) where o.user_session_id=:user_session_id and o.order_state='in_basket' - group by p.product_name, p.one_line_description, p.no_shipping_avail_p, p.shipping, p.shipping_additional, p.weight, p.product_id, u.offer_code, i.color_choice, i.size_choice, i.style_choice, deo.patron_id, deo.participant_id + group by p.product_name, p.one_line_description, p.no_shipping_avail_p, p.shipping, p.shipping_additional, p.weight, p.product_id, u.offer_code, i.color_choice, i.size_choice, i.style_choice, deo.patron_id, deo.participant_id, deo.item_id, s.section_id Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp 5 Jul 2005 23:57:38 -0000 1.4 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp 8 Jul 2005 11:03:52 -0000 1.5 @@ -32,9 +32,12 @@ @in_cart.product_name@ - + @in_cart.patron_name@ + + #dotlrn-ecommerce.lt_Participant_pays_for_# (#dotlrn-ecommerce.change#) + @@ -47,6 +50,7 @@ @in_cart.participant_name@ + (#dotlrn-ecommerce.change#) @@ -57,6 +61,9 @@ #dotlrn-ecommerce.delete# + DISABLED FOR NOW + #dotlrn-ecommerce.change# + Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl 28 Jun 2005 23:13:28 -0000 1.3 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl 8 Jul 2005 11:03:52 -0000 1.4 @@ -138,7 +138,7 @@ # p.no_shipping_avail_p, p.shipping, p.shipping_additional, p.weight # basically collect shipping information for any items where ec_products.no_shipping_avail_p = 't' -db_multirow -extend { line_subtotal patron_name participant_name participant_type } in_cart get_products_in_cart " +db_multirow -extend { line_subtotal patron_name participant_name participant_type edit_url } in_cart get_products_in_cart " select p.product_name, p.one_line_description, p.no_shipping_avail_p, p.shipping, p.shipping_additonal, p.weight, p.product_id, count(*) as quantity, u.offer_code, i.color_choice, i.size_choice, i.style_choice, '' as price from ec_orders o join ec_items i on (o.order_id=i.order_id) @@ -162,6 +162,8 @@ set participant_name $group(group_name) } } + + set edit_url [export_vars -base ../admin/process-purchase-course { section_id participant_id {user_id $patron_id} }] } for {set i 1} {$i <= [template::multirow size in_cart]} {incr i} {