Fix: Link was not translated

This commit is contained in:
Laurent Destailleur 2009-04-20 20:53:08 +00:00
parent 8f62565aae
commit 97bfc98f02
3 changed files with 244 additions and 211 deletions

View File

@ -38,7 +38,7 @@ require_once(DOL_DOCUMENT_ROOT."/fourn/facture/paiementfourn.class.php");
// Security check // Security check
if (!$user->rights->banque->lire) if (!$user->rights->banque->lire)
accessforbidden(); accessforbidden();
$langs->load("bills"); $langs->load("bills");
@ -59,8 +59,8 @@ $mesg='';
/* /*
* Action * Action
*/ */
$dateop=-1; $dateop=-1;
if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
@ -113,8 +113,8 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->r
/* /*
* View * View
*/ */
llxHeader(); llxHeader();
@ -519,6 +519,7 @@ if ($account || $_GET["ref"])
else if ($links[$key]['type']=='sc') { // This is waiting for card to link to payment_sc else if ($links[$key]['type']=='sc') { // This is waiting for card to link to payment_sc
$chargestatic->id=$links[$key]['url_id']; $chargestatic->id=$links[$key]['url_id'];
$chargestatic->ref=$links[$key]['url_id']; $chargestatic->ref=$links[$key]['url_id'];
$chargestatic->lib=$langs->trans("SocialContribution");
print ' '.$chargestatic->getNomUrl(2); print ' '.$chargestatic->getNomUrl(2);
} }
else if ($links[$key]['type']=='payment_sc') else if ($links[$key]['type']=='payment_sc')

View File

@ -25,6 +25,13 @@
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
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."/compta/tva/tva.class.php");
require_once(DOL_DOCUMENT_ROOT."/fourn/facture/paiementfourn.class.php");
$langs->load("banks"); $langs->load("banks");
$langs->load("bills"); $langs->load("bills");
@ -111,6 +118,13 @@ $form=new Form($db);
llxHeader(); llxHeader();
$societestatic=new Societe($db);
$chargestatic=new ChargeSociales($db);
$memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$paymentvatstatic=new TVA($db);
$acct = new Account($db); $acct = new Account($db);
$acct->fetch($_GET["account"]); $acct->fetch($_GET["account"]);
@ -230,26 +244,14 @@ if ($resql)
if (! $newline) print ' - '; if (! $newline) print ' - ';
else print '<br>'; else print '<br>';
if ($links[$key]['type']=='payment') { if ($links[$key]['type']=='payment') {
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; $paymentstatic->id=$links[$key]['url_id'];
print img_object($langs->trans('ShowPayment'),'payment').' '; print ' '.$paymentstatic->getNomUrl(2);
print $langs->trans("Payment");
print '</a>';
$newline=0; $newline=0;
} }
elseif ($links[$key]['type']=='payment_supplier') { elseif ($links[$key]['type']=='payment_supplier') {
print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$links[$key]['url_id'].'">'; $paymentsupplierstatic->id=$links[$key]['url_id'];
if (eregi('^\((.*)\)$',$links[$key]['label'],$reg)) $paymentsupplierstatic->ref=$links[$key]['label'];
{ print ' '.$paymentsupplierstatic->getNomUrl(1);
// Label générique car entre parenthèses. On l'affiche en le traduisant
if ($reg[1]=='paiement') $reg[1]='Payment';
print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans($reg[1]);
}
else
{
print $links[$key]['label'];
}
print '</a>';
$newline=0; $newline=0;
} }
elseif ($links[$key]['type']=='company') { elseif ($links[$key]['type']=='company') {
@ -260,16 +262,33 @@ if ($resql)
$newline=0; $newline=0;
} }
else if ($links[$key]['type']=='sc') { else if ($links[$key]['type']=='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('ShowBill'),'bill').' '; $chargestatic->ref=$links[$key]['url_id'];
print $langs->trans("SocialContribution"); $chargestatic->lib=$langs->trans("SocialContribution");
print '</a>'; print ' '.$chargestatic->getNomUrl(1);
} }
else if ($links[$key]['type']=='payment_sc') { else if ($links[$key]['type']=='payment_sc')
{
//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']=='payment_vat')
{
$paymentvatstatic->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$links[$key]['url_id'];
$paymentvatstatic->ref=$langs->trans("VATPayment");
print ' '.$paymentvatstatic->getNomUrl(1);
}
else if ($links[$key]['type']=='banktransfert') {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowTransaction'),'payment').' ';
print $langs->trans("TransactionOnTheOtherAccount");
print '</a>';
} }
else if ($links[$key]['type']=='member') { else if ($links[$key]['type']=='member') {
print '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$links[$key]['url_id'].'">';
@ -277,15 +296,19 @@ if ($resql)
print $links[$key]['label']; print $links[$key]['label'];
print '</a>'; print '</a>';
} }
else if ($links[$key]['type']=='banktransfert') {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowTransaction'),'payment').' ';
print $langs->trans("TransactionOnTheOtherAccount");
print '</a>';
}
else { else {
//print ' - ';
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
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]='Payment';
print $langs->trans($reg[1]);
}
else
{
print $links[$key]['label']; print $links[$key]['label'];
}
print '</a>'; print '</a>';
$newline=0; $newline=0;
} }

View File

@ -482,11 +482,20 @@ class PaiementFourn
$lien = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$this->id.'">';
$lienfin='</a>'; $lienfin='</a>';
$text=$this->ref; // Sometimes ref contains label
if (eregi('^\((.*)\)$',$text,$reg))
{
// Label générique car entre parenthèses. On l'affiche en le traduisant
if ($reg[1]=='paiement') $reg[1]='Payment';
$text=$langs->trans($reg[1]);
}
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"),'payment').$lienfin); if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"),'payment').$lienfin);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$lien.$text.$lienfin;
return $result; return $result;
} }
/** /**
* \brief Updates the payment number * \brief Updates the payment number
* \param string New num * \param string New num