| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: interface_demo.class.php,v 1.7 2005/12/10 13:56:05 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/triggers/interface_demo.class.php,v $ 20 */ 21 22 /** 23 \file htdocs/includes/triggers/interface_demo.class.php 24 \ingroup core 25 \brief Fichier de demo de personalisation des actions du workflow 26 \remarks Son propre fichier d'actions peut etre créé par recopie de celui-ci: 27 - Le nom du fichier doit etre interface_xxx.class.php 28 - Le fichier doit rester stocké dans includes/triggers 29 - Le nom de la classe doit etre InterfaceXxx 30 */ 31 32 33 /** 34 \class InterfaceDemo 35 \brief Classe des fonctions triggers des actions personalisées du workflow 36 */ 37 38 class InterfaceDemo 39 { 40 var $db; 41 42 /** 43 * \brief Constructeur. 44 * \param DB Handler d'accès base 45 */ 46 function InterfaceDemo($DB) 47 { 48 $this->db = $DB ; 49 50 $this->name = "Demo"; 51 $this->family = "demo"; 52 $this->description = "Les triggers de ce composant sont des fonctions vierges. Elles n'ont aucun effet. Ce composant est fourni à des fins de tutorial."; 53 $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version 54 } 55 56 /** 57 * \brief Renvoi nom du lot de triggers 58 * \return string Nom du lot de triggers 59 */ 60 function getName() 61 { 62 return $this->name; 63 } 64 65 /** 66 * \brief Renvoi descriptif du lot de triggers 67 * \return string Descriptif du lot de triggers 68 */ 69 function getDesc() 70 { 71 return $this->description; 72 } 73 74 /** 75 * \brief Renvoi version du lot de triggers 76 * \return string Version du lot de triggers 77 */ 78 function getVersion() 79 { 80 global $langs; 81 $langs->load("admin"); 82 83 if ($this->version == 'experimental') return $langs->trans("Experimental"); 84 elseif ($this->version == 'dolibarr') return DOL_VERSION; 85 elseif ($this->version) return $this->version; 86 else return $langs->trans("Unknown"); 87 } 88 89 /** 90 * \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr. 91 * D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers 92 * \param action Code de l'evenement 93 * \param object Objet concerné 94 * \param user Objet user 95 * \param lang Objet lang 96 * \param conf Objet conf 97 * \return int <0 si ko, 0 si aucune action faite, >0 si ok 98 */ 99 function run_trigger($action,$object,$user,$langs,$conf) 100 { 101 // Mettre ici le code à exécuter en réaction de l'action 102 // Les données de l'action sont stockées dans $object 103 104 // Users 105 if ($action == 'USER_CREATE') 106 { 107 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); 108 } 109 elseif ($action == 'USER_MODIFY') 110 { 111 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); 112 } 113 elseif ($action == 'USER_DISABLE') 114 { 115 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); 116 } 117 // Companies 118 elseif ($action == 'COMPANY_CREATE') 119 { 120 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); 121 } 122 elseif ($action == 'COMPANY_MODIFY') 123 { 124 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); 125 } 126 elseif ($action == 'COMPANY_DELETE') 127 { 128 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); 129 } 130 // Proposals 131 elseif ($action == 'PROPAL_CREATE') 132 { 133 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 134 } 135 elseif ($action == 'PROPAL_MODIFY') 136 { 137 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 138 } 139 elseif ($action == 'PROPAL_VALIDATE') 140 { 141 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 142 } 143 elseif ($action == 'PROPAL_CLOSE_SIGNED') 144 { 145 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 146 } 147 elseif ($action == 'PROPAL_CLOSE_REFUSED') 148 { 149 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 150 } 151 // Contracts 152 elseif ($action == 'CONTRACT_CREATE') 153 { 154 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 155 } 156 elseif ($action == 'CONTRACT_MODIFY') 157 { 158 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 159 } 160 elseif ($action == 'CONTRACT_ACTIVATE') 161 { 162 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 163 } 164 elseif ($action == 'CONTRACT_CANCEL') 165 { 166 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 167 } 168 elseif ($action == 'CONTRACT_CLOSE') 169 { 170 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 171 } 172 elseif ($action == 'CONTRACT_DELETE') 173 { 174 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 175 } 176 // Bills 177 elseif ($action == 'BILL_CREATE') 178 { 179 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 180 } 181 elseif ($action == 'BILL_MODIFY') 182 { 183 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 184 } 185 elseif ($action == 'BILL_VALIDATE') 186 { 187 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 188 } 189 elseif ($action == 'BILL_CANCEL') 190 { 191 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 192 } 193 elseif ($action == 'BILL_DELETE') 194 { 195 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 196 } 197 // Products 198 elseif ($action == 'PRODUCT_CREATE') 199 { 200 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 201 } 202 elseif ($action == 'PRODUCT_MODIFY') 203 { 204 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 205 } 206 elseif ($action == 'PRODUCT_DELETE') 207 { 208 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 209 } 210 elseif ($action == 'ORDER_CREATE') 211 { 212 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 213 } 214 elseif ($action == 'ORDER_MODIFY') 215 { 216 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 217 } 218 elseif ($action == 'ORDER_DELETE') 219 { 220 dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); 221 } 222 else 223 { 224 dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action."); 225 return -1; 226 } 227 return 0; 228 } 229 230 } 231 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
|