diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index b2049d9561f..6775ec2df0d 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Andre Cianfarani + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Andre Cianfarani * * 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 @@ -41,70 +41,52 @@ if (!$user->admin) accessforbidden(); -// positionne la variable pour le test d'affichage de l'icone - -$commande_addon_var = COMMANDE_ADDON; -$commande_addon_var_pdf = COMMANDE_ADDON_PDF; -$commande_rib_number_var = COMMANDE_RIB_NUMBER; - -$commande_addon_var = COMMANDE_ADDON; - - /* * Actions */ if ($_GET["action"] == 'setmod') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'COMMANDE_ADDON' ;"; - $db->query($sql); - $sql = ''; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES - ('COMMANDE_ADDON','".$_GET["value"]."',0) ; "; - - if ($db->query($sql)) - { - // la constante qui a été lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage cohérent - $commande_addon_var = $_GET["value"]; - } + dolibarr_set_const($db,'COMMANDE_ADDON',$_GET["value"]); } if ($_GET["action"] == 'set') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')"; - - if ($db->query($sql)) + $resql=$db->query($sql); + if (! $resql) { - + dolibarr_print_error($db); } } -$propale_addon_var_pdf = $conf->global->PROPALE_ADDON_PDF; if ($_GET["action"] == 'setpdf') { - - if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"])) - $commande_addon_var_pdf = $_GET["value"]; + dolibarr_set_const($db,'COMMANDE_ADDON_PDF',$_GET["value"]); // On active le modele $sql_del = "delete from ".MAIN_DB_PREFIX."commande_model_pdf where nom = '".$_GET["value"]."';"; - $db->query($sql_del); + $resql=$db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')"; - if ($db->query($sql)) + $resql=$db->query($sql); + if (! $resql) { - + dolibarr_print_error($db); } } if ($_GET["action"] == 'del') { $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_model_pdf WHERE nom='".$_GET["value"]."'"; - - if ($db->query($sql)) + $resql=$db->query($sql); + if (! $resql) { - + dolibarr_print_error($db); } } -$propale_addon_var_pdf = $conf->global->PROPALE_ADDON_PDF; + + +/* + * Affichage page + */ $dir = "../includes/modules/commande/"; @@ -116,9 +98,9 @@ print_titre($langs->trans("OrdersNumberingModules")); print ''; print ''; -print ''; +print ''; print ''; -print ''; +print ''; print "\n"; clearstatcache(); @@ -148,7 +130,7 @@ if ($handle) print $modCommande->getExample(); print ''; - if ($commande_addon_var == "$file") + if ($conf->global->COMMANDE_ADDON == "$file") { print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("Activated").'
'; print img_tick(); @@ -171,14 +153,14 @@ print '
'; * PDF */ print '
'; -print_titre("Modèles de commande pdf"); +print_titre($langs->trans("OrdersModelModule")); print "\n"; print "\n"; -print " \n"; +print ' \n"; print " \n"; -print ' \n"; -print ' \n"; +print ' \n"; +print ' \n"; print "\n"; clearstatcache(); @@ -188,65 +170,68 @@ $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."commande_model_pdf"; $resql=$db->query($sql); if ($resql) { - $i = 0; - $num_rows=$db->num_rows($resql); - while ($i < $num_rows) - { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $obj = $db->fetch_object($resql); + array_push($def, $obj->nom); + $i++; + } } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } $handle=opendir($dir); $var=True; while (($file = readdir($handle))!==false) { if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_') - { - $var = !$var; - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); - - $var=!$var; - print "\n \n \n \n \n \n \n \n \n"; + + // Activé + print "\n"; + + // Defaut + print "'; } - else - { - print ''.$langs->trans("Activate").''; - } - print ''; - } } closedir($handle); diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 5c718b1ae19..3cbc97c4da7 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -181,7 +181,7 @@ if ($_GET["id"] > 0) // Statut print ''; - print "\n"; + print "\n"; print ''; // Date
".$langs->trans("Name")."'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("Activated")."'.$langs->trans("Default")."
"; - print "$name"; - print "\n"; - require_once($dir.$file); - $obj = new $classname($db); - - print $obj->description; - - print "\n"; - - if (in_array($name, $def)) { - print img_tick(); - print ""; - print ''.$langs->trans("Disable").''; - } - else - { - print " "; - print ""; - print ''.$langs->trans("Activate").''; - } + $name = substr($file, 4, strlen($file) -16); + $classname = substr($file, 0, strlen($file) -12); - print ""; + $var=!$var; + print "
"; + print "$name"; + print "\n"; + require_once($dir.$file); + $obj = new $classname($db); - if ($commande_addon_var_pdf == "$name") - { - print img_tick(); + print $obj->description; + + print "\n"; + if (in_array($name, $def)) + { + print img_tick().' '; + if ($conf->global->COMMANDE_ADDON_PDF != "$name") + { + print ''.$langs->trans("Disable").''; + } + } + else + { + print ''.$langs->trans("Activate").''; + } + + print ""; + if ($conf->global->COMMANDE_ADDON_PDF == "$name") + { + print img_tick(); + } + else + { + print ''.$langs->trans("Default").''; + } + print '
'.$langs->trans("Status").'".$commande->statuts[$commande->statut]."".$commande->getLibStatut(4)."