Fix phpcs
This commit is contained in:
parent
504a67daee
commit
25fa83bd06
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/*
|
||||
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
@ -25,25 +26,27 @@
|
||||
* \ingroup agenda
|
||||
* \brief Trigger file for company - contactroles
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/triggers/dolibarrtriggers.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class of triggered functions for agenda module
|
||||
*/
|
||||
class InterfaceContactRoles extends DolibarrTriggers
|
||||
{
|
||||
|
||||
public $family = 'agenda';
|
||||
|
||||
public $description = "Triggers of this module auto link contact to company.";
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'action';
|
||||
@ -65,7 +68,6 @@ class InterfaceContactRoles extends DolibarrTriggers
|
||||
*/
|
||||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||
{
|
||||
|
||||
if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE'
|
||||
|| $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE'
|
||||
|| $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE') {
|
||||
@ -79,14 +81,9 @@ class InterfaceContactRoles extends DolibarrTriggers
|
||||
$contactdefault->socid = $socid;
|
||||
$TContact = $contactdefault->getContactRoles($object->element);
|
||||
|
||||
if (is_array($TContact) && ! empty($TContact))
|
||||
{
|
||||
if (is_array($TContact) && ! empty($TContact)) {
|
||||
$TContactAlreadyLinked = array();
|
||||
if ($object->id > 0)
|
||||
{
|
||||
/* $class = get_class($object);
|
||||
$cloneFrom = new $class($this->db);
|
||||
$r = $cloneFrom->fetch($object->id); */
|
||||
if ($object->id > 0) {
|
||||
$cloneFrom = dol_clone($object, 1);
|
||||
|
||||
if (! empty($cloneFrom->id)) {
|
||||
@ -96,14 +93,16 @@ class InterfaceContactRoles extends DolibarrTriggers
|
||||
|
||||
foreach ($TContact as $i => $infos) {
|
||||
foreach ($TContactAlreadyLinked as $contactData) {
|
||||
if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]);
|
||||
if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact'])
|
||||
unset($TContact[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$nb = 0;
|
||||
foreach ($TContact as $infos) {
|
||||
$res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']);
|
||||
if ($res > 0) $nb++;
|
||||
if ($res > 0)
|
||||
$nb ++;
|
||||
}
|
||||
|
||||
if ($nb > 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user