Fix: Si code compta ou code client non fourni on ne stocke rien plutot que chaine vide.

This commit is contained in:
Laurent Destailleur 2005-06-25 20:12:49 +00:00
parent 6e9969c6fb
commit 8194d434b8

View File

@ -310,37 +310,28 @@ class Societe {
if ($this->pays_id) if ($this->pays_id)
{ $sql .= ",fk_pays = '" . $this->pays_id ."'"; } { $sql .= ",fk_pays = '" . $this->pays_id ."'"; }
$sql .= ",tel = '" . $this->tel ."'"; $sql .= ",tel = ".($this->tel?"'".$this->tel."'":"null");
$sql .= ",fax = '" . $this->fax ."'"; $sql .= ",fax = ".($this->fax?"'".$this->fax."'":"null");
$sql .= ",url = '" . $this->url ."'"; $sql .= ",url = ".($this->url?"'".$this->url."'":"null");
$sql .= ",siren = '" . $this->siren ."'";
$sql .= ",siret = '" . $this->siret ."'"; $sql .= ",siren = '". $this->siren ."'";
$sql .= ",ape = '" . $this->ape ."'"; $sql .= ",siret = '". $this->siret ."'";
$sql .= ",ape = '". $this->ape ."'";
$sql .= ",tva_intra = '" . $this->tva_intra ."'"; $sql .= ",tva_intra = '" . $this->tva_intra ."'";
$sql .= ",capital = '" . $this->capital ."'"; $sql .= ",capital = '" . $this->capital ."'";
if ($this->prefix_comm) if ($this->prefix_comm) $sql .= ",prefix_comm = '" . $this->prefix_comm ."'";
{ $sql .= ",prefix_comm = '" . $this->prefix_comm ."'"; }
if ($this->effectif_id) if ($this->effectif_id) $sql .= ",fk_effectif = '" . $this->effectif_id ."'";
{ $sql .= ",fk_effectif = '" . $this->effectif_id ."'"; }
if ($this->typent_id) if ($this->typent_id) $sql .= ",fk_typent = '" . $this->typent_id ."'";
{ $sql .= ",fk_typent = '" . $this->typent_id ."'"; }
if ($this->forme_juridique_code) if ($this->forme_juridique_code) $sql .= ",fk_forme_juridique = '".$this->forme_juridique_code."'";
{
$sql .= ",fk_forme_juridique = '".$this->forme_juridique_code."'";
}
$sql .= ",client = " . $this->client; $sql .= ",client = " . $this->client;
$sql .= ",fournisseur = " . $this->fournisseur; $sql .= ",fournisseur = " . $this->fournisseur;
if ($user)
{
$sql .= ",fk_user_modif = '".$user->id."'";
}
if ($this->creation_bit || $this->codeclient_modifiable) if ($this->creation_bit || $this->codeclient_modifiable)
{ {
// Attention check_codeclient peut modifier le code // Attention check_codeclient peut modifier le code
@ -348,16 +339,18 @@ class Societe {
$this->check_codeclient(); $this->check_codeclient();
$sql .= ", code_client = '". $this->code_client ."'"; $sql .= ", code_client = ".($this->code_client?"'".$this->code_client."'":"null");
// Attention check_codecompta peut modifier le code // Attention check_codecompta peut modifier le code
// suivant le module utilisé // suivant le module utilisé
$this->check_codecompta(); $this->check_codecompta();
$sql .= ", code_compta = '". $this->code_compta ."'"; $sql .= ", code_compta = ".($this->code_compta?"'".$this->code_compta."'":"null");
} }
if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
$sql .= " WHERE idp = '" . $id ."'"; $sql .= " WHERE idp = '" . $id ."'";
if ($this->db->query($sql)) if ($this->db->query($sql))