From 91629561e1136dcc32e48ace521e18f0cef32b45 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 3 May 2007 08:39:24 +0000 Subject: [PATCH] Ajout creation des categories fournisseurs --- htdocs/admin/fournisseur.php | 278 ++++++++++++++++++++--------------- 1 file changed, 161 insertions(+), 117 deletions(-) diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 609e028728aff..3eeb4a17b3ab8 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2006 Regis Houssin +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2005-2006 Regis Houssin + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier * * 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 @@ -24,13 +24,14 @@ */ /** - \file htdocs/admin/fournisseur.php - \ingroup fournisseur - \brief Page d'administration-configuration du module Fournisseur - \version $Revision$ + \file htdocs/admin/fournisseur.php + \ingroup fournisseur + \brief Page d'administration-configuration du module Fournisseur + \version $Revision$ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.class.php'); require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.commande.class.php'); $langs->load("admin"); @@ -41,57 +42,56 @@ if (!$user->admin) accessforbidden(); - /* * Actions */ if ($_GET["action"] == 'specimen') { - $modele=$_GET["module"]; - - $facture = new CommandeFournisseur($db); - $facture->initAsSpecimen(); - - // Charge le modele - $dir = DOL_DOCUMENT_ROOT . "/fourn/commande/modules/pdf/"; - $file = "pdf_".$modele.".modules.php"; - if (file_exists($dir.$file)) - { - $classname = "pdf_".$modele; - require_once($dir.$file); - - $obj = new $classname($db); - - if ($obj->write_pdf_file($facture,$langs) > 0) - { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf"); - return; - } - } - else + $modele=$_GET["module"]; + + $facture = new CommandeFournisseur($db); + $facture->initAsSpecimen(); + + // Charge le modele + $dir = DOL_DOCUMENT_ROOT . "/fourn/commande/modules/pdf/"; + $file = "pdf_".$modele.".modules.php"; + if (file_exists($dir.$file)) + { + $classname = "pdf_".$modele; + require_once($dir.$file); + + $obj = new $classname($db); + + if ($obj->write_pdf_file($facture,$langs) > 0) { - $mesg='
'.$langs->trans("ErrorModuleNotFound").'
'; + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf"); + return; } + } + else + { + $mesg='
'.$langs->trans("ErrorModuleNotFound").'
'; + } } if ($_GET["action"] == 'set') { - $type='supplier_order'; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')"; - if ($db->query($sql)) + $type='supplier_order'; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')"; + if ($db->query($sql)) { - + } } if ($_GET["action"] == 'del') { - $type='supplier_order'; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; - if ($db->query($sql)) + $type='supplier_order'; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; + $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; + if ($db->query($sql)) { - + } } @@ -129,6 +129,11 @@ dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$_GET["value"]); } +if ($_POST["action"] == 'addcat') +{ + $fourn = new Fournisseur($db); + $fourn->CreateCategory($user,$_POST["cat"]); +} /* * Affichage page @@ -191,17 +196,17 @@ } print ''; - // Info - $htmltooltip=''; - $nextval=$module->getNextValue($mysoc); - if ($nextval != $langs->trans("NotAvailable")) - { - $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; - } - print ''; - print $html->textwithhelp('',$htmltooltip,1,0); - print ''; - + // Info + $htmltooltip=''; + $nextval=$module->getNextValue($mysoc); + if ($nextval != $langs->trans("NotAvailable")) + { + $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; + } + print ''; + print $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''; } } @@ -256,77 +261,116 @@ $var=true; while (($file = readdir($handle))!==false) { - if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_') + if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_') + { + $name = substr($file, 4, strlen($file) -16); + $classname = substr($file, 0, strlen($file) -12); + + $var=!$var; + print "\n $name"; + print "\n \n"; + require_once($dir.$file); + $module = new $classname($db); + print $module->description; + print "\n"; + + // Activé + if (in_array($name, $def)) { - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); - - $var=!$var; - print "\n "; - print "$name"; - print "\n \n"; - require_once($dir.$file); - $module = new $classname($db); - print $module->description; - print "\n"; - - // Activé - if (in_array($name, $def)) - { - print "\n"; - if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") - { - print ''; - print img_tick($langs->trans("Disable")); - print ''; - } - else - { - print img_tick($langs->trans("Enabled")); - } + print "\n"; + if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") + { + print ''; + print img_tick($langs->trans("Disable")); + print ''; + } + else + { + print img_tick($langs->trans("Enabled")); + } print ""; - } - else - { - print "\n"; - print ''.$langs->trans("Activate").''; - print ""; - } - - // Defaut - print ""; - if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") - { - print img_tick($langs->trans("Default")); - } - else - { - print ''.$langs->trans("Default").''; - } - print ''; - - // Info - $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - $htmltooltip.='
'.$langs->trans("Width").': '.$module->page_largeur; - $htmltooltip.='
'.$langs->trans("Height").': '.$module->page_hauteur; - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo); - $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg); - $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg); - print ''; - print $html->textwithhelp('',$htmltooltip,1,0); - print ''; - print ''; - print ''.img_object($langs->trans("Preview"),'order').''; - print ''; - - print "\n"; } + else + { + print "\n"; + print ''.$langs->trans("Activate").''; + print ""; + } + + // Defaut + print ""; + if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") + { + print img_tick($langs->trans("Default")); + } + else + { + print ''.$langs->trans("Default").''; + } + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Width").': '.$module->page_largeur; + $htmltooltip.='
'.$langs->trans("Height").': '.$module->page_hauteur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg); + print ''; + print $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''; + print ''.img_object($langs->trans("Preview"),'order').''; + print ''; + + print "\n"; + } } closedir($handle); -print ''; +print '
'; + +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 '
'; + print ''; + print '\n"; + $var=True; + + print ""; + print '\n"; + + while ($obj = $db->fetch_object($resql)) + { + $var=!$var; + print "\n"; + print ''; + print ''; + print "\n"; + } + print "
'; + print $langs->trans("Num").''.$langs->trans("Name"); + print "
  '; + print ''; + print "
'.$obj->rowid.''.stripslashes($obj->label).'
\n"; + + $db->free($resql); +} +else +{ + dolibarr_print_error($db); +} llxFooter('$Date$ - $Revision$'); ?>