Added last access handling.
[timetracker.git] / mobile / client_edit.php
index 2c553da..fc22036 100644 (file)
@@ -32,7 +32,7 @@ import('ttClientHelper');
 import('ttTeamHelper');
 
 // Access check.
-if (!ttAccessCheck(right_manage_team)) {
+if (!ttAccessAllowed('manage_clients') || !$user->isPluginEnabled('cl')) {
   header('Location: access_denied.php');
   exit();
 }
@@ -70,6 +70,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
   $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')));
+$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete')));
 
 if ($request->isPost()) {
   // Validate user input.
@@ -112,6 +113,11 @@ if ($request->isPost()) {
       } else
         $err->add($i18n->getKey('error.client_exists'));
     }
+    
+    if ($request->getParameter('btn_delete')) {
+      header("Location: client_delete.php?id=$cl_id");
+      exit();
+    }
   }
 } // isPost