Some optimization related to confirm save feature.
authorNik Okuntseff <support@anuko.com>
Sat, 1 Dec 2018 15:46:45 +0000 (15:46 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 1 Dec 2018 15:46:45 +0000 (15:46 +0000)
WEB-INF/lib/ttGroup.class.php
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl
expense_edit.php
mobile/expense_edit.php
mobile/time_edit.php
time_edit.php

index 8653634..44e225b 100644 (file)
@@ -50,7 +50,6 @@ class ttGroup {
   var $allow_overlap = 0;       // Whether to allow overlapping time entries.
   var $future_entries = 0;      // Whether to allow creating future entries.
   var $uncompleted_indicators = 0; // Uncompleted time entry indicators (show nowhere or on users page).
-  var $confirm_save = 0;        // Whether to show warnings for save action when date changed.
   var $bcc_email = null;        // Bcc email.
   var $allow_ip = null;         // Specification from where user is allowed access.
   var $password_complexity = null; // Password complexity example.
@@ -112,7 +111,6 @@ class ttGroup {
       $this->allow_overlap = $config->getDefinedValue('allow_overlap');
       $this->future_entries = $config->getDefinedValue('future_entries');
       $this->uncompleted_indicators = $config->getDefinedValue('uncompleted_indicators');
-      $this->confirm_save = $config->getDefinedValue('confirm_save');
       /*
       if ($this->isPluginEnabled('wu')) {
         $minutes_in_unit = $config->getIntValue('minutes_in_unit');
index 7a102a2..60f4f98 100644 (file)
@@ -60,7 +60,6 @@ class ttUser {
   var $allow_overlap = 0;       // Whether to allow overlapping time entries.
   var $future_entries = 0;      // Whether to allow creating future entries.
   var $uncompleted_indicators = 0; // Uncompleted time entry indicators (show nowhere or on users page).
-  var $confirm_save = 0;        // Whether to show warnings for save action when date changed.
   var $bcc_email = null;        // Bcc email.
   var $allow_ip = null;         // Specification from where user is allowed access.
   var $password_complexity = null; // Password complexity example.
@@ -144,7 +143,6 @@ class ttUser {
       $this->allow_overlap = $config->getDefinedValue('allow_overlap');
       $this->future_entries = $config->getDefinedValue('future_entries');
       $this->uncompleted_indicators = $config->getDefinedValue('uncompleted_indicators');
-      $this->confirm_save = $config->getDefinedValue('confirm_save');
       if ($this->isPluginEnabled('wu')) {
         $minutes_in_unit = $config->getIntValue('minutes_in_unit');
         if ($minutes_in_unit) $this->minutes_in_unit = $minutes_in_unit;
@@ -203,9 +201,13 @@ class ttUser {
     return ($this->behalfGroup ? $this->behalfGroup->config : $this->config);
   }
 
-  // getConfirmSave returns confirm_save option for user.
-  function getConfirmSave() {
-    return ($this->behalfGroup ? $this->behalfGroup->confirm_save : $this->confirm_save);
+  // getConfigOption returns true if an option is defined for group.
+  // This helps us keeping a set of user attributes smaller.
+  // We determine whether the option is set only on pages that need to know.
+  // For example: confirm_save is used only on time and expense edit pages.
+  function getConfigOption($name) {
+    $config = new ttConfigHelper($this->getConfig());
+    return $config->getDefinedValue($name);
   }
 
   // can - determines whether user has a right to do something.
index 90b3e90..b17fa67 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4554 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4555 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index a4bb6a4..9768fa2 100644 (file)
@@ -51,7 +51,7 @@ if (!$expense_item || $expense_item['invoice_id']) {
 }
 
 $item_date = new DateAndTime(DB_DATEFORMAT, $expense_item['date']);
-$confirm_save = $user->getConfirmSave();
+$confirm_save = $user->getConfigOption('confirm_save');
 
 // Initialize variables.
 $cl_date = $cl_client = $cl_project = $cl_item_name = $cl_cost = null;
index 9cae018..d139530 100644 (file)
@@ -51,7 +51,7 @@ if (!$expense_item || $expense_item['invoice_id']) {
 }
 
 $item_date = new DateAndTime(DB_DATEFORMAT, $expense_item['date']);
-$confirm_save = $user->getConfirmSave();
+$confirm_save = $user->getConfigOption('confirm_save');
 
 // Initialize variables.
 $cl_date = $cl_client = $cl_project = $cl_item_name = $cl_cost = null;
index 3094df6..9252204 100644 (file)
@@ -57,7 +57,7 @@ if ($user->isPluginEnabled('cf')) {
 }
 
 $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']);
-$confirm_save = $user->getConfirmSave();
+$confirm_save = $user->getConfigOption('confirm_save');
 
 // Initialize variables.
 $cl_start = $cl_finish = $cl_duration = $cl_date = $cl_note = $cl_project = $cl_task = $cl_billable = null;
index 5dd958b..08a5f39 100644 (file)
@@ -57,7 +57,7 @@ if ($user->isPluginEnabled('cf')) {
 }
 
 $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']);
-$confirm_save = $user->getConfirmSave();
+$confirm_save = $user->getConfigOption('confirm_save');
 
 // Initialize variables.
 $cl_start = $cl_finish = $cl_duration = $cl_date = $cl_note = $cl_project = $cl_task = $cl_billable = null;