Ajout gestion des produits specifiques

This commit is contained in:
Rodolphe Quiedeville 2006-12-01 15:37:26 +00:00
parent 80302636ba
commit cd7b7c847a

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -143,6 +144,13 @@ else if ($_POST["action"] == 'usesearchtoselectproduct')
Header("Location: produit.php"); Header("Location: produit.php");
exit; exit;
} }
else if ($_GET["action"] == 'set')
{
$const = "PRODUIT_SPECIAL_".strtoupper($_GET["spe"]);
dolibarr_set_const($db, $const, $_GET["value"]);
Header("Location: produit.php");
exit;
}
/* /*
@ -151,7 +159,6 @@ else if ($_POST["action"] == 'usesearchtoselectproduct')
llxHeader('',$langs->trans("ProductSetup")); llxHeader('',$langs->trans("ProductSetup"));
print_fiche_titre($langs->trans("ProductSetup"),'','setup'); print_fiche_titre($langs->trans("ProductSetup"),'','setup');
$html=new Form($db); $html=new Form($db);
@ -275,6 +282,66 @@ if ($conf->global->PRODUIT_CHANGE_PROD_DESC == 0)
print '</form>'; print '</form>';
} }
print '<tr class="liste_titre">';
print " <td>".$langs->trans("ProductSpecial")."</td>\n";
print " <td align=\"right\" width=\"60\">".$langs->trans("Value")."</td>\n";
print " <td width=\"80\">&nbsp;</td></tr>\n";
require_once(DOL_DOCUMENT_ROOT . "/product.class.php");
$dir = DOL_DOCUMENT_ROOT . "/product/canvas/";
if(is_dir($dir))
{
$handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, strlen($file) -10) == '.class.php' && substr($file,0,8) == 'product.')
{
$parts = explode('.',$file);
$classname = 'Product'.ucfirst($parts[1]);
require_once($dir.$file);
$module = new $classname();
$var=!$var;
print "<tr $bc[$var]><td>";
print $module->description;
print '</td><td align="center">';
if (defined ("PRODUIT_SPECIAL_LIVRE") && PRODUIT_SPECIAL_LIVRE == 1)
{
print img_tick();
print '</td><td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;spe='.$parts[1].'&amp;value=0">'.$langs->trans("Disable").'</a>';
}
else
{
print '&nbsp;</td><td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;spe='.$parts[1].'&amp;value=1">'.$langs->trans("Activate").'</a>';
}
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
else
{
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
}
print '</table>'; print '</table>';
$db->close(); $db->close();