Projects checkboxes should no longer appear on client_add.php in MODE_TIME tracking mode
</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} (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} (0{$user->decimal_mark}00)</td>
+ </tr>
<tr>
<td height="40"></td>
<td>{$i18n.label.required_fields}</td>
</tr>
<tr><td> </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> </td></tr>
+{/if}
<tr>
<td colspan="2" align="center" height="50">{$forms.clientForm.btn_submit.control}</td>
</tr>
</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} (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} (0{$user->decimal_mark}00)</td>
+ </tr>
+ <tr>
<td align = "right">{$i18n.label.status}:</td>
<td>{$forms.clientForm.status.control}</td>
</tr>
$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') {
$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);
} else
$errors->add($i18n->getKey('error.client_exists'));
}
-
+
if ($request->getParameter('btn_copy')) {
if (!ttClientHelper::getClientByName($cl_name)) {
if (ttClientHelper::insert(array(
}
}
} // 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');