2004-10-19 20:58:50 +02:00
|
|
|
|
<?php
|
2004-07-27 10:15:12 +02:00
|
|
|
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-02-21 00:40:13 +01:00
|
|
|
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
2004-09-01 23:23:20 +02:00
|
|
|
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
2004-09-11 01:17:33 +02:00
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
|
|
|
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
2003-11-19 15:57:07 +01:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
*
|
|
|
|
|
|
* $Id$
|
|
|
|
|
|
* $Source$
|
|
|
|
|
|
*/
|
2004-08-29 14:01:58 +02:00
|
|
|
|
|
|
|
|
|
|
/*! \file htdocs/admin/expedition.php
|
|
|
|
|
|
\ingroup expedition
|
|
|
|
|
|
\brief Page d'administration/configuration du module Expedition
|
|
|
|
|
|
\version $Revision$
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
require("./pre.inc.php");
|
|
|
|
|
|
|
2004-08-29 14:01:58 +02:00
|
|
|
|
$langs->load("admin");
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->admin)
|
|
|
|
|
|
accessforbidden();
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
if ($action == 'nbprod' && $user->admin)
|
|
|
|
|
|
{
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_NEW_FORM_NB_PRODUCT';";
|
2004-09-01 23:23:20 +02:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
$sql ='';
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_NEW_FORM_NB_PRODUCT','".$value."',0);";
|
2004-09-01 23:23:20 +02:00
|
|
|
|
|
|
|
|
|
|
//$sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'EXPEDITION_NEW_FORM_NB_PRODUCT', value='".$value."', visible=0";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
Header("Location: expedition.php");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
llxHeader();
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-02-14 13:25:48 +01:00
|
|
|
|
if ($_GET["action"] == 'set')
|
2003-11-19 15:57:07 +01:00
|
|
|
|
{
|
2004-02-14 13:25:48 +01:00
|
|
|
|
$file = DOL_DOCUMENT_ROOT . '/includes/modules/expedition/methode_expedition_'.$_GET["value"].'.modules.php';
|
2004-07-27 10:15:12 +02:00
|
|
|
|
|
2004-02-14 13:25:48 +01:00
|
|
|
|
$classname = 'methode_expedition_'.$_GET["value"];
|
|
|
|
|
|
require_once($file);
|
|
|
|
|
|
|
2004-09-10 21:30:08 +02:00
|
|
|
|
$obj = new $classname();
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition_methode WHERE rowid = ".$obj->id.";";
|
2004-09-10 21:30:08 +02:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
$sql='';
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle,description,status) VALUES (".$obj->id.",'".$obj->code."','".$obj->name."','".addslashes($obj->description)."',".$_GET["statut"].");";
|
2004-09-10 21:30:08 +02:00
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
2004-09-10 21:30:08 +02:00
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// positionne la variable pour le test d'affichage de l'icone
|
|
|
|
|
|
|
|
|
|
|
|
$expedition_addon_var_pdf = EXPEDITION_ADDON_PDF;
|
|
|
|
|
|
|
2004-07-27 10:15:12 +02:00
|
|
|
|
if ($_GET["action"] == 'setpdf')
|
2003-11-19 15:57:07 +01:00
|
|
|
|
{
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON_PDF';";
|
2004-09-01 23:23:20 +02:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
$sql='';
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON_PDF','".$_GET["value"]."',0)";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
// la constante qui a <20>t<EFBFBD> lue en avant du nouveau set
|
|
|
|
|
|
// on passe donc par une variable pour avoir un affichage coh<6F>rent
|
|
|
|
|
|
$expedition_addon_var_pdf = $value;
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
|
|
* On la set active
|
|
|
|
|
|
*/
|
2004-02-01 01:55:46 +01:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$value."')";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-02-14 13:25:48 +01:00
|
|
|
|
$expedition_default = EXPEDITION_DEFAULT;
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
2004-02-14 13:25:48 +01:00
|
|
|
|
if ($_GET["action"] == 'setdef')
|
2003-11-19 15:57:07 +01:00
|
|
|
|
{
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON';";
|
2004-09-01 23:23:20 +02:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
$sql='';
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON','".$value."',0)";
|
2004-09-01 23:23:20 +02:00
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
// la constante qui a <20>t<EFBFBD> lue en avant du nouveau set
|
|
|
|
|
|
// on passe donc par une variable pour avoir un affichage coh<6F>rent
|
2004-02-14 13:25:48 +01:00
|
|
|
|
$expedition_default = $_GET["value"];
|
2003-11-19 15:57:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
*
|
|
|
|
|
|
*
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
$def = array();
|
|
|
|
|
|
|
2004-02-01 01:55:46 +01:00
|
|
|
|
$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."propal_model_pdf";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
while ($i < $db->num_rows())
|
|
|
|
|
|
{
|
|
|
|
|
|
$array = $db->fetch_array($i);
|
|
|
|
|
|
array_push($def, $array[0]);
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print $db->error();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-02-14 13:25:48 +01:00
|
|
|
|
$dir = DOL_DOCUMENT_ROOT."/includes/modules/expedition/";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* M<EFBFBD>thode de livraison
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print_titre("Configuration du module Expedition/Livraisons");
|
|
|
|
|
|
|
|
|
|
|
|
print "<br>";
|
|
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
print_titre("M<EFBFBD>thode de livraison");
|
|
|
|
|
|
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print '<table class="noborder" cellpadding="3" cellspacing="0">';
|
2003-11-19 15:57:07 +01:00
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
|
print '<td>Nom</td><td>Info</td>';
|
|
|
|
|
|
print '<td align="center" colspan="2">Actif</td>';
|
|
|
|
|
|
print '<td align="center" colspan="2">D<>faut</td>';
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
2004-09-10 21:30:08 +02:00
|
|
|
|
if(is_dir($dir)) {
|
|
|
|
|
|
$handle=opendir($dir);
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
2004-09-10 21:30:08 +02:00
|
|
|
|
while (($file = readdir($handle))!==false)
|
2003-11-19 15:57:07 +01:00
|
|
|
|
{
|
2004-09-10 21:30:08 +02:00
|
|
|
|
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_')
|
2003-11-19 15:57:07 +01:00
|
|
|
|
{
|
2004-09-10 21:30:08 +02:00
|
|
|
|
$name = substr($file, 19, strlen($file) - 31);
|
|
|
|
|
|
$classname = substr($file, 0, strlen($file) - 12);
|
|
|
|
|
|
|
|
|
|
|
|
require_once($dir.$file);
|
|
|
|
|
|
|
|
|
|
|
|
$obj = new $classname();
|
|
|
|
|
|
|
|
|
|
|
|
print '<tr class="pair"><td>';
|
|
|
|
|
|
echo $obj->name;
|
2003-11-19 15:57:07 +01:00
|
|
|
|
print "</td><td>\n";
|
2004-09-10 21:30:08 +02:00
|
|
|
|
|
|
|
|
|
|
print $obj->description;
|
|
|
|
|
|
|
|
|
|
|
|
print '</td><td align="center">';
|
|
|
|
|
|
|
|
|
|
|
|
if (in_array($name, $def))
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
|
|
|
|
|
|
print "</td><td>\n";
|
|
|
|
|
|
print '<a href="expedition.php?action=set&statut=0&value='.$name.'">d<>sactiver</a>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print " ";
|
|
|
|
|
|
print "</td><td>\n";
|
|
|
|
|
|
print '<a href="expedition.php?action=set&statut=1&value='.$name.'">activer</a>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print '</td><td align="center">';
|
|
|
|
|
|
|
|
|
|
|
|
if ($expedition_default == "$name")
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print " ";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
print "</td><td>\n";
|
2004-09-10 21:30:08 +02:00
|
|
|
|
|
|
|
|
|
|
print '<a href="expedition.php?action=setdef&value='.$name.'">activer</a>';
|
|
|
|
|
|
|
|
|
|
|
|
print '</td></tr>';
|
2003-11-19 15:57:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-09-10 21:30:08 +02:00
|
|
|
|
closedir($handle);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print '<br>';
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
|
/*
|
2004-02-21 00:40:13 +01:00
|
|
|
|
*
|
2003-11-19 15:57:07 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
print_titre("Mod<EFBFBD>les bordereau de livraison");
|
|
|
|
|
|
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print '<table class="noborder" cellpadding="3" cellspacing="0">';
|
2003-11-19 15:57:07 +01:00
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
|
print '<td>Nom</td><td>Info</td>';
|
|
|
|
|
|
print '<td align="center" colspan="2">Actif</td>';
|
|
|
|
|
|
print '<td align="center" colspan="2">D<>faut</td>';
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
|
2004-09-10 21:30:08 +02:00
|
|
|
|
if(is_dir($dir)) {
|
|
|
|
|
|
$handle=opendir($dir);
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
2004-09-10 21:30:08 +02:00
|
|
|
|
while (($file = readdir($handle))!==false)
|
2003-11-19 15:57:07 +01:00
|
|
|
|
{
|
2004-09-10 21:30:08 +02:00
|
|
|
|
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
|
2003-11-19 15:57:07 +01:00
|
|
|
|
{
|
2004-09-10 21:30:08 +02:00
|
|
|
|
$name = substr($file, 15, strlen($file) - 27);
|
|
|
|
|
|
$classname = substr($file, 0, strlen($file) - 12);
|
|
|
|
|
|
|
|
|
|
|
|
print '<tr class="pair"><td>';
|
|
|
|
|
|
echo "$name";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
print "</td><td>\n";
|
2004-09-10 21:30:08 +02:00
|
|
|
|
require_once($dir.$file);
|
|
|
|
|
|
$obj = new $classname();
|
|
|
|
|
|
|
|
|
|
|
|
print $obj->description;
|
|
|
|
|
|
|
|
|
|
|
|
print '</td><td align="center">';
|
|
|
|
|
|
|
|
|
|
|
|
if (in_array($name, $def))
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
|
|
|
|
|
|
print "</td><td>\n";
|
|
|
|
|
|
print '<a href="expedition.php?action=del&value='.$name.'">d<>sactiver</a>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print " ";
|
|
|
|
|
|
print "</td><td>\n";
|
|
|
|
|
|
print '<a href="expedition.php?action=set&value='.$name.'">activer</a>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print '</td><td align="center">';
|
|
|
|
|
|
|
|
|
|
|
|
if ($expedition_addon_var_pdf == "$name")
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print " ";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
|
print "</td><td>\n";
|
2004-09-10 21:30:08 +02:00
|
|
|
|
|
|
|
|
|
|
print '<a href="expedition.php?action=setpdf&value='.$name.'">activer</a>';
|
|
|
|
|
|
|
|
|
|
|
|
print '</td></tr>';
|
2003-11-19 15:57:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-09-10 21:30:08 +02:00
|
|
|
|
closedir($handle);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
|
2003-11-19 15:57:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
*
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
|
|
|
|
|
llxFooter();
|
|
|
|
|
|
?>
|