X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=timesheet_edit.php;h=7919125a9ed6e28d3538b595baa71bc6764f3240;hb=840056890d9b574fcc62fdf386db346f133baa91;hp=e98d824f314f156eb9156d84ead7d8ff0d994c6d;hpb=fc8a4455218bc71e17697f33c111b9dbc55f8047;p=timetracker.git diff --git a/timesheet_edit.php b/timesheet_edit.php index e98d824f..7919125a 100644 --- a/timesheet_edit.php +++ b/timesheet_edit.php @@ -31,7 +31,7 @@ import('form.Form'); import('ttTimesheetHelper'); // Access checks. -if (!(ttAccessAllowed('manage_own_timesheets') || ttAccessAllowed('manage_timesheets'))) { +if (!(ttAccessAllowed('track_own_time') || ttAccessAllowed('track_time'))) { header('Location: access_denied.php'); exit(); } @@ -53,7 +53,7 @@ if ($request->isPost()) { $cl_status = $request->getParameter('status'); } else { $cl_name = $timesheet['name']; - $cl_comment = $timesheet['submitter_comment']; + $cl_comment = $timesheet['comment']; $cl_status = $timesheet['status']; } @@ -64,21 +64,22 @@ $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); 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, - 'submitter_comment' => $cl_comment, + 'comment' => $cl_comment, 'status' => $cl_status))) { header('Location: timesheets.php'); exit(); @@ -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()));