├── config.php ├── img ├── ATM_logo.jpg ├── freevat.png ├── object_freevat.png └── Dolibarr_Preferred_Partner_logo.png ├── script └── create-maj-base.php ├── README ├── langs ├── en_US │ └── freevat.lang └── fr_FR │ └── freevat.lang ├── config.default.php ├── lib └── freevat.lib.php ├── admin ├── freevat_about.php └── freevat_setup.php ├── core ├── boxes │ └── freevat_box.php ├── modules │ └── modFreeVAT.class.php └── triggers │ └── interface_99_modFreeVAT_FreeVATtrigger.class.php └── class └── actions_freevat.class.php /config.php: -------------------------------------------------------------------------------- 1 | init_db_by_vars($PDOdb); 23 | */ 24 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 ATM Consulting 3 | * 4 | * This program and files/directory inner it is free software: you can 5 | * redistribute it and/or modify it under the terms of the 6 | * GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | 20 | -------------------------------------------------------------------------------- /langs/en_US/freevat.lang: -------------------------------------------------------------------------------- 1 | Module104053Name = FreeVAT 2 | Module104053Desc = FreeVAT Description 3 | 4 | ATMAbout = This module has been developed by ATM Consulting
You can find the documentation on our wiki

For any question or feedback, contact us on support@atm-consulting.fr

For any commercial question, contact us on contact@atm-consulting.fr or at +33 9 77 19 50 70

Find our other modules on Dolistore 5 | 6 | FreeVATSetup = FreeVAT module setup 7 | FreeVATAbout = About FreeVAT 8 | -------------------------------------------------------------------------------- /config.default.php: -------------------------------------------------------------------------------- 1 | trans('AbricotNotFound'). ' : Abricot'; 27 | exit; 28 | } 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /langs/fr_FR/freevat.lang: -------------------------------------------------------------------------------- 1 | Module104053Name = TVA Libre 2 | Module104053Desc = TVA Libre, permet de saisir n'importe quel taux de TVA dans les propales, commandes, factures client et commandes, factures fournisseurs 3 | 4 | ATMAbout = Ce module a été développé par ATM Consulting
Vous pouvez retrouver la documentation sur notre wiki

Pour toute question technique ou retour, contactez-nous sur support@atm-consulting.fr

Pour toute question commerciale, contactez-nous sur contact@atm-consulting.fr ou au +33 9 77 19 50 70

