├── config.php ├── img ├── ATM_logo.jpg ├── facturecourrier.png ├── object_facturecourrier.png └── Dolibarr_Preferred_Partner_logo.png ├── ChangeLog.md ├── script └── create-maj-base.php ├── README ├── langs ├── en_US │ └── facturecourrier.lang └── fr_FR │ └── facturecourrier.lang ├── config.default.php ├── lib └── facturecourrier.lib.php ├── admin ├── facturecourrier_about.php └── facturecourrier_setup.php ├── class └── actions_facturecourrier.class.php ├── courrier.php └── core ├── modules └── modFactureCourrier.class.php └── triggers └── interface_99_modFactureCourrier_FactureCourriertrigger.class.php /config.php: -------------------------------------------------------------------------------- 1 | = 10 *06/05/2021* - 1.0.4 11 | - FIX : V13 Compatibility Box Module and GETPOST *06/05/2021* - 1.0.3 12 | -------------------------------------------------------------------------------- /script/create-maj-base.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/facturecourrier.lang: -------------------------------------------------------------------------------- 1 | Module104901Name = FactureCourrier 2 | Module104901Desc = FactureCourrier Descripion 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 | FactureCourrierSetup = FactureCourrier module setup 7 | FactureCourrierAbout = About FactureCourrier -------------------------------------------------------------------------------- /config.default.php: -------------------------------------------------------------------------------- 1 | trans('AbricotNotFound'). ' : Abricot'; 27 | exit; 28 | } 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /langs/fr_FR/facturecourrier.lang: -------------------------------------------------------------------------------- 1 | Module104901Name = FactureCourrier 2 | Module104901Desc = FactureCourrier Descripion 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 | FactureCourrierSetup = Configuration du module FactureCourrier 7 | FactureCourrierAbout = A propos du module FactureCourrier 8 | ClassifyCourrier=Classer ‘envoyée par courrier’ 9 | ClassifyCourrierMsg=Classée ‘envoyée par courrier’ 10 | ClassifyCourrierEvent=%s classée ‘envoyée par courrier’ 11 | UnClassifyCourrier=Effacer la date d’envoi par courrier 12 | UnClassifyCourrierMsg=Date d'envoi par courrier effacée 13 | BillsByPrint=Factures à envoyer par courrier 14 | BillsByPrintOK=Factures envoyées par courrier 15 | FactureCourrier=Factures à envoyer par courrier 16 | FactureCourrierOK=Factures envoyées par courrier 17 | -------------------------------------------------------------------------------- /lib/facturecourrier.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/facturecourrier.lib.php 21 | * \ingroup facturecourrier 22 | * \brief This file is an example module library 23 | * Put some comments here 24 | */ 25 | 26 | function facturecourrierAdminPrepareHead() 27 | { 28 | global $langs, $conf; 29 | 30 | $langs->load("facturecourrier@facturecourrier"); 31 | 32 | $h = 0; 33 | $head = array(); 34 | 35 | $head[$h][0] = dol_buildpath("/facturecourrier/admin/facturecourrier_setup.php", 1); 36 | $head[$h][1] = $langs->trans("Parameters"); 37 | $head[$h][2] = 'settings'; 38 | $h++; 39 | $head[$h][0] = dol_buildpath("/facturecourrier/admin/facturecourrier_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:@facturecourrier:/facturecourrier/mypage.php?id=__ID__' 48 | //); // to add new tab 49 | //$this->tabs = array( 50 | // 'entity:-tabname:Title:@facturecourrier:/facturecourrier/mypage.php?id=__ID__' 51 | //); // to remove a tab 52 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'facturecourrier'); 53 | 54 | return $head; 55 | } 56 | -------------------------------------------------------------------------------- /admin/facturecourrier_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 facturecourrier 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/facturecourrier.lib.php'; 34 | 35 | // Translations 36 | $langs->load("facturecourrier@facturecourrier"); 37 | 38 | // Access control 39 | if (! $user->admin) { 40 | accessforbidden(); 41 | } 42 | 43 | /* 44 | * View 45 | */ 46 | $page_name = "FactureCourrierAbout"; 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 = facturecourrierAdminPrepareHead(); 56 | dol_fiche_head( 57 | $head, 58 | 'about', 59 | $langs->trans("Module104901Name"), 60 | 0, 61 | 'facturecourrier@facturecourrier' 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/facturecourrier_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/facturecourrier.php 21 | * \ingroup facturecourrier 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/facturecourrier.lib.php'; 34 | 35 | // Translations 36 | $langs->load("facturecourrier@facturecourrier"); 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, 'none'), '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 = "FactureCourrierSetup"; 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 = facturecourrierAdminPrepareHead(); 90 | dol_fiche_head( 91 | $head, 92 | 'settings', 93 | $langs->trans("Module104901Name"), 94 | 0, 95 | "facturecourrier@facturecourrier" 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 | print ''; 108 | 109 | /* 110 | // Example with a yes / no select 111 | $var=!$var; 112 | print ''; 113 | print ''; 114 | print ''; 115 | print ''; 123 | */ 124 | print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
Ce module ne dispose pas de paramètres. Voir la fiche société pour configuré de statut d\'envoi de courrier
'.$langs->trans("ParamLabel").' '; 116 | print '
'; 117 | print ''; 118 | print ''; 119 | print $form->selectyesno("CONSTNAME",$conf->global->CONSTNAME,1); 120 | print ''; 121 | print '
'; 122 | print '
'; 125 | 126 | llxFooter(); 127 | 128 | $db->close(); 129 | -------------------------------------------------------------------------------- /class/actions_facturecourrier.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_facturecourrier.class.php 21 | * \ingroup facturecourrier 22 | * \brief This file is an example hook overload class file 23 | * Put some comments here 24 | */ 25 | 26 | /** 27 | * Class ActionsFactureCourrier 28 | */ 29 | class ActionsFactureCourrier 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 doActions($parameters, &$object, &$action, $hookmanager) 63 | { 64 | 65 | if (in_array('invoicecard', explode(':', $parameters['context']))) 66 | { 67 | 68 | if($action == 'update_courrier') { 69 | global $user,$db,$langs; 70 | $object->array_options['options_courrier_envoi'] = time(); 71 | $object->insertExtraFields(); 72 | 73 | dol_include_once('/comm/action/class/actioncomm.class.php'); 74 | 75 | $a=new ActionComm($db); 76 | $a->type_code = 'AC_OTH_AUTO'; 77 | $a->label = $langs->trans('ClassifyCourrierEvent',$object->ref); 78 | $a->fk_element = $object->id; 79 | $a->elementtype = 'facture'; 80 | $a->usertodo = $user; 81 | $a->userdone = $user; 82 | if(property_exists('ActionComm', 'userownerid')) $a->userownerid = $user->id; 83 | $a->percentage = 100; 84 | $a->datep = date('Y-m-d H:i:s'); 85 | if(method_exists($a, 'add')) $a->add($user); 86 | else $res=$a->create($user); 87 | 88 | setEventMessage('ClassifyCourrierMsg'); 89 | } 90 | else if($action == 'no_courrier') { 91 | global $user; 92 | $object->array_options['options_courrier_envoi'] = ''; 93 | $object->insertExtraFields(); 94 | 95 | setEventMessage('UnClassifyCourrierMsg'); 96 | } 97 | 98 | } 99 | 100 | return 0; 101 | } 102 | 103 | function getFormMail($parameters, &$object, &$action, $hookmanager) 104 | { 105 | 106 | if (in_array('formmail', explode(':', $parameters['context']))) 107 | { 108 | 109 | if(!empty($object->param['facid'])) { 110 | global $db; 111 | 112 | $facture = new Facture($db); 113 | $facture->fetch((int)$object->param['facid']); 114 | //var_dump($facture); 115 | 116 | if($facture->socid>0) { 117 | if(empty($facture->thirdparty)) $facture->fetch_thirdparty(); 118 | $societe = & $facture->thirdparty; 119 | 120 | if(!empty($societe->array_options['options_facture_papier']) && $societe->array_options['options_facture_papier'] == 2) { 121 | 122 | ?>id>0 && $object->statut == 1) { 156 | 157 | if(empty($object->thirdparty)) $object->fetch_thirdparty(); 158 | 159 | if(!empty($object->thirdparty->array_options['options_facture_papier']) && $object->thirdparty->array_options['options_facture_papier'] == 2) { 160 | 161 | if(empty($object->array_options['options_courrier_envoi'])) { 162 | ?> 163 | 168 | 173 | 178 | 3 | * Copyright (C) 2004 Eric Seigne 4 | * Copyright (C) 2004-2014 Laurent Destailleur 5 | * Copyright (C) 2005-2012 Regis Houssin 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | /** 22 | * \file htdocs/compta/facture/impayees.php 23 | * \ingroup facture 24 | * \brief Page to list and build liste of unpaid invoices 25 | */ 26 | 27 | require '../../main.inc.php'; 28 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; 29 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; 30 | require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; 31 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; 32 | require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; 33 | 34 | 35 | $langs->load("bills"); 36 | 37 | $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); 38 | $action = GETPOST('action','alpha'); 39 | $option = GETPOST('option', 'none'); 40 | $builddoc_generatebutton=GETPOST('builddoc_generatebutton', 'none'); 41 | 42 | // Security check 43 | if ($user->societe_id) $socid=$user->societe_id; 44 | $result = restrictedArea($user,'facture',$id,''); 45 | 46 | $diroutputpdf=$conf->facture->dir_output . '/unpaid/temp'; 47 | if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user 48 | 49 | 50 | /* 51 | * Action 52 | */ 53 | 54 | if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_search', 'none') && !empty($builddoc_generatebutton)) 55 | { 56 | if (is_array($_POST['toGenerate'])) 57 | { 58 | $arrayofinclusion=array(); 59 | foreach($_POST['toGenerate'] as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/'); 60 | $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC); 61 | 62 | // liste les fichiers 63 | $files = array(); 64 | $factures_bak = $factures ; 65 | foreach($_POST['toGenerate'] as $basename){ 66 | foreach($factures as $facture){ 67 | if(strstr($facture["name"],$basename)){ 68 | $files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"]; 69 | } 70 | } 71 | } 72 | 73 | // Define output language (Here it is not used because we do only merging existing PDF) 74 | $outputlangs = $langs; 75 | $newlang=''; 76 | if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'none')) $newlang=GETPOST('lang_id', 'none'); 77 | if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; 78 | if (! empty($newlang)) 79 | { 80 | $outputlangs = new Translate("",$conf); 81 | $outputlangs->setDefaultLang($newlang); 82 | } 83 | 84 | // Create empty PDF 85 | $pdf=pdf_getInstance(); 86 | if (class_exists('TCPDF')) 87 | { 88 | $pdf->setPrintHeader(false); 89 | $pdf->setPrintFooter(false); 90 | } 91 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); 92 | 93 | if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); 94 | 95 | // Add all others 96 | foreach($files as $file) 97 | { 98 | // Charge un document PDF depuis un fichier. 99 | $pagecount = $pdf->setSourceFile($file); 100 | for ($i = 1; $i <= $pagecount; $i++) 101 | { 102 | $tplidx = $pdf->importPage($i); 103 | $s = $pdf->getTemplatesize($tplidx); 104 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); 105 | $pdf->useTemplate($tplidx); 106 | } 107 | } 108 | 109 | // Create output dir if not exists 110 | dol_mkdir($diroutputpdf); 111 | 112 | // Save merged file 113 | $filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Courrier"))); 114 | if ($pagecount) 115 | { 116 | $now=dol_now(); 117 | $file=$diroutputpdf.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; 118 | $pdf->Output($file,'F'); 119 | if (! empty($conf->global->MAIN_UMASK)) 120 | @chmod($file, octdec($conf->global->MAIN_UMASK)); 121 | } 122 | else 123 | { 124 | $mesg='
'.$langs->trans('NoPDFAvailableForChecked').'
'; 125 | } 126 | } 127 | else 128 | { 129 | $mesg='
'.$langs->trans('InvoiceNotChecked').'
' ; 130 | } 131 | } 132 | 133 | // Remove file 134 | if ($action == 'remove_file') 135 | { 136 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; 137 | 138 | $langs->load("other"); 139 | $upload_dir = $diroutputpdf; 140 | $file = $upload_dir . '/' . GETPOST('file', 'none'); 141 | $ret=dol_delete_file($file,0,0,0,''); 142 | if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile', 'none'))); 143 | else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'none')), 'errors'); 144 | $action=''; 145 | } 146 | 147 | 148 | 149 | /* 150 | * View 151 | */ 152 | 153 | $form = new Form($db); 154 | $formfile = new FormFile($db); 155 | 156 | if(GETPOST('courrier', 'none') == 1) $title=$langs->trans("BillsByPrintOK"); 157 | else $title=$langs->trans("BillsByPrint"); 158 | 159 | 160 | llxHeader('',$title); 161 | 162 | ?> 163 | 173 | liste_limit * $page; 189 | $pageprev = $page - 1; 190 | $pagenext = $page + 1; 191 | if (! $sortfield) $sortfield="f.date_lim_reglement"; 192 | if (! $sortorder) $sortorder="ASC"; 193 | 194 | $limit = $conf->liste_limit; 195 | 196 | $invoiceRefDBField = floatval(DOL_VERSION) >= 10 ? 'ref' : 'facnumber'; 197 | 198 | $sql = "SELECT s.nom, s.rowid as socid"; 199 | $sql.= ", f.rowid as facid, f." .$invoiceRefDBField." as ref, f.ref_client, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp"; 200 | $sql.= ", f.datef as df, f.date_lim_reglement as datelimite,fex.courrier_envoi"; 201 | $sql.= ", f.paye as paye, f.fk_statut, f.type"; 202 | $sql.= ", sum(pf.amount) as am"; 203 | if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; 204 | $sql.= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields sex ON (sex.fk_object = s.rowid)"; 205 | if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; 206 | $sql.= ",".MAIN_DB_PREFIX."facture as f LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields fex ON (fex.fk_object = f.rowid)"; 207 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; 208 | $sql.= " WHERE f.fk_soc = s.rowid"; 209 | $sql.= " AND f.entity = ".$conf->entity; 210 | $sql.= " AND f.type IN (0,1,3) AND f.fk_statut = 1"; 211 | 212 | if(GETPOST('courrier', 'none') == 1) $sql.= " AND fex.courrier_envoi IS NOT NULL "; 213 | else $sql.= " AND fex.courrier_envoi IS NULL "; 214 | 215 | $sql.= " AND sex.facture_papier=2"; // facture d'entreprise à envoyée par courrier non envoyée 216 | if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; 217 | if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; 218 | if (! empty($socid)) $sql .= " AND s.rowid = ".$socid; 219 | 220 | if ($search_ref) $sql .= " AND f." .$invoiceRefDBField. " LIKE '%".$db->escape($search_ref)."%'"; 221 | if ($search_refcustomer) $sql .= " AND f.ref_client LIKE '%".$db->escape($search_refcustomer)."%'"; 222 | if ($search_societe) $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'"; 223 | if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'"; 224 | if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'"; 225 | if (GETPOST('sf_ref', 'none')) $sql .= " AND f." .$invoiceRefDBField. " LIKE '%".$db->escape(GETPOST('sf_ref'))."%'"; 226 | $sql.= " GROUP BY s.nom, s.rowid, f.rowid, f." .$invoiceRefDBField. ", f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type "; 227 | if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; 228 | $sql.= " ORDER BY "; 229 | $listfield=explode(',',$sortfield); 230 | foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; 231 | $sql.= " f." .$invoiceRefDBField. " DESC"; 232 | 233 | //$sql .= $db->plimit($limit+1,$offset); 234 | 235 | $resql = $db->query($sql); 236 | if ($resql) 237 | { 238 | $num = $db->num_rows($resql); 239 | 240 | if (! empty($socid)) 241 | { 242 | $soc = new Societe($db); 243 | $soc->fetch($socid); 244 | } 245 | 246 | $param=""; 247 | $param.=(! empty($socid)?"&socid=".$socid:""); 248 | $param.=(! empty($option)?"&option=".$option:""); 249 | if ($search_ref) $param.='&search_ref='.urlencode($search_ref); 250 | if ($search_refcustomer) $param.='&search_ref='.urlencode($search_refcustomer); 251 | if ($search_societe) $param.='&search_societe='.urlencode($search_societe); 252 | if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht); 253 | if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc); 254 | if ($late) $param.='&late='.urlencode($late); 255 | 256 | $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; 257 | $urlsource.=str_replace('&','&',$param); 258 | 259 | print_fiche_titre($title); 260 | //print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page 261 | 262 | dol_htmloutput_mesg($mesg); 263 | 264 | print '
'; 265 | print ''; 266 | if ($late) print ''; 267 | 268 | $i = 0; 269 | print ''; 270 | print ''; 271 | print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.".$invoiceRefDBField."","",$param,"",$sortfield,$sortorder); 272 | print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); 273 | print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder); 274 | print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); 275 | print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); 276 | print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder); 277 | print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder); 278 | print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); 279 | print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder); 280 | print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder); 281 | print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); 282 | print_liste_field_titre($langs->trans("Merge"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); 283 | print "\n"; 284 | 285 | // Lignes des champs de filtre 286 | print ''; 287 | // Ref 288 | print ''; 290 | print ''; 293 | print ''; 294 | print ''; 295 | print ''; 296 | print ''; 297 | print ''; 298 | print ''; 299 | print ''; 300 | print ''; 301 | print ''; 304 | print ''; 307 | print "\n"; 308 | 309 | if ($num > 0) 310 | { 311 | $var=True; 312 | $total_ht=0; 313 | $total_tva=0; 314 | $total_ttc=0; 315 | $total_paid=0; 316 | 317 | $facturestatic=new Facture($db); 318 | 319 | while ($i < $num) 320 | { 321 | $objp = $db->fetch_object($resql); 322 | $date_limit=$db->jdate($objp->datelimite); 323 | 324 | $var=!$var; 325 | 326 | print ""; 327 | $classname = "impayee"; 328 | 329 | print '\n"; 357 | 358 | // Customer ref 359 | print ''; 362 | 363 | print ''."\n"; 364 | print ''."\n"; 365 | 366 | print ''; 367 | 368 | print ''; 369 | print ''; 375 | print ''; 376 | print ''; 382 | 383 | // Remain to receive 384 | print ''; 385 | 386 | // Status of invoice 387 | print ''; 390 | 391 | // Checkbox 392 | print '' ; 398 | 399 | print "\n"; 400 | $total_ht+=$objp->total_ht; 401 | $total_tva+=($objp->total_tva + $tx1 + $tx2 + $revenuestamp); 402 | $total_ttc+=$objp->total_ttc; 403 | $total_paid+=$objp->am + $cn; 404 | 405 | $i++; 406 | } 407 | 408 | print ''; 409 | print ''; 410 | print ''; 411 | print ''; 412 | print ''; 413 | print ''; 414 | print ''; 415 | print ''; 416 | print ''; 417 | print "\n"; 418 | } 419 | 420 | print "
'; 289 | print ''; 291 | print ''; 292 | print '     '; 302 | print ''; 303 | print ''; 305 | if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; 306 | print '
'; 330 | 331 | $facturestatic->id=$objp->facid; 332 | $facturestatic->ref=$objp->ref; 333 | $facturestatic->type=$objp->type; 334 | 335 | print ''; 336 | 337 | // Ref 338 | print ''; 341 | 342 | // Warning picto 343 | print ''; 346 | 347 | // PDF Picto 348 | print ''; 353 | 354 | print '
'; 339 | print $facturestatic->getNomUrl(1); 340 | print ''; 344 | if ($date_limit < ($now - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); 345 | print ''; 349 | $filename=dol_sanitizeFileName($objp->ref); 350 | $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->ref); 351 | print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); 352 | print '
'; 355 | 356 | print "
'; 360 | print $objp->ref_client; 361 | print ''.dol_print_date($db->jdate($objp->df),'day').''.dol_print_date($db->jdate($objp->datelimite),'day').''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,28).''.price($objp->total_ht).''.price($objp->total_tva); 370 | $tx1=price2num($objp->localtax1); 371 | $tx2=price2num($objp->localtax2); 372 | $revenuestamp=price2num($objp->revenuestamp); 373 | if (! empty($tx1) || ! empty($tx2) || ! empty($revenuestamp)) print '+'.price($tx1 + $tx2 + $revenuestamp); 374 | print ''.price($objp->total_ttc).''; 377 | $cn=$facturestatic->getSumCreditNotesUsed(); 378 | if (! empty($objp->am)) print price($objp->am); 379 | if (! empty($objp->am) && ! empty($cn)) print '+'; 380 | if (! empty($cn)) print price($cn); 381 | print ''.((! empty($objp->am) || ! empty($cn))?price($objp->total_ttc-$objp->am-$cn):' ').''; 388 | print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); 389 | print ''; 393 | // if (! empty($formfile->numoffiles)) 394 | print ''; 395 | // else 396 | // print ' '; 397 | print '
'.$langs->trans("Total").''.price($total_ht).''.price($total_tva).''.price($total_ttc).''.price($total_paid).''.price($total_ttc - $total_paid).'  
"; 421 | 422 | /* 423 | * Show list of available documents 424 | */ 425 | $filedir=$diroutputpdf; 426 | $genallowed=$user->rights->facture->lire; 427 | $delallowed=$user->rights->facture->lire; 428 | 429 | $modulesubdir = str_replace($conf->facture->dir_output, '', $diroutputpdf); 430 | 431 | print '
'; 432 | print ''; 433 | // We disable multilang because we concat already existing pdf. 434 | $formfile->show_documents('facture',$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed,'',1,1,0,48,1,$param,$langs->trans("PDFMerge"),$langs->trans("PDFMerge")); 435 | print '
'; 436 | 437 | $db->free($resql); 438 | } 439 | else dol_print_error($db,''); 440 | 441 | 442 | llxFooter(); 443 | $db->close(); 444 | ?> 445 | -------------------------------------------------------------------------------- /core/modules/modFactureCourrier.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 facturecourrier Module FactureCourrier 22 | * \brief Example of a module descriptor. 23 | * Such a file must be copied into htdocs/facturecourrier/core/modules directory. 24 | * \file htdocs/facturecourrier/core/modules/modFactureCourrier.class.php 25 | * \ingroup facturecourrier 26 | * \brief Description and activation file for module FactureCourrier 27 | */ 28 | include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; 29 | 30 | 31 | /** 32 | * Description and activation class for module FactureCourrier 33 | */ 34 | class modFactureCourrier 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 = 104901; // 104000 to 104999 for ATM CONSULTING 50 | // Key text used to identify module (for permissions, menus, etc...) 51 | $this->rights_class = 'facturecourrier'; 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 FactureCourrier"; 60 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version 61 | $this->version = '1.0.5'; 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='facturecourrier@facturecourrier'; 70 | 71 | // Defined all module parts (triggers, login, substitutions, menus, css, etc...) 72 | // for default path (eg: /facturecourrier/core/xxxxx) (0=disable, 1=enable) 73 | // for specific path of parts (eg: /facturecourrier/core/modules/barcode) 74 | // for specific css file (eg: /facturecourrier/css/facturecourrier.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('/facturecourrier/css/facturecourrier.css.php'), // Set this to relative path of css file if module has its own css file 85 | // 'js' => array('/facturecourrier/js/facturecourrier.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@facturecourrier')) // Set here all workflow context managed by module 89 | // ); 90 | $this->module_parts = array( 91 | 92 | 'hooks'=>array('invoicecard','formmail') 93 | ); 94 | 95 | // Data directories to create when module is enabled. 96 | // Example: this->dirs = array("/facturecourrier/temp"); 97 | $this->dirs = array(); 98 | 99 | // Config pages. Put here list of php page, stored into facturecourrier/admin directory, to use to setup module. 100 | $this->config_page_url = array("facturecourrier_setup.php@facturecourrier"); 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("facturecourrier@facturecourrier"); 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@facturecourrier:$user->rights->facturecourrier->read:/facturecourrier/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 120 | // 'objecttype:+tabname2:Title2:mylangfile@facturecourrier:$user->rights->othermodule->read:/facturecourrier/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->facturecourrier->enabled)) 146 | { 147 | $conf->facturecourrier=new stdClass(); 148 | $conf->facturecourrier->enabled=0; 149 | } 150 | $this->dictionaries=array(); 151 | /* Example: 152 | if (! isset($conf->facturecourrier->enabled)) $conf->facturecourrier->enabled=0; // This is to avoid warnings 153 | $this->dictionaries=array( 154 | 'langs'=>'mylangfile@facturecourrier', 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->facturecourrier->enabled,$conf->facturecourrier->enabled,$conf->facturecourrier->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'=>'FactureCourrier top menu', 197 | // 'mainmenu'=>'facturecourrier', 198 | // 'leftmenu'=>'facturecourrier', 199 | // 'url'=>'/facturecourrier/pagetop.php', 200 | // 'langs'=>'mylangfile@facturecourrier', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 201 | // 'position'=>100, 202 | // 'enabled'=>'$conf->facturecourrier->enabled', // Define condition to show or hide menu entry. Use '$conf->facturecourrier->enabled' if entry must be visible if module is enabled. 203 | // 'perms'=>'1', // Use 'perms'=>'$user->rights->facturecourrier->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='.((float)DOL_VERSION > 6 ? 'billing' : 'accountancy').',fk_leftmenu=customers_bills', // 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'=>'FactureCourrier', 212 | 'mainmenu'=>(float)DOL_VERSION > 6 ? 'billing' : 'accountancy', 213 | 'leftmenu'=>'facture_courrier', 214 | 'url'=>'/facturecourrier/courrier.php', 215 | 'langs'=>'facturecourrier@facturecourrier', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 216 | // 'position'=>102, 217 | 'enabled'=>'$conf->facturecourrier->enabled', // Define condition to show or hide menu entry. Use '$conf->facturecourrier->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 218 | 'perms'=>'$user->rights->facture->lire', // Use 'perms'=>'$user->rights->facturecourrier->level1->level2' if you want your menu with a permission rules 219 | 'target'=>'', 220 | 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both 221 | $r++; 222 | $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu='.((float)DOL_VERSION > 6 ? 'billing' : 'accountancy').',fk_leftmenu=customers_bills', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 223 | 'type'=>'left', // This is a Left menu entry 224 | 'titre'=>'FactureCourrierOK', 225 | 'mainmenu'=>(float)DOL_VERSION > 6 ? 'billing' : 'accountancy', 226 | 'leftmenu'=>'facture_courrier_ok', 227 | 'url'=>'/facturecourrier/courrier.php?courrier=1', 228 | 'langs'=>'facturecourrier@facturecourrier', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 229 | // 'position'=>103, 230 | 'enabled'=>'$conf->facturecourrier->enabled', // Define condition to show or hide menu entry. Use '$conf->facturecourrier->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 231 | 'perms'=>'$user->rights->facture->lire', // Use 'perms'=>'$user->rights->facturecourrier->level1->level2' if you want your menu with a permission rules 232 | 'target'=>'', 233 | 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both 234 | $r++; 235 | 236 | // Exports 237 | $r=1; 238 | 239 | // Example: 240 | // $this->export_code[$r]=$this->rights_class.'_'.$r; 241 | // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) 242 | // $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. 243 | // $this->export_permission[$r]=array(array("facture","facture","export")); 244 | // $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'); 245 | // $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'); 246 | // $this->export_sql_start[$r]='SELECT DISTINCT '; 247 | // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; 248 | // $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; 249 | // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; 250 | // $this->export_sql_order[$r] .=' ORDER BY s.nom'; 251 | // $r++; 252 | } 253 | 254 | /** 255 | * Function called when module is enabled. 256 | * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. 257 | * It also creates data directories 258 | * 259 | * @param string $options Options when enabling module ('', 'noboxes') 260 | * @return int 1 if OK, 0 if KO 261 | */ 262 | function init($options='') 263 | { 264 | $sql = array(); 265 | 266 | define('INC_FROM_DOLIBARR',true); 267 | 268 | dol_include_once('/facturecourrier/config.php'); 269 | dol_include_once('/facturecourrier/script/create-maj-base.php'); 270 | 271 | dol_include_once('/core/class/extrafields.class.php'); 272 | $extrafields=new ExtraFields($this->db); 273 | $res = $extrafields->addExtraField('facture_papier', 'Facture par courrier', 'select', 0, '', 'societe',0, 0,'', array("options"=> array(1=>'Non',2=>'Oui'))); 274 | $res = $extrafields->addExtraField('courrier_envoi', 'Facture envoyée par courrier', 'date', 0, '', 'facture',0, 0,''); 275 | 276 | $result=$this->_load_tables('/facturecourrier/sql/'); 277 | 278 | return $this->_init($sql, $options); 279 | } 280 | 281 | /** 282 | * Function called when module is disabled. 283 | * Remove from database constants, boxes and permissions from Dolibarr database. 284 | * Data directories are not deleted 285 | * 286 | * @param string $options Options when enabling module ('', 'noboxes') 287 | * @return int 1 if OK, 0 if KO 288 | */ 289 | function remove($options='') 290 | { 291 | $sql = array(); 292 | 293 | return $this->_remove($sql, $options); 294 | } 295 | 296 | } 297 | -------------------------------------------------------------------------------- /core/triggers/interface_99_modFactureCourrier_FactureCourriertrigger.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_FactureCourriertrigger.class.php 21 | * \ingroup facturecourrier 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 InterfaceFactureCourriertrigger 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 = 'facturecourrier@facturecourrier'; 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 | } --------------------------------------------------------------------------------