diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index 24690895ff5..f4f4d5015cc 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -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++; } diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 18802301e5a..7d3118fe891 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -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); diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 75f8eb14f49..502a3642afe 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -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