From b0bb9205ed7aeeee700ab27ee4c76d196406e5fc Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 14 Dec 2018 17:36:55 +0000 Subject: [PATCH] Fixed work units config for subgroups. --- WEB-INF/templates/footer.tpl | 2 +- work_units.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 98ba14a6..e94e90fa 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.31.4652 | Copyright © Anuko | +  Anuko Time Tracker 1.18.31.4653 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/work_units.php b/work_units.php index b2373ada..84ef37e0 100644 --- a/work_units.php +++ b/work_units.php @@ -39,17 +39,18 @@ if (!$user->isPluginEnabled('wu')) { header('Location: feature_disabled.php'); exit(); } +// End of access checks. -$config = new ttConfigHelper($user->config); +$config = new ttConfigHelper($user->getConfig()); if ($request->isPost()) { $cl_minutes_in_unit = $request->getParameter('minutes_in_unit'); $cl_1st_unit_threshold = $request->getParameter('1st_unit_threshold'); $cl_totals_only = $request->getParameter('totals_only'); } else { - $cl_minutes_in_unit = $user->minutes_in_unit; - $cl_1st_unit_threshold = $user->first_unit_threshold; - $cl_totals_only = $user->unit_totals_only; + $cl_minutes_in_unit = $user->getConfigInt('minutes_in_unit'); + $cl_1st_unit_threshold = $user->getConfigInt('1st_unit_threshold'); + $cl_totals_only = $user->getConfigOption('unit_totals_only'); } $form = new Form('workUnitsForm'); @@ -60,7 +61,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('b if ($request->isPost()){ // Validate user input. - if (!ttValidInteger($cl_minutes_in_unit)) $err->add($i18n->get('error.field'), $i18n->get('form.work_units.minutes_in_unit')); + if (!ttValidInteger($cl_minutes_in_unit) || $cl_minutes_in_unit == 0) $err->add($i18n->get('error.field'), $i18n->get('form.work_units.minutes_in_unit')); if (!ttValidInteger($cl_1st_unit_threshold, true) ||($cl_minutes_in_unit && $cl_1st_unit_threshold > $cl_minutes_in_unit)) $err->add($i18n->get('error.field'), $i18n->get('form.work_units.1st_unit_threshold')); // Finished validating user input. -- 2.20.1