Index: openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl 11 Aug 2005 11:50:27 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl 11 Aug 2005 11:54:51 -0000 1.2 @@ -24,52 +24,54 @@ @error } { - set mail_from [parameter::get -package_id [ad_acs_kernel_id] -parameter OutgoingSender] - set subject "Notification for waitlist" - set message "" - - db_foreach get_sections_with_waitlist { - select t.* - from (select dc.course_name, - des.section_name, - des.notify_waiting_number, - (select count(*) - from membership_rels mr, - acs_rels ar - where ar.rel_id = mr.rel_id - and ar.object_id_one = des.community_id - and mr.member_state = 'needs approval') as waitlist_n - from dotlrn_catalog dc, - cr_items i, - dotlrn_ecommerce_section des - where dc.course_id = i.live_revision - and i.item_id = des.course_id - and des.notify_waiting_number is not null) t - where waitlist_n >= notify_waiting_number - } { - append message "Section: $course_name - $section_name + if {[parameter::get -parameter NotifyAdminsOfWaitlistDaily -default 0]} { + set mail_from [parameter::get -package_id [ad_acs_kernel_id] -parameter OutgoingSender] + set subject "Notification for waitlist" + set message "" + + db_foreach get_sections_with_waitlist { + select t.* + from (select dc.course_name, + des.section_name, + des.notify_waiting_number, + (select count(*) + from membership_rels mr, + acs_rels ar + where ar.rel_id = mr.rel_id + and ar.object_id_one = des.community_id + and mr.member_state = 'needs approval') as waitlist_n + from dotlrn_catalog dc, + cr_items i, + dotlrn_ecommerce_section des + where dc.course_id = i.live_revision + and i.item_id = des.course_id + and des.notify_waiting_number is not null) t + where waitlist_n >= notify_waiting_number + } { + append message "Section: $course_name - $section_name Applicants in notify list: $waitlist_n " - } + } - if {![empty_string_p $message]} { - set object_id [acs_lookup_magic_object security_context_root] - set privilege "admin" - db_foreach get_swas { - select p.email as email_to - from parties p, - users u, - acs_permissions ap - where u.user_id = p.party_id - and u.user_id = ap.grantee_id - and ap.object_id = :object_id - and ap.privilege = :privilege - } { - acs_mail_lite::send \ - -to_addr $email_to \ - -from_addr $mail_from \ - -subject $subject \ - -body $message + if {![empty_string_p $message]} { + set object_id [acs_lookup_magic_object security_context_root] + set privilege "admin" + db_foreach get_swas { + select p.email as email_to + from parties p, + users u, + acs_permissions ap + where u.user_id = p.party_id + and u.user_id = ap.grantee_id + and ap.object_id = :object_id + and ap.privilege = :privilege + } { + acs_mail_lite::send \ + -to_addr $email_to \ + -from_addr $mail_from \ + -subject $subject \ + -body $message + } } } }