Added entity type as read only field on custom field edit page.
authorNik Okuntseff <support@anuko.com>
Sat, 29 Jun 2019 15:58:39 +0000 (15:58 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 29 Jun 2019 15:58:39 +0000 (15:58 +0000)
WEB-INF/templates/cf_custom_field_edit.tpl
WEB-INF/templates/footer.tpl
cf_custom_field_edit.php
plugins/CustomFields.class.php

index beabbe7..62e2a26 100644 (file)
@@ -8,6 +8,10 @@
           <td align="right">{$i18n.label.thing_name} (*):</td>
           <td>{$forms.fieldForm.name.control}</td>
         </tr>
           <td align="right">{$i18n.label.thing_name} (*):</td>
           <td>{$forms.fieldForm.name.control}</td>
         </tr>
+        <tr>
+          <td align="right">{$i18n.label.entity}:</td>
+          <td>{$forms.fieldForm.entity.control} <a href="https://www.anuko.com/lp/tt_39.htm" target="_blank">{$i18n.label.what_is_it}</a></td>
+        </tr>
         <tr>
           <td align="right">{$i18n.label.type}:</td>
           <td>{$forms.fieldForm.type.control}</td>
         <tr>
           <td align="right">{$i18n.label.type}:</td>
           <td>{$forms.fieldForm.type.control}</td>
index 47814a1..46167ca 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.19.7.5023 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.19.7.5024 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index c5dd090..79ce131 100644 (file)
@@ -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));
 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'))));
   $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'))));
index 4494d58..d58cbe5 100644 (file)
@@ -267,7 +267,7 @@ class CustomFields {
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
     $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')) {
       " where id = $id and group_id = $group_id and org_id = $org_id";
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {