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
This commit is contained in:
Laurent Destailleur 2006-10-22 13:30:13 +00:00
parent a1204fd687
commit cd71ea89ef
14 changed files with 53 additions and 33 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -119,22 +119,22 @@ else if ($_POST["action"] == 'sousproduits')
Header("Location: produit.php"); 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') else if ($_POST["action"] == 'changeproductdesc')
{ {
dolibarr_set_const($db, "PRODUIT_CHANGE_PROD_DESC", $_POST["activate_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"); Header("Location: produit.php");
exit; exit;
} }
else if ($_POST["action"] == 'viewProdDescInForm') 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"); Header("Location: produit.php");
exit; exit;
} }
@ -215,20 +215,30 @@ print "</td>";
print '</tr>'; print '</tr>';
print '</form>'; print '</form>';
// confirmation de suppression ligne produit activation/desactivation // utilisation formulaire Ajax sur choix produit
$var=!$var; $var=!$var;
print "<form method=\"post\" action=\"produit.php\">"; print "<form method=\"post\" action=\"produit.php\">";
print "<input type=\"hidden\" name=\"action\" value=\"confirmdeleteline\">"; print "<input type=\"hidden\" name=\"action\" value=\"usesearchtoselectproduct\">";
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td width="80%">'.$langs->trans("ConfirmDeleteProductLineAbility").'</td>'; print '<td width="80%">'.$langs->trans("UseSearchToSelectProduct").'</td>';
if (! $conf->use_ajax)
{
print '<td width="60" align="right" colspan="2">';
print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>";
}
else
{
print '<td width="60" align="right">'; print '<td width="60" align="right">';
print $html->selectyesno("activate_confirmdeleteline",$conf->global->PRODUIT_CONFIRM_DELETE_LINE,1); print $html->selectyesno("activate_usesearchtoselectproduct",$conf->global->PRODUIT_USE_SEARCH_TO_SELECT,1);
print '</td><td align="right">'; print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td>"; print "</td>";
}
print '</tr>'; print '</tr>';
print '</form>'; print '</form>';
// Modification description produit activation/desactivation // Modification description produit activation/desactivation
$var=!$var; $var=!$var;
print "<form method=\"post\" action=\"produit.php\">"; print "<form method=\"post\" action=\"produit.php\">";
@ -252,7 +262,7 @@ if ($conf->global->PRODUIT_CHANGE_PROD_DESC == 0)
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td width="80%">'.$langs->trans("ViewProductDescInFormAbility").'</td>'; print '<td width="80%">'.$langs->trans("ViewProductDescInFormAbility").'</td>';
print '<td width="60" align="right">'; print '<td width="60" align="right">';
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 '</td><td align="right">'; print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td>"; print "</td>";

View File

@ -1045,7 +1045,7 @@ if ($conf->expedition->enabled)
print ' '.$objp->ref.'</a>'; print ' '.$objp->ref.'</a>';
print ' - '.nl2br($objp->product); print ' - '.nl2br($objp->product);
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on // \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 '<br>'.nl2br($objp->product_desc); print '<br>'.nl2br($objp->product_desc);
} }

View File

@ -1270,7 +1270,7 @@ else
print ' '.$objp->ref.'</a> - '.nl2br($objp->product); print ' '.$objp->ref.'</a> - '.nl2br($objp->product);
print ($objp->description && $objp->description!=$objp->product)?'<br>'.nl2br($objp->description):''; print ($objp->description && $objp->description!=$objp->product)?'<br>'.nl2br($objp->description):'';
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on // \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 '<br>'.nl2br($objp->product_desc); print '<br>'.nl2br($objp->product_desc);
} }

View File

@ -2055,7 +2055,7 @@ else
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):''; print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on // \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 '<br>'.nl2br($objp->product_desc); print '<br>'.nl2br($objp->product_desc);
} }

View File

