From 20668ad5b334e4e6cac14e0e292681007b09afc4 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 17 Feb 2004 09:59:06 +0000 Subject: [PATCH] Gestion du pays --- htdocs/soc.php | 13 ++++++++++++- htdocs/societe.class.php | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/htdocs/soc.php b/htdocs/soc.php index b628f5ba78c..8390052a62d 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -40,6 +40,7 @@ if ($HTTP_POST_VARS["action"] == 'add' or $HTTP_POST_VARS["action"] == 'update') $soc->adresse = $HTTP_POST_VARS["adresse"]; $soc->cp = $HTTP_POST_VARS["cp"]; $soc->ville = $HTTP_POST_VARS["ville"]; + $soc->pays_id = $HTTP_POST_VARS["pays_id"]; $soc->departement_id = $HTTP_POST_VARS["departement_id"]; $soc->tel = $HTTP_POST_VARS["tel"]; $soc->fax = $HTTP_POST_VARS["fax"]; @@ -90,6 +91,10 @@ if ($action == 'create') print $form->select_departement(0); print ''; + print 'Pays'; + print $form->select_pays($soc->pays_id); + print ''; + print 'Téléphone'; print 'Fax'; @@ -155,6 +160,11 @@ elseif ($action == 'edit') print 'Département'; print $form->select_departement($soc->departement_id); print ''; + + print 'Pays'; + print $form->select_pays($soc->pays_id); + print ''; + print 'Téléphone'; print 'Fax'; print 'Webhttp://'; @@ -269,7 +279,8 @@ else print ''; print ''; print ''; + print '
'.$soc->cp.' '.$soc->ville.'
'.$soc->pays.''; + print ''; print ''; diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 222a8d40d44..d40c5be00f2 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -92,6 +92,7 @@ class Societe { $sql .= ",cp = '" . trim($this->cp) ."'"; $sql .= ",ville = '" . trim($this->ville) ."'"; $sql .= ",fk_departement = " . $this->departement_id; + $sql .= ",fk_pays = " . $this->pays_id; $sql .= ",tel = '" . ereg_replace(" ","",$this->tel) ."'"; $sql .= ",fax = '" . ereg_replace(" ","",$this->fax) ."'"; $sql .= ",url = '" . trim($this->url) ."'"; @@ -106,7 +107,11 @@ class Societe { $sql .= ",fournisseur = " . $this->fournisseur ; $sql .= " WHERE idp = " . $id .";"; - if (! $this->db->query($sql)) + if ($this->db->query($sql)) + { + + } + else { print $this->db->error(); } @@ -125,13 +130,16 @@ class Societe { $sql .= ", s.siret, s.capital, s.ape, s.tva_intra, s.rubrique, s.fk_effectif"; $sql .= ", e.libelle as effectif, e.id as effectif_id"; $sql .= ", s.fk_forme_juridique as forme_juridique_id, fj.libelle as forme_juridique"; - $sql .= ", s.fk_departement"; + $sql .= ", s.fk_departement, s.fk_pays"; + $sql .= ", p.libelle as pays"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."c_effectif as e"; + $sql .= ", ".MAIN_DB_PREFIX."c_pays as p"; $sql .= ", ".MAIN_DB_PREFIX."c_forme_juridique as fj"; $sql .= " WHERE s.idp = ".$this->id; $sql .= " AND s.fk_effectif = e.id"; + $sql .= " AND s.fk_pays = p.rowid"; $sql .= " AND s.fk_forme_juridique = fj.code"; $result = $this->db->query($sql); @@ -146,6 +154,10 @@ class Societe { $this->cp = $obj->cp; $this->ville = stripslashes($obj->ville); $this->departement_id = $obj->fk_departement; + $this->pays_id = $obj->fk_pays; + + $this->pays = $obj->pays; + $this->url = $obj->url; $this->tel = $obj->tel;
Nom'.$soc->nom.'
Adresse'.nl2br($soc->adresse).' '; - print '
'.$soc->cp.' '.$soc->ville.'
Téléphone'.dolibarr_print_phone($soc->tel).'Fax'.dolibarr_print_phone($soc->fax).'