This commit is contained in:
Laurent Destailleur 2020-12-02 15:16:04 +01:00
parent 25bedc3497
commit 409b73fe2c
3 changed files with 10 additions and 7 deletions

View File

@ -106,7 +106,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$sql .= " AND s.outstanding_limit > 0";
$sql .= " AND s.rowid IN (SELECT fk_soc from ".MAIN_DB_PREFIX."facture as f WHERE f.fk_statut = 1 and f.fk_soc = s.rowid)";
$sql .= " ORDER BY s.tms DESC";
$sql .= $this->db->plimit($max, 0);
//$sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
$result = $this->db->query($sql);
@ -114,10 +114,13 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
{
$num = $this->db->num_rows($result);
$nboutstandingbillreachedcustomers = 0;
$line = 0;
while ($line < $num)
{
$objp = $this->db->fetch_object($result);
$datec = $this->db->jdate($objp->datec);
$datem = $this->db->jdate($objp->tms);
$thirdpartystatic->id = $objp->socid;
@ -136,22 +139,21 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$outstandingtotal = $thirdpartystatic->getOutstandingBills()['opened'];
$outstandinglimit = $thirdpartystatic->outstanding_limit;
$nboutstandingbillreachedcustomers = 0;
if ($outstandingtotal >= $outstandinglimit)
{
$this->info_box_contents[$line][] = array(
$this->info_box_contents[$nboutstandingbillreachedcustomers][] = array(
'td' => '',
'text' => $thirdpartystatic->getNomUrl(1),
'text' => $thirdpartystatic->getNomUrl(1, 'customer'),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
$this->info_box_contents[$nboutstandingbillreachedcustomers][] = array(
'td' => 'class="right" width="18"',
'text' => $thirdpartystatic->LibStatut($objp->status, 3)
);
$nboutstandingbillreachedcustomers++;
}
$line++;
}

View File

@ -542,3 +542,4 @@ CREATE TABLE llx_session(
user_agent varchar(128) NULL
)ENGINE=innodb;
INSERT INTO llx_boxes_def(file, entity) VALUES ('box_customers_outstanding_bill_reached', 1);

View File

@ -46,7 +46,7 @@ BoxTitleLastModifiedDonations=Latest %s modified donations
BoxTitleLastModifiedExpenses=Latest %s modified expense reports
BoxTitleLatestModifiedBoms=Latest %s modified BOMs
BoxTitleLatestModifiedMos=Latest %s modified Manufacturing Orders
BoxTitleLastOutstandingBillReached=Latest %s customers with maximum outstanding exceeded
BoxTitleLastOutstandingBillReached=Customers with maximum outstanding exceeded
BoxGlobalActivity=Global activity (invoices, proposals, orders)
BoxGoodCustomers=Good customers
BoxTitleGoodCustomers=%s Good customers