]> git.mjollnir.org Git - moodle.git/commitdiff
When the number of pending orders expiring are sent to the teachers via email, which...
authorethem <ethem>
Thu, 15 Jun 2006 12:55:39 +0000 (12:55 +0000)
committerethem <ethem>
Thu, 15 Jun 2006 12:55:39 +0000 (12:55 +0000)
Merged from 16 stable.

enrol/authorize/config.html
enrol/authorize/enrol.php

index 847d0e65d0c5d1e859d5ed94bee605f141a1ba1d..d9ffa3e57ae67e69bcdb52f280015f68f5e2ac59 100755 (executable)
@@ -16,6 +16,7 @@ if (!isset($frm->an_review)) $frm->an_review = '';
 if (!isset($frm->an_capture_day)) $frm->an_capture_day = '5';
 if (!isset($frm->an_emailexpired)) $frm->an_emailexpired = '2';
 if (!isset($frm->an_emailexpiredteacher)) $frm->an_emailexpiredteacher = '';
+if (!isset($frm->an_sorttype)) $frm->an_sorttype = 'ttl';
 if (!isset($frm->an_teachermanagepay)) $frm->an_teachermanagepay = '';
 
 if (isset($CFG->an_cutoff)) {
@@ -167,6 +168,15 @@ if (!isset($frm->acceptccs)) {
     <td><?php print_string("adminemailexpiredteacher", "enrol_authorize") ?></td>
 </tr>
 
+<tr valign="top">
+    <td align="right">an_sorttype:</td>
+    <td><?php
+    $sorts = array('ttl' => get_string('adminemailexpiredsortsum', 'enrol_authorize'),
+                   'cnt' => get_string('adminemailexpiredsortcount', 'enrol_authorize'));
+    choose_from_menu($sorts, "an_sorttype", $frm->an_sorttype, "","", "") ?></td>
+    <td><?php print_string("adminemailexpiredsort", "enrol_authorize") ?></td>
+</tr>
+
 <tr valign="top">
     <td align="right">enrol_mailstudents:</td>
     <td><?php print_checkbox('enrol_mailstudents', '1', !empty($frm->enrol_mailstudents)) ?></td>
index b1f62b1f6c7a6dfe917a88b8ab04f4b9cfbca7aa..c837f90446d970489ca4683eda7297c738ace1ad 100755 (executable)
@@ -527,6 +527,7 @@ class enrolment_plugin_authorize
         $captureday = optional_param('an_capture_day', 5, PARAM_INT);
         $emailexpired = optional_param('an_emailexpired', 2, PARAM_INT);
         $emailexpiredteacher = optional_param('an_emailexpiredteacher', 0, PARAM_BOOL);
+        $sorttype = optional_param('an_sorttype', 'ttl', PARAM_ALPHA);
 
         $captureday = ($captureday > 29) ? 29 : (($captureday < 0) ? 0 : $captureday);
         $emailexpired = ($emailexpired > 5) ? 5 : (($emailexpired < 0) ? 0 : $emailexpired);
@@ -542,6 +543,7 @@ class enrolment_plugin_authorize
         set_config('an_capture_day', $captureday);
         set_config('an_emailexpired', $emailexpired);
         set_config('an_emailexpiredteacher', $emailexpiredteacher);
+        set_config('an_sorttype', $sorttype);
 
         // required fields
         $loginval = optional_param('an_login', '');
@@ -666,9 +668,10 @@ class enrolment_plugin_authorize
                     $adminuser = get_admin();
                     email_to_user($adminuser, $adminuser, $subject, $message);
                     if (!empty($CFG->an_teachermanagepay) and !empty($CFG->an_emailexpiredteacher)) {
-                        $sql = "SELECT E.courseid, COUNT(E.courseid) AS cnt " .
+                        $sorttype = empty($CFG->an_sorttype) ? 'ttl' : $CFG->an_sorttype;
+                        $sql = "SELECT E.courseid, COUNT(E.courseid) AS cnt, SUM(E.amount) as ttl " .
                                "FROM {$CFG->prefix}enrol_authorize E " .
-                               "WHERE $select GROUP BY E.courseid ORDER BY cnt DESC";
+                               "WHERE $select GROUP BY E.courseid ORDER BY $sorttype DESC";
                         $message = ''; $subject = '';
                         $lastcourse = 0; $lastcount = 0;
                         $courseidandcounts = get_records_sql($sql);