Fix: Translation of Offered on PDF

This commit is contained in:
Laurent Destailleur 2009-01-15 00:32:10 +00:00
parent af1cede0ed
commit d370e2ff9f
9 changed files with 58 additions and 61 deletions

View File

@ -1379,7 +1379,7 @@ if ($id > 0 || ! empty($ref))
// Remise %
if ($objp->remise_percent > 0 && $objp->special_code != 3)
{
print '<td align="right">'.dol_print_reduction($objp->remise_percent)."</td>\n";
print '<td align="right">'.dol_print_reduction($objp->remise_percent,$langs)."</td>\n";
}
else
{

View File

@ -1137,7 +1137,7 @@ else
/* */
/* *************************************************************************** */
$now=gmmktime();
$id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
@ -1559,7 +1559,7 @@ else
print '</td>';
if ($objp->remise_percent > 0)
{
print '<td align="right">'.dol_print_reduction($objp->remise_percent).'</td>';
print '<td align="right">'.dol_print_reduction($objp->remise_percent,$langs).'</td>';
}
else
{
@ -2053,7 +2053,7 @@ else
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($commande,'order',$socid);
print '</td></tr></table>';
}

View File

@ -2640,7 +2640,7 @@ else
print '</td>';
if ($objp->remise_percent > 0)
{
print '<td align="right">'.dol_print_reduction($objp->remise_percent)."</td>\n";
print '<td align="right">'.dol_print_reduction($objp->remise_percent,$langs)."</td>\n";
}
else
{

View File

@ -564,7 +564,7 @@ if ($id > 0)
$langs->trans("MakeOrder"),$langs->trans("ConfirmMakeOrder",dolibarr_print_date($date_com,'day')),"confirm_commande");
print '<br />';
}
/*
* Confirmation de la suppression d'une ligne produit
*/
@ -724,7 +724,7 @@ if ($id > 0)
print '<td align="right" nowrap="nowrap">'.$commandline->qty.'</td>';
if ($commandline->remise_percent > 0)
{
print '<td align="right" nowrap="nowrap">'.dol_print_reduction($commandline->remise_percent)."</td>\n";
print '<td align="right" nowrap="nowrap">'.dol_print_reduction($commandline->remise_percent,$langs)."</td>\n";
}
else
{
@ -864,7 +864,7 @@ if ($id > 0)
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'#add" method="post">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="addligne">';

View File

@ -302,7 +302,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY ($this->posxdiscount, $curY);
if ($com->lignes[$i]->remise_percent)
{
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, dol_print_reduction($com->lignes[$i]->remise_percent), 0, 'R');
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, dol_print_reduction($com->lignes[$i]->remise_percent,$outputlangs), 0, 'R');
}
// Total HT ligne

View File

