Add trigger on delete accounting document
This commit is contained in:
parent
9f92446dba
commit
bf5d2ec336
@ -579,23 +579,21 @@ class BookKeeping
|
|||||||
* @param int $notrigger 1=Does not execute triggers, 0 otherwise
|
* @param int $notrigger 1=Does not execute triggers, 0 otherwise
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger = 0) {
|
function delete($user, $notrigger = 0)
|
||||||
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error)
|
||||||
if (! $notrigger) {
|
{
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
if (! $notrigger)
|
||||||
// want this action calls a trigger.
|
{
|
||||||
|
// Call trigger
|
||||||
// // Call triggers
|
$result=$this->call_trigger('ACCOUNTING_NUMPIECE_DELETE',$user);
|
||||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
if ($result < 0) $error++;
|
||||||
// $interface=new Interfaces($this->db);
|
// End call triggers
|
||||||
// $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
|
||||||
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// // End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,7 +617,9 @@ class BookKeeping
|
|||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return - 1 * $error;
|
return - 1 * $error;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -628,7 +628,8 @@ class BookKeeping
|
|||||||
/**
|
/**
|
||||||
* \brief Delete bookkepping by importkey
|
* \brief Delete bookkepping by importkey
|
||||||
*/
|
*/
|
||||||
function export_bookkeping($model = 'ebp') {
|
function export_bookkeping($model = 'ebp')
|
||||||
|
{
|
||||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||||
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||||
$sql .= " numero_compte, label_compte, debit, credit,";
|
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||||
@ -668,7 +669,9 @@ class BookKeeping
|
|||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::export_bookkeping " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::export_bookkeping " . $this->error, LOG_ERR);
|
||||||
return - 1;
|
return - 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user