2004-10-19 20:58:50 +02:00
|
|
|
|
<?php
|
2004-07-13 16:56:09 +02:00
|
|
|
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-12-28 18:07:21 +01:00
|
|
|
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
|
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
|
|
|
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
2003-06-19 14:38:34 +02: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
|
|
|
|
|
2004-12-28 18:07:21 +01:00
|
|
|
|
/** \file htdocs/admin/propale.php
|
2004-08-29 14:01:58 +02:00
|
|
|
|
\ingroup propale
|
|
|
|
|
|
\brief Page d'administration/configuration du module Propale
|
|
|
|
|
|
\version $Revision$
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2003-06-19 14:38:34 +02:00
|
|
|
|
require("./pre.inc.php");
|
|
|
|
|
|
|
2004-08-29 14:01:58 +02:00
|
|
|
|
$langs->load("admin");
|
|
|
|
|
|
|
2004-02-28 18:30:49 +01:00
|
|
|
|
if (!$user->admin)
|
|
|
|
|
|
accessforbidden();
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-13 16:56:09 +02:00
|
|
|
|
if ($_POST["action"] == 'nbprod')
|
2003-09-23 13:55:51 +02:00
|
|
|
|
{
|
2004-02-28 18:40:15 +01:00
|
|
|
|
dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$value);
|
2004-07-20 10:20:27 +02:00
|
|
|
|
Header("Location: propale.php");
|
2003-09-23 13:55:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2003-06-19 14:38:34 +02:00
|
|
|
|
llxHeader();
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-13 16:56:09 +02:00
|
|
|
|
if ($_GET["action"] == 'set')
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
2004-02-28 18:40:15 +01:00
|
|
|
|
|
2004-07-13 16:56:09 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
2003-07-07 15:43:02 +02:00
|
|
|
|
|
|
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-07-13 16:56:09 +02:00
|
|
|
|
if ($_GET["action"] == 'del')
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
2004-07-13 16:56:09 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_model_pdf WHERE nom='".$_GET["value"]."'";
|
2003-07-07 15:43:02 +02:00
|
|
|
|
|
|
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2003-07-25 01:40:02 +02:00
|
|
|
|
// positionne la variable pour le test d'affichage de l'icone
|
|
|
|
|
|
|
|
|
|
|
|
$propale_addon_var_pdf = PROPALE_ADDON_PDF;
|
|
|
|
|
|
|
2004-08-18 16:29:33 +02:00
|
|
|
|
if ($_GET["action"] == 'setpdf')
|
2003-07-25 01:40:02 +02:00
|
|
|
|
{
|
2004-08-18 16:29:33 +02:00
|
|
|
|
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$_GET["value"]))
|
2003-07-25 01:40:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
// 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-08-18 16:29:33 +02:00
|
|
|
|
$propale_addon_var_pdf = $_GET["value"];
|
2003-07-25 01:40:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
|
|
* On la set active
|
|
|
|
|
|
*/
|
2004-09-02 22:28:56 +02:00
|
|
|
|
$sql_del = "delete from ".MAIN_DB_PREFIX."propal_model_pdf
|
|
|
|
|
|
where nom = '".$_GET["value"]."';";
|
|
|
|
|
|
$db->query($sql_del);
|
|
|
|
|
|
|
2004-08-18 16:29:33 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
2003-07-25 01:40:02 +02:00
|
|
|
|
|
|
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$propale_addon_var = PROPALE_ADDON;
|
|
|
|
|
|
|
2004-08-18 16:29:33 +02:00
|
|
|
|
if ($_GET["action"] == 'setmod')
|
2003-09-01 00:54:47 +02:00
|
|
|
|
{
|
2004-08-18 16:29:33 +02:00
|
|
|
|
if (dolibarr_set_const($db, "PROPALE_ADDON",$_GET["value"]))
|
2003-09-01 00:54:47 +02:00
|
|
|
|
{
|
|
|
|
|
|
// 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-08-18 16:29:33 +02:00
|
|
|
|
$propale_addon_var = $_GET["value"];
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
2003-07-25 01:40:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2003-09-01 00:54:47 +02:00
|
|
|
|
/*
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print_titre("Configuration du module Propositions Commerciales");
|
2003-09-01 00:54:47 +02:00
|
|
|
|
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print "<br>";
|
|
|
|
|
|
|
|
|
|
|
|
print_titre("Module de num<75>rotation des propositions commerciales");
|
|
|
|
|
|
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print "<table class=\"noborder\" width=\"100%\">\n";
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "<tr class=\"liste_titre\">\n";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print " <td>".$langs->trans("Name")."</td>\n";
|
|
|
|
|
|
print " <td>".$langs->trans("Description")."</td>\n";
|
2004-12-28 18:07:21 +01:00
|
|
|
|
print " <td>".$langs->trans("Example")."</td>\n";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print " <td align=\"center\">".$langs->trans("Activated")."</td>\n";
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print " <td> </td>\n";
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print "</tr>\n";
|
2003-09-01 00:54:47 +02:00
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
|
|
|
|
|
|
$dir = "../includes/modules/propale/";
|
|
|
|
|
|
$handle = opendir($dir);
|
|
|
|
|
|
if ($handle)
|
|
|
|
|
|
{
|
|
|
|
|
|
while (($file = readdir($handle))!==false)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php')
|
|
|
|
|
|
{
|
|
|
|
|
|
$file = substr($file, 0, strlen($file)-4);
|
|
|
|
|
|
|
|
|
|
|
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$file.".php");
|
|
|
|
|
|
|
|
|
|
|
|
$modPropale = new $file;
|
|
|
|
|
|
|
2004-12-06 21:35:23 +01:00
|
|
|
|
if($pair == "pair")
|
|
|
|
|
|
$pair = "impair";
|
|
|
|
|
|
else
|
|
|
|
|
|
$pair = "pair";
|
2004-12-28 18:07:21 +01:00
|
|
|
|
print "<tr class=\"$pair\">\n <td width=\"140\">".$file."</td>";
|
|
|
|
|
|
print "\n <td>".$modPropale->info()."</td>\n";
|
|
|
|
|
|
print "\n <td>".$modPropale->getExample()."</td>\n";
|
2003-09-01 00:54:47 +02:00
|
|
|
|
|
|
|
|
|
|
if ($propale_addon_var == "$file")
|
|
|
|
|
|
{
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print " <td align=\"center\">";
|
|
|
|
|
|
print "<img src=\"".DOL_URL_ROOT."/theme/".$conf->theme."/img/tick.png\" border=\"0\"></a>";
|
|
|
|
|
|
print "</td>\n <td> </td>\n";
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print " <td> </td>\n";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print " <td align=\"center\"><a href=\"propale.php?action=setmod&value=".$file."\">".$langs->trans("Activate")."</a></td>\n";
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "</tr>\n";
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
closedir($handle);
|
|
|
|
|
|
}
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print "</table><br>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-09-01 00:54:47 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* PDF
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print_titre("Mod<EFBFBD>les de propale pdf");
|
2003-09-01 00:54:47 +02:00
|
|
|
|
|
2003-07-07 15:43:02 +02:00
|
|
|
|
$def = array();
|
|
|
|
|
|
|
2004-02-01 01:55:46 +01:00
|
|
|
|
$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."propal_model_pdf";
|
2003-07-07 15:43:02 +02:00
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
while ($i < $db->num_rows())
|
|
|
|
|
|
{
|
|
|
|
|
|
$array = $db->fetch_array($i);
|
|
|
|
|
|
array_push($def, $array[0]);
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2004-12-22 23:11:21 +01:00
|
|
|
|
dolibarr_print_error($db);
|
2003-07-07 15:43:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2003-06-19 14:38:34 +02:00
|
|
|
|
$dir = "../includes/modules/propale/";
|
|
|
|
|
|
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print "<table class=\"noborder\" width=\"100%\">\n";
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "<tr class=\"liste_titre\">\n";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print " <td width=\"140\">".$langs->trans("Name")."</td>\n";
|
|
|
|
|
|
print " <td>".$langs->trans("Description")."</td>\n";
|
|
|
|
|
|
print " <td colspan=\"2\">".$langs->trans("Activated")."</td>\n";
|
|
|
|
|
|
print " <td colspan=\"2\">".$langs->trans("Default")."</td>\n";
|
2004-02-21 00:40:13 +01:00
|
|
|
|
print "</tr>\n";
|
2003-06-19 14:38:34 +02:00
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
|
|
|
|
|
|
$handle=opendir($dir);
|
|
|
|
|
|
|
|
|
|
|
|
while (($file = readdir($handle))!==false)
|
|
|
|
|
|
{
|
2003-07-07 14:48:29 +02:00
|
|
|
|
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
|
2003-06-19 14:38:34 +02:00
|
|
|
|
{
|
2003-07-07 14:48:29 +02:00
|
|
|
|
$name = substr($file, 12, strlen($file) - 24);
|
2003-06-19 14:38:34 +02:00
|
|
|
|
$classname = substr($file, 0, strlen($file) -12);
|
|
|
|
|
|
|
2004-12-06 21:35:23 +01:00
|
|
|
|
if($pair == "pair")
|
|
|
|
|
|
$pair = "impair";
|
|
|
|
|
|
else
|
|
|
|
|
|
$pair = "pair";
|
|
|
|
|
|
print "<tr class=\"$pair\">\n <td>";
|
|
|
|
|
|
print "$name";
|
|
|
|
|
|
print "</td>\n <td>\n";
|
2003-06-19 14:38:34 +02:00
|
|
|
|
require_once($dir.$file);
|
|
|
|
|
|
$obj = new $classname();
|
|
|
|
|
|
|
|
|
|
|
|
print $obj->description;
|
|
|
|
|
|
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "</td>\n <td align=\"center\">\n";
|
2003-07-07 15:43:02 +02:00
|
|
|
|
|
|
|
|
|
|
if (in_array($name, $def))
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "</td>\n <td>";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print '<a href="propale.php?action=del&value='.$name.'">'.$langs->trans("Disable").'</a>';
|
2003-07-07 15:43:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print " ";
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "</td>\n <td>";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print '<a href="propale.php?action=set&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
2003-07-07 15:43:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "</td>\n <td align=\"center\">";
|
2003-06-19 14:38:34 +02:00
|
|
|
|
|
|
|
|
|
|
if ($propale_addon_var_pdf == "$name")
|
|
|
|
|
|
{
|
2003-06-24 17:15:39 +02:00
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
|
2003-06-19 14:38:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print " ";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "</td>\n <td>";
|
2003-06-19 14:38:34 +02:00
|
|
|
|
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print '<a href="propale.php?action=setpdf&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
2003-06-19 14:38:34 +02:00
|
|
|
|
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
closedir($handle);
|
|
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
2004-07-20 10:20:27 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* Repertoire
|
|
|
|
|
|
*/
|
|
|
|
|
|
print '<br>';
|
|
|
|
|
|
print_titre("Chemins d'acc<63>s aux documents");
|
|
|
|
|
|
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print "<table class=\"noborder\" width=\"100%\">\n";
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "<tr class=\"liste_titre\">\n";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print " <td>".$langs->trans("Name")."</td>\n";
|
|
|
|
|
|
print " <td>".$langs->trans("Value")."</td>\n";
|
2004-07-20 10:20:27 +02:00
|
|
|
|
print "</tr>\n";
|
2004-12-23 18:53:27 +01:00
|
|
|
|
print "<tr ".$bc[True].">\n <td width=\"140\">".$langs->trans("Directory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n";
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "</table>\n<br>";
|
2004-07-20 10:20:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-06-19 14:38:34 +02:00
|
|
|
|
/*
|
2004-12-22 23:11:21 +01:00
|
|
|
|
* Formulaire cr<EFBFBD>ation
|
2003-06-19 14:38:34 +02:00
|
|
|
|
*
|
|
|
|
|
|
*/
|
2003-09-23 13:55:51 +02:00
|
|
|
|
print_titre("Formulaire de cr<63>ation");
|
2004-12-22 23:11:21 +01:00
|
|
|
|
|
2004-12-22 21:12:47 +01:00
|
|
|
|
print "<form method=\"post\" action=\"propale.php\">
|
|
|
|
|
|
<input type=\"hidden\" name=\"action\" value=\"nbprod\">
|
|
|
|
|
|
<table class=\"noborder\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">
|
2004-12-22 23:11:21 +01:00
|
|
|
|
<tr class=\"liste_titre\">";
|
|
|
|
|
|
print " <td>".$langs->trans("Name")."</td>\n";
|
|
|
|
|
|
print " <td align=\"left\">".$langs->trans("Value")."</td>\n";
|
|
|
|
|
|
print " <td> </td>\n";
|
|
|
|
|
|
print "</tr>
|
2004-12-22 21:12:47 +01:00
|
|
|
|
<tr class=\"pair\">
|
|
|
|
|
|
<td>Nombre de ligne produits</td>
|
2004-12-22 23:11:21 +01:00
|
|
|
|
<td align=\"left\"><input size=\"3\" type=\"text\" name=\"value\" value=\"".PROPALE_NEW_FORM_NB_PRODUCT."\"></td>
|
2004-12-22 21:12:47 +01:00
|
|
|
|
<td><input type=\"submit\" value=\"changer\"></td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</form>\n";
|
2003-06-19 14:38:34 +02:00
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
|
|
|
|
|
llxFooter();
|
|
|
|
|
|
?>
|