X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=time.php;h=4f0d5918b0542016c738c029f860f045bce0f3e3;hb=6966f48816a53d2653bf02b537190d015407952e;hp=f7b1c12e7477e837c1d68ec9e63943728da6018c;hpb=086b93bd5a71b4c68ae3fa3e37d97182ee2a5b73;p=timetracker.git diff --git a/time.php b/time.php index f7b1c12e..4f0d5918 100644 --- a/time.php +++ b/time.php @@ -249,6 +249,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')) { @@ -288,6 +304,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.