From 753400ccf5514d6d9a6d238a48a7a89a23cc966b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Nov 2012 15:41:09 +0100 Subject: [PATCH] Fix: Label for payment by cheque using the wrong translation key Fix: Option to overwrite translation did not work as expected Fix: Bad translation for greece --- htdocs/core/class/translate.class.php | 37 +++++++++++++------ .../commande/doc/pdf_einstein.modules.php | 26 ++++++++----- .../modules/facture/doc/pdf_crabe.modules.php | 26 ++++++++----- .../modules/propale/doc/pdf_azur.modules.php | 26 ++++++++----- htdocs/langs/el_GR/bills.lang | 9 ----- 5 files changed, 74 insertions(+), 50 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 334b8113eaf..e41eb1a594d 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -388,6 +388,18 @@ class Translate { $str=$this->tab_translate[$key]; + // Overwrite translation + $overwritekey='MAIN_OVERWRITE_TRANS_'.$this->defaultlang; + if (! empty($conf->global->$overwritekey)) // Overwrite translation with key1:newstring1,key2:newstring2 + { + $tmparray=explode(',', $conf->global->$overwritekey); + foreach($tmparray as $tmp) + { + $tmparray2=explode(':',$tmp); + if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; } + } + } + if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings. if ($maxsize) $str=dol_trunc($str,$maxsize); @@ -401,17 +413,6 @@ class Translate // Restore HTML tags $str=str_replace(array('__lt__','__gt__','__quot__'),array('<','>','"',),$str); - // Overwrite translation - if (! empty($conf->global->MAIN_OVERWRITE_TRANS)) // Overwrite translation with string1:newstring1,string2:newstring2 - { - $tmparray=explode(',', $conf->global->MAIN_OVERWRITE_TRANS); - foreach($tmparray as $tmp) - { - $tmparray2=explode(':',$tmp); - if ($tmparray2[0]==$str) { $str=$tmparray2[1]; break; } - } - } - return $str; } else // Translation is not available @@ -458,10 +459,24 @@ class Translate */ function transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='') { + global $conf; + if (! empty($this->tab_translate[$key])) // Translation is available { $str=$this->tab_translate[$key]; + // Overwrite translation + $overwritekey='MAIN_OVERWRITE_TRANS_'.$this->defaultlang; + if (! empty($conf->global->$overwritekey)) // Overwrite translation with key1:newstring1,key2:newstring2 + { + $tmparray=explode(',', $conf->global->$overwritekey); + foreach($tmparray as $tmp) + { + $tmparray2=explode(':',$tmp); + if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; } + } + } + if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings. } else diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 81192c56b16..f79b056f94a 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -590,25 +590,31 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','B', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); $posy=$pdf->GetY()+1; - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0); - $posy=$pdf->GetY()+2; + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','B', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->name).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); $posy=$pdf->GetY()+1; - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); - $posy=$pdf->GetY()+2; + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } } } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index fae70279621..698911a08ee 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -708,25 +708,31 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','B', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); $posy=$pdf->GetY()+1; - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0); - $posy=$pdf->GetY()+2; + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','B', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->name).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); $posy=$pdf->GetY()+1; - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); - $posy=$pdf->GetY()+2; + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } } } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index f805a2bf936..ac17210651f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -624,25 +624,31 @@ class pdf_azur extends ModelePDFPropales $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','B', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); $posy=$pdf->GetY()+1; - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0); - $posy=$pdf->GetY()+2; + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','B', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->name).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); $posy=$pdf->GetY()+1; - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); - $posy=$pdf->GetY()+2; + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('','', $default_font_size - 3); + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } } } } diff --git a/htdocs/langs/el_GR/bills.lang b/htdocs/langs/el_GR/bills.lang index 6916832a169..38ee6bc8115 100644 --- a/htdocs/langs/el_GR/bills.lang +++ b/htdocs/langs/el_GR/bills.lang @@ -322,18 +322,9 @@ NetToBePaid=Φόρος που πρέπει να πληρωθεί PhoneNumber=Τηλ FullPhoneNumber=Τηλέφωνο TeleFax=Φαξ -PrettyLittleSentence=Accept the amount of payments due by checks issued in my name as a Member of an accounting association approved by the Fiscal Administration. -IntracommunityVATNumber=Intracommunity number of VAT -PaymentByChequeOrderedTo=Check payment (including tax) are payable to %s send to -PaymentByChequeOrderedToShort=Check payment (including tax) are payable to SendTo=Αποστολή σε PaymentByTransferOnThisBankAccount=Πληρωμή με έμβασμα στον ακόλουθο λογαριασμό VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI -LawApplicationPart1=By application of the law 80.335 of 12/05/80 -LawApplicationPart2=the goods remain the property of -LawApplicationPart3=the seller until the complete cashing of -LawApplicationPart4=their price. -LimitedLiabilityCompanyCapital=SARL with Capital of UseDiscount=Χρήση έκπτωσης UseCredit=Χρήση πίστωσης UseCreditNoteInInvoicePayment=Μείωση ποσού πληρωμής με αυτή την πίστωση