/// 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.
$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);
}
$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;
$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);
/// 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
}
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