]> wagnertech.de Git - timetracker.git/blobdiff - timesheet_add.php
A bit of cleanup with ongoing timesheet redesign.
[timetracker.git] / timesheet_add.php
index fa32ca7ff59035ead3cfc593a7061ae4acd41027..1ab4b704c990be6a5fd7c5a96db66de7329c0a49 100644 (file)
@@ -31,7 +31,7 @@ import('form.Form');
 import('ttTimesheetHelper');
 
 // Access checks.
-if (!(ttAccessAllowed('manage_own_timesheets') || ttAccessAllowed('manage_timesheets'))) {
+if (!(ttAccessAllowed('manage_own_timesheets') || ttAccessAllowed('manage_timesheets') || ttAccessAllowed('manage_all_timesheets'))) {
   header('Location: access_denied.php');
   exit();
 }
@@ -52,6 +52,10 @@ if ($request->isPost()) {
 
 $form = new Form('timesheetForm');
 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'timesheet_name','style'=>'width: 250px;','value'=>$cl_name));
+
+$form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start','value'=>$cl_start));
+$form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'finish','value'=>$cl_finish));
+
 $form->addInput(array('type'=>'textarea','name'=>'submitter_comment','style'=>'width: 250px; height: 40px;','value'=>$cl_comment));
 $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add')));
 
@@ -64,7 +68,7 @@ if ($request->isPost()) {
     $user_id = $bean->getDetachedAttribute('timesheet_user_id');
     if (!ttTimesheetHelper::getTimesheetByName($cl_name, $user_id)) {
       if (ttTimesheetHelper::insert(array('user_id' => $user_id,
-        // 'client_id' => ?
+        'client_id' => $bean->getAttribute('client'),
         'name' => $cl_name,
         'comment' => $cl_comment))) {
           header('Location: timesheets.php');