Link in bank transaction view are picto.

This allow to show full label.
This commit is contained in:
Laurent Destailleur 2008-10-23 18:09:52 +00:00
parent fab9a7ff17
commit 5a8eca23c1
2 changed files with 31 additions and 43 deletions

View File

@ -289,8 +289,8 @@ class ChargeSociales
/** /**
* \brief Renvoie nom clicable (avec eventuellement le picto) * \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto Inclut le picto dans le lien * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* \param maxlen Longueur max libelle * \param maxlen Longueur max libelle
* \return string Chaine avec URL * \return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$maxlen=0) function getNomUrl($withpicto=0,$maxlen=0)
@ -303,7 +303,8 @@ class ChargeSociales
$lienfin='</a>'; $lienfin='</a>';
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowSocialContribution"),'bill').$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; return $result;
} }

View File

@ -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."/societe.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/chargesociales.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) if (!$user->rights->banque->lire)
accessforbidden(); accessforbidden();
$langs->load("bills"); $langs->load("bills");
@ -111,9 +115,12 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->r
*/ */
llxHeader(); llxHeader();
$societestatic=new Societe($db); $societestatic=new Societe($db);
$chargestatic=new ChargeSociales($db); $chargestatic=new ChargeSociales($db);
$memberstatic=new Adherent($db); $memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$html = new Form($db); $html = new Form($db);
@ -414,13 +421,13 @@ if ($account || $_GET["ref"])
} }
if ($mode_search && $conf->adherent->enabled) 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."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"; //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
} }
if ($mode_search && $conf->tax->enabled) 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."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"; //$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; $isbanktransfert=false;
foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; } foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; }
$issocialcontrib=false; $issocialcontrib=false;
//foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; } foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; }
if (sizeof($links) == 0 || $isbanktransfert || $issocialcontrib) $showlabel=true;
//if (sizeof($links) == 0) $showlabel=true;
//if ($isbanktransfert || $issocialcontrib) $showlabel=true;
if ($showlabel)
{ {
if (eregi('^\((.*)\)$',$objp->label,$reg)) 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]); print $langs->trans($reg[1]);
} }
else else
@ -489,56 +499,33 @@ if ($account || $_GET["ref"])
} }
} }
/* // Add links in description field
* Ajout les liens autres que tiers
*/
foreach($links as $key=>$val) foreach($links as $key=>$val)
{ {
if ($links[$key]['type']=='payment') { if ($links[$key]['type']=='payment') {
//print ' - '; $paymentstatic->rowid=$links[$key]['url_id'];
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$links[$key]['url_id'].'">'; print ' '.$paymentstatic->getNomUrl(2);
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 '</a>';
} }
else if ($links[$key]['type']=='payment_supplier') { else if ($links[$key]['type']=='payment_supplier') {
//print ' - ';
print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$links[$key]['url_id'].'">'; $paymentsupplierstatic->rowid=$links[$key]['url_id'];
if (eregi('^\((.*)\)$',$links[$key]['label'],$reg)) print ' '.$paymentsupplierstatic->getNomUrl(2);
{
// 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 '</a>';
} }
else if ($links[$key]['type']=='company') { else if ($links[$key]['type']=='company') {
} }
else if ($links[$key]['type']=='sc') { // This is waitin for card to link to payment_sc else if ($links[$key]['type']=='sc') { // This is waiting for card to link to payment_sc
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">'; $chargestatic->id=$links[$key]['url_id'];
//print img_object($langs->trans('ShowPayment'),'payment').' '; print ' '.$chargestatic->getNomUrl(2);
print $langs->trans("SocialContribution");
print '</a>';
} }
else if ($links[$key]['type']=='payment_sc') else if ($links[$key]['type']=='payment_sc')
{ {
//print ' - '; //print ' - ';
/*
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">';
//print img_object($langs->trans('ShowPayment'),'payment').' '; //print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContributionPayment"); print $langs->trans("SocialContributionPayment");
print '</a>'; print '</a>';
*/
} }
else if ($links[$key]['type']=='banktransfert') { else if ($links[$key]['type']=='banktransfert') {
/* Do not show this link (avoid confusion). Can already be accessed from transaction detail */ /* Do not show this link (avoid confusion). Can already be accessed from transaction detail */