Retrouvez nos autres modules sur Dolistore 5 | 6 | FreeVATSetup = Configuration du module FreeVAT 7 | FreeVATAbout = A propos du module FreeVAT 8 | 9 | NoOptionsNeeded=Aucune option pour ce module, rendez-vous simplement sur votre propale, commande, facture client ou commande, facture fournisseur -------------------------------------------------------------------------------- /lib/freevat.lib.php: -------------------------------------------------------------------------------- 1 | 3 | * Copyright (C) 2015 ATM Consulting 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * \file lib/freevat.lib.php 21 | * \ingroup freevat 22 | * \brief This file is an example module library 23 | * Put some comments here 24 | */ 25 | 26 | function freevatAdminPrepareHead() 27 | { 28 | global $langs, $conf; 29 | 30 | $langs->load("freevat@freevat"); 31 | 32 | $h = 0; 33 | $head = array(); 34 | 35 | $head[$h][0] = dol_buildpath("/freevat/admin/freevat_setup.php", 1); 36 | $head[$h][1] = $langs->trans("Parameters"); 37 | $head[$h][2] = 'settings'; 38 | $h++; 39 | $head[$h][0] = dol_buildpath("/freevat/admin/freevat_about.php", 1); 40 | $head[$h][1] = $langs->trans("About"); 41 | $head[$h][2] = 'about'; 42 | $h++; 43 | 44 | // Show more tabs from modules 45 | // Entries must be declared in modules descriptor with line 46 | //$this->tabs = array( 47 | // 'entity:+tabname:Title:@freevat:/freevat/mypage.php?id=__ID__' 48 | //); // to add new tab 49 | //$this->tabs = array( 50 | // 'entity:-tabname:Title:@freevat:/freevat/mypage.php?id=__ID__' 51 | //); // to remove a tab 52 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'freevat'); 53 | 54 | return $head; 55 | } 56 | -------------------------------------------------------------------------------- /admin/freevat_about.php: -------------------------------------------------------------------------------- 1 | 3 | * Copyright (C) 2015 ATM Consulting 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * \file admin/about.php 21 | * \ingroup freevat 22 | * \brief This file is an example about page 23 | * Put some comments here 24 | */ 25 | // Dolibarr environment 26 | $res = @include("../../main.inc.php"); // From htdocs directory 27 | if (! $res) { 28 | $res = @include("../../../main.inc.php"); // From "custom" directory 29 | } 30 | 31 | // Libraries 32 | require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; 33 | require_once '../lib/freevat.lib.php'; 34 | 35 | // Translations 36 | $langs->load("freevat@freevat"); 37 | 38 | // Access control 39 | if (! $user->admin) { 40 | accessforbidden(); 41 | } 42 | 43 | /* 44 | * View 45 | */ 46 | $page_name = "FreeVATAbout"; 47 | llxHeader('', $langs->trans($page_name)); 48 | 49 | // Subheader 50 | $linkback = '' 51 | . $langs->trans("BackToModuleList") . ''; 52 | print_fiche_titre($langs->trans($page_name), $linkback); 53 | 54 | // Configuration header 55 | $head = freevatAdminPrepareHead(); 56 | dol_fiche_head( 57 | $head, 58 | 'about', 59 | $langs->trans("Module104053Name"), 60 | 0, 61 | 'freevat@freevat' 62 | ); 63 | 64 | // About page goes here 65 | print '
'; 66 | print '
'.$langs->trans('ATMAbout').'
'; 67 | 68 | dol_fiche_end(); 69 | 70 | print '
'; 71 | print ''; 72 | print '
'; 73 | 74 | llxFooter(); 75 | 76 | $db->close(); -------------------------------------------------------------------------------- /core/boxes/freevat_box.php: -------------------------------------------------------------------------------- 1 | 3 | * Copyright (C) 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * \file core/boxes/mybox.php 21 | * \ingroup freevat 22 | * \brief This file is a sample box definition file 23 | * Put some comments here 24 | */ 25 | include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php"; 26 | 27 | /** 28 | * Class to manage the box 29 | */ 30 | class freevatbox extends ModeleBoxes 31 | { 32 | 33 | public $boxcode = "mybox"; 34 | public $boximg = "freevat@freevat"; 35 | public $boxlabel; 36 | public $depends = array("freevat"); 37 | public $db; 38 | public $param; 39 | public $info_box_head = array(); 40 | public $info_box_contents = array(); 41 | 42 | /** 43 | * Constructor 44 | */ 45 | public function __construct() 46 | { 47 | global $langs; 48 | $langs->load("boxes"); 49 | 50 | $this->boxlabel = $langs->transnoentitiesnoconv("MyBox"); 51 | } 52 | 53 | /** 54 | * Load data into info_box_contents array to show array later. 55 | * 56 | * @param int $max Maximum number of records to load 57 | * @return void 58 | */ 59 | public function loadBox($max = 5) 60 | { 61 | global $conf, $user, $langs, $db; 62 | 63 | $this->max = $max; 64 | 65 | //include_once DOL_DOCUMENT_ROOT . "/freevat/class/freevat.class.php"; 66 | 67 | $text = $langs->trans("MyBoxDescription", $max); 68 | $this->info_box_head = array( 69 | 'text' => $text, 70 | 'limit' => dol_strlen($text) 71 | ); 72 | 73 | $this->info_box_contents[0][0] = array('td' => 'align="left"', 74 | 'text' => $langs->trans("MyBoxContent")); 75 | } 76 | 77 | /** 78 | * Method to show box 79 | * 80 | * @param array $head Array with properties of box title 81 | * @param array $contents Array with properties of box lines 82 | * @return void 83 | */ 84 | public function showBox($head = null, $contents = null) 85 | { 86 | parent::showBox($this->info_box_head, $this->info_box_contents); 87 | } 88 | } -------------------------------------------------------------------------------- /admin/freevat_setup.php: -------------------------------------------------------------------------------- 1 | 3 | * Copyright (C) 2015 ATM Consulting 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * \file admin/freevat.php 21 | * \ingroup freevat 22 | * \brief This file is an example module setup page 23 | * Put some comments here 24 | */ 25 | // Dolibarr environment 26 | $res = @include("../../main.inc.php"); // From htdocs directory 27 | if (! $res) { 28 | $res = @include("../../../main.inc.php"); // From "custom" directory 29 | } 30 | 31 | // Libraries 32 | require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; 33 | require_once '../lib/freevat.lib.php'; 34 | 35 | // Translations 36 | $langs->load("freevat@freevat"); 37 | 38 | // Access control 39 | if (! $user->admin) { 40 | accessforbidden(); 41 | } 42 | 43 | // Parameters 44 | $action = GETPOST('action', 'alpha'); 45 | 46 | /* 47 | * Actions 48 | */ 49 | if (preg_match('/set_(.*)/',$action,$reg)) 50 | { 51 | $code=$reg[1]; 52 | if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) 53 | { 54 | header("Location: ".$_SERVER["PHP_SELF"]); 55 | exit; 56 | } 57 | else 58 | { 59 | dol_print_error($db); 60 | } 61 | } 62 | 63 | if (preg_match('/del_(.*)/',$action,$reg)) 64 | { 65 | $code=$reg[1]; 66 | if (dolibarr_del_const($db, $code, 0) > 0) 67 | { 68 | Header("Location: ".$_SERVER["PHP_SELF"]); 69 | exit; 70 | } 71 | else 72 | { 73 | dol_print_error($db); 74 | } 75 | } 76 | 77 | /* 78 | * View 79 | */ 80 | $page_name = "FreeVATSetup"; 81 | llxHeader('', $langs->trans($page_name)); 82 | 83 | // Subheader 84 | $linkback = '' 85 | . $langs->trans("BackToModuleList") . ''; 86 | print_fiche_titre($langs->trans($page_name), $linkback); 87 | 88 | // Configuration header 89 | $head = freevatAdminPrepareHead(); 90 | dol_fiche_head( 91 | $head, 92 | 'settings', 93 | $langs->trans("Module104053Name"), 94 | 0, 95 | "freevat@freevat" 96 | ); 97 | 98 | // Setup page goes here 99 | $form=new Form($db); 100 | $var=false; 101 | print ''; 102 | print ''; 103 | print ''."\n"; 104 | print ''; 105 | print ''."\n"; 106 | 107 | 108 | // Example with a yes / no select 109 | $var=!$var; 110 | print ''; 111 | print ''; 112 | print ''; 113 | 114 | print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans("NoOptionsNeeded").'
'; 115 | 116 | llxFooter(); 117 | 118 | $db->close(); -------------------------------------------------------------------------------- /class/actions_freevat.class.php: -------------------------------------------------------------------------------- 1 | 3 | * Copyright (C) 2015 ATM Consulting 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * \file class/actions_freevat.class.php 21 | * \ingroup freevat 22 | * \brief This file is an example hook overload class file 23 | * Put some comments here 24 | */ 25 | 26 | /** 27 | * Class ActionsFreeVAT 28 | */ 29 | class ActionsFreeVAT 30 | { 31 | /** 32 | * @var array Hook results. Propagated to $hookmanager->resArray for later reuse 33 | */ 34 | public $results = array(); 35 | 36 | /** 37 | * @var string String displayed by executeHook() immediately after return 38 | */ 39 | public $resprints; 40 | 41 | /** 42 | * @var array Errors 43 | */ 44 | public $errors = array(); 45 | 46 | /** 47 | * Constructor 48 | */ 49 | public function __construct() 50 | { 51 | } 52 | 53 | /** 54 | * Overloading the doActions function : replacing the parent's function with the one below 55 | * 56 | * @param array() $parameters Hook metadatas (context, etc...) 57 | * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 58 | * @param string &$action Current action (if set). Generally create or edit or null 59 | * @param HookManager $hookmanager Hook manager propagated to allow calling another hook 60 | * @return int < 0 on error, 0 on success, 1 to replace standard code 61 | */ 62 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) 63 | { 64 | $TContext = explode(':', $parameters['context']); 65 | 66 | if (in_array('propalcard', $TContext) 67 | || in_array('ordercard', $TContext) 68 | || in_array('invoicecard', $TContext) 69 | || in_array('ordersuppliercard', $TContext) 70 | || in_array('invoicesuppliercard', $TContext) 71 | ) 72 | { 73 | 74 | $default_vat_tx = 0; 75 | if($action === 'editline' && !empty($parameters['lineid'])) { 76 | foreach($object->lines as &$line) { 77 | if($line->id == $parameters['lineid']) { 78 | $default_vat_tx = $line->tva_tx; 79 | } 80 | } 81 | 82 | } 83 | 84 | ?> 85 | 108 | 109 | 3 | * Copyright (C) 2004-2012 Laurent Destailleur 4 | * Copyright (C) 2005-2012 Regis Houssin 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /** 21 | * \defgroup freevat Module FreeVAT 22 | * \brief Example of a module descriptor. 23 | * Such a file must be copied into htdocs/freevat/core/modules directory. 24 | * \file htdocs/freevat/core/modules/modFreeVAT.class.php 25 | * \ingroup freevat 26 | * \brief Description and activation file for module FreeVAT 27 | */ 28 | include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; 29 | 30 | 31 | /** 32 | * Description and activation class for module FreeVAT 33 | */ 34 | class modFreeVAT extends DolibarrModules 35 | { 36 | /** 37 | * Constructor. Define names, constants, directories, boxes, permissions 38 | * 39 | * @param DoliDB $db Database handler 40 | */ 41 | function __construct($db) 42 | { 43 | global $langs,$conf; 44 | 45 | $this->db = $db; 46 | 47 | $this->editor_name = 'ATM-Consulting'; 48 | // Id for module (must be unique). 49 | // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). 50 | $this->numero = 104053; // 104000 to 104999 for ATM CONSULTING 51 | // Key text used to identify module (for permissions, menus, etc...) 52 | $this->rights_class = 'freevat'; 53 | 54 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' 55 | // It is used to group modules in module setup page 56 | $this->family = "ATM"; 57 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) 58 | $this->name = preg_replace('/^mod/i','',get_class($this)); 59 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) 60 | $this->description = "Description of module FreeVAT"; 61 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version 62 | $this->version = '1.0'; 63 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) 64 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); 65 | // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) 66 | $this->special = 0; 67 | // Name of image file used for this module. 68 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' 69 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' 70 | $this->picto='freevat@freevat'; 71 | 72 | // Defined all module parts (triggers, login, substitutions, menus, css, etc...) 73 | // for default path (eg: /freevat/core/xxxxx) (0=disable, 1=enable) 74 | // for specific path of parts (eg: /freevat/core/modules/barcode) 75 | // for specific css file (eg: /freevat/css/freevat.css.php) 76 | //$this->module_parts = array( 77 | // 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers) 78 | // 'login' => 0, // Set this to 1 if module has its own login method directory (core/login) 79 | // 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions) 80 | // 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) 81 | // 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) 82 | // 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) 83 | // 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) 84 | // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) 85 | // 'css' => array('/freevat/css/freevat.css.php'), // Set this to relative path of css file if module has its own css file 86 | // 'js' => array('/freevat/js/freevat.js'), // Set this to relative path of js file if module must load a js on all pages 87 | // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module 88 | // 'dir' => array('output' => 'othermodulename'), // To force the default directories names 89 | // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@freevat')) // Set here all workflow context managed by module 90 | // ); 91 | $this->module_parts = array( 92 | 'hooks'=>array('propalcard','ordercard','invoicecard','ordersuppliercard','invoicesuppliercard') 93 | ); 94 | 95 | // Data directories to create when module is enabled. 96 | // Example: this->dirs = array("/freevat/temp"); 97 | $this->dirs = array(); 98 | 99 | // Config pages. Put here list of php page, stored into freevat/admin directory, to use to setup module. 100 | $this->config_page_url = array("freevat_setup.php@freevat"); 101 | 102 | // Dependencies 103 | $this->hidden = false; // A condition to hide module 104 | $this->depends = array(); // List of modules id that must be enabled if this module is enabled 105 | $this->requiredby = array(); // List of modules id to disable if this one is disabled 106 | $this->conflictwith = array(); // List of modules id this module is in conflict with 107 | $this->phpmin = array(5,0); // Minimum version of PHP required by module 108 | $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module 109 | $this->langfiles = array("freevat@freevat"); 110 | 111 | // Constants 112 | // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) 113 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), 114 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) 115 | // ); 116 | $this->const = array(); 117 | 118 | // Array to add new pages in new tabs 119 | // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@freevat:$user->rights->freevat->read:/freevat/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 120 | // 'objecttype:+tabname2:Title2:mylangfile@freevat:$user->rights->othermodule->read:/freevat/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 121 | // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname 122 | // where objecttype can be 123 | // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) 124 | // 'contact' to add a tab in contact view 125 | // 'contract' to add a tab in contract view 126 | // 'group' to add a tab in group view 127 | // 'intervention' to add a tab in intervention view 128 | // 'invoice' to add a tab in customer invoice view 129 | // 'invoice_supplier' to add a tab in supplier invoice view 130 | // 'member' to add a tab in fundation member view 131 | // 'opensurveypoll' to add a tab in opensurvey poll view 132 | // 'order' to add a tab in customer order view 133 | // 'order_supplier' to add a tab in supplier order view 134 | // 'payment' to add a tab in payment view 135 | // 'payment_supplier' to add a tab in supplier payment view 136 | // 'product' to add a tab in product view 137 | // 'propal' to add a tab in propal view 138 | // 'project' to add a tab in project view 139 | // 'stock' to add a tab in stock view 140 | // 'thirdparty' to add a tab in third party view 141 | // 'user' to add a tab in user view 142 | $this->tabs = array(); 143 | 144 | // Dictionaries 145 | if (! isset($conf->freevat->enabled)) 146 | { 147 | $conf->freevat=new stdClass(); 148 | $conf->freevat->enabled=0; 149 | } 150 | $this->dictionaries=array(); 151 | /* Example: 152 | if (! isset($conf->freevat->enabled)) $conf->freevat->enabled=0; // This is to avoid warnings 153 | $this->dictionaries=array( 154 | 'langs'=>'mylangfile@freevat', 155 | 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor 156 | 'tablib'=>array("Table1","Table2","Table3"), // Label of tables 157 | 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields 158 | 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order 159 | 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) 160 | 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) 161 | 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) 162 | 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') 163 | 'tabcond'=>array($conf->freevat->enabled,$conf->freevat->enabled,$conf->freevat->enabled) // Condition to show each dictionary 164 | ); 165 | */ 166 | 167 | // Boxes 168 | // Add here list of php file(s) stored in core/boxes that contains class to show a box. 169 | $this->boxes = array(); // List of boxes 170 | // Example: 171 | //$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>''));); 172 | 173 | // Permissions 174 | $this->rights = array(); // Permission array used by this module 175 | $r=0; 176 | 177 | // Add here list of permission defined by an id, a label, a boolean and two constant strings. 178 | // Example: 179 | // $this->rights[$r][0] = $this->numero . $r; // Permission id (must not be already used) 180 | // $this->rights[$r][1] = 'Permision label'; // Permission label 181 | // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) 182 | // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) 183 | // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) 184 | // $r++; 185 | 186 | 187 | // Main menu entries 188 | $this->menu = array(); // List of menus to add 189 | $r=0; 190 | 191 | // Add here entries to declare new menus 192 | // 193 | // Example to declare a new Top Menu entry and its Left menu entry: 194 | // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu 195 | // 'type'=>'top', // This is a Top menu entry 196 | // 'titre'=>'FreeVAT top menu', 197 | // 'mainmenu'=>'freevat', 198 | // 'leftmenu'=>'freevat', 199 | // 'url'=>'/freevat/pagetop.php', 200 | // 'langs'=>'mylangfile@freevat', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 201 | // 'position'=>100, 202 | // 'enabled'=>'$conf->freevat->enabled', // Define condition to show or hide menu entry. Use '$conf->freevat->enabled' if entry must be visible if module is enabled. 203 | // 'perms'=>'1', // Use 'perms'=>'$user->rights->freevat->level1->level2' if you want your menu with a permission rules 204 | // 'target'=>'', 205 | // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both 206 | // $r++; 207 | // 208 | // Example to declare a Left Menu entry into an existing Top menu entry: 209 | // $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 210 | // 'type'=>'left', // This is a Left menu entry 211 | // 'titre'=>'FreeVAT left menu', 212 | // 'mainmenu'=>'xxx', 213 | // 'leftmenu'=>'freevat', 214 | // 'url'=>'/freevat/pagelevel2.php', 215 | // 'langs'=>'mylangfile@freevat', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 216 | // 'position'=>100, 217 | // 'enabled'=>'$conf->freevat->enabled', // Define condition to show or hide menu entry. Use '$conf->freevat->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 218 | // 'perms'=>'1', // Use 'perms'=>'$user->rights->freevat->level1->level2' if you want your menu with a permission rules 219 | // 'target'=>'', 220 | // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both 221 | // $r++; 222 | 223 | 224 | // Exports 225 | $r=1; 226 | 227 | // Example: 228 | // $this->export_code[$r]=$this->rights_class.'_'.$r; 229 | // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) 230 | // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. 231 | // $this->export_permission[$r]=array(array("facture","facture","export")); 232 | // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); 233 | // $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'); 234 | // $this->export_sql_start[$r]='SELECT DISTINCT '; 235 | // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; 236 | // $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; 237 | // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; 238 | // $this->export_sql_order[$r] .=' ORDER BY s.nom'; 239 | // $r++; 240 | } 241 | 242 | /** 243 | * Function called when module is enabled. 244 | * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. 245 | * It also creates data directories 246 | * 247 | * @param string $options Options when enabling module ('', 'noboxes') 248 | * @return int 1 if OK, 0 if KO 249 | */ 250 | function init($options='') 251 | { 252 | $sql = array(); 253 | 254 | define('INC_FROM_DOLIBARR',true); 255 | 256 | dol_include_once('/freevat/config.php'); 257 | dol_include_once('/freevat/script/create-maj-base.php'); 258 | 259 | $result=$this->_load_tables('/freevat/sql/'); 260 | 261 | return $this->_init($sql, $options); 262 | } 263 | 264 | /** 265 | * Function called when module is disabled. 266 | * Remove from database constants, boxes and permissions from Dolibarr database. 267 | * Data directories are not deleted 268 | * 269 | * @param string $options Options when enabling module ('', 'noboxes') 270 | * @return int 1 if OK, 0 if KO 271 | */ 272 | function remove($options='') 273 | { 274 | $sql = array(); 275 | 276 | return $this->_remove($sql, $options); 277 | } 278 | 279 | } 280 | -------------------------------------------------------------------------------- /core/triggers/interface_99_modFreeVAT_FreeVATtrigger.class.php: -------------------------------------------------------------------------------- 1 | 3 | * Copyright (C) 2015 ATM Consulting 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * \file core/triggers/interface_99_modMyodule_FreeVATtrigger.class.php 21 | * \ingroup freevat 22 | * \brief Sample trigger 23 | * \remarks You can create other triggers by copying this one 24 | * - File name should be either: 25 | * interface_99_modMymodule_Mytrigger.class.php 26 | * interface_99_all_Mytrigger.class.php 27 | * - The file must stay in core/triggers 28 | * - The class name must be InterfaceMytrigger 29 | * - The constructor method must be named InterfaceMytrigger 30 | * - The name property name must be Mytrigger 31 | */ 32 | 33 | /** 34 | * Trigger class 35 | */ 36 | class InterfaceFreeVATtrigger 37 | { 38 | 39 | private $db; 40 | 41 | /** 42 | * Constructor 43 | * 44 | * @param DoliDB $db Database handler 45 | */ 46 | public function __construct($db) 47 | { 48 | $this->db = $db; 49 | 50 | $this->name = preg_replace('/^Interface/i', '', get_class($this)); 51 | $this->family = "demo"; 52 | $this->description = "Triggers of this module are empty functions." 53 | . "They have no effect." 54 | . "They are provided for tutorial purpose only."; 55 | // 'development', 'experimental', 'dolibarr' or version 56 | $this->version = 'development'; 57 | $this->picto = 'freevat@freevat'; 58 | } 59 | 60 | /** 61 | * Trigger name 62 | * 63 | * @return string Name of trigger file 64 | */ 65 | public function getName() 66 | { 67 | return $this->name; 68 | } 69 | 70 | /** 71 | * Trigger description 72 | * 73 | * @return string Description of trigger file 74 | */ 75 | public function getDesc() 76 | { 77 | return $this->description; 78 | } 79 | 80 | /** 81 | * Trigger version 82 | * 83 | * @return string Version of trigger file 84 | */ 85 | public function getVersion() 86 | { 87 | global $langs; 88 | $langs->load("admin"); 89 | 90 | if ($this->version == 'development') { 91 | return $langs->trans("Development"); 92 | } elseif ($this->version == 'experimental') 93 | 94 | return $langs->trans("Experimental"); 95 | elseif ($this->version == 'dolibarr') return DOL_VERSION; 96 | elseif ($this->version) return $this->version; 97 | else { 98 | return $langs->trans("Unknown"); 99 | } 100 | } 101 | 102 | /** 103 | * Function called when a Dolibarrr business event is done. 104 | * All functions "run_trigger" are triggered if file 105 | * is inside directory core/triggers 106 | * 107 | * @param string $action Event action code 108 | * @param Object $object Object 109 | * @param User $user Object user 110 | * @param Translate $langs Object langs 111 | * @param conf $conf Object conf 112 | * @return int <0 if KO, 0 if no triggered ran, >0 if OK 113 | */ 114 | public function run_trigger($action, $object, $user, $langs, $conf) 115 | { 116 | // Put here code you want to execute when a Dolibarr business events occurs. 117 | // Data and type of action are stored into $object and $action 118 | // Users 119 | if ($action == 'USER_LOGIN') { 120 | dol_syslog( 121 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 122 | ); 123 | } elseif ($action == 'USER_UPDATE_SESSION') { 124 | // Warning: To increase performances, this action is triggered only if 125 | // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. 126 | dol_syslog( 127 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 128 | ); 129 | } elseif ($action == 'USER_CREATE') { 130 | dol_syslog( 131 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 132 | ); 133 | } elseif ($action == 'USER_CREATE_FROM_CONTACT') { 134 | dol_syslog( 135 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 136 | ); 137 | } elseif ($action == 'USER_MODIFY') { 138 | dol_syslog( 139 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 140 | ); 141 | } elseif ($action == 'USER_NEW_PASSWORD') { 142 | dol_syslog( 143 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 144 | ); 145 | } elseif ($action == 'USER_ENABLEDISABLE') { 146 | dol_syslog( 147 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 148 | ); 149 | } elseif ($action == 'USER_DELETE') { 150 | dol_syslog( 151 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 152 | ); 153 | } elseif ($action == 'USER_LOGOUT') { 154 | dol_syslog( 155 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 156 | ); 157 | } elseif ($action == 'USER_SETINGROUP') { 158 | dol_syslog( 159 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 160 | ); 161 | } elseif ($action == 'USER_REMOVEFROMGROUP') { 162 | dol_syslog( 163 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 164 | ); 165 | } 166 | 167 | // Groups 168 | elseif ($action == 'GROUP_CREATE') { 169 | dol_syslog( 170 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 171 | ); 172 | } elseif ($action == 'GROUP_MODIFY') { 173 | dol_syslog( 174 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 175 | ); 176 | } elseif ($action == 'GROUP_DELETE') { 177 | dol_syslog( 178 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 179 | ); 180 | } 181 | 182 | // Companies 183 | elseif ($action == 'COMPANY_CREATE') { 184 | dol_syslog( 185 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 186 | ); 187 | } elseif ($action == 'COMPANY_MODIFY') { 188 | dol_syslog( 189 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 190 | ); 191 | } elseif ($action == 'COMPANY_DELETE') { 192 | dol_syslog( 193 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 194 | ); 195 | } 196 | 197 | // Contacts 198 | elseif ($action == 'CONTACT_CREATE') { 199 | dol_syslog( 200 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 201 | ); 202 | } elseif ($action == 'CONTACT_MODIFY') { 203 | dol_syslog( 204 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 205 | ); 206 | } elseif ($action == 'CONTACT_DELETE') { 207 | dol_syslog( 208 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 209 | ); 210 | } 211 | 212 | // Products 213 | elseif ($action == 'PRODUCT_CREATE') { 214 | dol_syslog( 215 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 216 | ); 217 | } elseif ($action == 'PRODUCT_MODIFY') { 218 | dol_syslog( 219 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 220 | ); 221 | } elseif ($action == 'PRODUCT_DELETE') { 222 | dol_syslog( 223 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 224 | ); 225 | } 226 | 227 | // Customer orders 228 | elseif ($action == 'ORDER_CREATE') { 229 | dol_syslog( 230 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 231 | ); 232 | } elseif ($action == 'ORDER_CLONE') { 233 | dol_syslog( 234 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 235 | ); 236 | } elseif ($action == 'ORDER_VALIDATE') { 237 | dol_syslog( 238 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 239 | ); 240 | } elseif ($action == 'ORDER_DELETE') { 241 | dol_syslog( 242 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 243 | ); 244 | } elseif ($action == 'ORDER_BUILDDOC') { 245 | dol_syslog( 246 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 247 | ); 248 | } elseif ($action == 'ORDER_SENTBYMAIL') { 249 | dol_syslog( 250 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 251 | ); 252 | } elseif ($action == 'LINEORDER_INSERT') { 253 | dol_syslog( 254 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 255 | ); 256 | } elseif ($action == 'LINEORDER_DELETE') { 257 | dol_syslog( 258 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 259 | ); 260 | } 261 | 262 | // Supplier orders 263 | elseif ($action == 'ORDER_SUPPLIER_CREATE') { 264 | dol_syslog( 265 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 266 | ); 267 | } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { 268 | dol_syslog( 269 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 270 | ); 271 | } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { 272 | dol_syslog( 273 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 274 | ); 275 | } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { 276 | dol_syslog( 277 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 278 | ); 279 | } 280 | 281 | // Proposals 282 | elseif ($action == 'PROPAL_CREATE') { 283 | dol_syslog( 284 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 285 | ); 286 | } elseif ($action == 'PROPAL_CLONE') { 287 | dol_syslog( 288 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 289 | ); 290 | } elseif ($action == 'PROPAL_MODIFY') { 291 | dol_syslog( 292 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 293 | ); 294 | } elseif ($action == 'PROPAL_VALIDATE') { 295 | dol_syslog( 296 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 297 | ); 298 | } elseif ($action == 'PROPAL_BUILDDOC') { 299 | dol_syslog( 300 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 301 | ); 302 | } elseif ($action == 'PROPAL_SENTBYMAIL') { 303 | dol_syslog( 304 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 305 | ); 306 | } elseif ($action == 'PROPAL_CLOSE_SIGNED') { 307 | dol_syslog( 308 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 309 | ); 310 | } elseif ($action == 'PROPAL_CLOSE_REFUSED') { 311 | dol_syslog( 312 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 313 | ); 314 | } elseif ($action == 'PROPAL_DELETE') { 315 | dol_syslog( 316 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 317 | ); 318 | } elseif ($action == 'LINEPROPAL_INSERT') { 319 | dol_syslog( 320 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 321 | ); 322 | } elseif ($action == 'LINEPROPAL_MODIFY') { 323 | dol_syslog( 324 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 325 | ); 326 | } elseif ($action == 'LINEPROPAL_DELETE') { 327 | dol_syslog( 328 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 329 | ); 330 | } 331 | 332 | // Contracts 333 | elseif ($action == 'CONTRACT_CREATE') { 334 | dol_syslog( 335 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 336 | ); 337 | } elseif ($action == 'CONTRACT_MODIFY') { 338 | dol_syslog( 339 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 340 | ); 341 | } elseif ($action == 'CONTRACT_ACTIVATE') { 342 | dol_syslog( 343 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 344 | ); 345 | } elseif ($action == 'CONTRACT_CANCEL') { 346 | dol_syslog( 347 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 348 | ); 349 | } elseif ($action == 'CONTRACT_CLOSE') { 350 | dol_syslog( 351 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 352 | ); 353 | } elseif ($action == 'CONTRACT_DELETE') { 354 | dol_syslog( 355 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 356 | ); 357 | } 358 | 359 | // Bills 360 | elseif ($action == 'BILL_CREATE') { 361 | dol_syslog( 362 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 363 | ); 364 | } elseif ($action == 'BILL_CLONE') { 365 | dol_syslog( 366 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 367 | ); 368 | } elseif ($action == 'BILL_MODIFY') { 369 | dol_syslog( 370 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 371 | ); 372 | } elseif ($action == 'BILL_VALIDATE') { 373 | dol_syslog( 374 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 375 | ); 376 | } elseif ($action == 'BILL_BUILDDOC') { 377 | dol_syslog( 378 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 379 | ); 380 | } elseif ($action == 'BILL_SENTBYMAIL') { 381 | dol_syslog( 382 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 383 | ); 384 | } elseif ($action == 'BILL_CANCEL') { 385 | dol_syslog( 386 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 387 | ); 388 | } elseif ($action == 'BILL_DELETE') { 389 | dol_syslog( 390 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 391 | ); 392 | } elseif ($action == 'LINEBILL_INSERT') { 393 | dol_syslog( 394 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 395 | ); 396 | } elseif ($action == 'LINEBILL_DELETE') { 397 | dol_syslog( 398 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 399 | ); 400 | } 401 | 402 | // Payments 403 | elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { 404 | dol_syslog( 405 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 406 | ); 407 | } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { 408 | dol_syslog( 409 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 410 | ); 411 | } elseif ($action == 'PAYMENT_ADD_TO_BANK') { 412 | dol_syslog( 413 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 414 | ); 415 | } elseif ($action == 'PAYMENT_DELETE') { 416 | dol_syslog( 417 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 418 | ); 419 | } 420 | 421 | // Interventions 422 | elseif ($action == 'FICHEINTER_CREATE') { 423 | dol_syslog( 424 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 425 | ); 426 | } elseif ($action == 'FICHEINTER_MODIFY') { 427 | dol_syslog( 428 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 429 | ); 430 | } elseif ($action == 'FICHEINTER_VALIDATE') { 431 | dol_syslog( 432 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 433 | ); 434 | } elseif ($action == 'FICHEINTER_DELETE') { 435 | dol_syslog( 436 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 437 | ); 438 | } 439 | 440 | // Members 441 | elseif ($action == 'MEMBER_CREATE') { 442 | dol_syslog( 443 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 444 | ); 445 | } elseif ($action == 'MEMBER_VALIDATE') { 446 | dol_syslog( 447 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 448 | ); 449 | } elseif ($action == 'MEMBER_SUBSCRIPTION') { 450 | dol_syslog( 451 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 452 | ); 453 | } elseif ($action == 'MEMBER_MODIFY') { 454 | dol_syslog( 455 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 456 | ); 457 | } elseif ($action == 'MEMBER_NEW_PASSWORD') { 458 | dol_syslog( 459 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 460 | ); 461 | } elseif ($action == 'MEMBER_RESILIATE') { 462 | dol_syslog( 463 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 464 | ); 465 | } elseif ($action == 'MEMBER_DELETE') { 466 | dol_syslog( 467 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 468 | ); 469 | } 470 | 471 | // Categories 472 | elseif ($action == 'CATEGORY_CREATE') { 473 | dol_syslog( 474 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 475 | ); 476 | } elseif ($action == 'CATEGORY_MODIFY') { 477 | dol_syslog( 478 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 479 | ); 480 | } elseif ($action == 'CATEGORY_DELETE') { 481 | dol_syslog( 482 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 483 | ); 484 | } 485 | 486 | // Projects 487 | elseif ($action == 'PROJECT_CREATE') { 488 | dol_syslog( 489 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 490 | ); 491 | } elseif ($action == 'PROJECT_MODIFY') { 492 | dol_syslog( 493 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 494 | ); 495 | } elseif ($action == 'PROJECT_DELETE') { 496 | dol_syslog( 497 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 498 | ); 499 | } 500 | 501 | // Project tasks 502 | elseif ($action == 'TASK_CREATE') { 503 | dol_syslog( 504 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 505 | ); 506 | } elseif ($action == 'TASK_MODIFY') { 507 | dol_syslog( 508 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 509 | ); 510 | } elseif ($action == 'TASK_DELETE') { 511 | dol_syslog( 512 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 513 | ); 514 | } 515 | 516 | // Task time spent 517 | elseif ($action == 'TASK_TIMESPENT_CREATE') { 518 | dol_syslog( 519 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 520 | ); 521 | } elseif ($action == 'TASK_TIMESPENT_MODIFY') { 522 | dol_syslog( 523 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 524 | ); 525 | } elseif ($action == 'TASK_TIMESPENT_DELETE') { 526 | dol_syslog( 527 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 528 | ); 529 | } 530 | 531 | // Shipping 532 | elseif ($action == 'SHIPPING_CREATE') { 533 | dol_syslog( 534 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 535 | ); 536 | } elseif ($action == 'SHIPPING_MODIFY') { 537 | dol_syslog( 538 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 539 | ); 540 | } elseif ($action == 'SHIPPING_VALIDATE') { 541 | dol_syslog( 542 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 543 | ); 544 | } elseif ($action == 'SHIPPING_SENTBYMAIL') { 545 | dol_syslog( 546 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 547 | ); 548 | } elseif ($action == 'SHIPPING_DELETE') { 549 | dol_syslog( 550 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 551 | ); 552 | } elseif ($action == 'SHIPPING_BUILDDOC') { 553 | dol_syslog( 554 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 555 | ); 556 | } 557 | 558 | // File 559 | elseif ($action == 'FILE_UPLOAD') { 560 | dol_syslog( 561 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 562 | ); 563 | } elseif ($action == 'FILE_DELETE') { 564 | dol_syslog( 565 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id 566 | ); 567 | } 568 | 569 | return 0; 570 | } 571 | } --------------------------------------------------------------------------------