X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=time_edit.php;h=bb0457384a2087b56cc3c88b32f67e2a11fd2b33;hb=8a671525046655e057a15c6de9507834322b466d;hp=ef45226b883c0c59235c92c5f34f04b58c2e4a83;hpb=75f8d0ae1ade35bbe0b0efec6932cd55725ab152;p=timetracker.git diff --git a/time_edit.php b/time_edit.php index ef45226b..bb045738 100644 --- a/time_edit.php +++ b/time_edit.php @@ -191,6 +191,7 @@ 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'=>'datefield','name'=>'date','maxlength'=>'20','value'=>$cl_date)); $form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 250px; height: 200px;','value'=>$cl_note)); + // If we have custom fields - add controls for them. if ($custom_fields && $custom_fields->fields[0]) { // Only one custom field is supported at this time. @@ -205,6 +206,23 @@ if ($custom_fields && $custom_fields->fields[0]) { 'empty' => array('' => $i18n->get('dropdown.select')))); } } + +// 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); + } +} + // Hidden control for record id. $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); if ($user->isPluginEnabled('iv')) @@ -221,7 +239,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get( if ($request->isPost()) { // 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']); @@ -258,6 +276,9 @@ if ($request->isPost()) { } if (!ttValidDate($cl_date)) $err->add($i18n->get('error.field'), $i18n->get('label.date')); 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.