MDL-10181 User Management Improvements: Cron unenrolment of manual should takes place in the main cron.
It is time to use own enrolment method when calling funcs enrol_into_course, role_assign, role_unassign. Zend Studio Warning: Assignment in condition (line XX), Solved, one more () Assignments in a conditional statement are sometimes the result of a typo. In many cases, instead of the assignment operator =, the equality operator == should be used. When comparing a variable and a non-variable expression, it is common practice to put the variable on the right-hand side of the equality operator, so that if the equality operator is erroneously replaced with the assignment operator, PHP will report a parse error immediately. This helps you avoid a big subset of this class of bugs.
This commit is contained in:
@@ -221,7 +221,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;
|
||||
@@ -244,7 +244,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);
|
||||
}
|
||||
@@ -254,7 +254,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);
|
||||
}
|
||||
@@ -445,7 +445,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;
|
||||
@@ -646,7 +646,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;
|
||||
@@ -784,7 +784,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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 = round($order->amount - $extra->sum, 2);
|
||||
|
||||
@@ -206,7 +206,7 @@ function authorize_process_csv($filename)
|
||||
$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;
|
||||
|
||||
Reference in New Issue
Block a user