[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> 5 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> 6 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * 22 * $Id: expedition.php,v 1.17 2005/07/31 09:16:53 rodolphe Exp $ 23 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/expedition.php,v $ 24 */ 25 26 /** 27 \file htdocs/admin/expedition.php 28 \ingroup expedition 29 \brief Page d'administration/configuration du module Expedition 30 \version $Revision: 1.17 $ 31 */ 32 33 require ("./pre.inc.php"); 34 35 $langs->load("admin"); 36 $langs->load("sendings"); 37 38 if (!$user->admin) accessforbidden(); 39 40 // positionne la variable pour le test d'affichage de l'icone 41 $expedition_addon_var_pdf = EXPEDITION_ADDON_PDF; 42 $expedition_default = EXPEDITION_ADDON; 43 44 /* 45 * Actions 46 */ 47 if ($_GET["action"] == 'set') 48 { 49 $file = DOL_DOCUMENT_ROOT . '/expedition/mods/methode_expedition_'.$_GET["value"].'.modules.php'; 50 51 $classname = 'methode_expedition_'.$_GET["value"]; 52 require_once($file); 53 54 $obj = new $classname($db); 55 56 $obj->Active($_GET["statut"]); 57 58 Header("Location: expedition.php"); 59 } 60 61 if ($_GET["action"] == 'setpdf') 62 { 63 $db->begin(); 64 65 $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON_PDF';"; 66 $resql=$db->query($sql); 67 if ($resql) 68 { 69 $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON_PDF','".$_GET["value"]."',0)"; 70 $resql=$db->query($sql); 71 if ($resql) 72 { 73 // la constante qui a été lue en avant du nouveau set 74 // on passe donc par une variable pour avoir un affichage cohérent 75 $expedition_addon_var_pdf = $value; 76 77 $db->commit(); 78 79 Header("Location: ".$_SERVER["PHP_SELF"]); 80 exit; 81 } 82 else 83 { 84 $db->rollback(); 85 dolibarr_print_error($db); 86 } 87 } 88 else 89 { 90 $db->rollback(); 91 dolibarr_print_error($db); 92 } 93 } 94 95 if ($_GET["action"] == 'setdef') 96 { 97 $db->begin(); 98 99 $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON';"; 100 $resql=$db->query($sql); 101 if ($resql) 102 { 103 $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON','".$_GET["value"]."',0)"; 104 $resql=$db->query($sql); 105 if ($resql) 106 { 107 // la constante qui a été lue en avant du nouveau set 108 // on passe donc par une variable pour avoir un affichage cohérent 109 $expedition_default = $_GET["value"]; 110 $db->commit(); 111 112 Header("Location: ".$_SERVER["PHP_SELF"]); 113 exit; 114 } 115 else 116 { 117 $db->rollback(); 118 dolibarr_print_error($db); 119 } 120 } 121 else 122 { 123 $db->rollback(); 124 dolibarr_print_error($db); 125 } 126 } 127 128 /* 129 * 130 */ 131 132 $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE statut = 1"; 133 $db->fetch_all_rows($sql, $mods); 134 135 llxHeader(); 136 137 $dir = DOL_DOCUMENT_ROOT."/expedition/mods/"; 138 139 // Méthode de livraison 140 141 print_titre($langs->trans("SendingsSetup")); 142 143 print "<br>"; 144 145 print_titre($langs->trans("SendingMethod")); 146 147 print '<table class="noborder" width="100%">'; 148 print '<tr class="liste_titre">'; 149 print '<td width="140">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>'; 150 print '<td align="center"> </td>'; 151 print '<td align="center">'.$langs->trans("Active").'</td>'; 152 print '<td align="center">'.$langs->trans("Default").'</td>'; 153 print "</tr>\n"; 154 155 if(is_dir($dir)) { 156 $handle=opendir($dir); 157 $var=true; 158 159 while (($file = readdir($handle))!==false) 160 { 161 if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_') 162 { 163 $name = substr($file, 19, strlen($file) - 31); 164 $classname = substr($file, 0, strlen($file) - 12); 165 166 require_once($dir.$file); 167 168 $obj = new $classname(); 169 170 $var=!$var; 171 print "<tr $bc[$var]><td>"; 172 echo $obj->name; 173 print "</td><td>\n"; 174 175 print $obj->description; 176 177 print '</td><td align="center">'; 178 179 if (in_array($obj->id, $mods)) 180 { 181 print img_tick(); 182 print '</td><td align="center">'; 183 print '<a href="expedition.php?action=set&statut=0&value='.$name.'">'.$langs->trans("Disable").'</a>'; 184 185 } 186 else 187 { 188 print ' </td><td align="center">'; 189 print '<a href="expedition.php?action=set&statut=1&value='.$name.'">'.$langs->trans("Activate").'</a>'; 190 } 191 192 print '</td>'; 193 194 // Default 195 print '<td align="center">'; 196 if ($expedition_default == "$name") 197 { 198 print img_tick(); 199 } 200 else 201 { 202 print '<a href="expedition.php?action=setdef&value='.$name.'">'.$langs->trans("Default").'</a>'; 203 } 204 print '</td>'; 205 print '</tr>'; 206 } 207 } 208 closedir($handle); 209 } 210 else 211 { 212 print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n"; 213 } 214 print '</table>'; 215 216 print '<br>'; 217 218 // PDF 219 220 print_titre($langs->trans("SendingsReceiptModel")); 221 222 print '<table class="noborder" width="100%">'; 223 print '<tr class="liste_titre">'; 224 print '<td width="140">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>'; 225 print '<td align="center" colspan="2">'.$langs->trans("Active").'</td>'; 226 print "</tr>\n"; 227 228 clearstatcache(); 229 230 $dir = DOL_DOCUMENT_ROOT."/expedition/mods/pdf/"; 231 232 if(is_dir($dir)) 233 { 234 $handle=opendir($dir); 235 $var=true; 236 237 while (($file = readdir($handle))!==false) 238 { 239 if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_') 240 { 241 $name = substr($file, 15, strlen($file) - 27); 242 $classname = substr($file, 0, strlen($file) - 12); 243 244 $var=!$var; 245 print "<tr $bc[$var]><td>"; 246 print $name; 247 print "</td><td>\n"; 248 require_once($dir.$file); 249 $obj = new $classname(); 250 251 print $obj->description; 252 253 254 print '</td><td align="center">'; 255 256 if ($expedition_addon_var_pdf == "$name") 257 { 258 print img_tick(); 259 } 260 else 261 { 262 print " "; 263 } 264 265 print "</td><td>\n"; 266 267 print '<a href="expedition.php?action=setpdf&value='.$name.'">'.$langs->trans("Activate").'</a>'; 268 269 print '</td></tr>'; 270 } 271 } 272 closedir($handle); 273 } 274 else 275 { 276 print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n"; 277 } 278 print '</table>'; 279 280 /* 281 * 282 * 283 */ 284 285 $db->close(); 286 287 llxFooter(); 288 ?>
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 |
![]() |