Rename an_cutoff_hour and an_cutoff_min to an_cutoff.

This commit is contained in:
ethem
2006-02-01 13:03:13 +00:00
parent 88f47f81bc
commit 7fec4cb2f9
6 changed files with 43 additions and 15 deletions
+1 -4
View File
@@ -17,14 +17,11 @@ function getsettletime($time)
{
global $CFG;
$hrs = intval($CFG->an_cutoff_hour);
$mins = intval($CFG->an_cutoff_min);
$cutoff = intval($CFG->an_cutoff); $hrs = $cutoff / 60; $mins = $cutoff % 60;
$cutofftime = strtotime("$hrs:$mins", $time);
if ($cutofftime < $time) {
$cutofftime = strtotime("$hrs:$mins", $time + (24 * 3600));
}
return $cutofftime;
}
+5
View File
@@ -15,6 +15,11 @@ if (!isset($frm->an_test)) $frm->an_test = '';
if (!isset($frm->an_review)) $frm->an_review = '';
if (!isset($frm->an_capture_day)) $frm->an_capture_day = '5';
if (!isset($frm->an_emailexpired)) $frm->an_emailexpired = '2';
if (isset($CFG->an_cutoff)) {
$frm->an_cutoff_hour = intval($CFG->an_cutoff) / 60;
$frm->an_cutoff_min = intval($CFG->an_cutoff) % 60;
}
if (!isset($frm->an_cutoff_hour)) $frm->an_cutoff_hour = '0';
if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
+17 -5
View File
@@ -79,11 +79,23 @@ function authorize_upgrade($oldversion=0) {
execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP authcode", false);
}
if ($oldversion < 2006010200) {
if (isset($CFG->an_review_day)) { // rename an_review_day
set_config('an_capture_day', $CFG->an_review_day);
delete_records('config', 'name', 'an_review_day');
}
if ($oldversion < 2006010200) { // rename an_review_day
if (isset($CFG->an_review_day)) {
set_config('an_capture_day', $CFG->an_review_day);
delete_records('config', 'name', 'an_review_day');
}
}
if ($oldversion < 2006020100) { // rename an_cutoff_hour and an_cutoff_min to an_cutoff
if (isset($CFG->an_cutoff_hour) && isset($CFG->an_cutoff_min)) {
$an_cutoff_hour = intval($CFG->an_cutoff_hour);
$an_cutoff_min = intval($CFG->an_cutoff_min);
$an_cutoff = ($an_cutoff_hour * 60) + $an_cutoff_min;
if (set_config('an_cutoff', $an_cutoff)) {
delete_records('config', 'name', 'an_cutoff_hour');
delete_records('config', 'name', 'an_cutoff_min');
}
}
}
return $result;
+14 -2
View File
@@ -79,13 +79,25 @@ function authorize_upgrade($oldversion=0) {
execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP authcode", false);
}
if ($oldversion < 2006010200) {
if (isset($CFG->an_review_day)) { // rename an_review_day
if ($oldversion < 2006010200) { // rename an_review_day
if (isset($CFG->an_review_day)) {
set_config('an_capture_day', $CFG->an_review_day);
delete_records('config', 'name', 'an_review_day');
}
}
if ($oldversion < 2006020100) { // rename an_cutoff_hour and an_cutoff_min to an_cutoff
if (isset($CFG->an_cutoff_hour) && isset($CFG->an_cutoff_min)) {
$an_cutoff_hour = intval($CFG->an_cutoff_hour);
$an_cutoff_min = intval($CFG->an_cutoff_min);
$an_cutoff = ($an_cutoff_hour * 60) + $an_cutoff_min;
if (set_config('an_cutoff', $an_cutoff)) {
delete_records('config', 'name', 'an_cutoff_hour');
delete_records('config', 'name', 'an_cutoff_min');
}
}
}
return $result;
}
+5 -3
View File
@@ -463,8 +463,10 @@ class enrolment_plugin extends enrolment_base
set_config('an_avs', optional_param('an_avs', ''));
set_config('an_test', optional_param('an_test', ''));
set_config('an_referer', optional_param('an_referer', 'http://', PARAM_URL));
set_config('an_cutoff_hour', optional_param('an_cutoff_hour', 0, PARAM_INT));
set_config('an_cutoff_min', optional_param('an_cutoff_min', 5, PARAM_INT));
$cutoff_hour = optional_param('an_cutoff_hour', 0, PARAM_INT);
$cutoff_min = optional_param('an_cutoff_min', 5, PARAM_INT);
set_config('an_cutoff', $cutoff_hour * 60 + $cutoff_min);
$reviewval = optional_param('an_review', '');
$captureday = optional_param('an_capture_day', 5, PARAM_INT);
@@ -604,7 +606,7 @@ class enrolment_plugin extends enrolment_base
}
if (empty($CFG->an_review) || (!empty($CFG->an_test)) ||
intval($CFG->an_capture_day < 1) || (!$this->check_openssl_loaded())) {
(intval($CFG->an_capture_day) < 1) || (!$this->check_openssl_loaded())) {
return;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?PHP // $Id$
$module->version = 2006010200;
$module->version = 2006020100;
$module->requires = 2005072200;
?>