From: Nik Okuntseff Date: Sat, 29 Jun 2019 15:58:39 +0000 (+0000) Subject: Added entity type as read only field on custom field edit page. X-Git-Tag: timetracker_1.19-1~6 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=8b16d7c0b05921ad6d90c1e5342c02d62b093414;p=timetracker.git Added entity type as read only field on custom field edit page. --- diff --git a/WEB-INF/templates/cf_custom_field_edit.tpl b/WEB-INF/templates/cf_custom_field_edit.tpl index beabbe7d..62e2a267 100644 --- a/WEB-INF/templates/cf_custom_field_edit.tpl +++ b/WEB-INF/templates/cf_custom_field_edit.tpl @@ -8,6 +8,10 @@ {$i18n.label.thing_name} (*): {$forms.fieldForm.name.control} + + {$i18n.label.entity}: + {$forms.fieldForm.entity.control} {$i18n.label.what_is_it} + {$i18n.label.type}: {$forms.fieldForm.type.control} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 47814a16..46167ca4 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.19.7.5023 | Copyright © Anuko | +  Anuko Time Tracker 1.19.7.5024 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/cf_custom_field_edit.php b/cf_custom_field_edit.php index c5dd0904..79ce1310 100644 --- a/cf_custom_field_edit.php +++ b/cf_custom_field_edit.php @@ -51,6 +51,17 @@ $form = new Form('fieldForm'); if ($err->no()) { $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$field['label'])); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); + + // TODO: consider encapsulating this block in a function. + $entity_type = $field['entity_type']; + if (CustomFields::ENTITY_TIME == $entity_type) + $entity = $i18n->get('entity.time'); + else if (CustomFields::ENTITY_USER == $entity_type) + $entity = $i18n->get('entity.user'); + else if (CustomFields::ENTITY_PROJECT == $entity_type) + $entity = $i18n->get('entity.project'); + $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'entity','value'=>$entity,'enable'=>false)); + $form->addInput(array('type'=>'combobox','name'=>'type','value'=>$field['type'], 'data'=>array(CustomFields::TYPE_TEXT=>$i18n->get('label.type_text'), CustomFields::TYPE_DROPDOWN=>$i18n->get('label.type_dropdown')))); diff --git a/plugins/CustomFields.class.php b/plugins/CustomFields.class.php index 4494d58e..d58cbe53 100644 --- a/plugins/CustomFields.class.php +++ b/plugins/CustomFields.class.php @@ -267,7 +267,7 @@ class CustomFields { $group_id = $user->getGroup(); $org_id = $user->org_id; - $sql = "select label, type, required from tt_custom_fields". + $sql = "select label, entity_type, type, required from tt_custom_fields". " where id = $id and group_id = $group_id and org_id = $org_id"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) {