Merge pull request #16178 from werewolf7160/patch-1

call to createCommon() return int and not bool
This commit is contained in:
Laurent Destailleur 2021-02-06 00:20:29 +01:00 committed by GitHub
commit 91996378d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,7 +203,7 @@ class MyModuleApi extends DolibarrApi
foreach ($request_data as $field => $value) {
$this->myobject->$field = $value;
}
if (!$this->myobject->create(DolibarrApiAccess::$user)) {
if ($this->myobject->create(DolibarrApiAccess::$user)<0) {
throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors));
}
return $this->myobject->id;