From f00ac2232f0a7ac6a1b258041d2ff811db2f6376 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Sep 2004 16:36:33 +0000 Subject: [PATCH] =?UTF-8?q?Trad:=20M=E9canique=20de=20traduction=20des=20l?= =?UTF-8?q?istes=20d=E9roulantes=20des=20dictionnaires=20de=20donn=E9es.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/html.form.class.php | 328 +++++++++++++++++++++---------------- htdocs/soc.php | 51 +++--- 2 files changed, 212 insertions(+), 167 deletions(-) diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 98deddeef88..e680c741165 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -3,7 +3,6 @@ * Copyright (C) 2004 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier * * 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 @@ -23,15 +22,28 @@ * $Source$ */ +/*! + \file htdocs/html.form.class.php + \brief Fichier de la classe des fonctions prédéfinie de composants html + \version $Revision$ +*/ + + +/*! \class Form + \brief Classe permettant la génération de composants html +*/ + class Form { var $db; var $errorstr; - + /* + * \brief Constructeur + * \param DB handler d'accès base de donnée + */ function Form($DB) { - $this->db = $DB; return 1; @@ -47,6 +59,9 @@ class Form */ function select_departement($selected='',$htmlname='departement_id') { + global $conf,$langs; + $langs->load("dict"); + // On recherche les départements/cantons/province active d'une region et pays actif $sql = "SELECT d.rowid, d.code_departement as code , d.nom, d.active, p.libelle as libelle_pays, p.code as code_pays FROM "; $sql .= MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_pays as p"; @@ -55,44 +70,47 @@ class Form $sql .= "ORDER BY code_pays, code ASC"; if ($this->db->query($sql)) - { - print ''; - } - else { - dolibarr_print_error($this->db); + { + print ''; } - } + else { + dolibarr_print_error($this->db); + } + } /* * \brief Retourne la liste déroulante des regions actives dont le pays est actif @@ -103,6 +121,9 @@ class Form */ function select_region($selected='',$htmlname='region_id') { + global $conf,$langs; + $langs->load("dict"); + $sql = "SELECT r.rowid, r.code_region as code, r.nom as libelle, r.active, p.libelle as libelle_pays FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE r.fk_pays=p.rowid AND r.active = 1 and p.active = 1 ORDER BY libelle_pays, libelle ASC"; @@ -147,37 +168,53 @@ class Form } /* - * \brief Retourne la liste déroulante des pays actifs - * + * \brief Retourne la liste déroulante des pays actifs, dans la langue de l'utilisateur + * \param selected code pays pré-sélectionné + * \param htmlname nom de la liste deroulante */ function select_pays($selected='',$htmlname='pays_id') { - $sql = "SELECT rowid, libelle, active FROM ".MAIN_DB_PREFIX."c_pays"; - $sql .= " WHERE active = 1 ORDER BY libelle ASC;"; - + global $conf,$langs; + $langs->load("dict"); + + $sql = "SELECT rowid, libelle, code, active FROM ".MAIN_DB_PREFIX."c_pays"; + $sql .= " WHERE active = 1"; + $sql .= " ORDER BY libelle ASC;"; + if ($this->db->query($sql)) - { - print ''; - } + { + print ''; + return 0; + } + else { + dolibarr_print_error($this->db); + return 1; + } } @@ -324,45 +361,48 @@ class Form /* - * Retourne la liste déroulante des civilite actives - * + * \brief Retourne la liste déroulante des civilite actives + * \param selected civilite pré-sélectionnée */ function select_civilite($selected='') { - global $conf; + global $conf,$langs; + $langs->load("dict"); $sql = "SELECT rowid, code, civilite, active FROM ".MAIN_DB_PREFIX."c_civilite"; $sql .= " WHERE active = 1"; - $sql .= " AND lang='".$conf->langage."'"; - + if ($this->db->query($sql)) - { - print ''; - } + { + print ''; + } else { - dolibarr_print_error($this->db); - } - + dolibarr_print_error($this->db); + } + } /* @@ -370,57 +410,65 @@ class Form * avec un affichage avec rupture sur le pays * */ - function select_forme_juridique($selected='') + function select_forme_juridique($selected='') + { + global $conf,$langs; + $langs->load("dict"); + + // On recherche les formes juridiques actives des pays actifs + $sql = "SELECT f.rowid, f.code as code , f.libelle as nom, f.active, p.libelle as libelle_pays, p.code as code_pays FROM llx_c_forme_juridique as f, llx_c_pays as p"; + $sql .= " WHERE f.fk_pays=p.rowid"; + $sql .= " AND f.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC"; + + if ($this->db->query($sql)) { - // On recherche les formes juridiques actives des pays actifs - $sql = "SELECT f.rowid, f.code as code , f.libelle as nom, f.active, p.libelle as libelle_pays, p.code as code_pays FROM llx_c_forme_juridique as f, llx_c_pays as p"; - $sql .= " WHERE f.fk_pays=p.rowid"; - $sql .= " AND f.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC"; - - if ($this->db->query($sql)) + print ''; - $num = $this->db->num_rows(); - $i = 0; - if ($num) + $pays=''; + while ($i < $num) { - $pays=''; - while ($i < $num) - { - $obj = $this->db->fetch_object( $i); - if ($obj->code == 0) { - print ''; - } - else { - if ($pays == '' || $pays != $obj->libelle_pays) { - // Affiche la rupture - print '\n"; - $pays=$obj->libelle_pays; - } - - if ($selected > 0 && $selected == $obj->code) - { - print ''; - } - else - { - print ''; - } - } - $i++; + $obj = $this->db->fetch_object( $i); + if ($obj->code == 0) { + print ''; } + else { + if ($pays == '' || $pays != $obj->libelle_pays) { + // Affiche la rupture + print '\n"; + $pays=$obj->libelle_pays; + } + + if ($selected > 0 && $selected == $obj->code) + { + print ''; + } + $i++; } - print ''; - } - else { - dolibarr_print_error($this->db); - } + } + print ''; } + else { + dolibarr_print_error($this->db); + } + } /* - * - * - * + * \brief Affiche formulaire de demande de confirmation + * \param page page + * \param title title + * \param question question + * \param action action */ function form_confirm($page, $title, $question, $action) { diff --git a/htdocs/soc.php b/htdocs/soc.php index 0efb693b263..dcf606098b0 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -124,31 +124,29 @@ if ($_GET["action"] == 'create') print $langs->trans('Town').' '; print ''.$langs->trans('State').''; - print $form->select_departement($soc->departement_id); + $form->select_departement($soc->departement_id); print ''; print ''.$langs->trans('Country').''; - print $form->select_pays(MAIN_INFO_SOCIETE_PAYS); + $form->select_pays(defined(MAIN_INFO_SOCIETE_PAYS)?MAIN_INFO_SOCIETE_PAYS:''); print ''; print ''.$langs->trans('Phone').''; print ''.$langs->trans('Fax').''; - - print ''.$langs->trans('Web').'http://'; + print ''.$langs->trans('Web').''; print ''.$langs->trans('ProfIdSiren').''; - print ''.$langs->trans('ProfIdSiret').''; print ''.$langs->trans('ProfIdApe').''; print 'Capital '.MAIN_MONNAIE.''; print 'Forme juridique'; - print $form->select_forme_juridique($soc->forme_juridique_code); + $form->select_forme_juridique($soc->forme_juridique_code); print ''; print 'Effectif'; - print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); + $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); print ''; print ''.$langs->trans('TVAIntra').''; @@ -165,7 +163,7 @@ if ($_GET["action"] == 'create') print ''; print ''.$langs->trans('Supplier').''; - print $form->selectyesnonum("fournisseur",$soc->fournisseur); + $form->selectyesnonum("fournisseur",$soc->fournisseur); print ''; print ''; @@ -194,27 +192,27 @@ elseif ($_GET["action"] == 'edit') print ''; print ''; - print ''; + print ''; - print ''; + print ''; - print ''; print ''; + print $langs->trans('Town').' '; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -222,13 +220,12 @@ elseif ($_GET["action"] == 'edit') print ''; print ''; - print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print '
Nom
'.$langs->trans('Name').'Préfix
'.$langs->trans('Prefix').'
'.$langs->trans('Adresse').'
'.$langs->trans('Zip').' '; - print 'Ville '.$langs->trans('State').''; - print $form->select_departement($soc->departement_id); + $form->select_departement($soc->departement_id); print '
'.$langs->trans('Country').''; - print $form->select_pays($soc->pays_id); + $form->select_pays($soc->pays_id); print '
'.$langs->trans('Téléphone').'
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('Web').'http://
'.$langs->trans('Web').'
'.$langs->trans('ProfIdSiren').''.$langs->trans('ProfIdSiret').'
'.$langs->trans('ProfIdApe').'Capital '.MAIN_MONNAIE.'
Forme juridique'; - print $form->select_forme_juridique($soc->forme_juridique_code); + $form->select_forme_juridique($soc->forme_juridique_code); print '
Effectif'; - print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); + $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); print '
'.$langs->trans('TVAIntra').''; @@ -239,16 +236,16 @@ elseif ($_GET["action"] == 'edit') print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('Supplier').''; - print $form->selectyesnonum("fournisseur",$soc->fournisseur); + $form->selectyesnonum("fournisseur",$soc->fournisseur); print '
'; print ''; @@ -312,13 +309,13 @@ else */ print ''; - print ''; + print ''; - print ""; + print ""; - print ''; + print ''; print ''; - print '';
Nom'.$soc->nom.'Préfix'.$soc->prefix_comm.'
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Prefix').''.$soc->prefix_comm.'
".$langs->trans('Adresse')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Téléphone').''.dolibarr_print_phone($soc->tel).'
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax).'
Web'; + print '
'.$langs->trans('Web').''; if ($soc->url) { print 'http://'.$soc->url.''; } print '