X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=mobile%2Ftime.php;h=b9ee3bce3ada108d4a1fdf8aae216f364b5f9221;hb=bf5e56bc4052b478cca323386c7a71845a91989d;hp=fe723da5806cdb26b8f7d688877cd5003e118c7f;hpb=dac7b3b59c56d265e7ee630c10d8d5fe3614d399;p=timetracker.git diff --git a/mobile/time.php b/mobile/time.php index fe723da5..b9ee3bce 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -228,6 +228,22 @@ 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')) { @@ -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') && strpos($cl_note, '%req%') !== false) { + // A %req% element is found in note. They have to be replaced by user. + $err->add($i18n->get('error.field'), $i18n->get('label.note')); + } if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating user input.