Permalink
Browse files

Rename an_cutoff_hour and an_cutoff_min to an_cutoff.

  • Loading branch information...
1 parent 88f47f8 commit 7fec4cb2f930924f7a6044893fb9f571b28bdaf8 ethem committed Feb 1, 2006
View
5 enrol/authorize/action.php
@@ -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;
}
View
5 enrol/authorize/config.html
@@ -15,6 +15,11 @@
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';
View
22 enrol/authorize/db/mysql.php
@@ -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;
View
16 enrol/authorize/db/postgres7.php
@@ -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;
}
View
8 enrol/authorize/enrol.php
@@ -463,8 +463,10 @@ function process_config($config)
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 @@ function cron()
}
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;
}
View
2 enrol/authorize/version.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-$module->version = 2006010200;
+$module->version = 2006020100;
$module->requires = 2005072200;
?>

0 comments on commit 7fec4cb

Please sign in to comment.