Esempio n. 1
0
 function editItem()
 {
     $id = $_POST["object"];
     $name = $_POST["name"];
     $initValue = $_POST["initValue"];
     $value = $_POST["value"];
     $warranty = $_POST["warranty"];
     if ($warranty == "0000-00-00") {
         $warranty = null;
     }
     $summary = $_POST["summary"];
     $infos = $_POST["infos"];
     $publicItem = $_POST["publicItem"];
     $exceptions = $_POST["exceptions"];
     $quantity = $_POST["quantity"];
     if ($publicItem != "false") {
         $public = 1;
     } else {
         $public = 0;
     }
     Objects::updateObject($id, $name, $value, $initValue, $warranty, $infos, $summary, $quantity);
     Objects::updatePublic($id, $public);
     $exceptions = json_decode($exceptions, true);
     var_dump($exceptions);
     foreach ($exceptions as $exception) {
         $user = $exception["id"];
         if ($exception["state"] == "1") {
             //Vérifier si l'utilisateur à déjà une exception
             if (!Objects::isUserExempt($id, $user)) {
                 Objects::addException($id, $user);
             }
         } else {
             if (Objects::isUserExempt($id, $user)) {
                 Objects::deleteRight($id, $user);
             }
         }
     }
 }