From 012557ba7bce0dc28a88e0ef02957e0031f6cce0 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 19 Mar 2016 14:21:20 -0700 Subject: [PATCH] Fixed UI for client add in MODE_TIME Projects checkboxes should no longer appear on client_add.php in MODE_TIME tracking mode --- WEB-INF/templates/client_add.tpl | 14 ++++++++------ WEB-INF/templates/client_edit.tpl | 14 +++++++------- client_add.php | 3 ++- client_edit.php | 11 ++++++----- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/WEB-INF/templates/client_add.tpl b/WEB-INF/templates/client_add.tpl index 3a17dded..6814d1e2 100644 --- a/WEB-INF/templates/client_add.tpl +++ b/WEB-INF/templates/client_add.tpl @@ -9,22 +9,24 @@ {$i18n.label.client_address}: - {$forms.clientForm.address.control} - - - {$i18n.label.tax}, %: - {$forms.clientForm.tax.control} (0{$user->decimal_mark}00) - + {$forms.clientForm.address.control} + + + {$i18n.label.tax}, %: + {$forms.clientForm.tax.control} (0{$user->decimal_mark}00) + {$i18n.label.required_fields}   +{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} {$i18n.label.projects}: {$forms.clientForm.projects.control}   +{/if} {$forms.clientForm.btn_submit.control} diff --git a/WEB-INF/templates/client_edit.tpl b/WEB-INF/templates/client_edit.tpl index bd9f1561..578aa64e 100644 --- a/WEB-INF/templates/client_edit.tpl +++ b/WEB-INF/templates/client_edit.tpl @@ -9,13 +9,13 @@ {$i18n.label.client_address}: - {$forms.clientForm.address.control} - - - {$i18n.label.tax}, %: - {$forms.clientForm.tax.control} (0{$user->decimal_mark}00) - - + {$forms.clientForm.address.control} + + + {$i18n.label.tax}, %: + {$forms.clientForm.tax.control} (0{$user->decimal_mark}00) + + {$i18n.label.status}: {$forms.clientForm.status.control} diff --git a/client_add.php b/client_add.php index 4ddb500e..da9b90e1 100644 --- a/client_add.php +++ b/client_add.php @@ -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') { diff --git a/client_edit.php b/client_edit.php index 758b2ef0..373263cf 100644 --- a/client_edit.php +++ b/client_edit.php @@ -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'); -- 2.20.1