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.13 -r1.14
--- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 23 Jul 2005 13:30:27 -0000 1.13
+++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 23 Jul 2005 15:07:37 -0000 1.14
@@ -285,14 +285,13 @@
set time_period [parameter::get -package_id [apm_package_id_from_key dotlrn-ecommerce] -parameter ApprovedRegistrationTimePeriod -default 86400]
db_foreach check_applications {
- select community_id, user_id, (current_timestamp - o.creation_date)::interval as xxx
+ select community_id, user_id
from acs_objects o, dotlrn_member_rels_full r
where o.object_id = r.rel_id
- and (current_timestamp - o.creation_date)::interval >= (:time_period||' seconds')::interval
+ and (current_timestamp - o.last_modified)::interval >= (:time_period||' seconds')::interval
and r.member_state in ('request approved', 'waitinglist approved', 'payment received')
} {
dotlrn_community::membership_reject -community_id $community_id -user_id $user_id
- ns_log notice "DEBUG::XXXXXXXXXXXXXXXXXXXX $xxx, $community_id, $user_id"
}
}
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.6 -r1.7
--- openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl 23 Jul 2005 13:30:54 -0000 1.6
+++ openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl 23 Jul 2005 15:07:45 -0000 1.7
@@ -20,15 +20,20 @@
### Check for security
-if { $type == "full" } {
- set new_member_state "waitinglist approved"
- set old_member_state "needs approval"
-} elseif { $type == "prereq" } {
- set new_member_state "request approved"
- set old_member_state "request approval"
-} elseif { $type == "payment" } {
- set new_member_state "payment received"
- set old_member_state "awaiting payment"
+switch $type {
+ full {
+ set new_member_state "waitinglist approved"
+ set old_member_state "needs approval"
+ }
+ prereq {
+ set new_member_state "request approved"
+ set old_member_state "request approval"
+
+ }
+ payment {
+ set new_member_state "payment received"
+ set old_member_state "awaiting payment"
+ }
}
set actor_id [ad_conn user_id]
@@ -41,18 +46,32 @@
dotlrn_ecommerce::section::flush_cache $section_id
if { $user_id == $actor_id } {
- db_dml approve_request {
- update membership_rels
- set member_state = :new_member_state
- where rel_id in (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 update_objects [subst {
+ update acs_objects
+ set last_modified = current_timestamp
+ where object_id in ([join $rels ,])
+ }]
+ } on_error {
}
-
+
ad_returnredirect $return_url
} else {
if { $type == "prereq" } {
@@ -68,17 +87,31 @@
-on_request {
} \
-on_submit {
- db_dml approve_request {
- update membership_rels
- set member_state = :new_member_state
- where rel_id in (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 update_objects [subst {
+ update acs_objects
+ set last_modified = current_timestamp
+ where object_id in ([join $rels ,])
+ }]
+ } on_error {
+ }
+
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]
@@ -98,33 +131,46 @@
-after_submit {
ad_returnredirect $return_url
}
+
} else {
- db_dml approve_request {
- update membership_rels
- set member_state = :new_member_state
- where rel_id in (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
+ }]
- # 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 {![dotlrn_community::send_member_email -community_id $community_id -to_user $user_id -type "on approval"]} {
- acs_mail_lite::send \
- -to_addr $applicant_email \
- -from_addr $actor_email \
- -subject [subst "[_ dotlrn-ecommerce.Application_approved]"] \
- -body [subst "[_ dotlrn-ecommerce.lt_Your_application_to_j]"]
- }
-
- ad_returnredirect $return_url
- }
+ 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 {
}
+# 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 {![dotlrn_community::send_member_email -community_id $community_id -to_user $user_id -type "on approval"]} {
+ acs_mail_lite::send \
+ -to_addr $applicant_email \
+ -from_addr $actor_email \
+ -subject [subst "[_ dotlrn-ecommerce.Application_approved]"] \
+ -body [subst "[_ dotlrn-ecommerce.lt_Your_application_to_j]"]
+}
+
+ad_returnredirect $return_url
+}
+}
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/www/applications.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/applications.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/dotlrn-ecommerce/www/applications.tcl 23 Jul 2005 13:30:54 -0000 1.8
+++ openacs-4/packages/dotlrn-ecommerce/www/applications.tcl 23 Jul 2005 15:07:45 -0000 1.9
@@ -11,6 +11,7 @@
} {
type:optional
orderby:optional
+ section_id:optional
} -properties {
} -validate {
} -errors {
@@ -54,6 +55,9 @@
@applications.number@
+
+ Approved
+
}
}
person_name {
@@ -120,6 +124,7 @@
}
where_clause { member_state = :type }
}
+ section_id {}
} -orderby {
section_name {
label "[_ dotlrn-ecommerce.Section_1]"
@@ -138,6 +143,23 @@
}
}
+if { $admin_p } {
+ set user_clause ""
+} else {
+ set user_clause {
+ and c.community_id in (select community_id
+ from dotlrn_member_rels_full
+ where user_id = :user_id
+ and rel_type = 'dotlrn_admin_rel')
+ }
+}
+
+if { [exists_and_not_null section_id] } {
+ set section_clause {and s.section_id = :section_id}
+} else {
+ set section_clause ""
+}
+
db_multirow -extend { approve_url reject_url asm_url section_edit_url person_url } applications applications [subst {
select person__name(r.user_id) as person_name, member_state, r.community_id, r.user_id as applicant_user_id, s.section_name, t.course_name, s.section_id, r.rel_id, e.phone,
(select count(*)
@@ -155,10 +177,15 @@
where address_id in (select max(address_id)
from ec_addresses
group by user_id)) e
- on (r.user_id = e.user_id), dotlrn_ecommerce_section s, dotlrn_catalogi t
+ on (r.user_id = e.user_id), dotlrn_ecommerce_section s, dotlrn_catalogi t, cr_items i
where r.community_id = s.community_id
and s.course_id = t.item_id
+ and t.course_id = i.live_revision
and member_state in ('needs approval', 'waitinglist approved', 'request approval', 'request approved', 'awaiting payment', 'payment received')
+
+ $user_clause
+ $section_clause
+
[template::list::filter_where_clauses -and -name applications]
[template::list::orderby_clause -name applications -orderby]
}] {