├── config.php ├── link ├── .htaccess └── attachement.php ├── img ├── ATM_logo.jpg ├── attachementsaslink.png ├── object_attachementsaslink.png └── Dolibarr_Preferred_Partner_logo.png ├── script └── create-maj-base.php ├── README ├── config.default.php ├── langs ├── en_US │ └── attachementsaslink.lang └── fr_FR │ └── attachementsaslink.lang ├── lib └── attachementsaslink.lib.php ├── admin ├── attachementsaslink_about.php └── attachementsaslink_setup.php ├── class └── actions_attachementsaslink.class.php └── core ├── modules └── modAttachementsAsLink.class.php └── triggers └── interface_99_modAttachementsAsLink_AttachementsAsLinktrigger.class.php /config.php: -------------------------------------------------------------------------------- 1 | db->debug=true; 12 | 13 | $o=new TXXX($db); 14 | $o->init_db_by_vars($PDOdb); -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config.default.php: -------------------------------------------------------------------------------- 1 | trans('AbricotNotFound'). ' : Abricot'; 27 | exit; 28 | } 29 | */ 30 | 31 | 32 | -------------------------------------------------------------------------------- /link/attachement.php: -------------------------------------------------------------------------------- 1 | load('attachementsaslink@attachementsaslink'); 29 | exit($langs->trans('ErrorOnAttachement')); 30 | } 31 | -------------------------------------------------------------------------------- /langs/en_US/attachementsaslink.lang: -------------------------------------------------------------------------------- 1 | ModuleName = Attachements as links 2 | ModuleDesc = Replace attachments by links into e-mails sent from Dolibarr 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 | AttachementsAsLinkSetup = Attachements as links module setup 7 | AttachementsAsLinkAbout = About Attachements as links 8 | ATTACHEMENTASLINK_DELETE_ATTACHEMENT=Don't send attachments, only links 9 | SeeAttachementBelow=You can dowload attachments with the links below: 10 | ErrorOnAttachement=The link is no longer valid because file was deleted or modified since the e-mail was send -------------------------------------------------------------------------------- /langs/fr_FR/attachementsaslink.lang: -------------------------------------------------------------------------------- 1 | Module104490Name = AttachementsAsLink 2 | Module104490Desc = Ajoute des liens de téléchargement pour chaque pièce jointes du mail envoyé 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 | AttachementsAsLinkSetup = Configuration du module AttachementsAsLink 7 | AttachementsAsLinkAbout = A propos du module AttachementsAsLink 8 | ATTACHEMENTASLINK_DELETE_ATTACHEMENT=Ne laisser que les liens, supprimer les pièces jointes 9 | SeeAttachementBelow=Vous pouvez télécharger les fichiers joints en cliquant sur les liens ci-après : 10 | ErrorOnAttachement=Le lien pointe sur un fichier qui a soit été supprimé, soit été regénéré depuis l'envoi du mail. -------------------------------------------------------------------------------- /lib/attachementsaslink.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/attachementsaslink.lib.php 21 | * \ingroup attachementsaslink 22 | * \brief This file is an example module library 23 | * Put some comments here 24 | */ 25 | 26 | function attachementsaslinkAdminPrepareHead() 27 | { 28 | global $langs, $conf; 29 | 30 | $langs->load("attachementsaslink@attachementsaslink"); 31 | 32 | $h = 0; 33 | $head = array(); 34 | 35 | $head[$h][0] = dol_buildpath("/attachementsaslink/admin/attachementsaslink_setup.php", 1); 36 | $head[$h][1] = $langs->trans("Parameters"); 37 | $head[$h][2] = 'settings'; 38 | $h++; 39 | $head[$h][0] = dol_buildpath("/attachementsaslink/admin/attachementsaslink_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:@attachementsaslink:/attachementsaslink/mypage.php?id=__ID__' 48 | //); // to add new tab 49 | //$this->tabs = array( 50 | // 'entity:-tabname:Title:@attachementsaslink:/attachementsaslink/mypage.php?id=__ID__' 51 | //); // to remove a tab 52 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'attachementsaslink'); 53 | 54 | return $head; 55 | } 56 | -------------------------------------------------------------------------------- /admin/attachementsaslink_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 attachementsaslink 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/attachementsaslink.lib.php'; 34 | 35 | // Translations 36 | $langs->load("attachementsaslink@attachementsaslink"); 37 | 38 | // Access control 39 | if (! $user->admin) { 40 | accessforbidden(); 41 | } 42 | 43 | /* 44 | * View 45 | */ 46 | $page_name = "AttachementsAsLinkAbout"; 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 = attachementsaslinkAdminPrepareHead(); 56 | dol_fiche_head( 57 | $head, 58 | 'about', 59 | $langs->trans("ModuleName"), 60 | 0, 61 | 'attachementsaslink@attachementsaslink' 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(); -------------------------------------------------------------------------------- /admin/attachementsaslink_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/attachementsaslink.php 21 | * \ingroup attachementsaslink 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/attachementsaslink.lib.php'; 34 | 35 | // Translations 36 | $langs->load("attachementsaslink@attachementsaslink"); 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 = "AttachementsAsLinkSetup"; 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 = attachementsaslinkAdminPrepareHead(); 90 | dol_fiche_head( 91 | $head, 92 | 'settings', 93 | $langs->trans("ModuleName"), 94 | 0, 95 | "attachementsaslink@attachementsaslink" 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 | print ''; 121 | 122 | print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans("ATTACHEMENTASLINK_DELETE_ATTACHEMENT").' '; 114 | print '
'; 115 | print ''; 116 | print ''; 117 | print $form->selectyesno('ATTACHEMENTASLINK_DELETE_ATTACHEMENT',$conf->global->ATTACHEMENTASLINK_DELETE_ATTACHEMENT,1); 118 | print ''; 119 | print '
'; 120 | print '
'; 123 | 124 | llxFooter(); 125 | 126 | $db->close(); -------------------------------------------------------------------------------- /class/actions_attachementsaslink.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_attachementsaslink.class.php 21 | * \ingroup attachementsaslink 22 | * \brief This file is an example hook overload class file 23 | * Put some comments here 24 | */ 25 | 26 | /** 27 | * Class ActionsAttachementsAsLink 28 | */ 29 | class ActionsAttachementsAsLink 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 | } 55 | 56 | function getFormMail($parameters, &$object, &$action, $hookmanager) { 57 | 58 | global $langs,$conf; 59 | 60 | $listofpaths=array(); 61 | $listofnames=array(); 62 | $listofmimes=array(); 63 | 64 | $keytoavoidconflict = empty($object->trackid)?'':'-'.$object->trackid; // this->trackid must be defined 65 | 66 | if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); 67 | if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); 68 | if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); 69 | 70 | 71 | if(count($listofpaths)>0) { 72 | 73 | $langs->load('attachementsaslink@attachementsaslink'); 74 | 75 | $sep = "
\n"; 76 | 77 | $object->substit['__PERSONALIZED__'].=$langs->trans('SeeAttachementBelow'); 78 | 79 | foreach($listofpaths as $k=>$attachement) { 80 | $checksum = md5($attachement.'/'.$listofmimes[$k].'/'.filesize($attachement)); 81 | $object->substit['__PERSONALIZED__'].=$sep.''.$listofnames[$k].''; 82 | } 83 | 84 | $object->substit['__PERSONALIZED__'].=$sep.$sep; 85 | 86 | if($conf->global->ATTACHEMENTASLINK_DELETE_ATTACHEMENT) { 87 | $_SESSION['listofpaths']=array(); 88 | $_SESSION['listofnames']=array(); 89 | $_SESSION['listofmimes']=array(); 90 | } 91 | } 92 | } 93 | 94 | /** 95 | * Overloading the doActions function : replacing the parent's function with the one below 96 | * 97 | * @param array() $parameters Hook metadatas (context, etc...) 98 | * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 99 | * @param string &$action Current action (if set). Generally create or edit or null 100 | * @param HookManager $hookmanager Hook manager propagated to allow calling another hook 101 | * @return int < 0 on error, 0 on success, 1 to replace standard code 102 | */ 103 | function doActions($parameters, &$object, &$action, $hookmanager) 104 | { 105 | $error = 0; // Error counter 106 | $myvalue = 'test'; // A result value 107 | 108 | print_r($parameters); 109 | echo "action: " . $action; 110 | print_r($object); 111 | 112 | if (in_array('somecontext', explode(':', $parameters['context']))) 113 | { 114 | // do something only for the context 'somecontext' 115 | } 116 | 117 | if (! $error) 118 | { 119 | $this->results = array('myreturn' => $myvalue); 120 | $this->resprints = 'A text to show'; 121 | return 0; // or return 1 to replace standard code 122 | } 123 | else 124 | { 125 | $this->errors[] = 'Error message'; 126 | return -1; 127 | } 128 | } 129 | } -------------------------------------------------------------------------------- /core/modules/modAttachementsAsLink.class.php: -------------------------------------------------------------------------------- 1 | 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 attachementsaslink Module AttachementsAsLink 22 | * \brief Example of a module descriptor. 23 | * Such a file must be copied into htdocs/attachementsaslink/core/modules directory. 24 | * \file htdocs/attachementsaslink/core/modules/modAttachementsAsLink.class.php 25 | * \ingroup attachementsaslink 26 | * \brief Description and activation file for module AttachementsAsLink 27 | */ 28 | include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; 29 | 30 | 31 | /** 32 | * Description and activation class for module AttachementsAsLink 33 | */ 34 | class modAttachementsAsLink 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 | // Id for module (must be unique). 48 | // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). 49 | $this->numero = 104490; // 104000 to 104999 for ATM CONSULTING 50 | // Key text used to identify module (for permissions, menus, etc...) 51 | $this->rights_class = 'attachementsaslink'; 52 | 53 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' 54 | // It is used to group modules in module setup page 55 | $this->family = "other"; 56 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) 57 | $this->name = preg_replace('/^mod/i','',get_class($this)); 58 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) 59 | $this->description = "Description of module AttachementsAsLink"; 60 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version 61 | $this->version = '1.0'; 62 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) 63 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); 64 | // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) 65 | $this->special = 0; 66 | // Name of image file used for this module. 67 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' 68 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' 69 | $this->picto='attachementsaslink@attachementsaslink'; 70 | 71 | // Defined all module parts (triggers, login, substitutions, menus, css, etc...) 72 | // for default path (eg: /attachementsaslink/core/xxxxx) (0=disable, 1=enable) 73 | // for specific path of parts (eg: /attachementsaslink/core/modules/barcode) 74 | // for specific css file (eg: /attachementsaslink/css/attachementsaslink.css.php) 75 | //$this->module_parts = array( 76 | // 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers) 77 | // 'login' => 0, // Set this to 1 if module has its own login method directory (core/login) 78 | // 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions) 79 | // 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) 80 | // 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) 81 | // 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) 82 | // 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) 83 | // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) 84 | // 'css' => array('/attachementsaslink/css/attachementsaslink.css.php'), // Set this to relative path of css file if module has its own css file 85 | // 'js' => array('/attachementsaslink/js/attachementsaslink.js'), // Set this to relative path of js file if module must load a js on all pages 86 | // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module 87 | // 'dir' => array('output' => 'othermodulename'), // To force the default directories names 88 | // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@attachementsaslink')) // Set here all workflow context managed by module 89 | // ); 90 | $this->module_parts = array( 91 | 'hooks'=>array('formmail') 92 | ); 93 | 94 | // Data directories to create when module is enabled. 95 | // Example: this->dirs = array("/attachementsaslink/temp"); 96 | $this->dirs = array(); 97 | 98 | // Config pages. Put here list of php page, stored into attachementsaslink/admin directory, to use to setup module. 99 | $this->config_page_url = array("attachementsaslink_setup.php@attachementsaslink"); 100 | 101 | // Dependencies 102 | $this->hidden = false; // A condition to hide module 103 | $this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled 104 | $this->requiredby = array(); // List of modules id to disable if this one is disabled 105 | $this->conflictwith = array(); // List of modules id this module is in conflict with 106 | $this->phpmin = array(5,0); // Minimum version of PHP required by module 107 | $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module 108 | $this->langfiles = array("attachementsaslink@attachementsaslink"); 109 | 110 | // Constants 111 | // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) 112 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), 113 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) 114 | // ); 115 | $this->const = array(); 116 | 117 | // Array to add new pages in new tabs 118 | // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@attachementsaslink:$user->rights->attachementsaslink->read:/attachementsaslink/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 119 | // 'objecttype:+tabname2:Title2:mylangfile@attachementsaslink:$user->rights->othermodule->read:/attachementsaslink/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 120 | // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname 121 | // where objecttype can be 122 | // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) 123 | // 'contact' to add a tab in contact view 124 | // 'contract' to add a tab in contract view 125 | // 'group' to add a tab in group view 126 | // 'intervention' to add a tab in intervention view 127 | // 'invoice' to add a tab in customer invoice view 128 | // 'invoice_supplier' to add a tab in supplier invoice view 129 | // 'member' to add a tab in fundation member view 130 | // 'opensurveypoll' to add a tab in opensurvey poll view 131 | // 'order' to add a tab in customer order view 132 | // 'order_supplier' to add a tab in supplier order view 133 | // 'payment' to add a tab in payment view 134 | // 'payment_supplier' to add a tab in supplier payment view 135 | // 'product' to add a tab in product view 136 | // 'propal' to add a tab in propal view 137 | // 'project' to add a tab in project view 138 | // 'stock' to add a tab in stock view 139 | // 'thirdparty' to add a tab in third party view 140 | // 'user' to add a tab in user view 141 | $this->tabs = array(); 142 | 143 | // Dictionaries 144 | if (! isset($conf->attachementsaslink->enabled)) 145 | { 146 | $conf->attachementsaslink=new stdClass(); 147 | $conf->attachementsaslink->enabled=0; 148 | } 149 | $this->dictionaries=array(); 150 | /* Example: 151 | if (! isset($conf->attachementsaslink->enabled)) $conf->attachementsaslink->enabled=0; // This is to avoid warnings 152 | $this->dictionaries=array( 153 | 'langs'=>'mylangfile@attachementsaslink', 154 | 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor 155 | 'tablib'=>array("Table1","Table2","Table3"), // Label of tables 156 | '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 157 | 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order 158 | 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) 159 | 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) 160 | 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) 161 | 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') 162 | 'tabcond'=>array($conf->attachementsaslink->enabled,$conf->attachementsaslink->enabled,$conf->attachementsaslink->enabled) // Condition to show each dictionary 163 | ); 164 | */ 165 | 166 | // Boxes 167 | // Add here list of php file(s) stored in core/boxes that contains class to show a box. 168 | $this->boxes = array(); // List of boxes 169 | // Example: 170 | //$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>''));); 171 | 172 | // Permissions 173 | $this->rights = array(); // Permission array used by this module 174 | $r=0; 175 | 176 | // Add here list of permission defined by an id, a label, a boolean and two constant strings. 177 | // Example: 178 | // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) 179 | // $this->rights[$r][1] = 'Permision label'; // Permission label 180 | // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) 181 | // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) 182 | // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) 183 | // $r++; 184 | 185 | 186 | // Main menu entries 187 | $this->menu = array(); // List of menus to add 188 | $r=0; 189 | 190 | // Add here entries to declare new menus 191 | // 192 | // Example to declare a new Top Menu entry and its Left menu entry: 193 | // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu 194 | // 'type'=>'top', // This is a Top menu entry 195 | // 'titre'=>'AttachementsAsLink top menu', 196 | // 'mainmenu'=>'attachementsaslink', 197 | // 'leftmenu'=>'attachementsaslink', 198 | // 'url'=>'/attachementsaslink/pagetop.php', 199 | // 'langs'=>'mylangfile@attachementsaslink', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 200 | // 'position'=>100, 201 | // 'enabled'=>'$conf->attachementsaslink->enabled', // Define condition to show or hide menu entry. Use '$conf->attachementsaslink->enabled' if entry must be visible if module is enabled. 202 | // 'perms'=>'1', // Use 'perms'=>'$user->rights->attachementsaslink->level1->level2' if you want your menu with a permission rules 203 | // 'target'=>'', 204 | // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both 205 | // $r++; 206 | // 207 | // Example to declare a Left Menu entry into an existing Top menu entry: 208 | // $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 209 | // 'type'=>'left', // This is a Left menu entry 210 | // 'titre'=>'AttachementsAsLink left menu', 211 | // 'mainmenu'=>'xxx', 212 | // 'leftmenu'=>'attachementsaslink', 213 | // 'url'=>'/attachementsaslink/pagelevel2.php', 214 | // 'langs'=>'mylangfile@attachementsaslink', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 215 | // 'position'=>100, 216 | // 'enabled'=>'$conf->attachementsaslink->enabled', // Define condition to show or hide menu entry. Use '$conf->attachementsaslink->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 217 | // 'perms'=>'1', // Use 'perms'=>'$user->rights->attachementsaslink->level1->level2' if you want your menu with a permission rules 218 | // 'target'=>'', 219 | // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both 220 | // $r++; 221 | 222 | 223 | // Exports 224 | $r=1; 225 | 226 | // Example: 227 | // $this->export_code[$r]=$this->rights_class.'_'.$r; 228 | // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) 229 | // $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. 230 | // $this->export_permission[$r]=array(array("facture","facture","export")); 231 | // $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'); 232 | // $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'); 233 | // $this->export_sql_start[$r]='SELECT DISTINCT '; 234 | // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; 235 | // $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; 236 | // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; 237 | // $this->export_sql_order[$r] .=' ORDER BY s.nom'; 238 | // $r++; 239 | } 240 | 241 | /** 242 | * Function called when module is enabled. 243 | * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. 244 | * It also creates data directories 245 | * 246 | * @param string $options Options when enabling module ('', 'noboxes') 247 | * @return int 1 if OK, 0 if KO 248 | */ 249 | function init($options='') 250 | { 251 | $sql = array(); 252 | 253 | $result=$this->_load_tables('/attachementsaslink/sql/'); 254 | 255 | return $this->_init($sql, $options); 256 | } 257 | 258 | /** 259 | * Function called when module is disabled. 260 | * Remove from database constants, boxes and permissions from Dolibarr database. 261 | * Data directories are not deleted 262 | * 263 | * @param string $options Options when enabling module ('', 'noboxes') 264 | * @return int 1 if OK, 0 if KO 265 | */ 266 | function remove($options='') 267 | { 268 | $sql = array(); 269 | 270 | return $this->_remove($sql, $options); 271 | } 272 | 273 | } 274 | -------------------------------------------------------------------------------- /core/triggers/interface_99_modAttachementsAsLink_AttachementsAsLinktrigger.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_AttachementsAsLinktrigger.class.php 21 | * \ingroup attachementsaslink 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 InterfaceAttachementsAsLinktrigger 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 = 'attachementsaslink@attachementsaslink'; 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 | } --------------------------------------------------------------------------------