Ajout fonction delete
This commit is contained in:
parent
2ad75a54ae
commit
71252712c5
@ -97,6 +97,37 @@ class Paiement
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
Function delete()
|
||||||
|
{
|
||||||
|
$sql = "SELECT llx_paiement.rowid FROM llx_facture, llx_paiement WHERE llx_paiement.rowid = ".$this->id;
|
||||||
|
$sql .= " AND llx_paiement.fk_facture = llx_facture.rowid AND llx_facture.paye = 0";
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows() == 1)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM llx_paiement WHERE llx_paiement.rowid = ".$this->id;
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error() ."<br>".$sql;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error() ."<br>".$sql;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user