Fixed UI for client add in MODE_TIME
authorNik Okuntseff <support@anuko.com>
Sat, 19 Mar 2016 21:21:20 +0000 (14:21 -0700)
committerNik Okuntseff <support@anuko.com>
Sat, 19 Mar 2016 21:21:20 +0000 (14:21 -0700)
Projects checkboxes should no longer appear on client_add.php in MODE_TIME tracking mode

WEB-INF/templates/client_add.tpl
WEB-INF/templates/client_edit.tpl
client_add.php
client_edit.php

index 3a17dde..6814d1e 100644 (file)
@@ -9,22 +9,24 @@
         </tr>
         <tr>
           <td align="right">{$i18n.label.client_address}:</td>
-             <td>{$forms.clientForm.address.control}</td>
-           </tr>
-           <tr>
-             <td align="right">{$i18n.label.tax}, %:</td>
-             <td>{$forms.clientForm.tax.control}&nbsp;(0{$user->decimal_mark}00)</td>
-           </tr>
+          <td>{$forms.clientForm.address.control}</td>
+        </tr>
+        <tr>
+          <td align="right">{$i18n.label.tax}, %:</td>
+          <td>{$forms.clientForm.tax.control}&nbsp;(0{$user->decimal_mark}00)</td>
+        </tr>
         <tr>
           <td height="40"></td>
           <td>{$i18n.label.required_fields}</td>
         </tr>
         <tr><td>&nbsp;</td></tr>
+{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
         <tr>
           <td align="right">{$i18n.label.projects}:</td>
           <td>{$forms.clientForm.projects.control}</td>
         </tr>
         <tr><td>&nbsp;</td></tr>
+{/if}
         <tr>
           <td colspan="2" align="center" height="50">{$forms.clientForm.btn_submit.control}</td>
         </tr>
index bd9f156..578aa64 100644 (file)
@@ -9,13 +9,13 @@
         </tr>
         <tr>
           <td align="right">{$i18n.label.client_address}:</td>
-             <td>{$forms.clientForm.address.control}</td>
-           </tr>
-           <tr>
-             <td align="right">{$i18n.label.tax}, %:</td>
-             <td>{$forms.clientForm.tax.control}&nbsp;(0{$user->decimal_mark}00)</td>
-           </tr>
-           <tr>
+          <td>{$forms.clientForm.address.control}</td>
+        </tr>
+        <tr>
+          <td align="right">{$i18n.label.tax}, %:</td>
+          <td>{$forms.clientForm.tax.control}&nbsp;(0{$user->decimal_mark}00)</td>
+        </tr>
+        <tr>
           <td align = "right">{$i18n.label.status}:</td>
           <td>{$forms.clientForm.status.control}</td>
         </tr>
index 4ddb500..da9b90e 100644 (file)
@@ -54,7 +54,8 @@ $form = new Form('clientForm');
 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 350px;','value'=>$cl_name));
 $form->addInput(array('type'=>'textarea','name'=>'address','maxlength'=>'255','style'=>'width: 350px;','cols'=>'55','rows'=>'5','value'=>$cl_address));
 $form->addInput(array('type'=>'floatfield','name'=>'tax','size'=>'10','format'=>'.2','value'=>$cl_tax));
-$form->addInput(array('type'=>'checkboxgroup','name'=>'projects','data'=>$projects,'layout'=>'H','datakeys'=>array('id','name'),'value'=>$cl_projects));
+if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
+  $form->addInput(array('type'=>'checkboxgroup','name'=>'projects','data'=>$projects,'layout'=>'H','datakeys'=>array('id','name'),'value'=>$cl_projects));
 $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.add')));
        
 if ($request->getMethod() == 'POST') {
index 758b2ef..373263c 100644 (file)
@@ -66,16 +66,17 @@ $form->addInput(array('type'=>'textarea','name'=>'address','maxlength'=>'255','s
 $form->addInput(array('type'=>'floatfield','name'=>'tax','size'=>'10','format'=>'.2','value'=>$cl_tax));
 $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status,
   'data'=>array(ACTIVE=>$i18n->getKey('dropdown.status_active'),INACTIVE=>$i18n->getKey('dropdown.status_inactive'))));
-$form->addInput(array('type'=>'checkboxgroup','name'=>'projects','data'=>$projects,'datakeys'=>array('id','name'),'layout'=>'H','value'=>$cl_projects));
+if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
+  $form->addInput(array('type'=>'checkboxgroup','name'=>'projects','data'=>$projects,'datakeys'=>array('id','name'),'layout'=>'H','value'=>$cl_projects));
 $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save')));
 $form->addInput(array('type'=>'submit','name'=>'btn_copy','value'=>$i18n->getKey('button.copy')));
-       
+
 if ($request->getMethod() == 'POST') {
   // Validate user input.
   if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.client_name'));
   if (!ttValidString($cl_address, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.client_address'));
   if (!ttValidFloat($cl_tax, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.tax'));
-               
+
   if ($errors->isEmpty()) {
     if ($request->getParameter('btn_save')) {
       $client = ttClientHelper::getClientByName($cl_name);
@@ -94,7 +95,7 @@ if ($request->getMethod() == 'POST') {
       } else
         $errors->add($i18n->getKey('error.client_exists'));
     }
-       
+
     if ($request->getParameter('btn_copy')) {
       if (!ttClientHelper::getClientByName($cl_name)) {
         if (ttClientHelper::insert(array(
@@ -113,7 +114,7 @@ if ($request->getMethod() == 'POST') {
     }
   }
 } // post
-       
+
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 $smarty->assign('title', $i18n->getKey('title.edit_client'));
 $smarty->assign('content_page_name', 'client_edit.tpl');