diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 4ed3b7d1a00..e7e9dfbf7a3 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -193,7 +193,7 @@ print '
'; */ print_titre($langs->trans("OrdersModelModule")); -// Defini tableau def de modele propal +// Defini tableau def de modele $type='order'; $def = array(); $sql = "SELECT nom"; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 97bda613882..7b705818a5d 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -202,8 +202,6 @@ while (($file = readdir($handle))!==false) $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 'tooltip_properties($htmltooltip).'>'.img_help(0).''; print ''; diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 33c259857d4..784db70e435 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2006 Regis Houssin +/* Copyright (C) 2003-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2006 Regis Houssin * * 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 @@ -33,77 +33,88 @@ require("./pre.inc.php"); $langs->load("admin"); +$langs->load("bills"); +$langs->load("other"); $langs->load("orders"); -llxHeader(); - if (!$user->admin) accessforbidden(); -// positionne la variable pour le test d'affichage de l'icone - -$commande_fournisseur_addon_var = COMMANDE_SUPPLIER_ADDON; -$commande_fournisseur_addon_var_pdf = COMMANDE_SUPPLIER_ADDON_PDF; - /* * Actions */ +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)) + { + + } +} + +if ($_GET["action"] == 'del') +{ + $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom='".$_GET["value"]."'"; + if ($db->query($sql)) + { + + } +} + +if ($_GET["action"] == 'setdoc') +{ + $db->begin(); + + if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"])) + { + // La constante qui a été lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage cohérent + $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $_GET["value"]; + } + + // On active le modele + $type='supplier_order'; + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model where nom = '".$_GET["value"]."'"; + $result1=$db->query($sql_del); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')"; + $result2=$db->query($sql); + if ($result1 && $result2) + { + $db->commit(); + } + else + { + $db->rollback(); + } +} + if ($_GET["action"] == 'setmod') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'COMMANDE_SUPPLIER_ADDON' ;"; - $db->query($sql); - $sql = ''; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES - ('COMMANDE_SUPPLIER_ADDON','".$_GET["value"]."',0) ; "; + // \todo Verifier si module numerotation choisi peut etre activé + // par appel methode canBeActivated - if ($db->query($sql)) + + if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$_GET["value"])) { // la constante qui a été lue en avant du nouveau set // on passe donc par une variable pour avoir un affichage cohérent - $commande_fournisseur_addon_var = $_GET["value"]; + $conf->global->COMMANDE_SUPPLIER_ADDON = $_GET["value"]; } } -if ($_GET["action"] == 'set') -{ - $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_model_pdf (nom) VALUES ('".$_GET["value"]."')"; - if ($db->query($sql)) - { - } -} -$commande_fournisseur_addon_var_pdf = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; -if ($_GET["action"] == 'setpdf') -{ - - if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"])) - $commande_fournisseur_addon_var_pdf = $_GET["value"]; - - // On active le modele - $sql_del = "delete from ".MAIN_DB_PREFIX."commande_fournisseur_model_pdf where nom = '".$_GET["value"]."';"; - $db->query($sql_del); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_model_pdf (nom) VALUES ('".$_GET["value"]."')"; - if ($db->query($sql)) - { - - } -} -if ($_GET["action"] == 'del') -{ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur_model_pdf WHERE nom='".$_GET["value"]."'"; - - if ($db->query($sql)) - { - - } -} -$commande_fournisseur_addon_var_pdf = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; +/* + * Affichage page + */ + +llxHeader(); $dir = "../fourn/commande/modules/pdf/"; +$html=new Form($db); print_titre($langs->trans("OrdersSetup")); @@ -113,9 +124,11 @@ print_titre($langs->trans("OrdersNumberingModules")); print ''; print ''; -print ''; +print ''; +print ''; print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -134,27 +147,37 @@ if ($handle) require_once(DOL_DOCUMENT_ROOT ."/fourn/commande/modules/".$file.".php"); - $modCommande = new $file; + $module = new $file; $var=!$var; - print ''; - print ''; + // Examples + print '\n"; - if ($commande_fournisseur_addon_var == "$file") + print ''; + print img_tick($langs->trans("Activated")); } else { - print ''; + print ''.$langs->trans("Activate").''; } + print ''; + + // Info + $htmltooltip=''; + $nextval=$module->getNextValue(); + if ($nextval != $langs->trans("NotAvailable")) + { + $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; + } + print ''; print ''; } @@ -162,93 +185,120 @@ if ($handle) closedir($handle); } -print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("Activated").''.$langs->trans("Info").'
'.$modCommande->nom."\n"; - print $modCommande->info(); + print '
'.$module->nom."\n"; + print $module->info(); print ''; - print $modCommande->getExample(); - print ''.$module->getExample()."'; + if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file") { - print ''; - print img_tick(); - print ''.$langs->trans("Activate").'tooltip_properties($htmltooltip).'>'; + print ($htmltooltip?img_help(0):''); + print '
'; +print '
'; /* - * PDF + * Modeles de documents */ -print '
'; -print_titre("Modèles de commande fournisseur pdf"); +print_titre($langs->trans("OrdersModelModule")); -print "\n"; -print "\n"; -print " \n"; -print " \n"; -print ' \n"; -print ' \n"; -print "\n"; - -clearstatcache(); -$dir = "../fourn/commande/modules/pdf/"; +// Defini tableau def de modele +$type='supplier_order'; $def = array(); -$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."commande_fournisseur_model_pdf"; +$sql = "SELECT nom"; +$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql.= " WHERE type = '".$type."'"; $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) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } + $dir = "../fourn/commande/modules/pdf/"; + +print "
".$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."
\n"; +print "\n"; +print ' \n"; +print " \n"; +print '\n"; +print '\n"; +print ''; +print "\n"; + +clearstatcache(); + $handle=opendir($dir); -$var=True; + +$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é + if (in_array($name, $def)) + { + print ""; + } + else + { + print ""; + } - if ($commande_fournisseur_addon_var_pdf == "$name") - { - print img_tick(); + // Defaut + 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 "\n"; } - else - { - print ''.$langs->trans("Activate").''; - } - print ''; - } } closedir($handle); print '
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("Info").'
"; - 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); + $module = new $classname($db); + print $module->description; + 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"; + print ''.$langs->trans("Activate").''; + print ""; + if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") + { + print img_tick($langs->trans("Default")); + } + else + { + print ''.$langs->trans("Default").''; + } + print 'tooltip_properties($htmltooltip).'>'.img_help(0).'
'; + llxFooter('$Date$ - $Revision$'); ?> diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index 2d6a791821b..b452ea7984c 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -7,6 +7,7 @@ drop table if exists llx_commande_model_pdf; +drop table if exists llx_commande_fournisseur_model_pdf; alter table llx_commande add column note_public text after note; @@ -169,6 +170,7 @@ delete from llx_document_model where nom='rouge' and type='order'; delete from llx_document_model where nom='azur' and type='order'; delete from llx_document_model where nom='orange' and type='propal'; + alter table llx_actioncomm add column fk_commande integer after propalrowid; diff --git a/mysql/tables/llx_commande_fournisseur_model_pdf.sql b/mysql/tables/llx_commande_fournisseur_model_pdf.sql deleted file mode 100644 index f3d637bf728..00000000000 --- a/mysql/tables/llx_commande_fournisseur_model_pdf.sql +++ /dev/null @@ -1,30 +0,0 @@ --- =================================================================== --- Copyright (C) 2001-2003 Rodolphe Quiedeville --- --- 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$ --- --- Liste des modeles de commande fournisseur pdf disponibles --- --- =================================================================== - -create table llx_commande_fournisseur_model_pdf -( - nom varchar(50) PRIMARY KEY, - libelle varchar(255), - description text -)type=innodb;