diff --git a/enrol/authorize/lib.php b/enrol/authorize/lib.php
index 80751b3e324..7d172eea5a6 100644
--- a/enrol/authorize/lib.php
+++ b/enrol/authorize/lib.php
@@ -9,6 +9,10 @@ define('ORDER_DELETE', 'delete');
define('ORDER_REFUND', 'refund');
define('ORDER_VOID', 'void');
+/**
+ * print_authorize_orders
+ *
+ */
function print_authorize_orders()
{
global $CFG, $USER;
@@ -110,7 +114,7 @@ function print_authorize_orders()
if ($records = get_records_sql($select . $from . $where . $sort . $limit)) {
foreach ($records as $record) {
- $actionstatus = get_order_status_desc($record);
+ $actionstatus = get_status_action($record);
$actions = '';
if (empty($actionstatus->actions)) {
@@ -135,7 +139,11 @@ function print_authorize_orders()
$table->print_html();
}
-
+/**
+ * print_authorize_order_details
+ *
+ * @param int $orderno
+ */
function print_authorize_order_details($orderno) {
global $CFG, $USER;
global $strs, $authstrs;
@@ -143,19 +151,18 @@ function print_authorize_order_details($orderno) {
$unenrol = optional_param('unenrol', '');
$cmdconfirm = optional_param('confirm', '', PARAM_ALPHA);
- $cmdcapture = optional_param('capture', '', PARAM_ALPHA);
- $cmddelete = optional_param('delete', '', PARAM_ALPHA);
- $cmdrefund = optional_param('refund', '', PARAM_ALPHA);
- $cmdvoid = optional_param('void', '', PARAM_ALPHA);
+ $cmdcapture = optional_param(ORDER_CAPTURE, '', PARAM_ALPHA);
+ $cmddelete = optional_param(ORDER_DELETE, '', PARAM_ALPHA);
+ $cmdrefund = optional_param(ORDER_REFUND, '', PARAM_ALPHA);
+ $cmdvoid = optional_param(ORDER_VOID, '', PARAM_ALPHA);
$table->width = '100%';
$table->size = array('30%', '70%');
$table->align = array('right', 'left');
- $sql = "SELECT E.*, C.shortname, C.enrolperiod " .
- "FROM {$CFG->prefix}enrol_authorize E " .
- "INNER JOIN {$CFG->prefix}course C ON C.id = E.courseid " .
- "WHERE E.id = '$orderno'";
+ $sql = "SELECT E.*, C.shortname, C.enrolperiod FROM {$CFG->prefix}enrol_authorize E " .
+ "INNER JOIN {$CFG->prefix}course C ON C.id = E.courseid " .
+ "WHERE E.id = '$orderno'";
$order = get_record_sql($sql);
if (!$order) {
@@ -173,7 +180,7 @@ function print_authorize_order_details($orderno) {
echo "\n";
$settled = settled($order);
- $status = get_order_status_desc($order);
+ $status = get_status_action($order);
$table->data[] = array("$authstrs->orderid:", $orderno);
$table->data[] = array("$authstrs->transid:", $order->transid);
@@ -196,7 +203,7 @@ function print_authorize_order_details($orderno) {
if (empty($cmdconfirm)) {
$table->data[] = array("$strs->confirm:",
- "$authstrs->captureyes
$strs->yes
+ "$authstrs->captureyes
$strs->yes
$strs->no");
}
else {
@@ -267,7 +274,7 @@ function print_authorize_order_details($orderno) {
$table->data[] = array("$authstrs->howmuch",
"
- $strcanbecredit
");
+ $strcanbecredit
");
}
else {
$extra->amount = $amount;
@@ -307,7 +314,7 @@ function print_authorize_order_details($orderno) {
if (empty($cmdconfirm)) {
$strvoidyes = get_string('voidyes', 'enrol_authorize');
$table->data[] = array("$strs->confirm:",
- "$strvoidyes
+ "$strvoidyes
$strs->no");
@@ -332,7 +339,10 @@ function print_authorize_order_details($orderno) {
}
}
else { // cancel refunded transaction
- $suborder = get_record('enrol_authorize_refunds', 'id', $suborderno, 'status', AN_STATUS_CREDIT);
+ $suborder = get_record('enrol_authorize_refunds',
+ 'id', $suborderno,
+ 'orderid', $orderno,
+ 'status', AN_STATUS_CREDIT);
if (!$suborder) { // not found
error("Transaction can not be voided because of already been voided.");
}
@@ -346,7 +356,7 @@ function print_authorize_order_details($orderno) {
"");
$table->data[] = array("$strs->confirm:",
- "$strsubvoidyes
+ "$strsubvoidyes
@@ -382,15 +392,12 @@ function print_authorize_order_details($orderno) {
$a->action = ORDER_DELETE;
error(get_string('youcantdo', 'enrol_authorize', $a));
}
- //if (!in_array(ORDER_DELETE, $status->actions)) {
- // error("Order $orderno cannot be deleted. Status must be expired.");
- //}
if (empty($cmdconfirm)) {
$table->data[] = array("$authstrs->unenrolstudent",
"");
$table->data[] = array("$strs->confirm:",
- "
+ "
$strs->no");
@@ -418,9 +425,9 @@ function print_authorize_order_details($orderno) {
print_table($table);
if ($settled) { // show refunds.
echo "