New: Possibilité de définir le nombre max d'éléments des listes combo select des produits.

This commit is contained in:
Laurent Destailleur 2005-10-13 21:39:38 +00:00
parent d0b6ca2ec8
commit f773a3f22a
7 changed files with 98 additions and 10 deletions

79
htdocs/admin/produit.php Normal file
View File

@ -0,0 +1,79 @@
<?php
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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$
*/
/**
\file htdocs/admin/produit.php
\ingroup produit
\brief Page d'administration/configuration du module Produit
\version $Revision$
*/
require("./pre.inc.php");
$langs->load("admin");
$langs->load("propal");
if (!$user->admin)
accessforbidden();
if ($_POST["action"] == 'nbprod')
{
dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", $_POST["value"]);
Header("Location: produit.php");
exit;
}
/*
* Affiche page
*/
llxHeader('',$langs->trans("ProductSetup"));
print_titre($langs->trans("ProductSetup"));
/*
* Formulaire parametres divers
*/
print '<br>';
print "<form method=\"post\" action=\"produit.php\">";
print "<input type=\"hidden\" name=\"action\" value=\"nbprod\">";
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print " <td>".$langs->trans("Name")."</td>\n";
print " <td align=\"left\">".$langs->trans("Value")."</td>\n";
print " <td>&nbsp;</td>\n";
print "</tr><tr ".$bc[false].">";
print '<td>'.$langs->trans("NumberOfProductShowInSelect").'</td>';
print "<td align=\"left\"><input size=\"3\" type=\"text\" class=\"flat\" name=\"value\" value=\"".$conf->global->PRODUIT_LIMIT_SIZE."\"></td>";
print '<td><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
$db->close();
llxFooter();
?>

View File

@ -41,8 +41,9 @@ if (!$user->admin)
if ($_POST["action"] == 'nbprod') if ($_POST["action"] == 'nbprod')
{ {
dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$value); dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$_POST["value"]);
Header("Location: propale.php"); Header("Location: propale.php");
exit;
} }
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
@ -296,8 +297,8 @@ print " <td align=\"left\">".$langs->trans("Value")."</td>\n";
print " <td>&nbsp;</td>\n"; print " <td>&nbsp;</td>\n";
print "</tr><tr ".$bc[false].">"; print "</tr><tr ".$bc[false].">";
print '<td>'.$langs->trans("NumberOfProductLines").'</td>'; print '<td>'.$langs->trans("NumberOfProductLines").'</td>';
print "<td align=\"left\"><input size=\"3\" type=\"text\" name=\"value\" value=\"".PROPALE_NEW_FORM_NB_PRODUCT."\"></td>"; print "<td align=\"left\"><input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".PROPALE_NEW_FORM_NB_PRODUCT."\"></td>";
print '<td><input type="submit" value="'.$langs->trans("Modify").'"></td>'; print '<td><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';

View File

@ -20,7 +20,6 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
@ -71,6 +70,7 @@ class modProduit extends DolibarrModules
// Dépendances // Dépendances
$this->depends = array(); $this->depends = array();
$this->requiredby = array("modStock","modService","modBarcode"); $this->requiredby = array("modStock","modService","modBarcode");
$this->config_page_url = "produit.php";
// Constantes // Constantes
$this->const = array(); $this->const = array();

View File

@ -351,6 +351,9 @@ DNContactActiveExample=Desactivated synchronization
DNContact=Contacts' DN DNContact=Contacts' DN
DNContactExample=Complete DN (ex: ou=contacts,dc=society,dc=com) DNContactExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
TypeExample=OpenLdap, Egroupware or Active Directory TypeExample=OpenLdap, Egroupware or Active Directory
##### Products #####
ProductSetup=Products module setup
NumberOfProductShowInSelect=Max number of products in combos select lists (0=no limit)
##### Sendings ##### ##### Sendings #####
SendingsSetup=Sending module setup SendingsSetup=Sending module setup
SendingsReceiptModel=Sending receipt model SendingsReceiptModel=Sending receipt model

View File

@ -351,6 +351,9 @@ DNContact=DN des contacts
DNContactActiveExample=Synchronisation désactivée DNContactActiveExample=Synchronisation désactivée
DNContactExample=DN complet (ex: ou=contacts,dc=societe,dc=com) DNContactExample=DN complet (ex: ou=contacts,dc=societe,dc=com)
TypeExample=OpenLdap, Egroupware ou Active Directory TypeExample=OpenLdap, Egroupware ou Active Directory
##### Products #####
ProductSetup=Configuration du module Produits
NumberOfProductShowInSelect=Nombre de produits max dans les listes déroulantes (0=aucune limite)
##### Sendings ##### ##### Sendings #####
SendingsSetup=Configuration du module Expéditions/Livraisons SendingsSetup=Configuration du module Expéditions/Livraisons
SendingsReceiptModel=Modèle du bordereau de livraison SendingsReceiptModel=Modèle du bordereau de livraison

View File

@ -119,6 +119,10 @@ if (isset($user->conf->SIZE_LISTE_LIMIT) && $user->conf->SIZE_LISTE_LIMIT > 0)
{ {
$conf->liste_limit = $user->conf->SIZE_LISTE_LIMIT; $conf->liste_limit = $user->conf->SIZE_LISTE_LIMIT;
} }
if (isset($user->conf->PRODUIT_LIMIT_SIZE))
{
$conf->produit->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
}
if (isset($user->conf->MAIN_LANG_DEFAULT) && $user->conf->MAIN_LANG_DEFAULT) if (isset($user->conf->MAIN_LANG_DEFAULT) && $user->conf->MAIN_LANG_DEFAULT)
{ {
if ($conf->langage != $user->conf->MAIN_LANG_DEFAULT) if ($conf->langage != $user->conf->MAIN_LANG_DEFAULT)
@ -130,12 +134,6 @@ if (isset($user->conf->MAIN_LANG_DEFAULT) && $user->conf->MAIN_LANG_DEFAULT)
} }
} }
$conf->produit->limit_size=50;
if (isset($user->conf->PRODUIT_LIMIT_SIZE))
{
$conf->produit->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
}
// Remplace conf->css par valeur personnalisée // Remplace conf->css par valeur personnalisée
if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME) if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME)
{ {

View File

@ -335,6 +335,10 @@ else {
if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20; if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20;
$conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT; $conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT;
// $conf->produit->limit_size = constante de taille maximale des select de produit
if (! isset($conf->global->PRODUIT_LIMIT_SIZE)) $conf->global->PRODUIT_LIMIT_SIZE=50;
$conf->produit->limit_size=$conf->global->PRODUIT_LIMIT_SIZE;
// $conf->theme et $conf->css // $conf->theme et $conf->css
if (! $conf->global->MAIN_THEME) $conf->global->MAIN_THEME="eldy"; if (! $conf->global->MAIN_THEME) $conf->global->MAIN_THEME="eldy";
$conf->theme=$conf->global->MAIN_THEME; $conf->theme=$conf->global->MAIN_THEME;