From: Nik Okuntseff Date: Mon, 9 Apr 2018 13:18:27 +0000 (+0000) Subject: A bit of cleanup. X-Git-Tag: timetracker_1.19-1~858 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=de05f61301a897661c702f03c1b45dd3ab5c0e8a;p=timetracker.git A bit of cleanup. --- diff --git a/WEB-INF/lib/ttNotificationHelper.class.php b/WEB-INF/lib/ttNotificationHelper.class.php index 34c85276..35a96970 100644 --- a/WEB-INF/lib/ttNotificationHelper.class.php +++ b/WEB-INF/lib/ttNotificationHelper.class.php @@ -26,9 +26,6 @@ // | https://www.anuko.com/time_tracker/credits.htm // +----------------------------------------------------------------------+ -import('ttTeamHelper'); -import('ttUserHelper'); - // Class ttNotificationHelper is used to help with notification related tasks. class ttNotificationHelper { diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 092c737a..359f6b97 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -354,7 +354,7 @@ class ttTeamHelper { return $result; } - // getInactiveRoles - returns an array of inactive roles for team. + // getInactiveRoles - returns an array of inactive roles for a group. static function getInactiveRoles($group_id) { $result = array(); @@ -833,12 +833,12 @@ class ttTeamHelper { return false; } - // The getInactiveTeams is a maintenance function that returns an array of inactive group ids (max 100). - static function getInactiveTeams() { - $inactive_teams = array(); + // The getInactiveGroups is a maintenance function that returns an array of inactive group ids (max 100). + static function getInactiveGroups() { + $inactive_groups = array(); $mdb2 = getConnection(); - // Get all team ids for teams created or modified more than 8 months ago. + // Get all group ids for groups created or modified more than 8 months ago. // $ts = date('Y-m-d', strtotime('-1 year')); $ts = $mdb2->quote(date('Y-m-d', strtotime('-8 month'))); $sql = "select id from tt_groups where created < $ts and (modified is null or modified < $ts) order by id"; @@ -848,20 +848,20 @@ class ttTeamHelper { if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { $group_id = $val['id']; - if (ttTeamHelper::isTeamActive($group_id) == false) { + if (ttTeamHelper::isGroupActive($group_id) == false) { $count++; - $inactive_teams[] = $group_id; + $inactive_groups[] = $group_id; // Limit the array size for perfomance by allowing this operation on small chunks only. if ($count >= 100) break; } } - return $inactive_teams; + return $inactive_groups; } return false; } - // The isTeamActive determines if a team is using Time Tracker or abandoned it. - static function isTeamActive($group_id) { + // The isGroupActive determines if a group is using Time Tracker or abandoned it. + static function isGroupActive($group_id) { $users = array(); $mdb2 = getConnection(); @@ -873,7 +873,7 @@ class ttTeamHelper { } $user_list = implode(',', $users); // This is a comma-separated list of user ids. if (!$user_list) - return false; // No users in team. + return false; // No users in group. $count = 0; $ts = date('Y-m-d', strtotime('-2 years')); @@ -889,7 +889,7 @@ class ttTeamHelper { return false; // No time entries for the last 2 years. if ($count <= 5) { - // We will consider a team inactive if it has 5 or less time entries made more than 1 year ago. + // We will consider a group inactive if it has 5 or less time entries made more than 1 year ago. $count_last_year = 0; $ts = date('Y-m-d', strtotime('-1 year')); $sql = "select count(*) as cnt from tt_log where user_id in ($user_list) and created > '$ts'"; @@ -905,7 +905,7 @@ class ttTeamHelper { return true; } - // The delete function permanently deletes all data for a team. + // The delete function permanently deletes all data for a group. static function delete($group_id) { $mdb2 = getConnection(); @@ -957,7 +957,7 @@ class ttTeamHelper { return true; } - // The markTasksDeleted deletes task binds and marks the tasks as deleted for a team. + // The markTasksDeleted deletes task binds and marks the tasks as deleted for a group. static function markTasksDeleted($group_id) { $mdb2 = getConnection(); $sql = "select id from tt_tasks where group_id = $group_id"; @@ -981,7 +981,7 @@ class ttTeamHelper { return true; } - // The deleteTasks deletes all tasks and task binds for an inactive team. + // The deleteTasks deletes all tasks and task binds for an inactive group. static function deleteTasks($group_id) { $mdb2 = getConnection(); $sql = "select id from tt_tasks where group_id = $group_id"; @@ -1005,7 +1005,7 @@ class ttTeamHelper { return true; } - // The deleteCustomFields cleans up tt_custom_field_log, tt_custom_field_options and tt_custom_fields tables for an inactive team. + // The deleteCustomFields cleans up tt_custom_field_log, tt_custom_field_options and tt_custom_fields tables for an inactive group. static function deleteCustomFields($group_id) { $mdb2 = getConnection(); $sql = "select id from tt_custom_fields where group_id = $group_id"; diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index cbfd62d1..7afc9c15 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -58,7 +58,7 @@ class ttUser { var $plugins = null; // Comma-separated list of enabled plugins. var $config = null; // Comma-separated list of miscellaneous config options. var $group = null; // Group name. - var $custom_logo = 0; // Whether to use a custom logo for team. + var $custom_logo = 0; // Whether to use a custom logo for group. var $lock_spec = null; // Cron specification for record locking. 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. @@ -153,7 +153,7 @@ class ttUser { return $this->can('administer_site'); } - // isManager - determines whether current user is team manager. + // isManager - determines whether current user is group manager. // This is a legacy function that we are getting rid of by replacing with rights check. function isManager() { return $this->can('export_data'); // By default this is assigned to managers but not co-managers. @@ -161,7 +161,7 @@ class ttUser { // to this function and then remove it. } - // isCoManager - determines whether current user is team comanager. + // isCoManager - determines whether current user is group comanager. // This is a legacy function that we are getting rid of by replacing with rights check. function isCoManager() { return ($this->can('manage_users') && !$this->can('export_data')); diff --git a/WEB-INF/lib/ttUserHelper.class.php b/WEB-INF/lib/ttUserHelper.class.php index 40cd7829..3d4ead9f 100644 --- a/WEB-INF/lib/ttUserHelper.class.php +++ b/WEB-INF/lib/ttUserHelper.class.php @@ -246,7 +246,7 @@ class ttUserHelper { // Tho logic is different depending on who is doing the operation. // Co-manager and admin - mark user deleted. - // Manager - mark user deleted. If manager is the only account in team, mark team items deleted. + // Manager - mark user deleted. If manager is the only account in group, mark group items deleted. // admin part. if ($user->isAdmin()) { @@ -317,7 +317,7 @@ class ttUserHelper { if (is_a($affected, 'PEAR_Error')) return false; - // Mark team deleted. + // Mark group deleted. $sql = "update tt_groups set status = NULL where id = $user->group_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index 67af3161..8a62db50 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -46,7 +46,7 @@ $i18n_key_words = array( 'menu.logout' => 'Logout', 'menu.forum' => 'Forum', 'menu.help' => 'Aiuto', -'menu.create_team' => 'Crea gruppo', +'menu.create_group' => 'Crea gruppo', 'menu.profile' => 'Profilo', 'menu.group' => 'Gruppo', 'menu.time' => 'Tempo', diff --git a/WEB-INF/templates/admin_groups.tpl b/WEB-INF/templates/admin_groups.tpl index ebe88991..e0a8aa2c 100644 --- a/WEB-INF/templates/admin_groups.tpl +++ b/WEB-INF/templates/admin_groups.tpl @@ -15,15 +15,15 @@ {$i18n.label.edit} {$i18n.label.delete} -{if $teams} - {foreach $teams as $team} +{if $groups} + {foreach $groups as $group} - {$team.id} - {$team.name|escape} - {$team.date} - {$team.lang} - {$i18n.label.edit} - {$i18n.label.delete} + {$group.id} + {$group.name|escape} + {$group.date} + {$group.lang} + {$i18n.label.edit} + {$i18n.label.delete} {/foreach} {/if} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 90acc060..27066082 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.87.4243 | Copyright © Anuko | +  Anuko Time Tracker 1.17.87.4244 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/admin_groups.php b/admin_groups.php index fa5f51b2..78e083ca 100644 --- a/admin_groups.php +++ b/admin_groups.php @@ -36,7 +36,7 @@ if (!ttAccessAllowed('administer_site')) { } // End of access checks. -$smarty->assign('teams', ttGroupHelper::getTopGroups()); +$smarty->assign('groups', ttGroupHelper::getTopGroups()); $smarty->assign('title', $i18n->get('title.groups')); $smarty->assign('content_page_name', 'admin_groups.tpl'); $smarty->display('index.tpl'); diff --git a/dbinstall.php b/dbinstall.php index 63dee9c7..fb5e0317 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -900,7 +900,7 @@ if ($_POST) { if ($_POST["cleanup"]) { $mdb2 = getConnection(); - $inactive_teams = ttTeamHelper::getInactiveTeams(); + $inactive_teams = ttTeamHelper::getInactiveGroups(); $count = count($inactive_teams); print "$count inactive teams found...
\n"; diff --git a/locking.php b/locking.php index 94996ada..4359f219 100644 --- a/locking.php +++ b/locking.php @@ -28,7 +28,6 @@ require_once('initialize.php'); import('form.Form'); -import('ttTeamHelper'); // Access checks. if (!ttAccessAllowed('manage_advanced_settings')) { diff --git a/mobile/users.php b/mobile/users.php index b531d7a4..d0b5d218 100644 --- a/mobile/users.php +++ b/mobile/users.php @@ -45,7 +45,7 @@ if($user->can('manage_users')) { $inactive_users = ttTeamHelper::getInactiveUsers($user->group_id, true); } -// Check if the team is set to show indicators for uncompleted time entries. +// Check if the group is set to show indicators for uncompleted time entries. if ($user->uncompleted_indicators) { // Check each active user if they have an uncompleted time entry. foreach ($active_users as $key => $user) { diff --git a/mysql.sql b/mysql.sql index 3673d295..87f67755 100644 --- a/mysql.sql +++ b/mysql.sql @@ -9,7 +9,7 @@ # -# Structure for table tt_groups. A team is a group of users for whom we are tracking work time. +# Structure for table tt_groups. A group is a unit of users for whom we are tracking work time. # This table stores settings common to all group members such as language, week start day, etc. # CREATE TABLE `tt_groups` ( @@ -29,7 +29,7 @@ CREATE TABLE `tt_groups` ( `record_type` smallint(2) NOT NULL default 0, # time record type ("start and finish", "duration", or both) `bcc_email` varchar(100) default NULL, # bcc email to copy all reports to `allow_ip` varchar(255) default NULL, # specification from where users are allowed access - `plugins` varchar(255) default NULL, # a list of enabled plugins for team + `plugins` varchar(255) default NULL, # a list of enabled plugins for group `lock_spec` varchar(255) default NULL, # Cron specification for record locking, # for example: "0 10 * * 1" for "weekly on Mon at 10:00". `workday_minutes` smallint(4) default 480, # number of work minutes in a regular working day @@ -47,7 +47,7 @@ CREATE TABLE `tt_groups` ( # -# Structure for table tt_roles. This table stores customized team roles. +# Structure for table tt_roles. This table stores group roles. # CREATE TABLE `tt_roles` ( `id` int(11) NOT NULL auto_increment, # Role id. Identifies roles for all groups on the server. @@ -55,13 +55,11 @@ CREATE TABLE `tt_roles` ( `name` varchar(80) default NULL, # Role name - custom role name. In case we are editing a # predefined role (USER, etc.), we can rename the role here. `description` varchar(255) default NULL, # Role description. - `rank` int(11) default 0, # Role rank, an integer value between 0-324. Predefined role ranks: - # USER - 4, CLIENT - 16, COMANAGER - 68, MANAGER - 324. + `rank` int(11) default 0, # Role rank, an integer value between 0-512. Predefined role ranks: + # User - 4, Supervisor - 12, Client - 16, + # Co-manager - 68, Manager - 324, Top manager - 512. # Rank is used to determine what "lesser roles" are in each group - # for sutuations such as "manage_users". - # It also identifies a role within a team (by its "rank"). - # Value of rank is to be used in role field in tt_users table, - # just like standard roles now. + # for situations such as "manage_users". `rights` text default NULL, # Comma-separated list of rights assigned to a role. # NULL here for predefined roles (4, 16, 68, 324 - manager) # means a hard-coded set of default access rights. @@ -105,7 +103,7 @@ CREATE TABLE `tt_users` ( # Create an index that guarantees unique active and inactive logins. create unique index login_idx on tt_users(login, status); -# Create admin account with password 'secret'. Admin is a superuser, who can create teams. +# Create admin account with password 'secret'. Admin is a superuser, who can create groupd. DELETE from `tt_users` WHERE login = 'admin'; INSERT INTO `tt_users` (`login`, `password`, `name`, `group_id`, `role_id`) VALUES ('admin', md5('secret'), 'Admin', '0', (select id from tt_roles where rank = 1024)); @@ -221,7 +219,7 @@ CREATE TABLE `tt_invoices` ( PRIMARY KEY (`id`) ); -# Create an index that guarantees unique invoice names per team. +# Create an index that guarantees unique invoice names per group. create unique index name_idx on tt_invoices(group_id, name, status); @@ -306,7 +304,7 @@ CREATE TABLE `tt_clients` ( PRIMARY KEY (`id`) ); -# Create an index that guarantees unique active and inactive clients per team. +# Create an index that guarantees unique active and inactive clients per group. create unique index client_name_idx on tt_clients(group_id, name, status); diff --git a/plugins/CustomFields.class.php b/plugins/CustomFields.class.php index afb59dae..00582e3e 100644 --- a/plugins/CustomFields.class.php +++ b/plugins/CustomFields.class.php @@ -33,7 +33,7 @@ class CustomFields { const TYPE_TEXT = 1; // A text field. const TYPE_DROPDOWN = 2; // A dropdown field with pre-defined values. - var $fields = array(); // Array of custom fields for team. + var $fields = array(); // Array of custom fields for group. var $options = array(); // Array of options for a dropdown custom field. // Constructor. @@ -223,7 +223,7 @@ class CustomFields { return false; } - // getFields returns an array of custom fields for team. + // getFields returns an array of custom fields for group. static function getFields() { global $user; $mdb2 = getConnection(); @@ -270,7 +270,7 @@ class CustomFields { return false; } - // The insertField inserts a custom field for team. + // The insertField inserts a custom field for group. static function insertField($field_name, $field_type, $required) { global $user; $mdb2 = getConnection(); @@ -279,7 +279,7 @@ class CustomFields { return (!is_a($affected, 'PEAR_Error')); } - // The updateField updates custom field for team. + // The updateField updates custom field for group. static function updateField($id, $name, $type, $required) { global $user; $mdb2 = getConnection(); @@ -288,7 +288,7 @@ class CustomFields { return (!is_a($affected, 'PEAR_Error')); } - // The deleteField deletes a custom field, its options and log entries for team. + // The deleteField deletes a custom field, its options and log entries for group. static function deleteField($field_id) { // Our overall intention is to keep the code simple and manageable. diff --git a/plugins/MonthlyQuota.class.php b/plugins/MonthlyQuota.class.php index de1f7cd2..5a4e7079 100644 --- a/plugins/MonthlyQuota.class.php +++ b/plugins/MonthlyQuota.class.php @@ -81,7 +81,7 @@ class MonthlyQuota { return $numWorkdays * $user->workday_minutes; } - // getMany - returns an array of quotas for a given year for team. + // getMany - returns an array of quotas for a given year for group. private function getMany($year){ $group_id = $this->group_id; $sql = "SELECT month, minutes FROM tt_monthly_quotas WHERE year = $year AND group_id = $group_id"; diff --git a/quotas.php b/quotas.php index ac6542f5..8381c3b6 100644 --- a/quotas.php +++ b/quotas.php @@ -29,7 +29,6 @@ require_once('initialize.php'); require_once('plugins/MonthlyQuota.class.php'); import('form.Form'); -import('ttTeamHelper'); import('ttTimeHelper'); // Access checks. diff --git a/readme.txt b/readme.txt index 82bda026..fd2e78b3 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Copyright (c) Anuko (https://www.anuko.com) Project home page: https://www.anuko.com/time_tracker/index.htm Forum: https://www.anuko.com/forum/viewforum.php?f=4 Info for developers: https://www.anuko.com/time_tracker/info_for_developers.htm -Free hosting of Time Tracker for individuals and small teams is available at https://timetracker.anuko.com +Free hosting of Time Tracker for individuals and small groups is available at https://timetracker.anuko.com Unless otherwise noted, files in this archive are protected by the LIBERAL FREEWARE LICENSE. Read the file license.txt for details. @@ -30,7 +30,7 @@ The general installation procedure looks like this: 6) Change $dsn value in /WEB-INF/config.php file to reflect your database connection parameters (user name and password). 7) If you are upgrading from earlier Time Tracker version run dbinstall.php from your browser and do only the required "Update database structure" steps. 8) If you install time tracker into a sub-directory of your site reflect this in the APP_NAME parameter in /WEB-INF/config.php file. For example, for http://localhost/timetracker/ set APP_NAME = "timetracker". -9) Login to your time tracker site as admin with password "secret" without quotes and create at least one team. +9) Login to your time tracker site as admin with password "secret" without quotes and create at least one group. 10) Change admin password (on the admin "options" page). You can also use the following SQL console command: update tt_users set password = md5('new_password_here') where login='admin' or by using the "Change password of administrator account" option in http://your_time_tracker_site/dbinstall.php diff --git a/role_add.php b/role_add.php index 086da632..c8df24c7 100644 --- a/role_add.php +++ b/role_add.php @@ -28,7 +28,6 @@ require_once('initialize.php'); import('form.Form'); -import('ttTeamHelper'); import('ttRoleHelper'); // Access check. diff --git a/users.php b/users.php index d20617bc..b7a6606c 100644 --- a/users.php +++ b/users.php @@ -28,7 +28,6 @@ require_once('initialize.php'); import('form.Form'); -import('ttTeamHelper'); import('ttTimeHelper'); import('ttRoleHelper'); diff --git a/week_view.php b/week_view.php index 38b753a1..9f809af3 100644 --- a/week_view.php +++ b/week_view.php @@ -28,7 +28,6 @@ require_once('initialize.php'); import('form.Form'); -import('ttTeamHelper'); // Access checks. if (!ttAccessAllowed('manage_advanced_settings')) {