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>
|
2005-06-11 13:11:17 +02:00
|
|
|
|
* Copyright (C) 2004-2005 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
|
|
|
|
|
2005-08-22 21:39:55 +02: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");
|
2005-06-11 13:11:17 +02:00
|
|
|
|
$langs->load("propal");
|
2004-08-29 14:01:58 +02:00
|
|
|
|
|
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
|
|
|
|
{
|
2005-10-13 23:39:38 +02:00
|
|
|
|
dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$_POST["value"]);
|
2005-08-22 21:39:55 +02:00
|
|
|
|
Header("Location: propale.php");
|
2005-10-13 23:39:38 +02:00
|
|
|
|
exit;
|
2003-09-23 13:55:51 +02:00
|
|
|
|
}
|
2004-07-13 16:56:09 +02:00
|
|
|
|
if ($_GET["action"] == 'set')
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
2005-08-22 21:39:55 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
2003-07-07 15:43:02 +02:00
|
|
|
|
|
2005-08-22 21:39:55 +02:00
|
|
|
|
if ($db->query($sql))
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-07-13 16:56:09 +02:00
|
|
|
|
if ($_GET["action"] == 'del')
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
2005-08-22 21:39:55 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_model_pdf WHERE nom='".$_GET["value"]."'";
|
2003-07-07 15:43:02 +02:00
|
|
|
|
|
2005-08-22 21:39:55 +02:00
|
|
|
|
if ($db->query($sql))
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2003-07-25 01:40:02 +02:00
|
|
|
|
|
2005-08-22 21:39:55 +02:00
|
|
|
|
$propale_addon_var_pdf = $conf->global->PROPALE_ADDON_PDF;
|
2003-07-25 01:40:02 +02:00
|
|
|
|
|
2004-08-18 16:29:33 +02:00
|
|
|
|
if ($_GET["action"] == 'setpdf')
|
2003-07-25 01:40:02 +02:00
|
|
|
|
{
|
2005-06-11 13:11:17 +02:00
|
|
|
|
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$_GET["value"]))
|
2003-07-25 01:40:02 +02:00
|
|
|
|
{
|
2005-06-11 13:11:17 +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
|
|
|
|
|
|
$propale_addon_var_pdf = $_GET["value"];
|
2003-07-25 01:40:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-06-11 13:11:17 +02:00
|
|
|
|
// On active le modele
|
|
|
|
|
|
$sql_del = "delete from ".MAIN_DB_PREFIX."propal_model_pdf where nom = '".$_GET["value"]."';";
|
|
|
|
|
|
$db->query($sql_del);
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
|
|
|
|
|
if ($db->query($sql))
|
2003-07-25 01:40:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-08-22 21:39:55 +02:00
|
|
|
|
$propale_addon_var = $conf->global->PROPALE_ADDON;
|
2003-09-01 00:54:47 +02:00
|
|
|
|
|
2004-08-18 16:29:33 +02:00
|
|
|
|
if ($_GET["action"] == 'setmod')
|
2003-09-01 00:54:47 +02:00
|
|
|
|
{
|
2005-08-22 21:39:55 +02:00
|
|
|
|
// \todo Verifier si module numerotation choisi peut etre activ<69>
|
|
|
|
|
|
// par appel methode canBeActivated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
2005-06-11 13:11:17 +02:00
|
|
|
|
|
2003-09-01 00:54:47 +02:00
|
|
|
|
/*
|
2005-06-11 13:11:17 +02:00
|
|
|
|
* Affiche page
|
2003-09-01 00:54:47 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
2005-08-22 21:39:55 +02:00
|
|
|
|
$dir = "../includes/modules/propale/";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
llxHeader('',$langs->trans("PropalSetup"));
|
|
|
|
|
|
|
2005-02-12 22:50:40 +01:00
|
|
|
|
print_titre($langs->trans("PropalSetup"));
|
2003-09-01 00:54:47 +02:00
|
|
|
|
|
2004-02-21 00:40:13 +01:00
|
|
|
|
|
2005-08-22 21:39:55 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* Module num<EFBFBD>rotation
|
|
|
|
|
|
*/
|
|
|
|
|
|
print "<br>";
|
2005-06-11 13:11:17 +02:00
|
|
|
|
print_titre($langs->trans("ProposalsNumberingModules"));
|
2004-02-21 00:40:13 +01:00
|
|
|
|
|
2005-08-22 21:39:55 +02:00
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
|
print '<td>'.$langs->trans("Name")."</td>\n";
|
|
|
|
|
|
print '<td>'.$langs->trans("Description")."</td>\n";
|
|
|
|
|
|
print '<td nowrap>'.$langs->trans("Example")."</td>\n";
|
2005-08-22 21:52:22 +02:00
|
|
|
|
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
2005-08-22 21:39:55 +02:00
|
|
|
|
print '</tr>'."\n";
|
2003-09-01 00:54:47 +02:00
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
|
|
|
|
|
|
$handle = opendir($dir);
|
|
|
|
|
|
if ($handle)
|
|
|
|
|
|
{
|
2005-08-22 21:39:55 +02:00
|
|
|
|
$var=true;
|
|
|
|
|
|
while (($file = readdir($handle))!==false)
|
2003-09-01 00:54:47 +02:00
|
|
|
|
{
|
2005-08-22 21:39:55 +02:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
$var=!$var;
|
|
|
|
|
|
print "<tr ".$bc[$var].">\n <td width=\"140\">".$file."</td>";
|
|
|
|
|
|
print "\n <td>".$modPropale->info()."</td>\n";
|
|
|
|
|
|
print "\n <td nowrap>".$modPropale->getExample()."</td>\n";
|
|
|
|
|
|
|
2005-08-22 21:52:22 +02:00
|
|
|
|
print '<td align="center">';
|
2005-08-22 21:39:55 +02:00
|
|
|
|
if ($propale_addon_var == "$file")
|
|
|
|
|
|
{
|
2005-08-22 21:52:22 +02:00
|
|
|
|
$title='';
|
|
|
|
|
|
if ($modPropale->getNextValue() != $langs->trans("NotAvailable"))
|
|
|
|
|
|
{
|
|
|
|
|
|
$title=$langs->trans("NextValue").': '.$modPropale->getNextValue();
|
|
|
|
|
|
}
|
|
|
|
|
|
print img_tick($title);
|
2005-08-22 21:39:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2005-08-22 21:52:22 +02:00
|
|
|
|
print "<a href=\"propale.php?action=setmod&value=".$file."\">".$langs->trans("Activate")."</a>";
|
2005-08-22 21:39:55 +02:00
|
|
|
|
}
|
2005-08-22 21:52:22 +02:00
|
|
|
|
print '</td>';
|
2005-08-22 21:39:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
}
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
2005-08-22 21:39:55 +02:00
|
|
|
|
closedir($handle);
|
2003-09-01 00:54:47 +02:00
|
|
|
|
}
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print "</table><br>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-09-01 00:54:47 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* PDF
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2005-06-11 13:11:17 +02:00
|
|
|
|
print_titre($langs->trans("ProposalsPDFModules"));
|
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";
|
2005-06-11 13:11:17 +02:00
|
|
|
|
$resql=$db->query($sql);
|
|
|
|
|
|
if ($resql)
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
$i = 0;
|
2005-06-11 13:11:17 +02:00
|
|
|
|
$num_rows=$db->num_rows($resql);
|
|
|
|
|
|
while ($i < $num_rows)
|
2003-07-07 15:43:02 +02:00
|
|
|
|
{
|
2005-06-11 13:11:17 +02:00
|
|
|
|
$array = $db->fetch_array($resql);
|
2003-07-07 15:43:02 +02:00
|
|
|
|
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";
|
2005-06-11 13:11:17 +02:00
|
|
|
|
print ' <td align="center" colspan="2">'.$langs->trans("Activated")."</td>\n";
|
|
|
|
|
|
print ' <td align="center">'.$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);
|
|
|
|
|
|
|
2005-06-11 13:11:17 +02:00
|
|
|
|
$var=true;
|
2003-06-19 14:38:34 +02:00
|
|
|
|
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);
|
|
|
|
|
|
|
2005-03-20 02:46:22 +01:00
|
|
|
|
$var=!$var;
|
|
|
|
|
|
print "<tr ".$bc[$var].">\n <td>";
|
2004-12-06 21:35:23 +01:00
|
|
|
|
print "$name";
|
|
|
|
|
|
print "</td>\n <td>\n";
|
2003-06-19 14:38:34 +02:00
|
|
|
|
require_once($dir.$file);
|
2005-03-20 02:46:22 +01:00
|
|
|
|
$obj = new $classname($db);
|
2003-06-19 14:38:34 +02:00
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
{
|
2005-03-06 16:39:32 +01:00
|
|
|
|
print img_tick();
|
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")
|
|
|
|
|
|
{
|
2005-03-06 16:39:32 +01:00
|
|
|
|
print img_tick();
|
2003-06-19 14:38:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print '<a href="propale.php?action=setpdf&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
2005-06-11 13:11:17 +02:00
|
|
|
|
}
|
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";
|
2005-06-11 13:11:17 +02:00
|
|
|
|
print "<tr ".$bc[false].">\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
|
|
|
|
*
|
|
|
|
|
|
*/
|
2005-06-11 13:11:17 +02:00
|
|
|
|
print_titre($langs->trans("CreateForm"));
|
2004-12-22 23:11:21 +01:00
|
|
|
|
|
2005-02-12 22:50:40 +01:00
|
|
|
|
print "<form method=\"post\" action=\"propale.php\">";
|
|
|
|
|
|
print "<input type=\"hidden\" name=\"action\" value=\"nbprod\">";
|
2005-06-11 13:11:17 +02:00
|
|
|
|
print "<table class=\"noborder\" width=\"100%\">";
|
2005-02-12 22:50:40 +01:00
|
|
|
|
print "<tr class=\"liste_titre\">";
|
2004-12-22 23:11:21 +01:00
|
|
|
|
print " <td>".$langs->trans("Name")."</td>\n";
|
|
|
|
|
|
print " <td align=\"left\">".$langs->trans("Value")."</td>\n";
|
|
|
|
|
|
print " <td> </td>\n";
|
2005-06-11 13:11:17 +02:00
|
|
|
|
print "</tr><tr ".$bc[false].">";
|
|
|
|
|
|
print '<td>'.$langs->trans("NumberOfProductLines").'</td>';
|
2005-10-13 23:39:38 +02:00
|
|
|
|
print "<td align=\"left\"><input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".PROPALE_NEW_FORM_NB_PRODUCT."\"></td>";
|
|
|
|
|
|
print '<td><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
2005-02-12 22:50:40 +01:00
|
|
|
|
print '</tr>';
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
print '</form>';
|
2003-06-19 14:38:34 +02:00
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
|
|
|
|
|
llxFooter();
|
|
|
|
|
|
?>
|