Index: openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl,v diff -u -r1.25 -r1.26 --- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 25 Aug 2005 19:07:48 -0000 1.25 +++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 1 Sep 2005 21:43:57 -0000 1.26 @@ -328,7 +328,7 @@ @error } { - set time_period [parameter::get -package_id [apm_package_id_from_key dotlrn-ecommerce] -parameter ApprovedRegistrationTimePeriod -default 86400] + set time_period [parameter::get -package_id [apm_package_id_from_key dotlrn-ecommerce] -parameter ApprovedRegistrationTimePeriod -default 7776000] db_foreach check_applications { select community_id, user_id @@ -337,6 +337,14 @@ and (current_timestamp - o.last_modified)::interval >= (:time_period||' seconds')::interval and r.member_state in ('request approved', 'waitinglist approved', 'payment received') } { + if { [parameter::get -parameter AllowAheadAccess -package_id [apm_package_id_from_key dotlrn-ecommerce] -default 0] } { + # Dispatch dotlrn applet callbacks + dotlrn_community::applets_dispatch \ + -community_id $community_id \ + -op RemoveUserFromCommunity \ + -list_args [list $community_id $user_id] + } + dotlrn_community::membership_reject -community_id $community_id -user_id $user_id } } @@ -387,6 +395,14 @@ and m.member_state = 'needs approval') } + if { [parameter::get -parameter AllowAheadAccess -package_id [apm_package_id_from_key dotlrn-ecommerce] -default 0] } { + # Dispatch dotlrn applet callbacks + dotlrn_community::applets_dispatch \ + -community_id $community_id \ + -op AddUserToCommunity \ + -list_args [list $community_id $user_id] + } + acs_mail_lite::send \ -to_addr $email \ -from_addr $admin_email \ Index: openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl 11 Aug 2005 01:25:03 -0000 1.10 +++ openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl 1 Sep 2005 21:43:57 -0000 1.11 @@ -71,6 +71,14 @@ set last_modified = current_timestamp where object_id in ([join $rels ,]) }] + + if { [parameter::get -parameter AllowAheadAccess -default 0] } { + # Dispatch dotlrn applet callbacks + dotlrn_community::applets_dispatch \ + -community_id $community_id \ + -op AddUserToCommunity \ + -list_args [list $community_id $user_id] + } } on_error { } @@ -135,41 +143,49 @@ } } else { -db_transaction { - set rels [db_list rels { - select r.rel_id - from acs_rels r, - membership_rels m - where r.rel_id = m.rel_id - and r.object_id_one = :community_id - and r.object_id_two = :user_id - and m.member_state = :old_member_state - }] + db_transaction { + set rels [db_list rels { + select r.rel_id + from acs_rels r, + membership_rels m + where r.rel_id = m.rel_id + and r.object_id_one = :community_id + and r.object_id_two = :user_id + and m.member_state = :old_member_state + }] - db_dml approve_request [subst { - update membership_rels - set member_state = :new_member_state - where rel_id in ([join $rels ,]) - }] + db_dml approve_request [subst { + update membership_rels + set member_state = :new_member_state + where rel_id in ([join $rels ,]) + }] - db_dml update_objects [subst { - update acs_objects - set last_modified = current_timestamp - where object_id in ([join $rels ,]) - }] -} on_error { -} + db_dml update_objects [subst { + update acs_objects + set last_modified = current_timestamp + where object_id in ([join $rels ,]) + }] -# Send email to applicant -set applicant_email [cc_email_from_party $user_id] -set actor_email [cc_email_from_party $actor_id] -set community_name [dotlrn_community::get_community_name $community_id] -if {[exists_and_not_null reason]} { - set override_email $reason -} else { - set override_email "" -} -dotlrn_community::send_member_email -community_id $community_id -to_user $user_id -type $email_type -override_email $override_email -ad_returnredirect $return_url -} + if { [parameter::get -parameter AllowAheadAccess -default 0] } { + # Dispatch dotlrn applet callbacks + dotlrn_community::applets_dispatch \ + -community_id $community_id \ + -op AddUserToCommunity \ + -list_args [list $community_id $user_id] + } + } on_error { + } + + # Send email to applicant + set applicant_email [cc_email_from_party $user_id] + set actor_email [cc_email_from_party $actor_id] + set community_name [dotlrn_community::get_community_name $community_id] + if {[exists_and_not_null reason]} { + set override_email $reason + } else { + set override_email "" + } + dotlrn_community::send_member_email -community_id $community_id -to_user $user_id -type $email_type -override_email $override_email + ad_returnredirect $return_url + } } \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl 22 Aug 2005 17:41:44 -0000 1.9 +++ openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl 1 Sep 2005 21:43:57 -0000 1.10 @@ -30,7 +30,25 @@ dotlrn_ecommerce::section::flush_cache $section_id if { !$send_email_p || $user_id == $actor_id } { + if { [parameter::get -parameter AllowAheadAccess -default 0] } { + set member_state [db_string member_state { + select member_state + from dotlrn_member_rels_full + where user_id = :user_id + and community_id = :community_id + }] + + if { [lsearch $member_state {"waitinglist approved" "request approved" "payment received"}] != -1 } { + # Dispatch dotlrn applet callbacks + dotlrn_community::applets_dispatch \ + -community_id $community_id \ + -op RemoveUserFromCommunity \ + -list_args [list $community_id $user_id] + } + } + dotlrn_community::membership_reject -community_id $community_id -user_id $user_id + ad_returnredirect $return_url } else { # Send email to applicant @@ -64,7 +82,25 @@ set reason "[lang::message::format $reason $var_list]" } \ -on_submit { + if { [parameter::get -parameter AllowAheadAccess -default 0] } { + set member_state [db_string member_state { + select member_state + from dotlrn_member_rels_full + where user_id = :user_id + and community_id = :community_id + }] + + if { [lsearch $member_state {"waitinglist approved" "request approved" "payment received"}] != -1 } { + # Dispatch dotlrn applet callbacks + dotlrn_community::applets_dispatch \ + -community_id $community_id \ + -op RemoveUserFromCommunity \ + -list_args [list $community_id $user_id] + } + } + dotlrn_community::membership_reject -community_id $community_id -user_id $user_id + set applicant_email [cc_email_from_party $user_id] set actor_email [cc_email_from_party $actor_id] set community_name [dotlrn_community::get_community_name $community_id] @@ -82,8 +118,6 @@ set body "[_ dotlrn-ecommerce.lt_Your_application_to_j_1]" } } - - acs_mail_lite::send \ -to_addr $applicant_email \