Correction conflit CVS

This commit is contained in:
Rodolphe Quiedeville 2005-02-28 15:23:33 +00:00
parent 7d06600479
commit f332032fac

View File

@ -114,52 +114,57 @@ class Societe {
$result = $this->verify(); $result = $this->verify();
if ($result >= 0) if ($result >= 0)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, datec, datea, fk_user_creat) "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, datec, datea, fk_user_creat) ";
$sql .= " VALUES ('".addslashes($this->nom)."', now(), now(), '".$user->id."')"; $sql .= " VALUES ('".addslashes($this->nom)."', now(), now(), '".$user->id."')";
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
$this->id = $this->db->last_insert_id(); $this->id = $this->db->last_insert_id();
$this->creation_bit = 1; $this->creation_bit = 1;
$ret = $this->update($this->id); $ret = $this->update($this->id);
if ($ret == 0) { if ($ret == 0)
$this->db->commit(); {
} else { $this->db->commit();
dolibarr_syslog("Societe::create echec update"); }
else
{
dolibarr_syslog("Societe::create echec update");
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
return $ret; return $ret;
} }
else else
{
if ($this->db->errno() == DB_ERROR_RECORD_ALREADY_EXISTS) {
{ if ($this->db->errno() == DB_ERROR_RECORD_ALREADY_EXISTS)
{
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom); $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom);
} }
else { else
dolibarr_syslog("Societe::create echec insert sql=$sql"); {
} dolibarr_syslog("Societe::create echec insert sql=$sql");
}
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
} }
else { else
{
$this->db->rollback(); $this->db->rollback();
dolibarr_syslog("Societe::Create echec verify sql=$sql"); dolibarr_syslog("Societe::Create echec verify sql=$sql");
return -1; return -1;
} }
} }
/** /**
* \brief Verification lors de la modification * \brief Verification lors de la modification
* \return 0 si ok, < 0 en cas d'erreur * \return 0 si ok, < 0 en cas d'erreur
@ -300,13 +305,12 @@ class Societe {
$sql .= ",siren = '" . $this->siren ."'"; $sql .= ",siren = '" . $this->siren ."'";
$sql .= ",siret = '" . $this->siret ."'"; $sql .= ",siret = '" . $this->siret ."'";
$sql .= ",ape = '" . $this->ape ."'"; $sql .= ",ape = '" . $this->ape ."'";
$sql .= ",tva_intra = '" . $this->tva_intra ."'";
$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->tva_intra)
{ $sql .= ",tva_intra = '" . $this->tva_intra ."'"; }
if ($this->capital)
{ $sql .= ",capital = '" . $this->capital ."'"; }
if ($this->effectif_id) if ($this->effectif_id)
{ $sql .= ",fk_effectif = '" . $this->effectif_id ."'"; } { $sql .= ",fk_effectif = '" . $this->effectif_id ."'"; }