Implemented task required option.
authoranuko <support@anuko.com>
Sat, 6 May 2017 17:46:53 +0000 (17:46 +0000)
committeranuko <support@anuko.com>
Sat, 6 May 2017 17:46:53 +0000 (17:46 +0000)
WEB-INF/lib/ttTeamHelper.class.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/profile_edit.tpl
mobile/time.php
mobile/time_edit.php
profile_edit.php
time.php
time_edit.php

index 3dba92a..2f0c7cc 100644 (file)
@@ -764,6 +764,7 @@ class ttTeamHelper {
     $time_format_part = '';
     $week_start_part = '';
     $tracking_mode_part = '';
+    $task_required_part = ' , task_required = '.$mdb2->quote($fields['task_required']);
     $record_type_part = '';
     $uncompleted_indicators_part = '';
     $plugins_part = '';
@@ -785,7 +786,7 @@ class ttTeamHelper {
     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
+      $date_format_part $time_format_part $week_start_part $tracking_mode_part $task_required_part $record_type_part
       $uncompleted_indicators_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;
index fa18d98..d4ff45b 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.10.42.3628 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.11.43.3629 | 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 8c9cb8d..aea6773 100644 (file)
@@ -1,4 +1,19 @@
 <script>
+// handleTaskRequiredCheckbox - controls visibility of the Task Required checkbox.
+function handleTaskRequiredCheckbox() {
+  var taskRequiredCheckbox = document.getElementById("task_required");
+  var taskRequiredLabel = document.getElementById("task_required_label");
+  var trackingModeDropdown = document.getElementById("tracking_mode");
+  if (trackingModeDropdown.value == 2) {
+    taskRequiredCheckbox.style.visibility = "visible";
+    taskRequiredLabel.style.visibility = "visible";
+  } else {
+    taskRequiredCheckbox.style.visibility = "hidden";
+    taskRequiredLabel.style.visibility = "hidden";
+  }
+}
+
+
 // handleControls - controls visibility of controls.
 function handlePluginCheckboxes() {
   var clientsCheckbox = document.getElementById("clients");
@@ -139,7 +154,7 @@ function handlePluginCheckboxes() {
           </tr>
           <tr>
             <td align="right" nowrap>{$i18n.form.profile.tracking_mode}:</td>
-            <td>{$forms.profileForm.tracking_mode.control}</td>
+            <td>{$forms.profileForm.tracking_mode.control} {$forms.profileForm.task_required.control} <span id="task_required_label"><label for="task_required">{$i18n.label.required}</label></span></td></td>
           </tr>
           <tr>
             <td align="right" nowrap>{$i18n.form.profile.record_type}:</td>
index f5d7c2e..db8aa34 100644 (file)
@@ -196,6 +196,9 @@ if ($request->isPost()) {
     if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
       if (!$cl_project) $err->add($i18n->getKey('error.project'));
     }
+    if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode && $user->task_required) {
+      if (!$cl_task) $err->add($i18n->getKey('error.task'));
+    }
     if (strlen($cl_duration) == 0) {
       if ($cl_start || $cl_finish) {
         if (!ttTimeHelper::isValidTime($cl_start))
index f80611f..dcf7621 100644 (file)
@@ -218,6 +218,9 @@ if ($request->isPost()) {
   if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
     if (!$cl_project) $err->add($i18n->getKey('error.project'));
   }
+  if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode && $user->task_required) {
+    if (!$cl_task) $err->add($i18n->getKey('error.task'));
+  }
   if (!$cl_duration) {
     if ('0' == $cl_duration)
       $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
index 1663f44..7c3146a 100644 (file)
@@ -87,7 +87,7 @@ if ($request->isPost()) {
     $cl_custom_format_time = $user->time_format;
     $cl_start_week = $user->week_start;
     $cl_tracking_mode = $user->tracking_mode;
-    $cl_ttask_required = $user->task_required;
+    $cl_task_required = $user->task_required;
     $cl_record_type = $user->record_type;
     $cl_uncompleted_indicators = $user->uncompleted_indicators;
 
@@ -163,7 +163,8 @@ if ($user->canManageTeam()) {
   $tracking_mode_options[MODE_TIME] = $i18n->getKey('form.profile.mode_time');
   $tracking_mode_options[MODE_PROJECTS] = $i18n->getKey('form.profile.mode_projects');
   $tracking_mode_options[MODE_PROJECTS_AND_TASKS] = $i18n->getKey('form.profile.mode_projects_and_tasks');
-  $form->addInput(array('type'=>'combobox','name'=>'tracking_mode','style'=>'width: 150px;','data'=>$tracking_mode_options,'value'=>$cl_tracking_mode));
+  $form->addInput(array('type'=>'combobox','name'=>'tracking_mode','style'=>'width: 150px;','data'=>$tracking_mode_options,'value'=>$cl_tracking_mode,'onchange'=>'handleTaskRequiredCheckbox()'));
+  $form->addInput(array('type'=>'checkbox','name'=>'task_required','value'=>$cl_task_required));
 
   // Prepare record type choices.
   $record_type_options = array();
@@ -253,6 +254,7 @@ if ($request->isPost()) {
         'time_format' => $cl_custom_format_time,
         'week_start' => $cl_start_week,
         'tracking_mode' => $cl_tracking_mode,
+        'task_required' => $cl_task_required,
         'record_type' => $cl_record_type,
         'uncompleted_indicators' => $cl_uncompleted_indicators,
         'plugins' => $plugins));
@@ -275,7 +277,7 @@ if ($request->isPost()) {
 
 $smarty->assign('auth_external', $auth->isPasswordExternal());
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
-$smarty->assign('onload', 'onLoad="handlePluginCheckboxes()"');
+$smarty->assign('onload', 'onLoad="handleTaskRequiredCheckbox(); handlePluginCheckboxes();"');
 $smarty->assign('title', $i18n->getKey('title.profile'));
 $smarty->assign('content_page_name', 'profile_edit.tpl');
 $smarty->display('index.tpl');
index 519c18c..b808aaf 100644 (file)
--- a/time.php
+++ b/time.php
@@ -231,6 +231,9 @@ if ($request->isPost()) {
     if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
       if (!$cl_project) $err->add($i18n->getKey('error.project'));
     }
+    if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode && $user->task_required) {
+      if (!$cl_task) $err->add($i18n->getKey('error.task'));
+    }
     if (strlen($cl_duration) == 0) {
       if ($cl_start || $cl_finish) {
         if (!ttTimeHelper::isValidTime($cl_start))
index ae1b3c4..854c446 100644 (file)
@@ -219,6 +219,9 @@ if ($request->isPost()) {
   if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
     if (!$cl_project) $err->add($i18n->getKey('error.project'));
   }
+  if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode && $user->task_required) {
+    if (!$cl_task) $err->add($i18n->getKey('error.task'));
+  }
   if (!$cl_duration) {
     if ('0' == $cl_duration)
       $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));