From: Andréas Lundgren Date: Sun, 23 Oct 2016 13:22:44 +0000 (+0200) Subject: Add option to profile_edit.php to show/hide users uncompleted entries (#24) X-Git-Tag: timetracker_1.19-1~1626 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=139889a67699143cce59a4f3136b3158058b9ce2;p=timetracker.git Add option to profile_edit.php to show/hide users uncompleted entries (#24) I'll try to do some renaming after this merge. --- diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 4c1af14e..7b1fc245 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -701,6 +701,15 @@ class ttTeamHelper { $record_type_v = ''; } + $uncompleted_entries = $fields['uncompleted_entries']; + if ($uncompleted_entries !== null) { + $uncompleted_entries_f = ', uncompleted_entries'; + $uncompleted_entries_v = ', ' . (int)$uncompleted_entries; + } else { + $uncompleted_entries_f = ''; + $uncompleted_entries_v = ''; + } + $workday_hours = $fields['workday_hours']; if ($workday_hours !== null) { $workday_hours_f = ', workday_hours'; @@ -710,11 +719,11 @@ class ttTeamHelper { $workday_hours_v = ''; } - $sql = "insert into tt_teams (name, address, currency $lockspec_f, lang $decimal_mark_f $date_format_f $time_format_f $week_start_f $plugins_f $tracking_mode_f $record_type_f $workday_hours_f) + $sql = "insert into tt_teams (name, address, currency $lockspec_f, lang $decimal_mark_f $date_format_f $time_format_f $week_start_f $plugins_f $tracking_mode_f $record_type_f $uncompleted_entries_f $workday_hours_f) values(".$mdb2->quote(trim($fields['name'])). ", ".$mdb2->quote(trim($fields['address'])). ", ".$mdb2->quote(trim($fields['currency']))." $lockspec_v, ".$mdb2->quote($lang). - "$decimal_mark_v $date_format_v $time_format_v $week_start_v $plugins_v $tracking_mode_v $record_type_v $workday_hours_v)"; + "$decimal_mark_v $date_format_v $time_format_v $week_start_v $plugins_v $tracking_mode_v $record_type_v $uncompleted_entries_v $workday_hours_v)"; $affected = $mdb2->exec($sql); if (!is_a($affected, 'PEAR_Error')) { @@ -742,6 +751,7 @@ class ttTeamHelper { $week_start_part = ''; $tracking_mode_part = ''; $record_type_part = ''; + $uncompleted_entries_part = ''; $plugins_part = ''; $lock_spec_part = ''; $workday_hours_part = ''; @@ -755,13 +765,14 @@ class ttTeamHelper { if (isset($fields['week_start'])) $week_start_part = ', week_start = '.intval($fields['week_start']); if (isset($fields['tracking_mode'])) $tracking_mode_part = ', tracking_mode = '.intval($fields['tracking_mode']); if (isset($fields['record_type'])) $record_type_part = ', record_type = '.intval($fields['record_type']); + if (isset($fields['uncompleted_entries'])) $uncompleted_entries_part = ', uncompleted_entries = '.intval($fields['uncompleted_entries']); if (isset($fields['plugins'])) $plugins_part = ', plugins = '.$mdb2->quote($fields['plugins']); if (isset($fields['lock_spec'])) $lock_spec_part = ', lock_spec = '.$mdb2->quote($fields['lock_spec']); if (isset($fields['workday_hours'])) $workday_hours_part = ', workday_hours = '.$mdb2->quote($fields['workday_hours']); $sql = "update tt_teams set $name_part $addr_part $currency_part $lang_part $decimal_mark_part $date_format_part $time_format_part $week_start_part $tracking_mode_part $record_type_part - $plugins_part $lock_spec_part $workday_hours_part where id = $team_id"; + $uncompleted_entries_part $plugins_part $lock_spec_part $workday_hours_part where id = $team_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false; diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 1566a485..0d648267 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -27,30 +27,31 @@ // +----------------------------------------------------------------------+ class ttUser { - var $login = null; // User login. - var $name = null; // User name. - var $id = null; // User id. - var $team_id = null; // Team id. - var $role = null; // User role (user, client, comanager, manager, admin). - var $client_id = null; // Client id for client user role. - var $behalf_id = null; // User id, on behalf of whom we are working. - var $behalf_name = null; // User name, on behalf of whom we are working. - var $email = null; // User email. - var $lang = null; // Language. - var $decimal_mark = null; // Decimal separator. - var $date_format = null; // Date format. - var $time_format = null; // Time format. - var $week_start = 0; // Week start day. - var $tracking_mode = 0; // Tracking mode. - var $record_type = 0; // Record type (duration vs start and finish, or both). - var $currency = null; // Currency. - var $plugins = null; // Comma-separated list of enabled plugins. - var $team = null; // Team name. - var $custom_logo = 0; // Whether to use a custom logo for team. - var $address = null; // Address for invoices. - var $lock_spec = null; // Cron specification for record locking. - var $workday_hours = 8; // Number of work hours in a regular day. - var $rights = 0; // A mask of user rights. + var $login = null; // User login. + var $name = null; // User name. + var $id = null; // User id. + var $team_id = null; // Team id. + var $role = null; // User role (user, client, comanager, manager, admin). + var $client_id = null; // Client id for client user role. + var $behalf_id = null; // User id, on behalf of whom we are working. + var $behalf_name = null; // User name, on behalf of whom we are working. + var $email = null; // User email. + var $lang = null; // Language. + var $decimal_mark = null; // Decimal separator. + var $date_format = null; // Date format. + var $time_format = null; // Time format. + var $week_start = 0; // Week start day. + var $tracking_mode = 0; // Tracking mode. + var $record_type = 0; // Record type (duration vs start and finish, or both). + var $uncompleted_entries = 0; // Uncompleted entries (show nowhere or on users page). + var $currency = null; // Currency. + var $plugins = null; // Comma-separated list of enabled plugins. + var $team = null; // Team name. + var $custom_logo = 0; // Whether to use a custom logo for team. + var $address = null; // Address for invoices. + var $lock_spec = null; // Cron specification for record locking. + var $workday_hours = 8; // Number of work hours in a regular day. + var $rights = 0; // A mask of user rights. // Constructor. function ttUser($login, $id = null) { @@ -63,7 +64,7 @@ class ttUser { $sql = "SELECT u.id, u.login, u.name, u.team_id, u.role, u.client_id, u.email, t.name as team_name, t.address, t.currency, t.lang, t.decimal_mark, t.date_format, t.time_format, t.week_start, - t.tracking_mode, t.record_type, t.plugins, t.lock_spec, t.workday_hours, t.custom_logo + t.tracking_mode, t.record_type, t.uncompleted_entries, t.plugins, t.lock_spec, t.workday_hours, t.custom_logo FROM tt_users u LEFT JOIN tt_teams t ON (u.team_id = t.id) WHERE "; if ($id) $sql .= "u.id = $id"; @@ -92,6 +93,7 @@ class ttUser { $this->week_start = $val['week_start']; $this->tracking_mode = $val['tracking_mode']; $this->record_type = $val['record_type']; + $this->uncompleted_entries = $val['uncompleted_entries']; $this->team = $val['team_name']; $this->address = $val['address']; $this->currency = $val['currency']; diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index 0a83a1ba..5b726691 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -389,6 +389,9 @@ $i18n_key_words = array( 'form.profile.mode_projects' => 'projects', 'form.profile.mode_projects_and_tasks' => 'projects and tasks', 'form.profile.record_type' => 'Record type', +'form.profile.uncompleted_entries' => 'Uncompleted entries', +'form.profile.entries_none' => 'Do not show', +'form.profile.entries_users_page' => 'Show on Users page', 'form.profile.type_all' => 'all', 'form.profile.type_start_finish' => 'start and finish', 'form.profile.type_duration' => 'duration', diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index 2094860c..b40f1076 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -388,6 +388,9 @@ $i18n_key_words = array( 'form.profile.mode_projects' => 'Projekt', 'form.profile.mode_projects_and_tasks' => 'Projekt och arbetsuppgifter', 'form.profile.record_type' => 'Typ av tidsregistrering', +'form.profile.uncompleted_entries' => 'Oavslutade tidsregistreringar', +'form.profile.entries_none' => 'Visa inte', +'form.profile.entries_users_page' => 'Visa pÃ¥ sidan Användare', 'form.profile.type_all' => 'Alla', 'form.profile.type_start_finish' => 'Starttid och sluttid', 'form.profile.type_duration' => 'Varaktighet', diff --git a/WEB-INF/templates/mobile/users.tpl b/WEB-INF/templates/mobile/users.tpl index fedfa804..bd2f0f4f 100644 --- a/WEB-INF/templates/mobile/users.tpl +++ b/WEB-INF/templates/mobile/users.tpl @@ -19,7 +19,9 @@ {foreach $active_users as $u} - + {if $smarty.const.ENTRIES_USERS_PAGE == $user->uncompleted_entries} + + {/if} {if $user->isManager()} {$u.name|escape:'html'} {else} diff --git a/WEB-INF/templates/profile_edit.tpl b/WEB-INF/templates/profile_edit.tpl index e463ca68..d13e0871 100644 --- a/WEB-INF/templates/profile_edit.tpl +++ b/WEB-INF/templates/profile_edit.tpl @@ -139,6 +139,10 @@ function handlePluginCheckboxes() { {$i18n.form.profile.record_type}: {$forms.profileForm.record_type.control} + + {$i18n.form.profile.uncompleted_entries}: + {$forms.profileForm.uncompleted_entries.control} + {* initialize preview text *}