Fix: Error when capital is not a number

This commit is contained in:
Laurent Destailleur 2010-09-15 12:00:05 +00:00
parent 6ecd927def
commit 933ccfb259
2 changed files with 7 additions and 6 deletions

View File

@ -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 '<tr><td>'.$langs->trans("Company").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$objsoc->id.'">'.$objsoc->nom.'</a></td>';
print '<td colspan="3">';
print $objsoc->getNomUrl(1);
print '</td>';
print '<input type="hidden" name="socid" value="'.$objsoc->id.'">';
print '</td></tr>';
}

View File

@ -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");