diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 452708c201d..c2e14a48a22 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1349,7 +1349,7 @@ if ($_GET['propalid'] > 0) $var=true; print '\n"; - print ''; + print ''; print ''; if($societe->tva_assuj == "0") { @@ -1389,7 +1389,7 @@ if ($_GET['propalid'] > 0) $html->select_produits('','idprod','',$conf->produit->limit_size); } if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '
'; - print ''; + print ''; print ''; print ' '; print ''; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index fd3df64e8d2..7ebc82c93a4 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -818,60 +818,72 @@ class Form global $langs,$conf; if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT) { - print $langs->trans("RefOrLabel").' : '; - print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type=1','working'); - } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("RefOrLabel").':'; + print ajax_updater_indicator($htmlname,'working'); + print ''; + print '
'; + print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type=1',''); + print '
'; + } else { $this->select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level); } } - /** - \brief Retourne la liste des produits - \param selected Produit présélectionné - \param htmlname Nom de la zone select - \param filtretype Pour filtre sur type de produit - \param limit Limite sur le nombre de lignes retournées - \param price_level Niveau de prix en fonction du client - \param ajaxkeysearch Filtre des produits si ajax est utilisé - */ - function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeysearch='') - { - global $langs,$conf,$user; - $user->getrights("categorie"); - - $sql = "SELECT "; - if ($conf->categorie->enabled && ! $user->rights->categorie->voir) - { - $sql.="DISTINCT"; - } - $sql.= " p.rowid, p.label, p.ref, p.price, p.duration"; - $sql.= " FROM ".MAIN_DB_PREFIX."product as p "; - if ($conf->categorie->enabled && ! $user->rights->categorie->voir) - { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; - } - $sql.= " WHERE p.envente = 1"; - if ($conf->categorie->enabled && ! $user->rights->categorie->voir) - { - $sql.= ' AND IFNULL(c.visible,1)=1'; - } - if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype; - if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%'"; - $sql.= " ORDER BY p.nbvente DESC"; - if ($limit) $sql.= " LIMIT $limit"; - - dolibarr_syslog("Form::select_produits_do sql=$sql",LOG_DEBUG); + /** + \brief Retourne la liste des produits + \param selected Produit présélectionné + \param htmlname Nom de la zone select + \param filtretype Pour filtre sur type de produit + \param limit Limite sur le nombre de lignes retournées + \param price_level Niveau de prix en fonction du client + \param ajaxkeysearch Filtre des produits si ajax est utilisé + */ + function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeysearch='') + { + global $langs,$conf,$user; + $user->getrights("categorie"); + + $sql = "SELECT "; + if ($conf->categorie->enabled && ! $user->rights->categorie->voir) + { + $sql.="DISTINCT"; + } + $sql.= " p.rowid, p.label, p.ref, p.price, p.duration"; + $sql.= " FROM ".MAIN_DB_PREFIX."product as p "; + if ($conf->categorie->enabled && ! $user->rights->categorie->voir) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; + } + $sql.= " WHERE p.envente = 1"; + if ($conf->categorie->enabled && ! $user->rights->categorie->voir) + { + $sql.= ' AND IFNULL(c.visible,1)=1'; + } + if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype; + if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%'"; + $sql.= " ORDER BY p.nbvente DESC"; + if ($limit) $sql.= " LIMIT $limit"; + + dolibarr_syslog("Form::select_produits_do sql=$sql",LOG_DEBUG); - $result=$this->db->query($sql); - if (! $result) dolibarr_print_error($this->db); - - // Multilang : on construit une liste des traductions des produits listés - if ($conf->global->MAIN_MULTILANGS) - { - $sqld = "SELECT d.fk_product, d.label"; + $result=$this->db->query($sql); + if (! $result) dolibarr_print_error($this->db); + + // Multilang : on construit une liste des traductions des produits listés + if ($conf->global->MAIN_MULTILANGS) + { + $sqld = "SELECT d.fk_product, d.label"; $sqld.= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_det as d "; $sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'"; $sqld.= " ORDER BY p.nbvente DESC"; @@ -893,20 +905,20 @@ class Form else { print ''; - print ''; - } - - $i = 0; - while ($num && $i < $num) - { - $objp = $this->db->fetch_object($result); - + print ''; + } + + $i = 0; + while ($num && $i < $num) + { + $objp = $this->db->fetch_object($result); + // Multilangs : modification des donnée si une traduction existe if ($conf->global->MAIN_MULTILANGS) { @@ -918,24 +930,24 @@ class Form } $opt = '\n"; - print $opt; - $i++; - } - - print ''; - - $this->db->free($result); - } - else - { - dolibarr_print_error($db); - } - } + print $opt; + $i++; + } + + print ''; + + $this->db->free($result); + } + else + { + dolibarr_print_error($db); + } + } /** \brief Retourne la liste des produits fournisseurs en Ajax si ajax activé ou renvoie à select_produits_fournisseurs_do diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 35c3357560b..3c92b9f922e 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -100,19 +100,18 @@ $bc[true]=' class="bg2"'; function pHeader($soutitre,$next,$action='set') { - global $charset; + global $conf; global $langs; $langs->load("main"); $langs->load("admin"); - // On force contenu en ISO-8859-1 - header("Content-type: text/html; charset=".$charset); - //header("Content-type: text/html; charset=UTF-8"); + // On force contenu dans format sortie + header("Content-type: text/html; charset=".$conf->character_set_client); print ''."\n"; print ''; print ''; - print ''; + print ''; print ''; print ''.$langs->trans("DolibarrSetup").''; print ''; diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index 432c54b90e1..9294ff79c5e 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -322,7 +322,7 @@ class CMailFile $out.= "--" . $this->mime_boundary . $this->eol; if ($this->msgishtml) { - $out.= "Content-Type: text/html; charset=iso-8859-1".$this->eol; + $out.= "Content-Type: text/html; charset=".$conf->charset_output.$this->eol; } $out.= $this->eol; } diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 6e39bc46eea..f0192b9cfd8 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -2638,21 +2638,27 @@ function num_lines($texte) return $nblines; } +function ajax_updater_indicator($htmlname,$indicator='working') +{ + $script.=''; + return $script; +} + /** \brief Récupère la valeur d'un champ, effectue un traitement Ajax et affiche le résultat - \param htmlname nom et id du champ + \param htmlname nom et id du champ \param keysearch nom et id complémentaire du champ de collecte - \param url chemin du fichier de réponse : /chemin/fichier.php + \param url chemin du fichier de réponse : /chemin/fichier.php \param option champ supplémentaire de recherche dans les paramètres - \param indicator nom de l'image gif sans l'extension + \param indicator Nom de l'image gif sans l'extension \return script script complet */ function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working') { - $script = ''; - $script.= ''; - $script.= ''; - $script.= '
'; + $script.='Ajax.Responders.register(myIndicator'.$htmlname.');'; + $script.='new Form.Element.Observer($("'.$keysearch.$htmlname.'"), 1, + function(){ + var myAjax = new Ajax.Updater( { + success: \'ajdynfield'.$htmlname.'\'}, + \''.DOL_URL_ROOT.$url.'\', { + method: \'get\', + parameters: "'.$keysearch.'="+$F("'.$keysearch.$htmlname.'")+"&htmlname='.$htmlname.$option.'" + }); + });'; + $script.=''; + $script.='
'; + $script.=''; - return $script; + return $script; } /** diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3454003de99..2dd637009c5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -521,11 +521,11 @@ else /** * \brief Affiche en-tete HTML - * \param head lignes d'en-tete head - * \param title titre page web - * \param target target du menu Accueil + * \param head Lignes d'en-tete head optionnelles + * \param title Titre page web + * \param disablejs N'affiche pas les liens vers les js (Ex: qd fonction utilisée par sous formulaire Ajax) */ -function top_htmlhead($head, $title="", $target="") +function top_htmlhead($head, $title='', $disablejs=0) { global $user, $conf, $langs, $db, $micro_start_time; @@ -536,10 +536,10 @@ function top_htmlhead($head, $title="", $target="") if (! $conf->css) $conf->css ='/theme/eldy/eldy.css.php'; //header("Content-type: text/html; charset=UTF-8"); - header("Content-type: text/html; charset=".$_SESSION['charset']); + header("Content-type: text/html; charset=".$conf->character_set_client); print ''; -// print ''; + //print ''; print "\n"; print "\n"; print "\n"; @@ -549,10 +549,10 @@ function top_htmlhead($head, $title="", $target="") // Affiche meta print ''."\n"; // Evite indexation par robots - print ''."\n"; + print ''."\n"; // Affiche title - if (strlen($title) > 0) + if ($title) { print 'Dolibarr - '.$title.''; } @@ -574,20 +574,22 @@ function top_htmlhead($head, $title="", $target="") print ''."\n"; // Definition en alternate style sheet des feuilles de styles les plus maintenues - // Les navigateurs qui supportent sont rares. + // Les navigateurs qui supportent sont rares. Plus aucun connu. + /* print ''."\n"; print ''."\n"; print ''."\n"; - + */ + print ''."\n"; print ''."\n"; print ''."\n"; - if ($conf->use_javascript || $conf->use_ajax) + if (! $disablejs && ($conf->use_javascript || $conf->use_ajax)) { print ''."\n"; } - if ($conf->use_ajax) + if (! $disablejs && $conf->use_ajax) { print ''."\n"; print ''."\n"; diff --git a/htdocs/product/ajaxproducts.php b/htdocs/product/ajaxproducts.php index fe1dfedf828..9a0c48d7bf9 100644 --- a/htdocs/product/ajaxproducts.php +++ b/htdocs/product/ajaxproducts.php @@ -34,7 +34,7 @@ $langs->load("main"); top_htmlhead("", "", 1); -print ''."\n"; +print ''."\n"; // Generation liste de produits if(isset($_GET['keysearch']) && !empty($_GET['keysearch'])) diff --git a/htdocs/searchpostalcode.php b/htdocs/searchpostalcode.php index 6787225d8be..66cf72c76e4 100644 --- a/htdocs/searchpostalcode.php +++ b/htdocs/searchpostalcode.php @@ -81,7 +81,7 @@ if ($user->societe_id > 0) -top_htmlhead("", $langs->trans("SearchTown"), ""); +top_htmlhead("", $langs->trans("SearchTown")); print ""; diff --git a/htdocs/societe/ajaxcountries.php b/htdocs/societe/ajaxcountries.php index 3cb7a62ca36..c522a8eb488 100644 --- a/htdocs/societe/ajaxcountries.php +++ b/htdocs/societe/ajaxcountries.php @@ -26,13 +26,11 @@ \version $Revision$ */ -require('../master.inc.php'); +require('../main.inc.php'); -//header("Content-type: text/html; charset=UTF-8"); -header("Content-type: text/html; charset=iso-8859-1"); -print ''; -print "\n"; -print "\n"; +top_htmlhead("", "", 1); + +print ''; // Generation liste des pays if(isset($_POST['pays']) && !empty($_POST['pays'])) diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 402d2b07448..343019af3d8 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -36,7 +36,7 @@ $WS_DOL_URL='http://ec.europa.eu/taxation_customs/vies/api/checkVatPort'; $WS_METHOD = 'checkVat'; -top_htmlhead("", $langs->trans("VATIntraCheckableOnEUSite"), ""); +top_htmlhead("", $langs->trans("VATIntraCheckableOnEUSite")); print ''; print '
'; print '
'; diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 185c70cd6b2..f9a30a5adac 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -348,12 +348,9 @@ class Translate { * [en] Send header and return a string of html start page * \return string html header avec charset */ - function lang_header() { - //header("Content-Type: text/html; charset=$charset"); $texte = "\n"; - return $texte; } @@ -364,7 +361,6 @@ class Translate { * \param searchalt cherche aussi dans langue alternative * \return boolean true si existe, false sinon */ - function file_exists($filename,$searchalt=0) { // Test si fichier dans répertoire de la langue