Fix: Gestion erreur liste propals

This commit is contained in:
Laurent Destailleur 2005-03-15 16:01:11 +00:00
parent 74ec2a2529
commit de8084be3d

View File

@ -284,12 +284,12 @@ class Propal
} }
else else
{ {
print $this->db->error() . '<b><br>'.$sql; dolibarr_print_error($this->db);
} }
} }
else else
{ {
print $this->db->error() . '<b><br>'.$sql; dolibarr_print_error($this->db);
} }
return $this->id; return $this->id;
} }
@ -439,7 +439,7 @@ class Propal
} }
else else
{ {
print $this->db->error(); dolibarr_print_error($this->db);
} }
/* /*
@ -478,14 +478,14 @@ class Propal
} }
else else
{ {
print $this->db->error(); dolibarr_print_error($this->db);
} }
} }
return 1; return 1;
} }
else else
{ {
print $this->db->error(); dolibarr_print_error($this->db);
return 0; return 0;
} }
} }
@ -510,7 +510,7 @@ class Propal
} }
else else
{ {
print $this->db->error() . ' in ' . $sql; dolibarr_print_error($this->db);
return -1; return -1;
} }
} }
@ -539,7 +539,7 @@ class Propal
} }
else else
{ {
print $this->db->error() . ' in ' . $sql; dolibarr_print_error($this->db);
} }
} }
} }
@ -564,7 +564,7 @@ class Propal
} }
else else
{ {
print $this->db->error() . ' in ' . $sql; dolibarr_print_error($this->db);
return 0; return 0;
} }
} }
@ -579,11 +579,10 @@ class Propal
{ {
$this->statut = $statut; $this->statut = $statut;
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$user->id"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$user->id";
$sql .= " WHERE rowid = $this->id;"; $sql .= " WHERE rowid = $this->id;";
if ($this->db->query($sql) ) if ($this->db->query($sql))
{ {
if ($statut == 2) if ($statut == 2)
{ {
@ -609,7 +608,7 @@ class Propal
} }
else else
{ {
print $this->db->error() . ' in ' . $sql; dolibarr_print_error($this->db);
} }
} }
@ -647,13 +646,16 @@ class Propal
} }
else else
{ {
print $this->db->error() . ' in ' . $sql; dolibarr_print_error($this->db);
} }
} }
/** /**
* * \brief Renvoi la liste des propal (éventuellement filtrée sur un user) dans un tableau
* * \param brouillon 0=non brouillon, 1=brouillon
* \param user Objet user de filtre
* \return int -1 si erreur, tableau résultat si ok
*/ */
function liste_array ($brouillon=0, $user='') function liste_array ($brouillon=0, $user='')
@ -661,7 +663,8 @@ class Propal
$ga = array(); $ga = array();
$sql = "SELECT rowid, ref FROM ".MAIN_DB_PREFIX."propal"; $sql = "SELECT rowid, ref FROM ".MAIN_DB_PREFIX."propal";
if ($brouillon = 1)
if ($brouillon)
{ {
$sql .= " WHERE fk_statut = 0"; $sql .= " WHERE fk_statut = 0";
if ($user) if ($user)
@ -679,16 +682,17 @@ class Propal
$sql .= " ORDER BY datep DESC"; $sql .= " ORDER BY datep DESC";
if ($this->db->query($sql) ) $result=$this->db->query($sql);
if ($result)
{ {
$nump = $this->db->num_rows(); $nump = $this->db->num_rows($result);
if ($nump) if ($nump)
{ {
$i = 0; $i = 0;
while ($i < $nump) while ($i < $nump)
{ {
$obj = $this->db->fetch_object(); $obj = $this->db->fetch_object($result);
$ga[$obj->rowid] = $obj->ref; $ga[$obj->rowid] = $obj->ref;
$i++; $i++;
@ -698,7 +702,7 @@ class Propal
} }
else else
{ {
print $this->db->error(); return -1;
} }
} }
@ -732,7 +736,7 @@ class Propal
} }
else else
{ {
print $this->db->error(); dolibarr_print_error($this->db);
} }
} }
@ -779,7 +783,7 @@ class Propal
} }
else else
{ {
print $this->db->error() . ' in ' . $sql; dolibarr_print_error($this->db);
return -1; return -1;
} }
} }
@ -832,7 +836,7 @@ class Propal
} }
else else
{ {
print $this->db->error(); dolibarr_print_error($this->db);
} }
} }