mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 19:25:22 +01:00
Fix #yogosha5877
This commit is contained in:
@@ -208,12 +208,17 @@ class MyModuleApi extends DolibarrApi
|
||||
if (!DolibarrApiAccess::$user->rights->mymodule->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->myobject->$field = $value;
|
||||
}
|
||||
|
||||
// Clean data
|
||||
// $this->myobject->abc = checkVal($this->myobject->abc, 'alphanohtml');
|
||||
|
||||
if ($this->myobject->create(DolibarrApiAccess::$user)<0) {
|
||||
throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors));
|
||||
}
|
||||
@@ -253,6 +258,9 @@ class MyModuleApi extends DolibarrApi
|
||||
$this->myobject->$field = $value;
|
||||
}
|
||||
|
||||
// Clean data
|
||||
// $this->myobject->abc = checkVal($this->myobject->abc, 'alphanohtml');
|
||||
|
||||
if ($this->myobject->update(DolibarrApiAccess::$user, false) > 0) {
|
||||
return $this->get($id);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user