@ -75,6 +75,9 @@ class Conf
{ {
dolibarr_syslog("functions.inc.php::setValues"); dolibarr_syslog("functions.inc.php::setValues");
// Par defaut, à oui
$this->global->PRODUIT_CONFIRM_DELETE_LINE=1;
/* /*
* Definition de toutes les Constantes globales d'environnement * Definition de toutes les Constantes globales d'environnement
* - En constante php (\todo a virer) * - En constante php (\todo a virer)

View File

@ -218,7 +218,7 @@ class pdf_muscadet extends ModelePDFCommandesSuppliers
} }
// Ajoute description du produit // 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) if ($com->lignes[$i]->product_desc&&$com->lignes[$i]->product_desc!=$fac->lignes[$i]->libelle&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->desc)
{ {

View File

@ -715,7 +715,7 @@ class Form
function select_produits($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0) function select_produits($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0)
{ {
global $langs,$conf,$user; global $langs,$conf,$user;
if ($conf->use_ajax) if ($conf->use_ajax && $conf->PRODUIT_USE_SEARCH_TO_SELECT)
{ {
print $langs->trans("Ref").':<input type="text" size="8" name="ajkeyref'.$htmlname.'" id="ajkeyref'.$htmlname.'">&nbsp; &nbsp;'; print $langs->trans("Ref").':<input type="text" size="8" name="ajkeyref'.$htmlname.'" id="ajkeyref'.$htmlname.'">&nbsp; &nbsp;';
print $langs->trans("Label").':<input type="text" size="16" name="ajkeylabel'.$htmlname.'" id="ajkeylabel'.$htmlname.'">'; print $langs->trans("Label").':<input type="text" size="16" name="ajkeylabel'.$htmlname.'" id="ajkeylabel'.$htmlname.'">';

View File

@ -248,7 +248,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
// Ajoute description du produit // 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) if ($com->lignes[$i]->product_desc&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->libelle&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->desc)
{ {

View File

@ -241,7 +241,7 @@ class pdf_crabe extends ModelePDFFactures
} }
// Ajoute description du produit // 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) if ($fac->lignes[$i]->product_desc&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->libelle&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->desc)
{ {

View File

@ -239,7 +239,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
// Ajoute description complète du produit // 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) if ($propale->lignes[$i]->product_desc && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->libelle && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->desc)
{ {

View File

@ -17,6 +17,8 @@ ErrorModuleRequirePHPVersion=Error, this module require PHP version %s or higher
DictionnarySetup=Dictionnary setup DictionnarySetup=Dictionnary setup
DisableJavascript=Disable javascript functions DisableJavascript=Disable javascript functions
DisableAjax=Disable ajax 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 JavascriptDisabled=Javascript disabled
UsePopupCalendar=Use popup for dates input UsePopupCalendar=Use popup for dates input
NextValue=Next value NextValue=Next value

View File

@ -17,6 +17,8 @@ ErrorModuleRequirePHPVersion=Erreur, ce module requiert une version %s ou sup
DictionnarySetup=Dictionnaires DictionnarySetup=Dictionnaires
DisableJavascript=Désactiver les fonctions javascript DisableJavascript=Désactiver les fonctions javascript
DisableAjax=Désactiver les fonctions ajax 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é JavascriptDisabled=Javascript désactivé
UsePopupCalendar=Utiliser les popups pour la saisie des dates UsePopupCalendar=Utiliser les popups pour la saisie des dates
NextValue=Prochaine valeur NextValue=Prochaine valeur

View File

@ -219,7 +219,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
} }
// Ajoute description du produit // 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) if ($lignesdelivery[$i]->product_desc&&$lignesdelivery[$i]->product_desc!=$lignesdelivery[$i]->libelle&&$lignesdelivery[$i]->product_desc!=$lignesdelivery[$i]->desc)
{ {

View File

@ -174,6 +174,7 @@ drop table if exists llx_avoir_model_pdf;
drop table if exists llx_soc_recontact; 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='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='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'; 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 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='FACTURE_DISABLE_RECUR';
update llx_const set visible=0 where name='MAILING_EMAIL_FROM'; 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_MAIL_FROM';
update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_EMAIL_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('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'); 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');