diff --git a/enrol/authorize/db/mysql.php b/enrol/authorize/db/mysql.php index fecdd288bef..9dbf6612bc1 100755 --- a/enrol/authorize/db/mysql.php +++ b/enrol/authorize/db/mysql.php @@ -2,7 +2,7 @@ // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT! // -// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL +// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY. // MySQL commands for upgrading this enrolment module @@ -56,7 +56,7 @@ function enrol_authorize_upgrade($oldversion=0) { PRIMARY KEY (`id`), KEY `orderid` (`orderid`));"); // defaults. - if ($courses = get_records_select('course', '', '', 'id, cost, currency')) { + if (($courses = get_records_select('course', '', '', 'id, cost, currency'))) { foreach ($courses as $course) { execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET amount = '$course->cost', currency = '$course->currency' @@ -70,7 +70,7 @@ function enrol_authorize_upgrade($oldversion=0) { table_column('enrol_authorize_refunds', '', 'settletime', 'integer', '10', 'unsigned', '0', 'not null', 'transid'); table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null'); $status = AN_STATUS_AUTH | AN_STATUS_CAPTURE; - if ($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime')) { + if (($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime'))) { include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php"); foreach ($settlements as $settlement) { execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" . diff --git a/enrol/authorize/db/postgres7.php b/enrol/authorize/db/postgres7.php index 5dfd62c274f..62c1d878263 100644 --- a/enrol/authorize/db/postgres7.php +++ b/enrol/authorize/db/postgres7.php @@ -2,7 +2,7 @@ // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT! // -// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL +// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY. // PostgreSQL commands for upgrading this enrolment module @@ -67,7 +67,7 @@ function enrol_authorize_upgrade($oldversion=0) { );"); modify_database("","CREATE INDEX prefix_enrol_authorize_refunds_orderid_idx ON prefix_enrol_authorize_refunds (orderid);"); // defaults. - if ($courses = get_records_select('course', '', '', 'id, cost, currency')) { + if (($courses = get_records_select('course', '', '', 'id, cost, currency'))) { foreach ($courses as $course) { execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET amount = '$course->cost', currency = '$course->currency' @@ -81,7 +81,7 @@ function enrol_authorize_upgrade($oldversion=0) { table_column('enrol_authorize_refunds', '', 'settletime', 'integer', '10', 'unsigned', '0', 'not null', 'transid'); table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null'); $status = AN_STATUS_AUTH | AN_STATUS_CAPTURE; - if ($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime')) { + if (($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime'))) { include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php"); foreach ($settlements as $settlement) { execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" . diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index 296a777f90d..2595bb44265 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -199,7 +199,7 @@ class enrolment_plugin_authorize redirect($CFG->wwwroot, get_string("reviewnotify", "enrol_authorize"), '30'); } else { - enrol_into_course($course, $USER, 'manual'); + enrol_into_course($course, $USER, 'authorize'); redirect("$CFG->wwwroot/course/view.php?id=$course->id"); } return; @@ -222,7 +222,7 @@ class enrolment_plugin_authorize $a->orderid = $order->id; $emailsubject = get_string('adminnewordersubject', 'enrol_authorize', $a); $context = get_context_instance(CONTEXT_COURSE, $course->id); - if ($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments')) { + if (($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments'))) { foreach ($paymentmanagers as $paymentmanager) { email_to_user($paymentmanager, $USER, $emailsubject, $emailmessage); } @@ -232,7 +232,7 @@ class enrolment_plugin_authorize } // Credit card captured, ENROL student now... - if (enrol_into_course($course, $USER, 'manual')) { + if (enrol_into_course($course, $USER, 'authorize')) { if (!empty($CFG->enrol_mailstudents)) { send_welcome_messages($order->id); } @@ -423,7 +423,7 @@ class enrolment_plugin_authorize } } - if ($count = count_records('enrol_authorize', 'status', AN_STATUS_AUTH)) { + if (($count = count_records('enrol_authorize', 'status', AN_STATUS_AUTH))) { $a = new stdClass; $a->count = $count; $a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH; @@ -627,7 +627,7 @@ class enrolment_plugin_authorize $timeend = $order->settletime + $course->enrolperiod; } $user = get_record('user', 'id', $order->userid); - if (role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, 'manual')) { + if (role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, 'authorize')) { $this->log .= "User($user->id) has been enrolled to course($course->id).\n"; if (!empty($CFG->enrol_mailstudents)) { $sendem[] = $order->id; @@ -766,7 +766,7 @@ class enrolment_plugin_authorize foreach($courseinfos as $courseinfo) { $lastcourse = $courseinfo->courseid; $context = get_context_instance(CONTEXT_COURSE, $lastcourse); - if ($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments')) { + if (($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments'))) { $a = new stdClass; $a->course = $courseinfo->shortname; $a->pending = $courseinfo->cnt; diff --git a/enrol/authorize/localfuncs.php b/enrol/authorize/localfuncs.php index 994d49327da..59763f82f59 100644 --- a/enrol/authorize/localfuncs.php +++ b/enrol/authorize/localfuncs.php @@ -40,7 +40,7 @@ function prevent_double_paid($course) $sql .= 'AND status='.AN_STATUS_NONE; } - if ($recid = get_field_sql($sql)) { + if (($recid = get_field_sql($sql))) { $a = new stdClass; $a->orderid = $recid; $a->url = "$CFG->wwwroot/enrol/authorize/index.php?order=$a->orderid"; diff --git a/enrol/authorize/locallib.php b/enrol/authorize/locallib.php index a8c93b5f107..7746b9c77fc 100644 --- a/enrol/authorize/locallib.php +++ b/enrol/authorize/locallib.php @@ -53,7 +53,7 @@ function authorize_print_orders($courseid, $userid) $sql .= "WHERE (e.userid='$userid') "; } $sql .= "ORDER BY c.sortorder, c.fullname"; - if ($popupcrs = get_records_sql_menu($sql)) { + if (($popupcrs = get_records_sql_menu($sql))) { $popupcrs = array($SITE->id => $SITE->fullname) + $popupcrs; echo ""; echo ""; @@ -155,7 +155,7 @@ function authorize_print_orders($courseid, $userid) $where .= "AND (e.userid = '" . $userid . "') "; } - if ($sort = $table->get_sql_sort()) { + if (($sort = $table->get_sql_sort())) { $sort = ' ORDER BY ' . $sort; } @@ -163,7 +163,7 @@ function authorize_print_orders($courseid, $userid) $table->initialbars($totalcount > $perpage); $table->pagesize($perpage, $totalcount); - if ($records = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) { + if (($records = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size()))) { foreach ($records as $record) { $actionstatus = authorize_get_status_action($record); $color = authorize_get_status_color($actionstatus->status); @@ -278,7 +278,7 @@ function authorize_print_order_details($orderno) else { if (empty($CFG->an_test)) { $user = get_record('user', 'id', $order->userid); - if (enrol_into_course($course, $user, 'manual')) { + if (enrol_into_course($course, $user, 'authorize')) { if (!empty($CFG->enrol_mailstudents)) { send_welcome_messages($order->id); } @@ -311,7 +311,7 @@ function authorize_print_order_details($orderno) $sql = "SELECT SUM(amount) AS refunded FROM {$CFG->prefix}enrol_authorize_refunds " . "WHERE (orderid = '" . $orderno . "') AND (status = '" . AN_STATUS_CREDIT . "')"; - if ($refund = get_record_sql($sql)) { + if (($refund = get_record_sql($sql))) { $extra->sum = floatval($refund->refunded); } $upto = format_float($order->amount - $extra->sum, 2); diff --git a/enrol/authorize/uploadcsv.php b/enrol/authorize/uploadcsv.php index f13dfbd346a..bf69384721a 100644 --- a/enrol/authorize/uploadcsv.php +++ b/enrol/authorize/uploadcsv.php @@ -16,7 +16,7 @@ print_heading_with_help($struploadcsv, 'uploadcsv', 'enrol/authorize'); /// Handle CSV file - if ($form = data_submitted() && confirm_sesskey()) { + if (($form = data_submitted()) && confirm_sesskey()) { $um = new upload_manager('csvfile', false, false, null, false, 0); if ($um->preprocess_files()) { $filename = $um->files['csvfile']['tmp_name']; @@ -115,7 +115,7 @@ function authorize_process_csv($filename) $settlementdate = strtotime($data[$csvfields['Settlement Date/Time']]); if ($transstatus == 'Approved Review' || $transstatus == 'Review Failed') { - if ($order = get_record('enrol_authorize', 'transid', $transid)) { + if (($order = get_record('enrol_authorize', 'transid', $transid))) { $order->status = ($transstatus == 'Approved Review') ? AN_STATUS_APPROVEDREVIEW : AN_STATUS_REVIEWFAILED; update_record('enrol_authorize', $order); $updated++; // Updated order status @@ -124,7 +124,7 @@ function authorize_process_csv($filename) } if (!empty($reftransid) && is_numeric($reftransid) && 'Settled Successfully' == $transstatus && 'Credit' == $transtype) { - if ($order = get_record('enrol_authorize', 'transid', $reftransid)) { + if (($order = get_record('enrol_authorize', 'transid', $reftransid))) { if (AN_METHOD_ECHECK == $order->paymentmethod) { $refund = get_record('enrol_authorize_refunds', 'transid', $transid); if ($refund) { @@ -195,14 +195,14 @@ function authorize_process_csv($filename) } // If user wasn't enrolled, enrol now. Ignore otherwise. Because admin user might submit this file again. - if ($role = get_default_course_role($course)) { + if (($role = get_default_course_role($course))) { if (! user_has_role_assignment($user->id, $role->id, $coursecontext->id)) { $timestart = $timeend = 0; if ($course->enrolperiod) { $timestart = time(); $timeend = $timestart + $course->enrolperiod; } - if (role_assign($role->id, $user->id, 0, $coursecontext->id, $timestart, $timeend, 0, 'manual')) { + if (role_assign($role->id, $user->id, 0, $coursecontext->id, $timestart, $timeend, 0, 'authorize')) { $imported++; if (!empty($CFG->enrol_mailstudents)) { $sendem[] = $order->id;