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 '| Web | http:// |
';
@@ -269,7 +279,8 @@ else
print '';
print '| Nom | '.$soc->nom.' |
';
print '| Adresse | '.nl2br($soc->adresse).' ';
- print ' '.$soc->cp.' '.$soc->ville.' |
';
+ print '
'.$soc->cp.' '.$soc->ville.'
'.$soc->pays.'';
+
print '| Téléphone | '.dolibarr_print_phone($soc->tel).' | ';
print 'Fax | '.dolibarr_print_phone($soc->fax).' |
';
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;