30require_once DOL_DOCUMENT_ROOT.
'/core/triggers/dolibarrtriggers.class.php';
46 $this->
name = preg_replace(
'/^Interface/i',
'', get_class($this));
47 $this->family =
"agenda";
48 $this->
description =
"Triggers of this module auto link contact to company.";
49 $this->version = self::VERSIONS[
'prod'];
50 $this->picto =
'company';
70 if ($action ===
'PROPAL_CREATE' || $action ===
'ORDER_CREATE' || $action ===
'BILL_CREATE'
71 || $action ===
'ORDER_SUPPLIER_CREATE' || $action ===
'BILL_SUPPLIER_CREATE' || $action ===
'PROPOSAL_SUPPLIER_CREATE'
72 || $action ===
'CONTRACT_CREATE' || $action ===
'FICHINTER_CREATE' || $action ===
'PROJECT_CREATE' || $action ===
'TICKET_CREATE') {
73 dol_syslog(
"Trigger '".$this->
name.
"' for action '".$action.
"' launched by ".__FILE__.
". id=".
$object->id);
77 if (!empty($socid) && $socid > 0) {
78 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
79 $contactdefault =
new Contact($this->db);
80 $contactdefault->socid = $socid;
83 if (method_exists($contactdefault,
'getContactRoles')) {
84 $TContact = $contactdefault->getContactRoles(
$object->element);
87 if (is_array($TContact) && !empty($TContact)) {
88 $TContactAlreadyLinked = array();
91 $TContactAlreadyLinked = array_merge(
$object->liste_contact(-1,
'external'),
$object->liste_contact(-1,
'internal'));
94 foreach ($TContact as $i => $infos) {
95 foreach ($TContactAlreadyLinked as $contactData) {
96 if ($contactData[
'id'] == $infos[
'fk_socpeople'] && $contactData[
'fk_c_type_contact'] == $infos[
'type_contact']) {
103 foreach ($TContact as $infos) {
104 $res =
$object->add_contact($infos[
'fk_socpeople'], $infos[
'type_contact']);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to stock current configuration.
Class that all triggers must inherit.
Class to manage translations.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db name
Only used if Module[ID]Name translation string is not found.