some update after night

This commit is contained in:
Frédéric FRANCE 2019-09-17 07:59:46 +02:00
parent fb7ef3cefc
commit a2d3cde291
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
3 changed files with 16 additions and 3 deletions

View File

@ -422,7 +422,9 @@ if ($action == 'update')
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$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"]);
@ -610,6 +612,8 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
{
$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

@ -772,7 +772,6 @@ class ActionComm extends CommonObject
$error=0;
$this->db->begin();
$this->oldcopy = clone $this;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm";
$sql.= " WHERE id=".$this->id;

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');
}
@ -269,7 +274,12 @@ class AgendaEvents extends DolibarrApi
throw new RestException(401, "Insuffisant rights to delete your Agenda Event");
}
$result = $this->actioncomm->fetch($id);
$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);