Moved Delete to timesheet_edit.php to have room for paid status column.
authorNik Okuntseff <support@anuko.com>
Tue, 19 Feb 2019 13:12:17 +0000 (13:12 +0000)
committerNik Okuntseff <support@anuko.com>
Tue, 19 Feb 2019 13:12:17 +0000 (13:12 +0000)
WEB-INF/templates/footer.tpl
WEB-INF/templates/timesheet_edit.tpl
WEB-INF/templates/timesheets.tpl
timesheet_edit.php

index 8a16269..d8ce977 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.37.4737 | 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.37.4738 | 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 500bb55..5848c57 100644 (file)
@@ -24,7 +24,8 @@
           <td>&nbsp;</td>
         </tr>
         <tr>
-          <td colspan="2" align="center" height="50">{$forms.timesheetForm.btn_save.control}</td>
+          <td></td>
+          <td align="left" height="50">{$forms.timesheetForm.btn_save.control} {$forms.timesheetForm.btn_delete.control}</td>
         </tr>
       </table>
     </td>
index 6a5269b..45a6764 100644 (file)
@@ -27,7 +27,6 @@
   {/if}
           <td class="tableHeader">{$i18n.label.view}</td>
           <td class="tableHeader">{$i18n.label.edit}</td>
-          <td class="tableHeader">{$i18n.label.delete}</td>
         </tr>
         {foreach $active_timesheets as $timesheet}
         <tr valign="top" bgcolor="{cycle values="#f5f5f5,#ffffff"}">
@@ -44,7 +43,6 @@
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
   {if !$user->isClient()}
           <td><a href="timesheet_edit.php?id={$timesheet.id}">{$i18n.label.edit}</a></td>
-          <td><a href="timesheet_delete.php?id={$timesheet.id}">{$i18n.label.delete}</a></td>
   {/if}
         </tr>
         {/foreach}
@@ -72,7 +70,6 @@
   {/if}
           <td class="tableHeader">{$i18n.label.view}</td>
           <td class="tableHeader">{$i18n.label.edit}</td>
-          <td class="tableHeader">{$i18n.label.delete}</td>
         </tr>
         {foreach $inactive_timesheets as $timesheet}
         <tr valign="top" bgcolor="{cycle values="#f5f5f5,#ffffff"}">
@@ -89,7 +86,6 @@
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
   {if !$user->isClient()}
           <td><a href="timesheet_edit.php?id={$timesheet.id}">{$i18n.label.edit}</a></td>
-          <td><a href="timesheet_delete.php?id={$timesheet.id}">{$i18n.label.delete}</a></td>
   {/if}
         </tr>
         {/foreach}
index 50d2a44..1708bdf 100644 (file)
@@ -64,17 +64,18 @@ $form->addInput(array('type'=>'textarea','name'=>'comment','style'=>'width: 250p
 $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status,
   'data'=>array(ACTIVE=>$i18n->get('dropdown.status_active'),INACTIVE=>$i18n->get('dropdown.status_inactive'))));
 $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save')));
+$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete')));
 
 if ($request->isPost()) {
   // Validate user input.
   if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name'));
   if (!ttValidString($cl_comment, true)) $err->add($i18n->get('error.field'), $i18n->get('label.comment'));
 
-  if ($err->no()) {
-    if ($request->getParameter('btn_save')) {
+  if ($request->getParameter('btn_save')) {
+    if ($err->no()) {
       $existing_timesheet = ttTimesheetHelper::getTimesheetByName($cl_name, $timesheet['user_id']);
       if (!$existing_timesheet || ($cl_timesheet_id == $existing_timesheet['id'])) {
-         // Update project information.
+         // Update timesheet information.
          if (ttTimesheetHelper::update(array(
            'id' => $cl_timesheet_id,
            'name' => $cl_name,
@@ -88,6 +89,11 @@ if ($request->isPost()) {
         $err->add($i18n->get('error.object_exists'));
     }
   }
+
+  if ($request->getParameter('btn_delete')) {
+    header("Location: timesheet_delete.php?id=$cl_timesheet_id");
+    exit();
+  }
 } // isPost
 
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));