|
@@ -5689,22 +5689,25 @@ class FactureLigne extends CommonInvoiceLine
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Delete line in database
|
|
|
- * TODO Add param User $user and notrigger (see skeleton)
|
|
|
+ * Delete line in database
|
|
|
*
|
|
|
- * @return int <0 if KO, >0 if OK
|
|
|
+ * @param User $tmpuser User that deletes
|
|
|
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
|
|
|
+ * @return int <0 if KO, >0 if OK
|
|
|
*/
|
|
|
- public function delete()
|
|
|
+ public function delete($tmpuser = null, $notrigger = false)
|
|
|
{
|
|
|
global $user;
|
|
|
|
|
|
$this->db->begin();
|
|
|
|
|
|
// Call trigger
|
|
|
- $result = $this->call_trigger('LINEBILL_DELETE', $user);
|
|
|
- if ($result < 0) {
|
|
|
- $this->db->rollback();
|
|
|
- return -1;
|
|
|
+ if (empty($notrigger)) {
|
|
|
+ $result = $this->call_trigger('LINEBILL_DELETE', $user);
|
|
|
+ if ($result < 0) {
|
|
|
+ $this->db->rollback();
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
}
|
|
|
// End call triggers
|
|
|
|
|
@@ -5716,7 +5719,7 @@ class FactureLigne extends CommonInvoiceLine
|
|
|
}
|
|
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->rowid);
|
|
|
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
|
|
+
|
|
|
if ($this->db->query($sql)) {
|
|
|
$this->db->commit();
|
|
|
return 1;
|