From f02ba450358f23431dcbcd8b5ea4490089baa0c5 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 26 Jun 2015 17:29:54 +0200 Subject: [PATCH] Allow to fetch a payment by its associated bank line id --- htdocs/compta/paiement/class/paiement.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 60d669fcacf..7ec698f06bc 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -78,11 +78,11 @@ class Paiement extends CommonObject /** * Load payment from database * - * @param int $id Id of payment to get - * @param int $ref Ref of payment to get (same as $id) - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id of payment to get + * @param int $fk_bank Id of bank line associated to payment + * @return int <0 if KO, 0 if not found, >0 if OK */ - function fetch($id, $ref='') + function fetch($id, $fk_bank='') { $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,'; $sql.= ' c.code as type_code, c.libelle as type_libelle,'; @@ -91,8 +91,8 @@ class Paiement extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid '; $sql.= ' WHERE p.fk_paiement = c.id'; - if ($ref) - $sql.= ' AND p.rowid = '.$ref; + if ($fk_bank) + $sql.= ' AND p.fk_bank = '.$fk_bank; else $sql.= ' AND p.rowid = '.$id;