From 5a8eca23c1707bf51ac1f13b63a29c1886b53ca1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Oct 2008 18:09:52 +0000 Subject: [PATCH] Link in bank transaction view are picto. This allow to show full label. --- htdocs/chargesociales.class.php | 7 ++-- htdocs/compta/bank/account.php | 67 +++++++++++++-------------------- 2 files changed, 31 insertions(+), 43 deletions(-) diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index bd78201c2c1..ef88a19375d 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -289,8 +289,8 @@ class ChargeSociales /** * \brief Renvoie nom clicable (avec eventuellement le picto) - * \param withpicto Inclut le picto dans le lien - * \param maxlen Longueur max libelle + * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \param maxlen Longueur max libelle * \return string Chaine avec URL */ function getNomUrl($withpicto=0,$maxlen=0) @@ -303,7 +303,8 @@ class ChargeSociales $lienfin=''; if ($withpicto) $result.=($lien.img_object($langs->trans("ShowSocialContribution"),'bill').$lienfin.' '); - $result.=$lien.($maxlen?dolibarr_trunc($this->lib,$maxlen):$this->lib).$lienfin; + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$lien.($maxlen?dolibarr_trunc($this->lib,$maxlen):$this->lib).$lienfin; return $result; } diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 53bc8c68102..dd2cf803731 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -32,10 +32,14 @@ require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); require_once(DOL_DOCUMENT_ROOT."/societe.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php"); +require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); +require_once(DOL_DOCUMENT_ROOT."/fourn/facture/paiementfourn.class.php"); +// Security check if (!$user->rights->banque->lire) accessforbidden(); + $langs->load("bills"); @@ -111,9 +115,12 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->r */ llxHeader(); + $societestatic=new Societe($db); $chargestatic=new ChargeSociales($db); $memberstatic=new Adherent($db); +$paymentstatic=new Paiement($db); +$paymentsupplierstatic=new PaiementFourn($db); $html = new Form($db); @@ -414,13 +421,13 @@ if ($account || $_GET["ref"]) } if ($mode_search && $conf->adherent->enabled) { - // \TODO Mettre jointure sur adherent + // \TODO Mettre jointure sur adherent pour recherche sur un adherent //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND bu.type='company'"; //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; } if ($mode_search && $conf->tax->enabled) { - // \TODO Mettre jointure sur charges sociales + // \TODO Mettre jointure sur charges sociales pour recherche sur une charge //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND bu.type='company'"; //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; } @@ -474,13 +481,16 @@ if ($account || $_GET["ref"]) $isbanktransfert=false; foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; } $issocialcontrib=false; - //foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; } - - if (sizeof($links) == 0 || $isbanktransfert || $issocialcontrib) + foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; } + + $showlabel=true; + //if (sizeof($links) == 0) $showlabel=true; + //if ($isbanktransfert || $issocialcontrib) $showlabel=true; + if ($showlabel) { if (eregi('^\((.*)\)$',$objp->label,$reg)) { - // Label générique car entre parenthèses. On l'affiche en le traduisant + // Genereic description because between (). We show it after translating. print $langs->trans($reg[1]); } else @@ -489,56 +499,33 @@ if ($account || $_GET["ref"]) } } - /* - * Ajout les liens autres que tiers - */ + // Add links in description field foreach($links as $key=>$val) { if ($links[$key]['type']=='payment') { - //print ' - '; - print ''; - if (eregi('^\((.*)\)$',$links[$key]['label'],$reg)) - { - // Label générique car entre parenthèses. On l'affiche en le traduisant - if ($reg[1]=='paiement') $reg[1]='CustomerInvoicePayment'; - print $langs->trans($reg[1]); - } - else - { - print $links[$key]['label']; - } - print ''; + $paymentstatic->rowid=$links[$key]['url_id']; + print ' '.$paymentstatic->getNomUrl(2); } else if ($links[$key]['type']=='payment_supplier') { - //print ' - '; - print ''; - if (eregi('^\((.*)\)$',$links[$key]['label'],$reg)) - { - // Label générique car entre parenthèses. On l'affiche en le traduisant - if ($reg[1]=='paiement') $reg[1]='SupplierInvoicePayment'; - print $langs->trans($reg[1]); - } - else - { - print $links[$key]['label']; - } - print ''; + + $paymentsupplierstatic->rowid=$links[$key]['url_id']; + print ' '.$paymentsupplierstatic->getNomUrl(2); } else if ($links[$key]['type']=='company') { } - else if ($links[$key]['type']=='sc') { // This is waitin for card to link to payment_sc - print ''; - //print img_object($langs->trans('ShowPayment'),'payment').' '; - print $langs->trans("SocialContribution"); - print ''; + else if ($links[$key]['type']=='sc') { // This is waiting for card to link to payment_sc + $chargestatic->id=$links[$key]['url_id']; + print ' '.$chargestatic->getNomUrl(2); } else if ($links[$key]['type']=='payment_sc') { //print ' - '; + /* print ''; //print img_object($langs->trans('ShowPayment'),'payment').' '; print $langs->trans("SocialContributionPayment"); print ''; + */ } else if ($links[$key]['type']=='banktransfert') { /* Do not show this link (avoid confusion). Can already be accessed from transaction detail */