]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Wed, 14 May 2008 05:56:10 +0000 (05:56 +0000)
committerdongsheng <dongsheng>
Wed, 14 May 2008 05:56:10 +0000 (05:56 +0000)
enrol/authorize/enrol_form.php
enrol/authorize/index.php
enrol/authorize/locallib.php
enrol/authorize/uploadcsv.php

index eea8655f5895d857d0a223cb7c366d462f2d1c1a..77ec0234dac1432da45396e5c3da882ddffddebc 100755 (executable)
@@ -11,7 +11,7 @@ class enrol_authorize_form extends moodleform
         $paymentmethodsenabled = get_list_of_payment_methods();
         $paymentmethod = optional_param('paymentmethod', $paymentmethodsenabled[0], PARAM_ALPHA);
         if (!in_array($paymentmethod, $paymentmethodsenabled)) {
-            print_error("Invalid payment method: $paymentmethod");
+            print_error('invalidpaymentmethod', '', '', $paymentmethod);
         }
 
         $mform =& $this->_form;
index 12d416756d1d7c37d0575031d74a6e3bb6d0e85c..60146ac9f2734aad6e0d6f1b247009e7f515b454 100644 (file)
 
 /// Get course
     if (! $course = get_record('course', 'id', $courseid)) {
-        print_error('Could not find that course');
+        print_error('invaliduserid');
     }
 
 /// Only SITE users can access to this page
     require_login(); // Don't use $courseid! User may want to see old orders.
     if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), $USER->id, false)) {
-        print_error("Guests cannot use this page.");
+        print_error('noguest');
     }
 
     /// Load strings. All strings should be defined here. locallib.php uses these strings.
index 09f3e42ae5311d02e3f8b1490f2700131e67f7c4..6b7c79337af95f5f58547145198e8c1883f1323c 100644 (file)
@@ -211,15 +211,16 @@ function authorize_print_order($orderid)
     $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
     if (!$order = get_record('enrol_authorize', 'id', $orderid)) {
-        print_error("Order $orderid not found.", '', "$CFG->wwwroot/enrol/authorize/index.php");
+        print_error('orderidnotfound', '',
+                "$CFG->wwwroot/enrol/authorize/index.php", $orderid);
     }
 
     if (!$course = get_record('course', 'id', $order->courseid)) {
-        print_error("Could not find that course id $order->courseid", '', "$CFG->wwwroot/enrol/authorize/index.php");
+        print_error('invalidcourseid', '', "$CFG->wwwroot/enrol/authorize/index.php");
     }
 
     if (!$user = get_record('user', 'id', $order->userid)) {
-        print_error("Could not find that user id $order->userid", '', "$CFG->wwwroot/enrol/authorize/index.php");
+        print_error('nousers', '', "$CFG->wwwroot/enrol/authorize/index.php");
     }
 
     $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
@@ -317,11 +318,13 @@ function authorize_print_order($orderid)
         }
         $upto = round($order->amount - $refunded, 2);
         if ($upto <= 0) {
-            print_error("Refunded to original amount: $order->amount", '', "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
+            print_error('refoundtoorigi', '',
+                    "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid", $order->amount);
         }
         $amount = round(optional_param('amount', $upto), 2);
         if ($amount > $upto) {
-            print_error("Can be refunded to $upto", '', "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
+            print_error('refoundto', '',
+                    "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid", $upto);
         }
         if ($confirm && confirm_sesskey()) {
             $extra = new stdClass;
@@ -403,7 +406,7 @@ function authorize_print_order($orderid)
 
             $suborder = get_record_sql($sql);
             if (!$suborder) { // not found
-                print_error("Transaction can not be voided because of already been voided.", '', "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
+                print_error('transactionvoid', '', "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
             }
             $refundedstatus = authorize_get_status_action($suborder);
             unset($suborder->courseid);
index 940033abcd19e6b1dd6443771d616d69d9d4cdb4..288c53d54efb69171e5519a8601a5507c6d2d44b 100644 (file)
@@ -76,13 +76,13 @@ function authorize_process_csv($filename)
 /// Open the file and get first line
     $handle = fopen($filename, "r");
     if (!$handle) {
-        print_error('CANNOT OPEN CSV FILE');
+        print_error('cannotopencsv');
     }
     $firstline = fgetcsv($handle, 8192, ",");
     $numfields = count($firstline);
     if ($numfields != 49 && $numfields != 70) {
         @fclose($handle);
-        print_error('INVALID CSV FILE; Each line must include 49 or 70 fields');
+        print_error('csvinvalidcolsnum');
     }
 
 /// Re-sort fields
@@ -97,9 +97,7 @@ function authorize_process_csv($filename)
     }
     if (empty($csvfields)) {
         @fclose($handle);
-        print_error("<b>INVALID CSV FILE:</b> First line must include 'Header Fields' and
-               the file must be type of <br />'Expanded Fields/Comma Separated'<br />or<br />
-              'Expanded Fields with CAVV Result Code/Comma Separated'");
+        print_error('csvinvalidcols');
     }
 
 /// Read lines