Ajout creation des categories fournisseurs

This commit is contained in:
Rodolphe Quiedeville 2007-05-03 08:39:24 +00:00
parent 1a54f93846
commit 91629561e1

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* *
* 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
@ -31,6 +31,7 @@
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.class.php');
require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.commande.class.php');
$langs->load("admin"); $langs->load("admin");
@ -41,7 +42,6 @@ $langs->load("orders");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
/* /*
* Actions * Actions
*/ */
@ -129,6 +129,11 @@ if ($_GET["action"] == 'setmod')
dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$_GET["value"]); dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$_GET["value"]);
} }
if ($_POST["action"] == 'addcat')
{
$fourn = new Fournisseur($db);
$fourn->CreateCategory($user,$_POST["cat"]);
}
/* /*
* Affichage page * Affichage page
@ -262,8 +267,7 @@ while (($file = readdir($handle))!==false)
$classname = substr($file, 0, strlen($file) -12); $classname = substr($file, 0, strlen($file) -12);
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">\n <td>"; print "<tr ".$bc[$var].">\n <td>$name";
print "$name";
print "</td>\n <td>\n"; print "</td>\n <td>\n";
require_once($dir.$file); require_once($dir.$file);
$module = new $classname($db); $module = new $classname($db);
@ -317,7 +321,7 @@ while (($file = readdir($handle))!==false)
print $html->textwithhelp('',$htmltooltip,1,0); print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>'; print '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -325,8 +329,48 @@ while (($file = readdir($handle))!==false)
} }
closedir($handle); closedir($handle);
print '</table>'; print '</table><br/>';
print_titre($langs->trans("Categories"));
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie";
$sql.= " ORDER BY label ASC";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
print '<form action="fournisseur.php" method="POST"><table class="liste" width="100%">';
print '<input type="hidden" name="action" value="addcat">';
print '<tr class="liste_titre"><td>';
print $langs->trans("Num").'</td><td>'.$langs->trans("Name");
print "</td></tr>\n";
$var=True;
print "<tr $bc[$var]><td>&nbsp;</td>";
print '<td><input type="text" name="cat">&nbsp;';
print '<input type="submit" value="'.$langs->trans("Add").'">';
print "</td></tr>\n";
while ($obj = $db->fetch_object($resql))
{
$var=!$var;
print "<tr $bc[$var]>\n";
print '<td width="10%">'.$obj->rowid.'</td>';
print '<td width="90%"><a href="liste.php?cat='.$obj->rowid.'">'.stripslashes($obj->label).'</a></td>';
print "</tr>\n";
}
print "</table></form>\n";
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
llxFooter('$Date$ - $Revision$'); llxFooter('$Date$ - $Revision$');
?> ?>