Merge pull request #9411 from frederic34/patch-11
Update api_agendaevents.class.php
This commit is contained in:
commit
f3b0e16f27
@ -219,7 +219,7 @@ class AgendaEvents extends DolibarrApi
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Agenda Event general fields (won't touch lines of expensereport)
|
* Update Agenda Event general fields
|
||||||
*
|
*
|
||||||
* @param int $id Id of Agenda Event to update
|
* @param int $id Id of Agenda Event to update
|
||||||
* @param array $request_data Datas
|
* @param array $request_data Datas
|
||||||
@ -236,20 +236,20 @@ class AgendaEvents extends DolibarrApi
|
|||||||
throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->expensereport->fetch($id);
|
$result = $this->actioncomm->fetch($id);
|
||||||
if ( ! $result ) {
|
if ( ! $result ) {
|
||||||
throw new RestException(404, 'expensereport not found');
|
throw new RestException(404, 'actioncomm not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
|
if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
if ($field == 'id') continue;
|
if ($field == 'id') continue;
|
||||||
$this->expensereport->$field = $value;
|
$this->actioncomm->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->expensereport->update($id, DolibarrApiAccess::$user,1,'','','update'))
|
if ($this->actioncomm->update($id, DolibarrApiAccess::$user,1,'','','update'))
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user