From eefa2bcaba7d27c2829a4a9e757831bdad47dcb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Aug 2020 21:06:38 +0200 Subject: [PATCH] FIX List of invoice waiting for direct debit --- htdocs/compta/prelevement/demandes.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index e377957888e..a83a6a2938c 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -107,14 +107,17 @@ if ($type != 'bank-transfer') { llxHeader('', $title); $thirdpartystatic = new Societe($db); -$invoicestatic = new Facture($db); +if ($type == 'bank-transfer') { + $invoicestatic = new FactureFournisseur($db); +} else { + $invoicestatic = new Facture($db); +} // List of requests $sql = "SELECT f.ref, f.rowid, f.total_ttc,"; $sql .= " s.nom as name, s.rowid as socid,"; -$sql .= " pfd.date_demande as date_demande,"; -$sql .= " pfd.fk_user_demande"; +$sql .= " pfd.date_demande as date_demande, pfd.amount, pfd.fk_user_demande"; if ($type != 'bank-transfer') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; } else { @@ -128,6 +131,7 @@ $sql .= " AND f.entity IN (".getEntity('invoice').")"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql .= " AND f.fk_soc = ".$socid; if (!$status) $sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; if ($status) $sql .= " AND pfd.traite = ".$status; $sql .= " AND f.total_ttc > 0"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) @@ -143,7 +147,6 @@ if ($search_facture) $sql .= natural_search("f.ref", $search_facture); if ($search_societe) $sql .= natural_search("s.nom", $search_societe); $sql .= $db->order($sortfield, $sortorder); - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -207,7 +210,7 @@ print ''; print ''; print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]); print_liste_field_titre("Company", $_SERVER["PHP_SELF"]); -print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right '); +print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right '); print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); print_liste_field_titre(''); print ''; @@ -230,12 +233,12 @@ while ($i < min($num, $limit)) $obj = $db->fetch_object($resql); if (empty($obj)) break; // Should not happen + $invoicestatic->fetch($obj->rowid); + print ''; // Ref facture print ''; @@ -245,7 +248,9 @@ while ($i < min($num, $limit)) print $thirdpartystatic->getNomUrl(1, 'customer'); print ''; - print ''; + print ''; print '';
'; - $invoicestatic->id = $obj->rowid; - $invoicestatic->ref = $obj->ref; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''.price($obj->total_ttc).''; + print price($obj->amount, 1, $langs, 1, -1, -1, $conf->currency).' / '.price($obj->total_ttc, 1, $langs, 1, -1, -1, $conf->currency); + print ''.dol_print_date($db->jdate($obj->date_demande), 'day').'