Merge pull request #11910 from frederic34/patch-10

NEW Add more complete info for triggers actioncom
This commit is contained in:
Laurent Destailleur 2019-09-27 14:45:39 +02:00 committed by GitHub
commit c198bd2462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -435,8 +435,10 @@ if (empty($reshook) && $action == 'update')
if ($p2hour == -1) $p2hour='0';
if ($p2min == -1) $p2min='0';
//$object->fetch($id);
//$object->fetch_userassigned();
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = clone $object;
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
@ -622,7 +624,10 @@ if (empty($reshook) && $action == 'update')
*/
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes')
{
//$object->fetch($id);
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = clone $object;
if ($user->rights->agenda->myactions->delete
|| $user->rights->agenda->allactions->delete)

View File

@ -237,6 +237,11 @@ class AgendaEvents extends DolibarrApi
}
$result = $this->actioncomm->fetch($id);
if ($result) {
$this->actioncomm->fetch_optionals();
$this->actioncomm->fetch_userassigned();
$this->actioncomm->oldcopy = clone $this->actioncomm;
}
if ( ! $result ) {
throw new RestException(404, 'actioncomm not found');
}
@ -270,6 +275,11 @@ class AgendaEvents extends DolibarrApi
}
$result = $this->actioncomm->fetch($id);
if ($result) {
$this->actioncomm->fetch_optionals();
$this->actioncomm->fetch_userassigned();
$this->actioncomm->oldcopy = clone $this->actioncomm;
}
if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) {
throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);