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