function addItem() { $parent = $_POST["parent"]; if ($parent == '' || $parent == null) { $ownerId = users::getFamilyOwnerByUserId($_SESSION['id']); $parent = objects::getRacinesContainersId((int) $ownerId[0]["UserInfoFamilyOwner"]); $parent = (int) $parent[0]["ObjectId"]; } $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"]; $owner = $_POST["owner"]; if ($publicItem != "false") { $public = 1; } else { $public = 0; } $object = Objects::addObject($name, $owner, $parent, $value, $initValue, $warranty, $infos, $summary, $public, $quantity); $exceptions = json_decode($exceptions, true); foreach ($exceptions as $exception) { if ($exception["state"] == 1) { $user = $exception["id"]; Objects::addException($object, $user); } } }