wip
This commit is contained in:
parent
61d432865b
commit
bd4c9a64a8
@ -1637,7 +1637,7 @@ class ActionComm extends CommonObject
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
* @return int >0 if ok
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
@ -1669,6 +1669,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
$this->userownerid=$user->id;
|
||||
$this->userassigned[$user->id]=array('id'=>$user->id, 'transparency'=> 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -64,25 +64,28 @@ class AgendaEvents extends DolibarrApi
|
||||
public function get($id)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) {
|
||||
throw new RestException(401, "Insuffisant rights to read an event");
|
||||
throw new RestException(401, "Insufficient rights to read an event");
|
||||
}
|
||||
if ($id == 0) {
|
||||
$result = $this->actioncomm->initAsSpecimen();
|
||||
} else {
|
||||
$result = $this->actioncomm->fetch($id);
|
||||
if ($result) {
|
||||
$this->actioncomm->fetch_optionals();
|
||||
$this->actioncomm->fetchObjectLinked();
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->actioncomm->fetch($id);
|
||||
if ( ! $result ) {
|
||||
throw new RestException(404, 'Agenda Events not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->ownerid != DolibarrApiAccess::$user->id) {
|
||||
throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
throw new RestException(401, "Insufficient rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->actioncomm->fetch_optionals();
|
||||
|
||||
$this->actioncomm->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->actioncomm);
|
||||
}
|
||||
|
||||
@ -106,7 +109,7 @@ class AgendaEvents extends DolibarrApi
|
||||
$obj_ret = array();
|
||||
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) {
|
||||
throw new RestException(401, "Insuffisant rights to read events");
|
||||
throw new RestException(401, "Insufficient rights to read events");
|
||||
}
|
||||
|
||||
// case of external user
|
||||
@ -191,10 +194,10 @@ class AgendaEvents extends DolibarrApi
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
|
||||
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
|
||||
throw new RestException(401, "Insufficient rights to create your Agenda Event");
|
||||
}
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
|
||||
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, "Insufficient rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
}
|
||||
|
||||
// Check mandatory fields
|
||||
@ -230,10 +233,10 @@ class AgendaEvents extends DolibarrApi
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
|
||||
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
|
||||
throw new RestException(401, "Insufficient rights to create your Agenda Event");
|
||||
}
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
|
||||
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, "Insufficient rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
}
|
||||
|
||||
$result = $this->actioncomm->fetch($id);
|
||||
@ -266,13 +269,13 @@ class AgendaEvents extends DolibarrApi
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) {
|
||||
throw new RestException(401, "Insuffisant rights to delete your Agenda Event");
|
||||
throw new RestException(401, "Insufficient rights to delete your Agenda Event");
|
||||
}
|
||||
|
||||
$result = $this->actioncomm->fetch($id);
|
||||
|
||||
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);
|
||||
throw new RestException(401, "Insufficient rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
}
|
||||
|
||||
if( ! $result ) {
|
||||
|
||||
@ -1288,7 +1288,7 @@ class Contact extends CommonObject
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
* @return int >0 if ok
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
@ -1325,6 +1325,7 @@ class Contact extends CommonObject
|
||||
|
||||
$this->socid = $socid;
|
||||
$this->statut=1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -187,7 +187,7 @@ class Contracts extends DolibarrApi
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
throw new RestException(401, "Insufficient rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
@ -74,8 +74,11 @@ class Contacts extends DolibarrApi
|
||||
{
|
||||
throw new RestException(401, 'No permission to read contacts');
|
||||
}
|
||||
|
||||
$result = $this->contact->fetch($id);
|
||||
if ($id ==0) {
|
||||
$result = $this->contact->intiAsSpecimen();
|
||||
} else {
|
||||
$result = $this->contact->fetch($id);
|
||||
}
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
|
||||
@ -76,8 +76,11 @@ class Thirdparties extends DolibarrApi
|
||||
if(! DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->company->fetch($id);
|
||||
if ($id ==0) {
|
||||
$result = $this->company->intiAsSpecimen();
|
||||
} else {
|
||||
$result = $this->company->fetch($id);
|
||||
}
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
}
|
||||
|
||||
@ -3539,7 +3539,7 @@ class Societe extends CommonObject
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
* @return int >0 if ok
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
@ -3586,6 +3586,7 @@ class Societe extends CommonObject
|
||||
$this->idprof4='idprof4';
|
||||
$this->idprof5='idprof5';
|
||||
$this->idprof6='idprof6';
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user