From 2f1f85a6925660d8c4bef491e48d7b621bbb998e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2004 00:26:07 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Inclusion=20des=20regions=20et=20departe?= =?UTF-8?q?ments=20de=20Belgique=20dans=20le=20fichier=20standard=20et=20m?= =?UTF-8?q?odifications=20divers=20pour=20permettre=20=E0=20Dolibarr=20de?= =?UTF-8?q?=20g=E9rer=20plusieurs=20pays=20au=20niveau=20des=20Pays,=20d?= =?UTF-8?q?=E9partements=20et=20regions=20pour=20les=20fiches=20societes.?= =?UTF-8?q?=20Tous=20les=20pays=20francophones=20sont=20actifs=20par=20def?= =?UTF-8?q?aut.=20L'utilisateur=20peut=20utiliser=20la=20page=20de=20confi?= =?UTF-8?q?guration=20du=20dictionnaire=20de=20donn=E9es=20pour=20d=E9sact?= =?UTF-8?q?iver=20un=20pays=20ou=20d=E9partements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/html.form.class.php | 90 ++++--- mysql/data/data.sql | 93 ++++--- mysql/migration/1.1.0-1.2.0-RC1.sql | 395 +++++++++++----------------- mysql/tables/llx_c_departements.sql | 4 +- mysql/tables/llx_c_pays.sql | 4 +- mysql/tables/llx_c_regions.sql | 4 +- 6 files changed, 273 insertions(+), 317 deletions(-) diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index db7cbf01dbf..0af58872457 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -32,42 +32,62 @@ class Form { return 1; } + /* - * + * Retourne la liste déroulante des départements/province/cantons + * avec un affichage avec rupture sur le pays * */ - Function select_departement($selected='', $addnsp=0) - { - print ''; - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - if ($num) - { - while ($i < $num) - { - $obj = $this->db->fetch_object( $i); - if ($selected == $obj->rowid) - { - print ''; - } - else - { - print ''; - } - $i++; - } - } - } - print ''; - } - /* - * + // 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 llx_c_departements as d, llx_c_regions as r, llx_c_pays as p"; + $sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid"; + $sql .= " AND d.active = 1 AND r.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC"; + + if ($this->db->query($sql)) + { + $num = $this->db->num_rows(); + $i = 0; + if ($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 ''; + $pays=$obj->libelle_pays; + } + + if ($selected > 0 && $selected == $obj->rowid) + { + print ''; + } + else + { + print ''; + } + } + $i++; + } + } + } + else { + print "Erreur : $sql : ".$this->db->error(); + } + print ''; + } + + /* + * Retourne la liste déroulante des pays actifs * */ Function select_pays($selected='', $addnsp=0) @@ -75,8 +95,8 @@ class Form { print '