@ -57,7 +57,7 @@ class pdf_crabe extends ModelePDFFactures
$this->db = $db;
$this->name = "crabe";
$this->description = $langs->trans('PDFCrabeDescription');
// Dimension page pour format A4
$this->type = 'pdf';
$this->page_largeur = 210;
@ -78,7 +78,7 @@ class pdf_crabe extends ModelePDFFactures
$this->option_credit_note = 1; // Gère les avoirs
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1;
@ -113,13 +113,13 @@ class pdf_crabe extends ModelePDFFactures
if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->setPhpLang();
if ($conf->facture->dir_output)
@ -131,7 +131,7 @@ class pdf_crabe extends ModelePDFFactures
$fac = new Facture($this->db,"",$id);
$ret=$fac->fetch($id);
}
$deja_regle = $fac->getSommePaiement();
$amount_credit_not_included = $fac->getSommeCreditNote();
@ -174,7 +174,7 @@ class pdf_crabe extends ModelePDFFactures
{
$pdf=new FPDI('P','mm',$this->format);
}
$pdf->Open();
$pdf->AddPage();
@ -237,13 +237,13 @@ class pdf_crabe extends ModelePDFFactures
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
// Description de la ligne produit
$libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1);
if ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc != $fac->lignes[$i]->libelle)
{
if ($libelleproduitservice) $libelleproduitservice.="<br>";
if ($fac->lignes[$i]->desc == '(CREDIT_NOTE)' && $fac->lignes[$i]->fk_remise_except)
{
$discount=new DiscountAbsolute($this->db);
@ -266,7 +266,7 @@ class pdf_crabe extends ModelePDFFactures
}
}
}
// Si ligne associee a un code produit
if ($fac->lignes[$i]->produit_id)
{
@ -287,7 +287,7 @@ class pdf_crabe extends ModelePDFFactures
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
}
}
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
@ -321,7 +321,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($this->posxdiscount, $curY);
if ($fac->lignes[$i]->remise_percent)
{
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($fac->lignes[$i]->remise_percent), 0, 'R');
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($fac->lignes[$i]->remise_percent,$outputlangs), 0, 'R');
}
// Total HT ligne
@ -355,7 +355,7 @@ class pdf_crabe extends ModelePDFFactures
{
$nblineFollowDesc = 0;
}
// test si besoin nouvelle page
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
{
@ -413,9 +413,9 @@ class pdf_crabe extends ModelePDFFactures
$pdf->Close();
$pdf->Output($file);
if (! empty($conf->global->MAIN_UMASK))
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->setPhpLang(); // On restaure langue session
return 1; // Pas d'erreur
}
@ -617,7 +617,7 @@ class pdf_crabe extends ModelePDFFactures
if ($object->type != 2)
{
// Check a payment mode is defined
if (empty($object->mode_reglement_code)
if (empty($object->mode_reglement_code)
&& ! $conf->global->FACTURE_CHQ_NUMBER
&& ! $conf->global->FACTURE_RIB_NUMBER)
{
@ -626,10 +626,10 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0);
$pdf->SetTextColor(0,0,0);
$posy=$pdf->GetY()+1;
}
// Sown payment mode
if ($object->mode_reglement_code
&& $object->mode_reglement_code != 'CHQ'
@ -639,15 +639,15 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentMode").':';
$pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('Arial','',8);
$pdf->SetXY(50, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentMode".$object->mode_reglement_code)!=('PaymentMode'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentMode".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg,0,'L');
$posy=$pdf->GetY()+2;
}
/*
* Propose mode reglement par CHQ
*/
@ -660,16 +660,16 @@ class pdf_crabe extends ModelePDFFactures
{
$account = new Account($this->db);
$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$outputlangs->convToOutputCharset($account->proprio)).':',0,'L',0);
$posy=$pdf->GetY()+1;
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('Arial','',8);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0);
$posy=$pdf->GetY()+2;
}
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
@ -678,16 +678,16 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->nom).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0);
$posy=$pdf->GetY()+1;
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('Arial','',8);
$pdf->MultiCell(80, 6, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0);
$posy=$pdf->GetY()+2;
}
}
}
/*
* Si mode reglement non force ou si force a VIR, propose mode reglement par RIB
*/
@ -697,7 +697,7 @@ class pdf_crabe extends ModelePDFFactures
{
$account = new Account($this->db);
$account->fetch($conf->global->FACTURE_RIB_NUMBER);
$curx=$this->marge_gauche;
$cury=$posy;
@ -707,7 +707,7 @@ class pdf_crabe extends ModelePDFFactures
}
}
}
return $posy;
}
@ -732,7 +732,7 @@ class pdf_crabe extends ModelePDFFactures
$lltot = 200; $col1x = 120; $col2x = 182; $largcol2 = $lltot - $col2x;
$index = 0;
// Total HT
$pdf->SetFillColor(255,255,255);
$pdf->SetXY ($col1x, $tab2_top + 0);
@ -755,7 +755,7 @@ class pdf_crabe extends ModelePDFFactures
if (eregi('\*',$tvakey))
{
$tvakey=eregi_replace('\*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
@ -790,7 +790,7 @@ class pdf_crabe extends ModelePDFFactures
$creditnoteamount=$object->getSommeCreditNote();
$resteapayer = $object->total_ttc - $deja_regle - $creditnoteamount;
if ($object->paye) $resteapayer=0;
if ($deja_regle > 0 || $creditnoteamount > 0)
{
// Already payed
@ -809,7 +809,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount), 0, 'R', 0);
}
$resteapayer = $object->total_ttc - $deja_regle - $creditnoteamount;
if ($object->paye) $resteapayer=0;
@ -823,7 +823,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle), $useborder, 'R', 1);
$resteapayer=0;
}
@ -915,7 +915,7 @@ class pdf_crabe extends ModelePDFFactures
$outputlangs->load("companies");
//Affiche le filigrane brouillon - Print Draft Watermark
if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
{
$watermark_angle=atan($this->page_hauteur/$this->page_largeur);
$watermark_x=5;
@ -932,7 +932,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->_out('Q');
}
//Print content
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',13);
@ -1010,7 +1010,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CorrectionInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R');
}
$posy+=5;
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
@ -1023,7 +1023,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dolibarr_print_date($object->date_lim_reglement,"day",false,$outputlangs), '', 'R');
}
if ($showadress)
{
// Emetteur
@ -1102,7 +1102,7 @@ class pdf_crabe extends ModelePDFFactures
$socname = $object->client->nom;
}
$pdf->MultiCell(96,4, $outputlangs->convToOutputCharset($socname), 0, 'L');
// Nom client
$carac_client = "\n".$object->contact->getFullName($outputlangs,1,1);
@ -1121,7 +1121,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY(102,$posy+3);
$pdf->SetFont('Arial','B',11);
$pdf->MultiCell(96,4, $outputlangs->convToOutputCharset($object->client->nom), 0, 'L');
// Nom du contact facturation si c'est une societe
$arrayidcontact = $object->getIdContact('external','BILLING');
if (sizeof($arrayidcontact) > 0)

