Changeset: cb0a5e94fc9f https://sourceforge.net/p/mrbs/hg-code/ci/cb0a5e94fc9fea35df56c108e42f569cbaf2b1cf Author: Campbell Morrison <cimorri...@hg.code.sf.net> Date: Thu Apr 13 13:08:12 2017 +0100 Log message:
Fixed checks for maximum duration diffstat: web/edit_entry.php | 1 + web/js/edit_entry.js.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diffs (40 lines): diff -r c48bd0b98159 -r cb0a5e94fc9f web/edit_entry.php --- a/web/edit_entry.php Thu Apr 13 12:43:30 2017 +0100 +++ b/web/edit_entry.php Thu Apr 13 13:08:12 2017 +0100 @@ -432,6 +432,7 @@ $attributes[] = 'style="display: none"'; // Put in some data about the area for use by the JavaScript $attributes[] = 'data-enable_periods=' . (($areas[$a]['enable_periods']) ? 1 : 0); + $attributes[] = 'data-n_periods=' . count($areas[$a]['periods']); $attributes[] = 'data-default_duration=' . ((isset($areas[$a]['default_duration']) && ($areas[$a]['default_duration'] != 0)) ? $areas[$a]['default_duration'] : SECONDS_PER_HOUR); $attributes[] = 'data-default_duration_all_day=' . (($areas[$a]['default_duration_all_day']) ? 1 : 0); $attributes[] = 'data-max_duration_enabled=' . (($areas[$a]['max_duration_enabled']) ? 1 : 0); diff -r c48bd0b98159 -r cb0a5e94fc9f web/js/edit_entry.js.php --- a/web/js/edit_entry.js.php Thu Apr 13 12:43:30 2017 +0100 +++ b/web/js/edit_entry.js.php Thu Apr 13 13:08:12 2017 +0100 @@ -76,7 +76,7 @@ // by default the current area var areaConfig = function areaConfig(property, areaId) { - var properties = ['enable_periods', 'periods', 'default_duration', 'max_duration_enabled', + var properties = ['enable_periods', 'n_periods', 'default_duration', 'max_duration_enabled', 'max_duration_secs', 'max_duration_periods', 'max_duration_qty', 'max_duration_units', 'timezone']; var i, p, room; @@ -1046,6 +1046,7 @@ $('#end_seconds' + currentArea).find('option').each(function(i) { var thisValue = parseInt($(this).val(), 10), + nPeriods = areaConfig('n_periods'), maxDurationEnabled = areaConfig('max_duration_enabled'), maxDurationSecs = areaConfig('max_duration_secs'), maxDurationPeriods = areaConfig('max_duration_periods'), @@ -1070,7 +1071,7 @@ if (enablePeriods) { duration = duration/60 + 1; <?php // because of the way periods work ?> - duration += dateDifference * <?php echo count($periods) ?>; + duration += dateDifference * nPeriods; } else { ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Mrbs-commits mailing list Mrbs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mrbs-commits