Fix #yogosha5877
This commit is contained in:
parent
b2c2c55214
commit
ac68599fab
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user