View File

@ -304,7 +304,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetXY ($this->posxdiscount, $curY);
if ($propale->lignes[$i]->remise_percent && $propale->lignes[$i]->special_code != 3)
{
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($propale->lignes[$i]->remise_percent), 0, 'R');
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($propale->lignes[$i]->remise_percent,$outputlangs), 0, 'R');
}
// Total HT ligne
@ -341,7 +341,7 @@ class pdf_propale_azur extends ModelePDFPropales
{
$nblineFollowDesc = 0;
}
// test si besoin nouvelle page
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
{
@ -847,7 +847,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',11);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->nom), 0, 'L');
// Caracteristiques emetteur
$carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->adresse);

View File

@ -433,7 +433,7 @@ AutomaticCode=Automatic code
NotManaged=Not managed
FeatureDisabled=Feature disabled
MoveBox=Move box %s
Offered=Offered
Offered=Free
NotEnoughPermissions=You don't have permission for this action
SessionName=Session name
Method=Method

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@ -77,7 +77,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
// Clean parameters
if ($date == '') $date=mktime(); // We use local year and month of PHP server to search numbers
// but we should use local year and month of user
// Extract value for mask counter, mask raz and mask offset
if (! eregi('\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}',$mask,$reg)) return 'ErrorBadMask';
$masktri=$reg[1].$reg[2].$reg[3];
@ -139,7 +139,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
if (strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
if (strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
if (strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
$sqlwhere='';
$sqlwhere.='( (SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.$yearcomp;
if ($monthcomp > 1) // Test useless if monthcomp = 1 (or 0 is same as 1)
@ -196,7 +196,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
if ($maskrefclient_maskcounter)
{
//print "maskrefclient_maskcounter=".$maskrefclient_maskcounter." maskwithnocode=".$maskwithnocode." maskrefclient=".$maskrefclient."\n<br>";
// Define $sqlstring
$maskrefclient_posnumstart=strpos($maskwithnocode,$maskrefclient_maskcounter,strpos($maskwithnocode,$maskrefclient)); // Pos of counter in final string (from 0 to ...)
if ($maskrefclient_posnumstart <= 0) return 'ErrorBadMask';
@ -224,7 +224,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
dolibarr_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG);
$maskrefclient_resql=$db->query($maskrefclient_sql);
if ($maskrefclient_resql)
@ -522,11 +522,8 @@ function dol_set_user_page_param($db, &$user, $url='', $tab)
* \param reduction Reduction percentage
* \return string Formated reduction
*/
function dol_print_reduction($reduction=0)
function dol_print_reduction($reduction=0,$langs)
{
global $langs;
$langs->load("main");
$string = '';
if ($reduction == 100)
{