FIX Bad adress of vendor in PDF for PDF of supplier payment
FIX dol_convertToWord() Bad conversion of number into a string
This commit is contained in:
parent
24a9a5ac2d
commit
1cf3422e05
@ -24,20 +24,20 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to return number in text.
|
* Function to return a number into a text.
|
||||||
* May use module NUMBERWORDS if found.
|
* May use module NUMBERWORDS if found.
|
||||||
*
|
*
|
||||||
* @param float $num Number to convert
|
* @param float $num Number to convert (must be a numeric value, like reported by price2num())
|
||||||
* @param Translate $langs Language
|
* @param Translate $langs Language
|
||||||
* @param boolean $currency 0=number to translate | 1=currency to translate
|
* @param boolean $currency 0=number to translate | 1=currency to translate
|
||||||
* @param boolean $centimes 0=no centimes | 1=centimes to translate
|
* @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate
|
||||||
* @return string|false Text of the number
|
* @return string|false Text of the number
|
||||||
*/
|
*/
|
||||||
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$num = str_replace(array(',', ' '), '', trim($num));
|
//$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value
|
||||||
if (!$num) {
|
if (!$num) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -56,6 +56,7 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
|||||||
$concatWords = $langs->getLabelFromNumber($num, $type);
|
$concatWords = $langs->getLabelFromNumber($num, $type);
|
||||||
return $concatWords;
|
return $concatWords;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$TNum = explode('.', $num);
|
$TNum = explode('.', $num);
|
||||||
$num = (int) $TNum[0];
|
$num = (int) $TNum[0];
|
||||||
$words = array();
|
$words = array();
|
||||||
@ -140,7 +141,11 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
|||||||
// If we need to write cents call again this function for cents
|
// If we need to write cents call again this function for cents
|
||||||
if (!empty($TNum[1])) {
|
if (!empty($TNum[1])) {
|
||||||
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
|
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
|
||||||
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
|
|
||||||
|
$decimalpart = $TNum[1];
|
||||||
|
$decimalpart = preg_replace('/0+$/', '', $decimalpart);
|
||||||
|
|
||||||
|
$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
|
||||||
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
|
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
|
||||||
}
|
}
|
||||||
return $concatWords;
|
return $concatWords;
|
||||||
|
|||||||
@ -223,7 +223,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$total = $object->montant;
|
$total = $object->amount;
|
||||||
|
|
||||||
// Definition of $dir and $file
|
// Definition of $dir and $file
|
||||||
if ($object->specimen)
|
if ($object->specimen)
|
||||||
@ -550,12 +550,12 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
|||||||
|
|
||||||
// Total payments
|
// Total payments
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 50, $posy);
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - 50, $posy);
|
||||||
$pdf->MultiCell(50, 4, price($object->montant), 0, 'R', 1);
|
$pdf->MultiCell(50, 4, price($object->amount), 0, 'R', 1);
|
||||||
$posy += 20;
|
$posy += 20;
|
||||||
|
|
||||||
// translate amount
|
// translate amount
|
||||||
$currency = $conf->currency;
|
$currency = $conf->currency;
|
||||||
$translateinletter = strtoupper(dol_convertToWord($object->montant, $outputlangs, $currency));
|
$translateinletter = strtoupper(dol_convertToWord($object->amount, $outputlangs, $currency));
|
||||||
$pdf->SetXY($this->marge_gauche + 50, $posy);
|
$pdf->SetXY($this->marge_gauche + 50, $posy);
|
||||||
$pdf->MultiCell(90, 8, $translateinletter, 0, 'L', 1);
|
$pdf->MultiCell(90, 8, $translateinletter, 0, 'L', 1);
|
||||||
$posy += 8;
|
$posy += 8;
|
||||||
@ -565,10 +565,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
|||||||
$pdf->MultiCell(150, 4, $object->thirdparty->nom, 0, 'L', 1);
|
$pdf->MultiCell(150, 4, $object->thirdparty->nom, 0, 'L', 1);
|
||||||
|
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
|
||||||
$pdf->MultiCell(35, 4, str_pad(price($object->montant).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1);
|
$pdf->MultiCell(35, 4, str_pad(price($object->amount).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1);
|
||||||
$posy += 10;
|
$posy += 10;
|
||||||
|
|
||||||
|
|
||||||
// City
|
// City
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
|
||||||
$pdf->MultiCell(150, 4, $mysoc->town, 0, 'L', 1);
|
$pdf->MultiCell(150, 4, $mysoc->town, 0, 'L', 1);
|
||||||
@ -608,9 +607,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
|||||||
$pdf->SetTextColor(0, 0, 0);
|
$pdf->SetTextColor(0, 0, 0);
|
||||||
$pdf->SetFont('', '', $default_font_size - 2);
|
$pdf->SetFont('', '', $default_font_size - 2);
|
||||||
|
|
||||||
$titre = strtoupper($mysoc->town).', le '.date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y");
|
/*$titre = strtoupper($mysoc->town).' - '.dol_print_date(dol_now(), 'day', 'tzserver', $outputlangs);
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top - 6);
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top - 6);
|
||||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);*/
|
||||||
|
|
||||||
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top);
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top);
|
||||||
@ -774,7 +773,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
|||||||
|
|
||||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||||
|
|
||||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object);
|
$usecontact = 0;
|
||||||
|
|
||||||
|
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object);
|
||||||
|
|
||||||
// Show recipient
|
// Show recipient
|
||||||
$widthrecbox = 90;
|
$widthrecbox = 90;
|
||||||
|
|||||||
@ -941,6 +941,39 @@ ShortThursday=T
|
|||||||
ShortFriday=F
|
ShortFriday=F
|
||||||
ShortSaturday=S
|
ShortSaturday=S
|
||||||
ShortSunday=S
|
ShortSunday=S
|
||||||
|
one=one
|
||||||
|
two=two
|
||||||
|
three=three
|
||||||
|
four=four
|
||||||
|
five=five
|
||||||
|
six=six
|
||||||
|
seven=seven
|
||||||
|
eight=eight
|
||||||
|
nine=nine
|
||||||
|
ten=ten
|
||||||
|
eleven=eleven
|
||||||
|
twelve=twelve
|
||||||
|
thirteen=thirdteen
|
||||||
|
fourteen=fourteen
|
||||||
|
fifteen=fifteen
|
||||||
|
sixteen=sixteen
|
||||||
|
seventeen=seventeen
|
||||||
|
eighteen=eighteen
|
||||||
|
nineteen=nineteen
|
||||||
|
twenty=twenty
|
||||||
|
thirty=thirty
|
||||||
|
forty=forty
|
||||||
|
fifty=fifty
|
||||||
|
sixty=sixty
|
||||||
|
seventy=seventy
|
||||||
|
eighty=eighty
|
||||||
|
ninety=ninety
|
||||||
|
hundred=hundred
|
||||||
|
thousand=thousand
|
||||||
|
million=million
|
||||||
|
billion=billion
|
||||||
|
trillion=trillion
|
||||||
|
quadrillion=quadrillion
|
||||||
SelectMailModel=Select an email template
|
SelectMailModel=Select an email template
|
||||||
SetRef=Set ref
|
SetRef=Set ref
|
||||||
Select2ResultFoundUseArrows=Some results found. Use arrows to select.
|
Select2ResultFoundUseArrows=Some results found. Use arrows to select.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user