From 43d64cca1b78d7e134d5d22d5971702df14cf761 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 May 2013 02:28:14 +0200 Subject: [PATCH] Fix: Links when transaction is withdraw has disappeared. --- htdocs/compta/bank/account.php | 34 ++++++++++++++++++++-- htdocs/compta/bank/class/account.class.php | 3 +- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 2aad34cd229..1f8e725eae8 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -133,6 +133,8 @@ $memberstatic=new Adherent($db); $paymentstatic=new Paiement($db); $paymentsupplierstatic=new PaiementFourn($db); $paymentvatstatic=new TVA($db); +$bankstatic=new Account($db); +$banklinestatic=new AccountLine($db); $form = new Form($db); @@ -426,7 +428,8 @@ if ($id > 0 || ! empty($ref)) */ $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; - $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; + $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; + $sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; if ($mode_search) { $sql.= ", s.rowid as socid, s.nom as thirdparty"; @@ -568,7 +571,34 @@ if ($id > 0 || ! empty($ref)) } else if ($links[$key]['type']=='banktransfert') { - // Do not show this link (avoid confusion). Can already be accessed from transaction detail + // Do not show link to transfer ince there is no transfer card (avoid confusion). Can already be accessed from transaction detail. + if ($objp->amount > 0) + { + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print ' ('.$langs->trans("From "); + print $bankstatic->getNomUrl(1,''); + print ' '.$langs->trans("toward").' '; + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + print $bankstatic->getNomUrl(1,'transactions'); + print ')'; + } + else + { + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print ' ('.$langs->trans("From "); + print $bankstatic->getNomUrl(1,''); + print ' '.$langs->trans("toward").' '; + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + print $bankstatic->getNomUrl(1,'transactions'); + print ')'; + } + //var_dump($links); } else if ($links[$key]['type']=='member') { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 78c3c6998fd..e740ea0e387 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1081,7 +1081,7 @@ class AccountLine extends CommonObject $sql.= " b.fk_type, b.num_releve, b.num_chq, b.rappro, b.note,"; $sql.= " b.fk_bordereau, b.banque, b.emetteur,"; //$sql.= " b.author"; // Is this used ? - $sql.= " ba.label as bank_account_label"; + $sql.= " ba.ref as bank_account_ref, ba.label as bank_account_label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE b.fk_account = ba.rowid"; @@ -1122,6 +1122,7 @@ class AccountLine extends CommonObject $this->fk_bordereau = $obj->fk_bordereau; $this->fk_account = $obj->fk_account; + $this->bank_account_ref = $obj->bank_account_ref; $this->bank_account_label = $obj->bank_account_label; $ret=1;