Fix [ bug #658 ] Seacrh on bank do not work for description

This commit is contained in:
fhenry 2012-12-29 16:02:02 +01:00
parent ca6e9643ea
commit 32966fe25f

View File

@ -117,11 +117,6 @@ if (is_numeric($credit)) {
$si++; $si++;
$sqlw[$si] .= " b.amount = " . $credit; $sqlw[$si] .= " b.amount = " . $credit;
} }
// Search criteria description
if ($description) {
$si++;
$sqlw[$si] .= " b.label like '%" . $description . "%'";
}
// Other search criteria // Other search criteria
for ($i = 1 ; $i <= $si; $i++) { for ($i = 1 ; $i <= $si; $i++) {
$sql .= " AND " . $sqlw[$i]; $sql .= " AND " . $sqlw[$i];
@ -195,75 +190,87 @@ if ($resql)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $printline=false;
//Search Description
if ($description) {
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1]) {
if ($langs->transnoentities($reg[1])==$description) {
$printline=true;
}
}elseif ($objp->label==$description) {$printline=true;}
}else {$printline=true;}
print "<tr $bc[$var]>"; if ($printline) {
$var=!$var;
// Ref print "<tr $bc[$var]>";
print '<td align="left" nowrap="nowrap">';
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid."</a> &nbsp; ";
print '</td>';
// Date ope // Ref
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n"; print '<td align="left" nowrap="nowrap">';
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid."</a> &nbsp; ";
print '</td>';
// Date value // Date ope
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n"; print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
// Payment type // Date value
print "<td align=\"center\">"; print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
else print $labeltype;
print "</td>\n";
// Num // Payment type
print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n"; print "<td align=\"center\">";
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
else print $labeltype;
print "</td>\n";
// Description // Num
print "<td>"; print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">"; // Description
$reg=array(); print "<td>";
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
else print dol_trunc($objp->label,40);
print "</a>&nbsp;";
print '</td>'; print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
else print dol_trunc($objp->label,40);
print "</a>&nbsp;";
// Third party print '</td>';
print "<td>";
if ($objp->url_id) // Third party
{ print "<td>";
$companystatic->id=$objp->url_id; if ($objp->url_id)
$companystatic->nom=$objp->labelurl; {
print $companystatic->getNomUrl(1); $companystatic->id=$objp->url_id;
$companystatic->nom=$objp->labelurl;
print $companystatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Debit/Credit
if ($objp->amount < 0)
{
print "<td align=\"right\">".price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
}
else
{
print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</td>\n";
}
// Bank account
print '<td align="left" nowrap="nowrap">';
$bankaccountstatic->id=$objp->bankid;
$bankaccountstatic->label=$objp->bankref;
print $bankaccountstatic->getNomUrl(1);
print "</td>\n";
print "</tr>";
} }
else
{
print '&nbsp;';
}
print '</td>';
// Debit/Credit
if ($objp->amount < 0)
{
print "<td align=\"right\">".price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
}
else
{
print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</td>\n";
}
// Bank account
print '<td align="left" nowrap="nowrap">';
$bankaccountstatic->id=$objp->bankid;
$bankaccountstatic->label=$objp->bankref;
print $bankaccountstatic->getNomUrl(1);
print "</td>\n";
print "</tr>";
$i++; $i++;
} }