diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 62798371a58..4ca75ade9b9 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -318,7 +318,7 @@ if ($action == 'add') $db->begin(); // On cree l'action - $idaction=$object->add($user); + $idaction=$object->create($user); if ($idaction > 0) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d4e56bb2715..c0e1f11579c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -173,7 +173,7 @@ class ActionComm extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; @@ -189,7 +189,7 @@ class ActionComm extends CommonObject * @param int $notrigger 1 = disable triggers, 0 = enable triggers * @return int Id of created event, < 0 if KO */ - function add($user,$notrigger=0) + public function create(User $user, $notrigger = 0) { global $langs,$conf,$hookmanager; @@ -395,6 +395,20 @@ class ActionComm extends CommonObject } + /** + * Add an action/event into database. + * $this->type_id OR $this->type_code must be set. + * + * @param User $user Object user making action + * @param int $notrigger 1 = disable triggers, 0 = enable triggers + * @return int Id of created event, < 0 if KO + * @deprecated Use create instead + */ + public function add(User $user, $notrigger = 0) + { + $this->create($user, $notrigger); + } + /** * Load an object from its id and create a new one in database * @@ -436,7 +450,7 @@ class ActionComm extends CommonObject } // Create clone - $result=$this->add($fuser); + $result=$this->create($fuser); if ($result < 0) $error++; if (! $error) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 0a5d4a81ed6..5c85309ed8c 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -803,7 +803,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->fk_element = $object->id; $actioncomm->elementtype = $object->element; - $ret=$actioncomm->add($user); // User creating action + $ret=$actioncomm->create($user); // User creating action unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index dc07bc156ec..a5df31c2a7e 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -459,7 +459,7 @@ function createActionComm($authentication,$actioncomm) $db->begin(); - $result=$newobject->add($fuser); + $result=$newobject->create($fuser); if ($result <= 0) { $error++;