]> wagnertech.de Git - timetracker.git/blobdiff - client_add.php
Siwtched to using isPost() function
[timetracker.git] / client_add.php
index b7187056942573a7ee111bef43d12e0bf818305e..1bdb160972b81c7a9e48d6e3d28e891eb97e9f17 100644 (file)
@@ -39,7 +39,7 @@ if (!ttAccessCheck(right_manage_team)) {
 
 $projects = ttTeamHelper::getActiveProjects($user->team_id);
 
-if ($request->getMethod() == 'POST') {
+if ($request->isPost()) {
   $cl_name = trim($request->getParameter('name'));
   $cl_address = trim($request->getParameter('address'));
   $cl_tax = $request->getParameter('tax');
@@ -58,13 +58,13 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
   $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') {
+if ($request->isPost()) {
   // 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 ($errors->no()) {
     if (!ttClientHelper::getClientByName($cl_name)) {
       if (ttClientHelper::insert(array(
         'team_id' => $user->team_id,
@@ -80,7 +80,7 @@ if ($request->getMethod() == 'POST') {
      } else
        $errors->add($i18n->getKey('error.client_exists'));
   }
-} // post
+} // POST
 
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 $smarty->assign('onload', 'onLoad="document.clientForm.name.focus()"');