diff --git a/htdocs/admin/produit.php b/htdocs/admin/produit.php index 4fb55892173..36475c8cd7d 100644 --- a/htdocs/admin/produit.php +++ b/htdocs/admin/produit.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2007 Auguria SARL + * Copyright (C) 2007 Auguria SARL * * 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 @@ -54,50 +54,30 @@ if ($_POST["action"] == 'multiprix') { $res=$db->DDLDescTable(MAIN_DB_PREFIX."societe","price_level"); if(! $db->fetch_row($res)) + { + $field_desc = array('type'=>'TINYINT','value'=>'4','default'=>'1'); + if ($_POST["activate_multiprix"]) { - $field_desc = array('type'=>'TINYINT','value'=>'4','default'=>'1'); - if ($_POST["activate_multiprix"]) - { - // on ajoute le champ price_level dans la table societe - if ($db->DDLAddField(MAIN_DB_PREFIX."societe","price_level",$field_desc) < 0) + // on ajoute le champ price_level dans la table societe + if ($db->DDLAddField(MAIN_DB_PREFIX."societe","price_level",$field_desc) < 0) { dolibarr_print_error($db); exit; } - // on crée la table societe_prices - else - { - /* - * La table est desormais cree par un fichier SQL comme les autres tables - * - * $table = MAIN_DB_PREFIX."societe_prices"; - * $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - * $fields['fk_soc'] = array('type'=>'int','value'=>'11','null'=>'not null','default'=> '0'); - * $fields['tms'] = array('type'=>'timestamp','value'=>'14','null'=>'not null'); - * $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->DDLCreateTable($table,$fields,"rowid","InnoDB") < 0) - * { - * dolibarr_print_error($db); - * exit; - * } - */ - } - } - dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); - dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); - Header("Location: produit.php"); - exit; - } + } + dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); + dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); + Header("Location: produit.php"); + exit; + } else - { - dolibarr_syslog("Table definition for ".MAIN_DB_PREFIX."societe already ok"); - dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); - dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); - Header("Location: produit.php"); - exit; - } + { + dolibarr_syslog("Table definition for ".MAIN_DB_PREFIX."societe already ok"); + dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); + dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); + Header("Location: produit.php"); + exit; + } } else if ($_POST["action"] == 'sousproduits') { diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index 922deb42af9..e537ad48225 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -65,6 +65,19 @@ if ($_GET["action"] == 'setcodecompta') } } +if ($_POST["action"] == 'usesearchtoselectcompany') +{ + if (dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectcompany"])) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dolibarr_print_error($db); + } +} + /* * Affichage page configuration module societe @@ -201,40 +214,38 @@ print '
'; // Autres options -/* -print_titre($langs->trans("OtherOptions")); - +$html=new Form($db); $var=true; - print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; -print ''; +print " \n"; +print " \n"; +print " \n"; +// utilisation formulaire Ajax sur choix société $var=!$var; -print ''; -print '\n"; -print ''; -print ''; -print ''; -print "\n"; - +print ""; +print ""; +print ""; +print ''; +if (! $conf->use_ajax) +{ + print '"; +} +else +{ + print '"; +} +print ''; print ''; -print "
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Description").' 
".$langs->trans("Parameters")."".$langs->trans("Value")." 
'.$langs->trans("UseXXX")."'; -print $form->selectyesno('constvalue',! $conf->global->XXX,1); -print ''.$langs->trans("XXXDesc").''; -print '   '; -print '
'.$langs->trans("UseSearchToSelectCompany").''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print "'; + print $html->selectyesno("activate_usesearchtoselectcompany",$conf->global->COMPANY_USE_SEARCH_TO_SELECT,1); + print ''; + print ''; + print "
\n"; -*/ - +print ''; $db->close(); diff --git a/htdocs/commonobject.class.php b/htdocs/commonobject.class.php index ef3968465d2..4d8f99447f2 100644 --- a/htdocs/commonobject.class.php +++ b/htdocs/commonobject.class.php @@ -387,7 +387,7 @@ class CommonObject // On recherche les societes $sql = "SELECT s.rowid, s.nom FROM"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if ($conf->use_ajax && $conf->global->CODE_DE_TEST == 1) + if ($conf->use_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) { $sql.= " WHERE rowid = ".$selected; } @@ -396,7 +396,7 @@ class CommonObject $resql = $object->db->query($sql); if ($resql) { - if ($conf->use_ajax && $conf->global->CODE_DE_TEST == 1) + if ($conf->use_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) { $langs->load("companies"); $obj = $this->db->fetch_object($resql); @@ -406,6 +406,8 @@ class CommonObject // On applique un delai d'execution pour le bon fonctionnement $htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"'; + print ''; + print ''; + print ''; + print '
'; print '
'; if ($obj->rowid == 0) { @@ -415,8 +417,12 @@ class CommonObject { print ''; } - - print ajax_autocompleter($socid,'newcompany','/societe/ajaxcompanies.php','working'); + print ajax_autocompleter($socid,'newcompany','/societe/ajaxcompanies.php',''); + print '
'; + print ajax_indicator($htmlname,'working'); + print '
'; return $socid; } else diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 1a2060a1e7d..634fe6e0a86 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -397,7 +397,7 @@ class Form { $htmloption = 'onChange="ac_delay(\'company_save_refresh()\',\'500\')"'; } - + print '
'; if ($obj->rowid == 0) { @@ -409,7 +409,6 @@ class Form } print ajax_autocompleter($pays_id,'pays','/societe/ajaxcountries.php','working'); - } else { @@ -893,7 +892,7 @@ class Form print ''; print $langs->trans("RefOrLabel").':'; print ''; - print ajax_updater_indicator($htmlname,'working'); + print ajax_indicator($htmlname,'working'); print ''; print ' '; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1147287174a..faba2cf87df 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -21,6 +21,7 @@ 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) +UseSearchToSelectProduct=Use a search form to choose a company (intead of using a list box) NotAvailableWhenAjaxDisabled=Not available when Ajax disabled JavascriptDisabled=JavaScript disabled UsePopupCalendar=Use popup for dates input diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 40970903808..f480ebdbdec 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -21,6 +21,7 @@ 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) +UseSearchToSelectCompany=Utiliser un formulaire de recherche pour choix d'un tiers (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 diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 3ae93ad7764..b4d5c8a5ccc 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -2733,7 +2733,7 @@ function num_lines($texte) return $nblines; } -function ajax_updater_indicator($htmlname,$indicator='working') +function ajax_indicator($htmlname,$indicator='working') { $script.=''; return $script; @@ -2751,7 +2751,7 @@ function ajax_updater_indicator($htmlname,$indicator='working') function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working') { $script = ''; - if ($indicator) $script.=ajax_updater_indicator($htmlname,$indicator); + if ($indicator) $script.=ajax_indicator($htmlname,$indicator); $script.='