From 351514c0823db572768c8f4d7f9dbb4fad81447c Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Tue, 19 Feb 2019 13:12:17 +0000 Subject: [PATCH] Moved Delete to timesheet_edit.php to have room for paid status column. --- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/timesheet_edit.tpl | 3 ++- WEB-INF/templates/timesheets.tpl | 4 ---- timesheet_edit.php | 12 +++++++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 8a162696..d8ce9770 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - + +
 Anuko Time Tracker 1.18.37.4737 | Copyright © Anuko | +  Anuko Time Tracker 1.18.37.4738 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/timesheet_edit.tpl b/WEB-INF/templates/timesheet_edit.tpl index 500bb55b..5848c571 100644 --- a/WEB-INF/templates/timesheet_edit.tpl +++ b/WEB-INF/templates/timesheet_edit.tpl @@ -24,7 +24,8 @@  
{$forms.timesheetForm.btn_save.control}{$forms.timesheetForm.btn_save.control} {$forms.timesheetForm.btn_delete.control}
diff --git a/WEB-INF/templates/timesheets.tpl b/WEB-INF/templates/timesheets.tpl index 6a5269b5..45a67645 100644 --- a/WEB-INF/templates/timesheets.tpl +++ b/WEB-INF/templates/timesheets.tpl @@ -27,7 +27,6 @@ {/if} {$i18n.label.view} {$i18n.label.edit} - {$i18n.label.delete} {foreach $active_timesheets as $timesheet} @@ -44,7 +43,6 @@ {$i18n.label.view} {if !$user->isClient()} {$i18n.label.edit} - {$i18n.label.delete} {/if} {/foreach} @@ -72,7 +70,6 @@ {/if} {$i18n.label.view} {$i18n.label.edit} - {$i18n.label.delete} {foreach $inactive_timesheets as $timesheet} @@ -89,7 +86,6 @@ {$i18n.label.view} {if !$user->isClient()} {$i18n.label.edit} - {$i18n.label.delete} {/if} {/foreach} diff --git a/timesheet_edit.php b/timesheet_edit.php index 50d2a44d..1708bdf7 100644 --- a/timesheet_edit.php +++ b/timesheet_edit.php @@ -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())); -- 2.20.1