From 933ccfb259dc4ae47322931eed73e5dd0b269fcb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Sep 2010 12:00:05 +0000 Subject: [PATCH] Fix: Error when capital is not a number --- htdocs/contact/fiche.php | 6 ++++-- htdocs/societe/class/societe.class.php | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 87e2958602b..384cb0c0904 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -224,7 +224,7 @@ $formcompany = new FormCompany($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -if ($socid) +if ($socid > 0) { $objsoc = new Societe($db); $objsoc->fetch($socid); @@ -326,7 +326,9 @@ if ($user->rights->societe->contact->creer) if ($socid > 0) { print ''.$langs->trans("Company").''; - print ''.$objsoc->nom.''; + print ''; + print $objsoc->getNomUrl(1); + print ''; print ''; print ''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 73818298e83..96f2d970666 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -363,7 +363,6 @@ class Societe extends CommonObject // Clean parameters $this->id=$id; - $this->capital=trim($this->capital); $this->nom=trim($this->nom); $this->adresse=trim($this->adresse); // TODO obsolete $this->address=trim($this->address); @@ -392,8 +391,8 @@ class Societe extends CommonObject $this->localtax1_assuj=trim($this->localtax1_assuj); $this->localtax2_assuj=trim($this->localtax2_assuj); - $this->capital=trim($this->capital); - if (dol_strlen($this->capital) == 0) $this->capital = 0; + $this->capital=price2num(trim($this->capital),'MT'); + if (empty($this->capital)) $this->capital = 0; $this->effectif_id=trim($this->effectif_id); $this->forme_juridique_code=trim($this->forme_juridique_code); @@ -452,7 +451,7 @@ class Societe extends CommonObject $sql .= ",localtax1_assuj = ".($this->localtax1_assuj!=''?"'".$this->localtax1_assuj."'":"null"); $sql .= ",localtax2_assuj = ".($this->localtax2_assuj!=''?"'".$this->localtax2_assuj."'":"null"); - $sql .= ",capital = '" . addslashes($this->capital) ."'"; + $sql .= ",capital = ".$this->capital; $sql .= ",prefix_comm = ".($this->prefix_comm?"'".addslashes($this->prefix_comm)."'":"null");