X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/f490a9f5e080c426f54502d1004f8ab444d26469..decf7058c3d2cc57fa2f814f33e7c09b264ff854:/timesheet_edit.php 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()));