From 6968ef66a0264c35eff9bdd8ed92af48b34b8d19 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 20 Jul 2018 16:06:16 +0000 Subject: [PATCH] Initial work done on Work units plugin. Still in debug mode. --- WEB-INF/lib/ttConfigHelper.class.php | 2 +- WEB-INF/lib/ttReportHelper.class.php | 42 ++++++++++++++++++++-------- WEB-INF/lib/ttUser.class.php | 25 +++++++++++------ WEB-INF/resources/ca.lang.php | 1 + WEB-INF/resources/cs.lang.php | 1 + WEB-INF/resources/da.lang.php | 1 + WEB-INF/resources/de.lang.php | 1 + WEB-INF/resources/en.lang.php | 1 + WEB-INF/resources/es.lang.php | 1 + WEB-INF/resources/et.lang.php | 1 + WEB-INF/resources/fa.lang.php | 1 + WEB-INF/resources/fi.lang.php | 1 + WEB-INF/resources/fr.lang.php | 1 + WEB-INF/resources/gr.lang.php | 1 + WEB-INF/resources/he.lang.php | 1 + WEB-INF/resources/hu.lang.php | 1 + WEB-INF/resources/it.lang.php | 1 + WEB-INF/resources/ja.lang.php | 1 + WEB-INF/resources/ko.lang.php | 1 + WEB-INF/resources/nl.lang.php | 1 + WEB-INF/resources/no.lang.php | 1 + WEB-INF/resources/pl.lang.php | 1 + WEB-INF/resources/pt-br.lang.php | 1 + WEB-INF/resources/pt.lang.php | 1 + WEB-INF/resources/ro.lang.php | 1 + WEB-INF/resources/ru.lang.php | 1 + WEB-INF/resources/sk.lang.php | 1 + WEB-INF/resources/sl.lang.php | 1 + WEB-INF/resources/sv.lang.php | 1 + WEB-INF/resources/tr.lang.php | 1 + WEB-INF/resources/zh-cn.lang.php | 1 + WEB-INF/resources/zh-tw.lang.php | 1 + WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/report.tpl | 8 ++++++ WEB-INF/templates/reports.tpl | 8 ++++++ reports.php | 4 +++ work_units.php | 4 +-- 37 files changed, 101 insertions(+), 23 deletions(-) diff --git a/WEB-INF/lib/ttConfigHelper.class.php b/WEB-INF/lib/ttConfigHelper.class.php index 95cd1218..b33734c8 100644 --- a/WEB-INF/lib/ttConfigHelper.class.php +++ b/WEB-INF/lib/ttConfigHelper.class.php @@ -44,7 +44,7 @@ class ttConfigHelper { // getDefinedValue determines if a value identified by name is defined. function getDefinedValue($name) { - return in_array($name, $this->$config_array); + return in_array($name, $this->config_array); } // The getIntValue parses an integer value from the source config string. diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 67f1da26..daaad46c 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -303,6 +303,10 @@ class ttReportHelper { if (($canViewReports || $isClient) && $bean->getAttribute('chinvoice')) array_push($fields, 'i.name as invoice'); + // Add work units. + if ($bean->getAttribute('chunits')) + array_push($fields, "if(time_to_sec(duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(duration)/60/$user->minutes_in_unit)) as units"); + // Prepare sql query part for left joins. $left_joins = null; if ($bean->getAttribute('chclient') || 'client' == $group_by_option) @@ -380,6 +384,10 @@ class ttReportHelper { if (($canViewReports || $isClient) && $bean->getAttribute('chinvoice')) array_push($fields, 'i.name as invoice'); + // Add work units. + if ($bean->getAttribute('chunits')) + array_push($fields, 'null'); // null for work units. + // Prepare sql query part for left joins. $left_joins = null; if ($canViewReports || $isClient) @@ -769,21 +777,25 @@ class ttReportHelper { if (MODE_TIME == $user->tracking_mode) { if ($group_by_option != 'user') $left_join = 'left join tt_users u on (l.user_id = u.id)'; - $sql = "select $group_field as group_field, sum(time_to_sec(l.duration)) as time, + $sql = "select $group_field as group_field, sum(time_to_sec(l.duration)) as time, + sum(if(time_to_sec(duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(duration)/60/$user->minutes_in_unit))) as units, sum(cast(l.billable * coalesce(u.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10, 2))) as cost, null as expenses from tt_log l $group_join $left_join $where group by $group_field"; } else { // If we are including cost and tracking projects, our query (the same as above) needs to join the tt_user_project_binds table. - $sql = "select $group_field as group_field, sum(time_to_sec(l.duration)) as time, + $sql = "select $group_field as group_field, sum(time_to_sec(l.duration)) as time, + sum(if(time_to_sec(duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(duration)/60/$user->minutes_in_unit))) as units, sum(cast(l.billable * coalesce(upb.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10,2))) as cost, null as expenses from tt_log l $group_join left join tt_user_project_binds upb on (l.user_id = upb.user_id and l.project_id = upb.project_id) $where group by $group_field"; } } else { - $sql = "select $group_field as group_field, sum(time_to_sec(l.duration)) as time, null as expenses from tt_log l - $group_join $where group by $group_field"; + $sql = "select $group_field as group_field, sum(time_to_sec(l.duration)) as time, + sum(if(time_to_sec(duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(duration)/60/$user->minutes_in_unit))) as units, + null as expenses from tt_log l + $group_join $where group by $group_field"; } // By now we have sql for time items. @@ -813,13 +825,13 @@ class ttReportHelper { } $where = ttReportHelper::getExpenseWhere($bean); - $sql_for_expenses = "select $group_field as group_field, null as time, sum(ei.cost) as cost, sum(ei.cost) as expenses from tt_expense_items ei + $sql_for_expenses = "select $group_field as group_field, null as time, null as units, sum(ei.cost) as cost, sum(ei.cost) as expenses from tt_expense_items ei $group_join $where"; // Add a "group by" clause if we are grouping. if ('null' != $group_field) $sql_for_expenses .= " group by $group_field"; // Create a combined query. - $sql = "select group_field, sum(time) as time, sum(cost) as cost, sum(expenses) as expenses from (($sql) union all ($sql_for_expenses)) t group by group_field"; + $sql = "select group_field, sum(time) as time, sum(units) as units, sum(cost) as cost, sum(expenses) as expenses from (($sql) union all ($sql_for_expenses)) t group by group_field"; } // Execute query. @@ -839,9 +851,9 @@ class ttReportHelper { $val['cost'] = str_replace('.', $user->decimal_mark, $val['cost']); $val['expenses'] = str_replace('.', $user->decimal_mark, $val['expenses']); } - $subtotals[$val['group_field']] = array('name'=>$val['group_field'],'time'=>$time,'cost'=>$val['cost'],'expenses'=>$val['expenses']); + $subtotals[$val['group_field']] = array('name'=>$val['group_field'],'time'=>$time, 'units'=> $val['units'],'cost'=>$val['cost'],'expenses'=>$val['expenses']); } else - $subtotals[$val['group_field']] = array('name'=>$val['group_field'],'time'=>$time); + $subtotals[$val['group_field']] = array('name'=>$val['group_field'],'time'=>$time, 'units'=> $val['units']); } return $subtotals; @@ -984,30 +996,37 @@ class ttReportHelper { $where = ttReportHelper::getWhere($bean); + // TODO: build query in parts so the work units inclusion is conditional. + // Start with a query for time items. if ($bean->getAttribute('chcost')) { if (MODE_TIME == $user->tracking_mode) { $sql = "select sum(time_to_sec(l.duration)) as time, + sum(if(time_to_sec(duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(duration)/60/$user->minutes_in_unit))) as units, sum(cast(l.billable * coalesce(u.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10,2))) as cost, null as expenses from tt_log l left join tt_users u on (l.user_id = u.id) $where"; } else { $sql = "select sum(time_to_sec(l.duration)) as time, + sum(if(time_to_sec(duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(duration)/60/$user->minutes_in_unit))) as units, sum(cast(l.billable * coalesce(upb.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10,2))) as cost, null as expenses from tt_log l left join tt_user_project_binds upb on (l.user_id = upb.user_id and l.project_id = upb.project_id) $where"; } } else - $sql = "select sum(time_to_sec(l.duration)) as time, null as cost, null as expenses from tt_log l $where"; + $sql = "select sum(time_to_sec(l.duration)) as time," + ." sum(if(time_to_sec(duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(duration)/60/$user->minutes_in_unit))) as units," + ." null as cost, null as expenses from tt_log l $where"; // If we have expenses, query becomes a bit more complex. if ($bean->getAttribute('chcost') && $user->isPluginEnabled('ex')) { $where = ttReportHelper::getExpenseWhere($bean); - $sql_for_expenses = "select null as time, sum(cost) as cost, sum(cost) as expenses from tt_expense_items ei $where"; + $sql_for_expenses = "select null as time, null as units, sum(cost) as cost, sum(cost) as expenses from tt_expense_items ei $where"; + // Create a combined query. - $sql = "select sum(time) as time, sum(cost) as cost, sum(expenses) as expenses from (($sql) union all ($sql_for_expenses)) t"; + $sql = "select sum(time) as time, sum(units) as units, sum(cost) as cost, sum(expenses) as expenses from (($sql) union all ($sql_for_expenses)) t"; } // Execute query. @@ -1039,6 +1058,7 @@ class ttReportHelper { $totals['start_date'] = $period->getStartDate(); $totals['end_date'] = $period->getEndDate(); $totals['time'] = $total_time; + $totals['units'] = $val['units']; $totals['cost'] = $total_cost; $totals['expenses'] = $total_expenses; diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 07d810b8..28165931 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -26,6 +26,8 @@ // | https://www.anuko.com/time_tracker/credits.htm // +----------------------------------------------------------------------+ +import('ttConfigHelper'); + class ttUser { var $login = null; // User login. var $name = null; // User name. @@ -64,6 +66,8 @@ class ttUser { var $workday_minutes = 480; // Number of work minutes in a regular day. var $rights = array(); // An array of user rights such as 'track_own_time', etc. var $is_client = false; // Whether user is a client as determined by missing 'track_own_time' right. + var $minutes_in_unit = 15; // Number of minutes in unit for Work units plugin. + var $first_unit_threshold = 0;// Threshold for 1st unit for Work units plugin. // Constructor. function __construct($login, $id = null) { @@ -123,15 +127,20 @@ class ttUser { $this->custom_logo = $val['custom_logo']; $this->config = $val['config']; - $config_array = explode(',', $this->config); - + $config = new ttConfigHelper($this->config); // Set user config options. - $this->show_holidays = in_array('show_holidays', $config_array); - $this->punch_mode = in_array('punch_mode', $config_array); - $this->allow_overlap = in_array('allow_overlap', $config_array); - $this->future_entries = in_array('future_entries', $config_array); - $this->uncompleted_indicators = in_array('uncompleted_indicators', $config_array); - + $this->show_holidays = $config->getDefinedValue('show_holidays'); + $this->punch_mode = $config->getDefinedValue('punch_mode'); + $this->allow_overlap = $config->getDefinedValue('allow_overlap'); + $this->future_entries = $config->getDefinedValue('future_entries'); + $this->uncompleted_indicators = $config->getDefinedValue('uncompleted_indicators'); + if ($this->isPluginEnabled('wu')) { + $minutes_in_unit = $config->getIntValue('minutes_in_unit'); + if ($minutes_in_unit) $this->minutes_in_unit = $minutes_in_unit; + $first_unit_threshold = $config->getIntValue('1st_unit_threshold'); + if ($first_unit_threshold) $this->first_unit_threshold = $first_unit_threshold; + } + // Set "on behalf" id and name. if (isset($_SESSION['behalf_id'])) { $this->behalf_id = $_SESSION['behalf_id']; diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 6f499dd6..0e909ab8 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -244,6 +244,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. // TODO: Improve titles for consistency, so that each title explains correctly what each diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index 21e16a6f..282296ef 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -254,6 +254,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. // TODO: Improve titles for consistency, so that each title explains correctly what each diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index 3b6487ed..38e9f43d 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -225,6 +225,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Login', diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index cf112e99..613bdc7c 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -221,6 +221,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Anmelden', diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index 7e57b2fe..e4abce9f 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -212,6 +212,7 @@ $i18n_key_words = array( 'label.week_note' => 'Week note', 'label.week_list' => 'Week list', 'label.work_units' => 'Work units', +'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Login', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index d3ab0e8c..5a040b80 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -247,6 +247,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Sesión iniciada', diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index 8547caf7..2b1bdde3 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -250,6 +250,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. // TODO: Improve titles for consistency, so that each title explains correctly what each diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php index 9b06bb13..c567d072 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -237,6 +237,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'ورود', diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php index cf4d0b83..48b5089f 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -229,6 +229,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Kirjautuminen', diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php index 010d6792..888e0ee8 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -223,6 +223,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Connexion', diff --git a/WEB-INF/resources/gr.lang.php b/WEB-INF/resources/gr.lang.php index 42b7986d..e8f03b01 100644 --- a/WEB-INF/resources/gr.lang.php +++ b/WEB-INF/resources/gr.lang.php @@ -214,6 +214,7 @@ $i18n_key_words = array( 'label.week_list' => 'Λίστα εβδομάδων', // TODO: translate the following. // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Σύνδεση', diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php index 646e12a2..e513d5fc 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -247,6 +247,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'כניסה', diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php index 74c3bd2f..cf6b0878 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -247,6 +247,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Bejelentkezés', diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index ed335fe4..ae1dae45 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -219,6 +219,7 @@ $i18n_key_words = array( 'label.week_list' => 'Lista settimanale', // TODO: translate the following. // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. // TODO: Improve titles for consistency, so that each title explains correctly what each diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php index 7902decf..fa4b4bec 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -252,6 +252,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'ログイン', diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php index 4128eb67..b4c79c23 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -252,6 +252,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => '로그인', diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php index 25b8148f..0107a708 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -212,6 +212,7 @@ $i18n_key_words = array( 'label.week_list' => 'Week overzicht', // TODO: translate the following. // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Aanmelden', diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php index 3bd4cc24..1bfc0534 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -250,6 +250,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Innlogging', diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php index 5a6150eb..ec6b7848 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -230,6 +230,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Logowanie', diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php index c4f9f6a7..db390eb2 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -227,6 +227,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Login', diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php index 5e43040d..4b9727fa 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -239,6 +239,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Login', diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php index 002a38c9..b9c12201 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -251,6 +251,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. // TODO: Improve titles for consistency, so that each title explains correctly what each diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index 804d9cd5..114ecc54 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -211,6 +211,7 @@ $i18n_key_words = array( 'label.week_note' => 'Комментарий недели', 'label.week_list' => 'Список недели', 'label.work_units' => 'Единицы работы', +'label.work_units_short' => 'Единицы', // Form titles. 'title.login' => 'Вход в систему', diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php index 45d16c83..87beb6f6 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -237,6 +237,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Prihlásenie', diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php index 8dc9a6d0..732286b9 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -234,6 +234,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => 'Prijava', diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index 1e056716..11eff194 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -223,6 +223,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Rubriker för formulär 'title.login' => 'Logga in', diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php index 6449a7cd..ee3b4456 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -258,6 +258,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. // Form titles. diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php index cbd7de32..1cb84d71 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -241,6 +241,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => '登录', diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php index 6a77cff5..fc3ec995 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -248,6 +248,7 @@ $i18n_key_words = array( // 'label.week_note' => 'Week note', // 'label.week_list' => 'Week list', // 'label.work_units' => 'Work units', +// 'label.work_units_short' => 'Units', // Form titles. 'title.login' => '登錄', diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 3f71f0ef..3ad220b3 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chcost')}{/if} {foreach $subtotals as $subtotal} {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chcost')}{/if} {/foreach} @@ -30,6 +32,7 @@ {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chcost')}{/if} {else} @@ -44,6 +47,7 @@ {if $bean->getAttribute('chstart')}{/if} {if $bean->getAttribute('chfinish')}{/if} {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} @@ -66,6 +70,7 @@ {if $bean->getAttribute('chstart')}{/if} {if $bean->getAttribute('chfinish')}{/if} {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} @@ -91,6 +96,7 @@ {if $bean->getAttribute('chstart')}{/if} {if $bean->getAttribute('chfinish')}{/if} {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} {if $bean->getAttribute('chfinish')}{/if} {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} @@ -136,6 +143,7 @@ {if $bean->getAttribute('chstart')}{/if} {if $bean->getAttribute('chfinish')}{/if} {if $bean->getAttribute('chduration')}{/if} + {if $bean->getAttribute('chunits')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} diff --git a/WEB-INF/templates/reports.tpl b/WEB-INF/templates/reports.tpl index a70a3f07..b57ba841 100644 --- a/WEB-INF/templates/reports.tpl +++ b/WEB-INF/templates/reports.tpl @@ -284,6 +284,14 @@ function handleCheckboxes() { {/if} +{if $user->isPluginEnabled('wu')} + + + + + + +{/if}
 Anuko Time Tracker 1.17.91.4275 | Copyright © Anuko | +  Anuko Time Tracker 1.17.92.4276 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/report.tpl b/WEB-INF/templates/report.tpl index ddea591a..55438428 100644 --- a/WEB-INF/templates/report.tpl +++ b/WEB-INF/templates/report.tpl @@ -16,12 +16,14 @@
{$group_by_header|escape}{$i18n.label.duration}{$i18n.label.work_units_short}{$i18n.label.cost}
{if $subtotal['name']}{$subtotal['name']|escape}{else} {/if}{$subtotal['time']}{$subtotal['units']}{if $user->can('manage_invoices') || $user->isClient()}{$subtotal['cost']}{else}{$subtotal['expenses']}{/if}
{$i18n.label.total}{$totals['time']}{$totals['units']}{$user->currency|escape} {if $user->can('manage_invoices') || $user->isClient()}{$totals['cost']}{else}{$totals['expenses']}{/if}
{$i18n.label.start}{$i18n.label.finish}{$i18n.label.duration}{$i18n.label.work_units_short}{$i18n.label.note}{$i18n.label.cost}{$i18n.label.paid}{$subtotals[$prev_grouped_by]['time']}{$subtotals[$prev_grouped_by]['units']}{if $user->can('manage_invoices') || $user->isClient()}{$subtotals[$prev_grouped_by]['cost']}{else}{$subtotals[$prev_grouped_by]['expenses']}{/if}{$item.start}{$item.finish}{$item.duration}{$item.units}{$item.note|escape}{if $user->can('manage_invoices') || $user->isClient()}{$item.cost}{else}{$item.expense}{/if}{if $item.paid == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{/if} @@ -116,6 +122,7 @@ {if $bean->getAttribute('chstart')}{$subtotals[$cur_grouped_by]['time']}{$subtotals[$cur_grouped_by]['units']}{if $user->can('manage_invoices') || $user->isClient()}{$subtotals[$cur_grouped_by]['cost']}{else}{$subtotals[$cur_grouped_by]['expenses']}{/if}{$totals['time']}{$totals['units']}{$user->currency|escape} {if $user->can('manage_invoices') || $user->isClient()}{$totals['cost']}{else}{$totals['expenses']}{/if}
diff --git a/reports.php b/reports.php index fcefd047..0565cf71 100644 --- a/reports.php +++ b/reports.php @@ -214,6 +214,9 @@ $form->addInput(array('type'=>'checkbox','name'=>'chcost')); // If we have a custom field - add a checkbox for it. if ($custom_fields && $custom_fields->fields[0]) $form->addInput(array('type'=>'checkbox','name'=>'chcf_1')); +if ($user->isPluginEnabled('wu')) + $form->addInput(array('type'=>'checkbox','name'=>'chunits')); + // Add group by control. $group_by_options['no_grouping'] = $i18n->get('form.reports.group_by_no'); $group_by_options['date'] = $i18n->get('form.reports.group_by_date'); @@ -260,6 +263,7 @@ if ($request->isGet() && !$bean->isSaved()) { $form->setValueByElement('chfinish', '1'); $form->setValueByElement('chnote', '1'); $form->setValueByElement('chcf_1', '0'); + $form->setValueByElement('chunits', '0'); $form->setValueByElement('chtotalsonly', '0'); } diff --git a/work_units.php b/work_units.php index 3340ec15..dd01488a 100644 --- a/work_units.php +++ b/work_units.php @@ -46,8 +46,8 @@ if ($request->isPost()) { $cl_minutes_in_unit = $request->getParameter('minutes_in_unit'); $cl_1st_unit_threshold = $request->getParameter('1st_unit_threshold'); } else { - $cl_minutes_in_unit = $config->getIntValue('minutes_in_unit'); - $cl_1st_unit_threshold = $config->getIntValue('1st_unit_threshold'); + $cl_minutes_in_unit = $user->minutes_in_unit; + $cl_1st_unit_threshold = $user->first_unit_threshold; } $form = new Form('workUnitsForm'); -- 2.20.1