replace with space by tab

This commit is contained in:
Andrelec1 2014-08-04 10:11:56 +02:00
parent 7318d0fbc0
commit 92a5030f8f

View File

@ -1,11 +1,12 @@
<?php <?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -166,7 +167,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
* This class is an enhanced FPDI class that support method writeHTMLCell * This class is an enhanced FPDI class that support method writeHTMLCell
*/ */
class FPDI_DolExtended extends FPDI class FPDI_DolExtended extends FPDI
{ {
/** /**
* __call * __call
* *
@ -432,9 +433,9 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
// Add a background image on document // Add a background image on document
if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF))
{ {
$pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image
$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height); $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height);
$pdf->SetAutoPageBreak(1,0); // Restore pagebreak $pdf->SetAutoPageBreak(1,0); // Restore pagebreak
} }
} }
@ -492,164 +493,162 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
*/ */
function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default_font_size=10) function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default_font_size=10)
{ {
global $mysoc, $conf; global $mysoc, $conf;
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
$diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT); $diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT);
$pdf->SetXY($curx, $cury);
$pdf->SetXY($curx, $cury); if (empty($onlynumber))
{
$pdf->SetFont('','B',$default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0);
$cury+=4;
}
if (empty($onlynumber)) $outputlangs->load("banks");
{
$pdf->SetFont('','B',$default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0);
$cury+=4;
}
$outputlangs->load("banks"); // Get format of bank account according to its country
$usedetailedbban=$account->useDetailedBBAN();
// Get format of bank account according to its country //$onlynumber=0; $usedetailedbban=0; // For tests
$usedetailedbban=$account->useDetailedBBAN(); if ($usedetailedbban)
{
$savcurx=$curx;
//$onlynumber=0; $usedetailedbban=0; // For tests if (empty($onlynumber))
if ($usedetailedbban) {
{ $pdf->SetFont('','',$default_font_size - $diffsizecontent);
$savcurx=$curx; $pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
$cury+=3;
}
if (empty($onlynumber)) // Use correct name of bank id according to country
{ $ibankey="IBANNumber";
$pdf->SetFont('','',$default_font_size - $diffsizecontent); if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
$pdf->SetXY($curx, $cury); if (! empty($account->iban))
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0); {
$cury+=3; $ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban);
} $ibanDisplay = "";
// Use correct name of bank id according to country for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++){
$ibankey="IBANNumber"; $ibanDisplay .= $ibanDisplay_temp[$i];
if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; if($i%4 == 3 && $i > 0){
if (! empty($account->iban)) $ibanDisplay .= " ";
{ }
}
$ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban); $pdf->SetFont('','B',$default_font_size - 3);
$ibanDisplay = ""; $pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0);
$cury+=3;
}
for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++){ if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8);
$ibanDisplay .= $ibanDisplay_temp[$i];
if($i%4 == 3 && $i > 0){
$ibanDisplay .= " ";
}
}
$pdf->SetFont('','B',$default_font_size - 3); if ($usedetailedbban == 1)
$pdf->SetXY($curx, $cury); {
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0); $fieldstoshow=array('bank','desk','number','key');
$cury+=3; if ($conf->global->BANK_SHOW_ORDER_OPTION==1) $fieldstoshow=array('bank','desk','key','number');
} }
else if ($usedetailedbban == 2)
{
$fieldstoshow=array('bank','number');
}
else dol_print_error('','Value returned by function useDetailedBBAN not managed');
if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8); foreach ($fieldstoshow as $val)
{
if ($val == 'bank')
{
// Bank code
$tmplength=18;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
if ($val == 'desk')
{
// Desk
$tmplength=18;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
if ($val == 'number')
{
// Number
$tmplength=24;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
if ($val == 'key')
{
// Key
$tmplength=13;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
}
if ($usedetailedbban == 1) $curx=$savcurx;
{ $cury+=10;
$fieldstoshow=array('bank','desk','number','key'); }
if ($conf->global->BANK_SHOW_ORDER_OPTION==1) $fieldstoshow=array('bank','desk','key','number'); else
} {
else if ($usedetailedbban == 2) $pdf->SetFont('','B',$default_font_size - $diffsizecontent);
{ $pdf->SetXY($curx, $cury);
$fieldstoshow=array('bank','number'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
} $cury+=3;
else dol_print_error('','Value returned by function useDetailedBBAN not managed');
foreach ($fieldstoshow as $val) $pdf->SetFont('','B',$default_font_size - $diffsizecontent);
{ $pdf->SetXY($curx, $cury);
if ($val == 'bank') $pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
{ $cury+=3;
// Bank code
$tmplength=18;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
if ($val == 'desk')
{
// Desk
$tmplength=18;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
if ($val == 'number')
{
// Number
$tmplength=24;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
if ($val == 'key')
{
// Key
$tmplength=13;
$pdf->SetXY($curx, $cury+5);
$pdf->SetFont('','',$default_font_size - 3);$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
$pdf->SetXY($curx, $cury+1);
$curx+=$tmplength;
$pdf->SetFont('','B',$default_font_size - 4);$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
if (empty($onlynumber)) $pdf->line($curx, $cury+1, $curx, $cury+8);
}
}
$curx=$savcurx; if ($diffsizecontent <= 2) $cury+=1;
$cury+=10; }
}
else
{
$pdf->SetFont('','B',$default_font_size - $diffsizecontent);
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
$cury+=3;
$pdf->SetFont('','B',$default_font_size - $diffsizecontent); // Use correct name of bank id according to country
$pdf->SetXY($curx, $cury); $bickey="BICNumber";
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0); if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
$cury+=3;
if ($diffsizecontent <= 2) $cury+=1; $pdf->SetFont('','',$default_font_size - $diffsizecontent);
}
// Use correct name of bank id according to country if (empty($onlynumber) && ! empty($account->domiciliation))
$bickey="BICNumber"; {
if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; $pdf->SetXY($curx, $cury);
$val=$outputlangs->transnoentities("Residence").': ' . $outputlangs->convToOutputCharset($account->domiciliation);
$pdf->MultiCell(100, 3, $val, 0, 'L', 0);
//$nboflines=dol_nboflines_bis($val,120);
//$cury+=($nboflines*3)+2;
$tmpy=$pdf->getStringHeight(100, $val);
$cury+=$tmpy;
}
else if (! $usedetailedbban) $cury+=1;
$pdf->SetFont('','',$default_font_size - $diffsizecontent); if (! empty($account->bic))
{
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
}
if (empty($onlynumber) && ! empty($account->domiciliation)) return $pdf->getY();
{
$pdf->SetXY($curx, $cury);
$val=$outputlangs->transnoentities("Residence").': ' . $outputlangs->convToOutputCharset($account->domiciliation);
$pdf->MultiCell(100, 3, $val, 0, 'L', 0);
//$nboflines=dol_nboflines_bis($val,120);
//$cury+=($nboflines*3)+2;
$tmpy=$pdf->getStringHeight(100, $val);
$cury+=$tmpy;
}
else if (! $usedetailedbban) $cury+=1;
if (! empty($account->bic))
{
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
}
return $pdf->getY();
} }
/** /**
@ -681,11 +680,11 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
{ {
// Make substitution // Make substitution
$substitutionarray=array( $substitutionarray=array(
'__FROM_NAME__' => $fromcompany->nom, '__FROM_NAME__' => $fromcompany->nom,
'__FROM_EMAIL__' => $fromcompany->email, '__FROM_EMAIL__' => $fromcompany->email,
'__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht, '__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat '__TOTAL_VAT__' => $object->total_vat
); );
complete_substitutions_array($substitutionarray,$outputlangs,$object); complete_substitutions_array($substitutionarray,$outputlangs,$object);
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);