From cd71ea89ef4f881e26706b10fd47116619b00b72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Oct 2006 13:30:13 +0000 Subject: [PATCH] L'option de confirmation de suppression de ligne produit est toujours a oui (La constante existe toujours pour permettre desactivation au cas ou). Ajout option pour choisir si on utilise le module de choix de produit ajax --- htdocs/admin/produit.php | 58 +++++++++++-------- htdocs/comm/propal.php | 2 +- htdocs/commande/fiche.php | 2 +- htdocs/compta/facture.php | 2 +- htdocs/conf/conf.class.php | 3 + .../modules/pdf/pdf_muscadet.modules.php | 2 +- htdocs/html.form.class.php | 2 +- .../modules/commande/pdf_einstein.modules.php | 2 +- .../modules/facture/pdf_crabe.modules.php | 2 +- .../propale/pdf_propale_azur.modules.php | 2 +- htdocs/langs/en_US/admin.lang | 2 + htdocs/langs/fr_FR/admin.lang | 2 + .../livraison/mods/pdf/pdf_typhon.modules.php | 2 +- mysql/migration/2.0.0-2.1.0.sql | 3 + 14 files changed, 53 insertions(+), 33 deletions(-) diff --git a/htdocs/admin/produit.php b/htdocs/admin/produit.php index 544c9255569..9dba914b6e8 100644 --- a/htdocs/admin/produit.php +++ b/htdocs/admin/produit.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2006 Andre Cianfarani * * This program is free software; you can redistribute it and/or modify @@ -50,12 +50,12 @@ else if ($_POST["action"] == 'multiprix_num') } if ($_POST["action"] == 'multiprix') { - $res=$db -> desc_table(MAIN_DB_PREFIX."societe","price_level"); - if(! $db -> fetch_row()) - { + $res=$db->desc_table(MAIN_DB_PREFIX."societe","price_level"); + if(! $db->fetch_row()) + { $field_desc = array('type'=>'TINYINT','value'=>'4','default'=>'1'); // on ajoute le champ price_level dans la table societe - if(! $db -> add_field(MAIN_DB_PREFIX."societe","price_level",$field_desc)) + if(! $db->add_field(MAIN_DB_PREFIX."societe","price_level",$field_desc)) { dolibarr_print_error($db); print ""; @@ -70,7 +70,7 @@ if ($_POST["action"] == 'multiprix') $fields['datec'] = array('type'=>'datetime','default'=> 'null'); $fields['fk_user_author'] = array('type'=>'int','value'=>'11','default'=> 'null'); $fields['price_level'] = array('type'=>'tinyint','value'=>'4','default'=> '1'); - if(! $db -> create_table($table,$fields,"rowid","InnoDB")) + if(! $db->create_table($table,$fields,"rowid","InnoDB")) { dolibarr_print_error($db); print ""; @@ -89,7 +89,7 @@ if ($_POST["action"] == 'multiprix') dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); Header("Location: produit.php"); } - exit; + exit; } else if ($_POST["action"] == 'sousproduits') { @@ -119,22 +119,22 @@ else if ($_POST["action"] == 'sousproduits') Header("Location: produit.php"); } } -else if ($_POST["action"] == 'confirmdeleteline') -{ - dolibarr_set_const($db, "PRODUIT_CONFIRM_DELETE_LINE", $_POST["activate_confirmdeleteline"]); - Header("Location: produit.php"); - exit; -} else if ($_POST["action"] == 'changeproductdesc') { dolibarr_set_const($db, "PRODUIT_CHANGE_PROD_DESC", $_POST["activate_changeproductdesc"]); - dolibarr_set_const($db, "FORM_ADD_PROD_DESC", 0); + dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", 0); Header("Location: produit.php"); exit; } else if ($_POST["action"] == 'viewProdDescInForm') { - dolibarr_set_const($db, "FORM_ADD_PROD_DESC", $_POST["activate_viewProdDescInForm"]); + dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $_POST["activate_viewProdDescInForm"]); + Header("Location: produit.php"); + exit; +} +else if ($_POST["action"] == 'usesearchtoselectproduct') +{ + dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectproduct"]); Header("Location: produit.php"); exit; } @@ -215,20 +215,30 @@ print ""; print ''; print ''; -// confirmation de suppression ligne produit activation/desactivation +// utilisation formulaire Ajax sur choix produit $var=!$var; print "
"; -print ""; +print ""; print ""; -print ''.$langs->trans("ConfirmDeleteProductLineAbility").''; -print ''; -print $html->selectyesno("activate_confirmdeleteline",$conf->global->PRODUIT_CONFIRM_DELETE_LINE,1); -print ''; -print ''; -print ""; +print ''.$langs->trans("UseSearchToSelectProduct").''; +if (! $conf->use_ajax) +{ + print ''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print ""; +} +else +{ + print ''; + print $html->selectyesno("activate_usesearchtoselectproduct",$conf->global->PRODUIT_USE_SEARCH_TO_SELECT,1); + print ''; + print ''; + print ""; +} print ''; print '
'; + // Modification description produit activation/desactivation $var=!$var; print "
"; @@ -252,7 +262,7 @@ if ($conf->global->PRODUIT_CHANGE_PROD_DESC == 0) print ""; print ''.$langs->trans("ViewProductDescInFormAbility").''; print ''; - print $html->selectyesno("activate_viewProdDescInForm",$conf->global->FORM_ADD_PROD_DESC,1); + print $html->selectyesno("activate_viewProdDescInForm",$conf->global->PRODUIT_DESC_IN_FORM,1); print ''; print ''; print ""; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 53348171c1f..30d258077e0 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1045,7 +1045,7 @@ if ($conf->expedition->enabled) print ' '.$objp->ref.''; print ' - '.nl2br($objp->product); // \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { print '
'.nl2br($objp->product_desc); } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index a7c4ef4b424..dca66a76869 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1270,7 +1270,7 @@ else print ' '.$objp->ref.' - '.nl2br($objp->product); print ($objp->description && $objp->description!=$objp->product)?'
'.nl2br($objp->description):''; // \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { print '
'.nl2br($objp->product_desc); } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d279f92150a..14b232660b3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2055,7 +2055,7 @@ else print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):''; // \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { print '
'.nl2br($objp->product_desc); } diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index c84ac9b386d..79ad0d07836 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -75,6 +75,9 @@ class Conf { dolibarr_syslog("functions.inc.php::setValues"); + // Par defaut, à oui + $this->global->PRODUIT_CONFIRM_DELETE_LINE=1; + /* * Definition de toutes les Constantes globales d'environnement * - En constante php (\todo a virer) diff --git a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php index 20bce753819..a3707d006a5 100644 --- a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php +++ b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php @@ -218,7 +218,7 @@ class pdf_muscadet extends ModelePDFCommandesSuppliers } // Ajoute description du produit - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { if ($com->lignes[$i]->product_desc&&$com->lignes[$i]->product_desc!=$fac->lignes[$i]->libelle&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->desc) { diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 877245f9716..6444d77c788 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -715,7 +715,7 @@ class Form function select_produits($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0) { global $langs,$conf,$user; - if ($conf->use_ajax) + if ($conf->use_ajax && $conf->PRODUIT_USE_SEARCH_TO_SELECT) { print $langs->trans("Ref").':   '; print $langs->trans("Label").':'; diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 5e962cd1a5c..d2b4a2bacbf 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -248,7 +248,7 @@ class pdf_einstein extends ModelePDFCommandes } // Ajoute description du produit - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { if ($com->lignes[$i]->product_desc&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->libelle&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->desc) { diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index c44349ca483..c928ae68b0b 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -241,7 +241,7 @@ class pdf_crabe extends ModelePDFFactures } // Ajoute description du produit - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { if ($fac->lignes[$i]->product_desc&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->libelle&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->desc) { diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 52ec4b34edb..9ce3b916fae 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -239,7 +239,7 @@ class pdf_propale_azur extends ModelePDFPropales } // Ajoute description complète du produit - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { if ($propale->lignes[$i]->product_desc && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->libelle && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->desc) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 71acfe0aef6..325e7c23da4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -17,6 +17,8 @@ ErrorModuleRequirePHPVersion=Error, this module require PHP version %s or higher DictionnarySetup=Dictionnary setup DisableJavascript=Disable javascript functions DisableAjax=Disable ajax functions +UseSearchToSelectProduct=Use a search form to choose a product (intead of using a list box) +NotAvailableWhenAjaxDisabled=Not available when Ajax disabled JavascriptDisabled=Javascript disabled UsePopupCalendar=Use popup for dates input NextValue=Next value diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 090433efe0d..e9bc44d0c8b 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -17,6 +17,8 @@ ErrorModuleRequirePHPVersion=Erreur, ce module requiert une version %s ou sup DictionnarySetup=Dictionnaires DisableJavascript=Désactiver les fonctions javascript DisableAjax=Désactiver les fonctions ajax +UseSearchToSelectProduct=Utiliser un formulaire de recherche pour choix d'un produit (plutôt que liste déroulante) +NotAvailableWhenAjaxDisabled=Non disponible quand Ajax désactivé JavascriptDisabled=Javascript désactivé UsePopupCalendar=Utiliser les popups pour la saisie des dates NextValue=Prochaine valeur diff --git a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php index 32ff2cee390..87e0df5af49 100644 --- a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php +++ b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php @@ -219,7 +219,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder } // Ajoute description du produit - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { if ($lignesdelivery[$i]->product_desc&&$lignesdelivery[$i]->product_desc!=$lignesdelivery[$i]->libelle&&$lignesdelivery[$i]->product_desc!=$lignesdelivery[$i]->desc) { diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index c9599b71cbb..06e83d5ca07 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -174,6 +174,7 @@ drop table if exists llx_avoir_model_pdf; drop table if exists llx_soc_recontact; +update llx_const set name='PRODUIT_DESC_IN_FORM' where name='FORM_ADD_PROD_DESC'; update llx_const set name='PRODUIT_CHANGE_PROD_DESC' where name='CHANGE_PROD_DESC'; update llx_const set name='COMMANDE_ADD_PROD_DESC' where name='COM_ADD_PROD_DESC'; update llx_const set name='PROPALE_ADD_PROD_DESC' where name='PROP_ADD_PROD_DESC'; @@ -182,9 +183,11 @@ update llx_const set name='MAIN_SIZE_LISTE_LIMIT' where name='SIZE_LISTE_LIMIT'; update llx_const set name='SOCIETE_FISCAL_MONTH_START' where name='FISCAL_MONTH_START'; update llx_const set visible=0 where name='FACTURE_DISABLE_RECUR'; update llx_const set visible=0 where name='MAILING_EMAIL_FROM'; +update llx_const set visible=1 where name='PRODUIT_CONFIRM_DELETE_LINE'; update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_MAIL_FROM'; update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_EMAIL_FROM'; + insert into llx_const(name,value,type,visible,note) values('MAIN_SHOW_DEVELOPMENT_MODULES','0','yesno',1,'Make development modules visible'); insert into llx_const(name,value,type,visible,note) values('PRODUCT_SHOW_WHEN_CREATE','1','yesno',1,'Add products\' list in first step of proposal, invoice, order creation');