Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cron handles all expired unenrolments. It is time to use own enrolmen…

…t method when calling funcs enrol_into_course, role_assign.

Zend Studio Warning: Assignment in condition (line XX), Solved, one more ()

Merged from MOODLE_17_STABLE
  • Loading branch information...
commit 2b72207cc360792322558d740bfacb20deef00f0 1 parent a9aecc7
ethem authored
View
6 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 = '" .
View
6 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 = '" .
View
12 enrol/authorize/enrol.php
@@ -218,7 +218,7 @@ function cc_submit($form, $course)
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;
@@ -241,7 +241,7 @@ function cc_submit($form, $course)
$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);
}
@@ -251,7 +251,7 @@ function cc_submit($form, $course)
}
// 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);
}
@@ -442,7 +442,7 @@ function config_form($frm)
}
}
- 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;
@@ -643,7 +643,7 @@ function cron()
$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;
@@ -781,7 +781,7 @@ function cron_daily()
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;
View
2  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";
View
10 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 "<table border='0' width='100%' cellspacing='0' cellpadding='3' class='generaltable generalbox'>";
echo "<tr>";
@@ -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);
@@ -279,7 +279,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);
}
@@ -312,7 +312,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);
View
10 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;
Please sign in to comment.
Something went wrong with that request. Please try again.