diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index 32a896ae79b..4c269ed7b43 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -75,13 +75,9 @@ print "\n"; > - +select_types_paiements(empty($_POST['type'])?'':$_POST['type'],'type'); +?> '; @@ -125,10 +121,13 @@ else { dolibarr_print_error($db); } -$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_account, b.fk_type, ba.label as labelaccount"; -$sql .= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba"; -$sql .= " WHERE b.fk_account=ba.rowid"; -$sql .= " AND fk_type like '" . $type . "'"; +$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_account, b.fk_type, ba.label as labelaccount, p.libelle as payment_type "; +$sql .= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba, ".MAIN_DB_PREFIX."c_paiement as p "; +$sql .= " WHERE b.fk_account=ba.rowid AND p.code = b.fk_type "; +if(!empty($type)) +{ + $sql .= " AND p.id = " . $type ." "; +} $si=0; @@ -184,7 +183,7 @@ if ($result) print " ".price($objp->amount)."\n"; } - print "".$objp->fk_type."\n"; + print "".$objp->payment_type."\n"; print "".$objp->labelaccount."\n";