diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 43c4d4088bf..ea38df7a826 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2005,7 +2005,7 @@ abstract class CommonObject if (get_class($this) == 'Fournisseur') $this->mode_reglement_supplier_id = $id; return 1; } else { - dol_syslog(get_class($this).'::setPaymentMethods Erreur '.$sql.' - '.$this->db->error()); + dol_syslog(get_class($this).'::setPaymentMethods Error '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } @@ -2042,7 +2042,7 @@ abstract class CommonObject return 1; } else { - dol_syslog(get_class($this).'::setMulticurrencyCode Erreur '.$sql.' - '.$this->db->error()); + dol_syslog(get_class($this).'::setMulticurrencyCode Error '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } @@ -2146,7 +2146,7 @@ abstract class CommonObject return 1; } else { - dol_syslog(get_class($this).'::setMulticurrencyRate Erreur '.$sql.' - '.$this->db->error()); + dol_syslog(get_class($this).'::setMulticurrencyRate Error '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } @@ -2185,7 +2185,7 @@ abstract class CommonObject $this->cond_reglement = $id; // for compatibility return 1; } else { - dol_syslog(get_class($this).'::setPaymentTerms Erreur '.$sql.' - '.$this->db->error()); + dol_syslog(get_class($this).'::setPaymentTerms Error '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } @@ -2221,16 +2221,12 @@ abstract class CommonObject // for supplier if (get_class($this) == 'Fournisseur') $this->transport_mode_supplier_id = $id; return 1; - } - else - { + } else { dol_syslog(get_class($this).'::setTransportMode Error '.$sql.' - '.$this->db->error()); $this->error=$this->db->error(); return -1; } - } - else - { + } else { dol_syslog(get_class($this).'::setTransportMode, status of the object is incompatible'); $this->error='Status of the object is incompatible '.$this->statut; return -2; @@ -2259,7 +2255,7 @@ abstract class CommonObject $this->retained_warranty_fk_cond_reglement = $id; return 1; } else { - dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Erreur '.$sql.' - '.$this->db->error()); + dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Error '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } @@ -2291,7 +2287,7 @@ abstract class CommonObject return 1; } else { $this->error = $this->db->error(); - dol_syslog(get_class($this).'::setDeliveryAddress Erreur '.$sql.' - '.$this->error); + dol_syslog(get_class($this).'::setDeliveryAddress Error '.$sql.' - '.$this->error); return -1; } } @@ -8332,7 +8328,7 @@ abstract class CommonObject * @param int $fromId Id object source * @param int $toId Id object cible * @param string $type Type of category ('product', ...) - * @return int < 0 si erreur, > 0 si ok + * @return int < 0 if error, > 0 if ok */ public function cloneCategories($fromId, $toId, $type = '') { diff --git a/htdocs/core/modules/modIntracommreport.class.php b/htdocs/core/modules/modIntracommreport.class.php index 1ab8b11173d..1979c47f613 100644 --- a/htdocs/core/modules/modIntracommreport.class.php +++ b/htdocs/core/modules/modIntracommreport.class.php @@ -66,7 +66,7 @@ class modIntracommreport extends DolibarrModules $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->conflictwith = array(); // List of modules id this module is in conflict with $this->phpmin = array(5,5); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(10,0); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(13,0); // Minimum version of Dolibarr required by module $this->langfiles = array("intracommreport"); // Constants diff --git a/htdocs/core/triggers/interface_99_modintracommreport_intracommreporttrigger.class.php b/htdocs/core/triggers/interface_99_modintracommreport_intracommreporttrigger.class.php deleted file mode 100644 index fb2852cedb8..00000000000 --- a/htdocs/core/triggers/interface_99_modintracommreport_intracommreporttrigger.class.php +++ /dev/null @@ -1,571 +0,0 @@ - - * Copyright (C) 2015 ATM Consulting - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file core/triggers/interface_99_modMyodule_intracommreporttrigger.class.php - * \ingroup intracommreport - * \brief Sample trigger - * \remarks You can create other triggers by copying this one - * - File name should be either: - * interface_99_modMymodule_Mytrigger.class.php - * interface_99_all_Mytrigger.class.php - * - The file must stay in core/triggers - * - The class name must be InterfaceMytrigger - * - The constructor method must be named InterfaceMytrigger - * - The name property name must be Mytrigger - */ - -/** - * Trigger class - */ -class Interfaceintracommreporttrigger -{ - - private $db; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i', '', get_class($this)); - $this->family = "demo"; - $this->description = "Triggers of this module are empty functions." - . "They have no effect." - . "They are provided for tutorial purpose only."; - // 'development', 'experimental', 'dolibarr' or version - $this->version = 'development'; - $this->picto = 'intracommreport'; - } - - /** - * Trigger name - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } - - /** - * Trigger description - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } - - /** - * Trigger version - * - * @return string Version of trigger file - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("Development"); - } elseif ($this->version == 'experimental') - - return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else { - return $langs->trans("Unknown"); - } - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file - * is inside directory core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - public function run_trigger($action, $object, $user, $langs, $conf) - { - // Put here code you want to execute when a Dolibarr business events occurs. - // Data and type of action are stored into $object and $action - // Users - if ($action == 'USER_LOGIN') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_UPDATE_SESSION') { - // Warning: To increase performances, this action is triggered only if - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_CREATE_FROM_CONTACT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_NEW_PASSWORD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_ENABLEDISABLE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_LOGOUT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_SETINGROUP') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_REMOVEFROMGROUP') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Groups - elseif ($action == 'GROUP_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'GROUP_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'GROUP_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Companies - elseif ($action == 'COMPANY_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'COMPANY_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'COMPANY_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Contacts - elseif ($action == 'CONTACT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTACT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTACT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Products - elseif ($action == 'PRODUCT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PRODUCT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PRODUCT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Customer orders - elseif ($action == 'ORDER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEORDER_INSERT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEORDER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Supplier orders - elseif ($action == 'ORDER_SUPPLIER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Proposals - elseif ($action == 'PROPAL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLOSE_SIGNED') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLOSE_REFUSED') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_INSERT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Contracts - elseif ($action == 'CONTRACT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_ACTIVATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_CANCEL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_CLOSE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Bills - elseif ($action == 'BILL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_CANCEL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEBILL_INSERT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEBILL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Payments - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_ADD_TO_BANK') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Interventions - elseif ($action == 'FICHEINTER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Members - elseif ($action == 'MEMBER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_SUBSCRIPTION') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_NEW_PASSWORD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_RESILIATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Categories - elseif ($action == 'CATEGORY_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CATEGORY_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CATEGORY_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Projects - elseif ($action == 'PROJECT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROJECT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROJECT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Project tasks - elseif ($action == 'TASK_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Task time spent - elseif ($action == 'TASK_TIMESPENT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_TIMESPENT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_TIMESPENT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Shipping - elseif ($action == 'SHIPPING_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // File - elseif ($action == 'FILE_UPLOAD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FILE_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - return 0; - } -} diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index f86f3b36caf..c4f3cfd0c99 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -92,7 +92,7 @@ class IntracommReport extends CommonObject * Generate XML file * * @param int $mode O for create, R for regenerate (Look always 0 ment toujours 0 within the framework of XML exchanges according to documentation) - * @param string $type introduction or expedition + * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) * @param string $period_reference Period of reference * @return void */ @@ -144,7 +144,14 @@ class IntracommReport extends CommonObject else return 0; } - // $type_declaration tjrs = "expedition" à voir si ça évolue + /** + * Generate XMLDes file + * + * @param int $period_year Year of declaration + * @param int $period_month Month of declaration + * @param string $type_declaration Declaration type by default - introduction or expedition (always 'expedition' for Des) + * @return void + */ public function getXMLDes($period_year, $period_month, $type_declaration = 'expedition') { global $db, $conf, $mysoc; @@ -167,9 +174,17 @@ class IntracommReport extends CommonObject else return 0; } + /** + * Add line from invoice + * + * @param int $declaration Reference declaration + * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) + * @param int $period_reference Reference period + * @param string $exporttype deb=DEB, des=DES + * @return int <0 if KO, >0 if OK + */ public function addItemsFact(&$declaration, $type, $period_reference, $exporttype = 'deb') { - global $db, $conf; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; @@ -182,7 +197,7 @@ class IntracommReport extends CommonObject $i=1; if (empty($resql->num_rows)) { - $this->errors[] = 'Aucune donnée pour cette période'; + $this->errors[] = 'No data for this period'; return 0; } @@ -198,8 +213,8 @@ class IntracommReport extends CommonObject $this->addItemXMlDes($declaration, $res, '', $i); } else { if (empty($res->fk_pays)) { - // On n'arrête pas la boucle car on veut savoir quels sont tous les tiers qui n'ont pas de pays renseigné - $this->errors[] = 'Pays non renseigné pour le tiers '.$res->nom.''; + // We don't stop the loop because we want to know all the third parties who don't have an informed country + $this->errors[] = 'Country not filled in for the third party '.$res->nom.''; } else { if ($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0 && $categ_fraisdeport->containsObject('product', $res->id_prod)) { $TLinesFraisDePort[] = $res; @@ -218,9 +233,16 @@ class IntracommReport extends CommonObject return 1; } + /** + * Add invoice line + * + * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) + * @param int $period_reference Reference declaration + * @param string $exporttype deb=DEB, des=DES + * @return int <0 if KO, >0 if OK + */ public function getSQLFactLines($type, $period_reference, $exporttype = 'deb') { - global $mysoc, $conf; if ($type=='expedition' || $exporttype=='des') { @@ -257,9 +279,17 @@ class IntracommReport extends CommonObject return $sql; } + /** + * Add item for DEB + * + * @param int $declaration Reference declaration + * @param int $res Result of request SQL + * @param string $code_douane_spe Specific douane code + * @param int $i Line Id + * @return void + */ public function addItemXMl(&$declaration, &$res, $code_douane_spe = '', $i) { - $item = $declaration->addChild('Item'); $item->addChild('ItemNumber', $i); $cn8 = $item->addChild('CN8'); @@ -280,16 +310,31 @@ class IntracommReport extends CommonObject $item->addChild('regionCode', substr($res->zip, 0, 2)); } - public function addItemXMlDes($declaration, &$res, $code_douane_spe = '', $i) + /** + * Add item for DES + * + * @param int $declaration Reference declaration + * @param int $res Result of request SQL + * @param int $i Line Id + * @return void + */ + public function addItemXMlDes($declaration, &$res, $i) { $item = $declaration->addChild('ligne_des'); $item->addChild('numlin_des', $i); - $item->addChild('valeur', round($res->total_ht)); // Montant total ht de la facture (entier attendu) - $item->addChild('partner_des', $res->tva_intra); // Représente le numéro TVA du client étranger + $item->addChild('valeur', round($res->total_ht)); // Total amount excl. tax of the invoice (whole amount expected) + $item->addChild('partner_des', $res->tva_intra); // Represents the foreign customer's VAT number } /** - * Cette fonction ajoute un item en récupérant le code douane du produit ayant le plus haut montant dans la facture + * This function adds an item by retrieving the customs code of the product with the highest amount in the invoice + * + * @param int $declaration Reference declaration + * @param int $TLinesFraisDePort Data of shipping costs line + * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) + * @param int $categ_fraisdeport Id of category of shipping costs + * @param int $i Line Id + * @return void */ public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i) { @@ -301,8 +346,7 @@ class IntracommReport extends CommonObject $tabledet = 'facturedet'; $field_link = 'fk_facture'; $more_sql = 'f.facnumber'; - } - else { // Introduction + } else { // Introduction $table = 'facture_fourn'; $tabledet = 'facture_fourn_det'; $field_link = 'fk_facture_fourn'; @@ -342,9 +386,9 @@ class IntracommReport extends CommonObject } /** - * Return next reference of declaration not already used (or last reference) + * Return next reference of declaration not already used (or last reference) * - * @return string free ref or last ref + * @return string free ref or last ref */ public function getNextDeclarationNumber() {