X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=mobile%2Ftime.php;h=0c634f3a55765837e5aafd8267baf731abf873dd;hb=36677b1481af7686a45ea1b37bec577f60f4ed2a;hp=679dcadf950541479af7bf903592d1f348174f7e;hpb=19f245ff861895c99c3f04fbc53404564bb44267;p=timetracker.git diff --git a/mobile/time.php b/mobile/time.php index 679dcadf..0c634f3a 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -66,7 +66,7 @@ $cl_finish = trim($request->getParameter('finish')); $cl_duration = trim($request->getParameter('duration')); $cl_note = trim($request->getParameter('note')); // Custom field. -$cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1']))); +$cl_cf_1 = trim($request->getParameter('cf_1', ($request->isPost() ? null : @$_SESSION['cf_1']))); $_SESSION['cf_1'] = $cl_cf_1; $cl_billable = 1; if ($user->isPluginEnabled('iv')) { @@ -77,11 +77,11 @@ if ($user->isPluginEnabled('iv')) { if (isset($_SESSION['billable'])) $cl_billable = $_SESSION['billable']; } -$cl_client = $request->getParameter('client', ($request->getMethod()=='POST'? null : @$_SESSION['client'])); +$cl_client = $request->getParameter('client', ($request->isPost() ? null : @$_SESSION['client'])); $_SESSION['client'] = $cl_client; -$cl_project = $request->getParameter('project', ($request->getMethod()=='POST'? null : @$_SESSION['project'])); +$cl_project = $request->getParameter('project', ($request->isPost() ? null : @$_SESSION['project'])); $_SESSION['project'] = $cl_project; -$cl_task = $request->getParameter('task', ($request->getMethod()=='POST'? null : @$_SESSION['task'])); +$cl_task = $request->getParameter('task', ($request->isPost() ? null : @$_SESSION['task'])); $_SESSION['task'] = $cl_task; // Elements of timeRecordForm. @@ -155,17 +155,17 @@ if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) { $form->addInput(array('type'=>'text','name'=>'start','value'=>$cl_start,'onchange'=>"formDisable('start');")); $form->addInput(array('type'=>'text','name'=>'finish','value'=>$cl_finish,'onchange'=>"formDisable('finish');")); -} -if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) { - // Make the start and finish fields read-only. - $form->getElement('start')->setEnable(false); - $form->getElement('finish')->setEnable(false); + if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) { + // Make the start and finish fields read-only. + $form->getElement('start')->setEnabled(false); + $form->getElement('finish')->setEnabled(false); + } } if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type)) $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');")); $form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 250px; height: 60px;','value'=>$cl_note)); if ($user->isPluginEnabled('iv')) - $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable)); + $form->addInput(array('type'=>'checkbox','name'=>'billable','value'=>$cl_billable)); $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click. $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit'))); @@ -196,13 +196,11 @@ if ($request->isPost()) { if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { if (!$cl_project) $err->add($i18n->getKey('error.project')); } - if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { + if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode && $user->task_required) { if (!$cl_task) $err->add($i18n->getKey('error.task')); } - if (!$cl_duration) { - if ('0' == $cl_duration) - $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration')); - elseif ($cl_start || $cl_finish) { + if (strlen($cl_duration) == 0) { + if ($cl_start || $cl_finish) { if (!ttTimeHelper::isValidTime($cl_start)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start')); if ($cl_finish) {