X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=mobile%2Ftime.php;h=5a5c054d6a310a0b08e6fde75a890954aad80b58;hb=4334f16faa68ecaec5aceb5c16bb500d62a3688f;hp=107a72c7f5193a42b3d4e0c37c67bd86cc4e8118;hpb=41bb577927a2b54d6a2cbc97ccc63e2935f7604b;p=timetracker.git diff --git a/mobile/time.php b/mobile/time.php index 107a72c7..5a5c054d 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -115,9 +115,9 @@ $form = new Form('timeRecordForm'); if ($user->can('track_time')) { $rank = $user->getMaxRankForGroup($group_id); if ($user->can('track_own_time')) - $options = array('group_id'=>$group_id,'status'=>ACTIVE,'max_rank'=>$rank,'include_self'=>true,'self_first'=>true); + $options = array('status'=>ACTIVE,'max_rank'=>$rank,'include_self'=>true,'self_first'=>true); else - $options = array('group_id'=>$group_id,'status'=>ACTIVE,'max_rank'=>$rank); + $options = array('status'=>ACTIVE,'max_rank'=>$rank); $user_list = $user->getUsers($options); if (count($user_list) >= 1) { $form->addInput(array('type'=>'combobox', @@ -228,12 +228,28 @@ if ($custom_fields && $custom_fields->fields[0]) { } } +// If we have templates, add a dropdown to select one. +if ($user->isPluginEnabled('tp')){ + $templates = ttGroupHelper::getActiveTemplates(); + if (count($templates) >= 1) { + $form->addInput(array('type'=>'combobox', + 'onchange'=>'fillNote(this.value);', + 'name'=>'template', + 'style'=>'width: 250px;', + 'data'=>$templates, + 'datakeys'=>array('id','name'), + 'empty'=>array(''=>$i18n->get('dropdown.select')))); + $smarty->assign('template_dropdown', 1); + $smarty->assign('templates', $templates); + } +} + // Submit. if ($request->isPost()) { if ($request->getParameter('btn_submit')) { // Validate user input. - if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client) + if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client) $err->add($i18n->get('error.client')); if ($custom_fields) { if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']); @@ -267,6 +283,10 @@ if ($request->isPost()) { $err->add($i18n->get('error.field'), $i18n->get('label.duration')); } if (!ttValidString($cl_note, true)) $err->add($i18n->get('error.field'), $i18n->get('label.note')); + if ($user->isPluginEnabled('tp') && !ttValidTemplateText($cl_note)) { + $err->add($i18n->get('error.field'), $i18n->get('label.note')); + } + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating user input. // Prohibit creating entries in future. @@ -327,7 +347,7 @@ if ($request->isPost()) { $smarty->assign('next_date', $next_date); $smarty->assign('prev_date', $prev_date); -$smarty->assign('time_records', ttTimeHelper::getRecords($user_id, $cl_date)); +$smarty->assign('time_records', ttTimeHelper::getRecords($cl_date)); $smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date)); $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list);