Debug v13

This commit is contained in:
Laurent Destailleur 2020-12-14 10:58:09 +01:00
parent cce0b2f31b
commit b0e3f1678f
2 changed files with 34 additions and 1 deletions

View File

@ -707,4 +707,37 @@ class PaymentSocialContribution extends CommonObject
return $result;
}
/**
* Return if object was dispatched into bookkeeping
*
* @return int <0 if KO, 0=no, 1=yes
*/
public function getVentilExportCompta()
{
$alreadydispatched = 0;
$type = 'bank';
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".$this->bank_line;
$resql = $this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$alreadydispatched = $obj->nb;
}
} else {
$this->error = $this->db->lasterror();
return -1;
}
if ($alreadydispatched)
{
return 1;
}
return 0;
}
}

View File

@ -1781,7 +1781,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
// Add if object was dispatched "into accountancy"
if (!empty($conf->accounting->enabled) && in_array($object->element, array('bank', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various')))
if (!empty($conf->accounting->enabled) && in_array($object->element, array('bank', 'paiementcharge', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various')))
{
// Note: For 'chargesociales', 'salaries'... this is the payments that are dispatched (so element = 'bank')
if (method_exists($object, 'getVentilExportCompta'))