Index: openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl,v
diff -u -r1.52 -r1.53
--- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 6 Sep 2005 01:12:10 -0000 1.52
+++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 6 Sep 2005 03:23:00 -0000 1.53
@@ -469,7 +469,20 @@
}
}
+# these are the communities that will have patron information
+# only check these for patron information
+
+set patron_communities [db_list patron_communities {
+ select r.community_id from
+ dotlrn_member_rels_full r,
+ acs_objects o
+ where o.object_id = r.rel_id
+ and r.member_state in ('request approval', 'request approved', 'needs approval', 'waitinglist approved')
+ and o.creation_user=:user_id
+ and r.user_id <> o.creation_user
+}]
+
set grade_tree_id [parameter::get -package_id [ad_conn package_id] -parameter GradeCategoryTree -default 0]
if { $offer_code_p } {
@@ -693,43 +706,13 @@
# Get the patron information
set patron_message ""
- # get waiting list requests
- db_multirow -extend {waiting_list_number} waiting_lists waiting_lists {
- select r.user_id as participant_id,
- acs_object__name(r.user_id) as name, r.member_state
- from
- dotlrn_member_rels_full r,
- acs_objects o
- where o.object_id = r.rel_id
- and r.community_id = :community_id
- and r.member_state in ('request approval', 'request approved', 'needs approval', 'waitinglist approved')
- and o.creation_user=:user_id
- and r.user_id <> o.creation_user
- } {
+
+ if {[lsearch $patron_communities $community_id] >= 0} {
+
- set waiting_list_number [util_memoize [list dotlrn_ecommerce::section::waiting_list_number $participant_id $community_id] $memoize_max_age]
-
- set registration_approved_url [export_vars -base ecommerce/shopping-cart-add { user_id product_id participant_id}]
-
- switch $member_state {
- "request approval" {
- append patron_message "$name has a prerequisite application pending."
- }
- "request approved" {
- append patron_message "$name has been accepted.
- [_ dotlrn-ecommerce.lt_Continue_Registration]"
-
- }
- "needs approval" {
- append patron_message "$name is number $waiting_list_number on waiting list"
- }
- "waitinglist approved" {
- append patron_message "There is a place for $name.
[_ dotlrn-ecommerce.lt_Continue_Registration]"
- }
- }
+ set patron_message [util_memoize [list dotlrn_ecommerce::patron_catalog_message $community_id $user_id $product_id] $memoize_max_age]
}
-
# HAM : if we don't have an instructor id
set instructor_p -1
if { [exists_and_not_null instructor_ids] } {