Fix phpcs

This commit is contained in:
Laurent Destailleur 2019-04-08 18:02:27 +02:00
parent 7b01e76d2b
commit d01b54ca5b
4 changed files with 97 additions and 105 deletions

View File

@ -1080,7 +1080,7 @@ abstract class CommonDocGenerator
* @param int $hidetop Hide top * @param int $hidetop Hide top
* @return float Height of col tab titles * @return float Height of col tab titles
*/ */
function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0) public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
{ {
global $hookmanager; global $hookmanager;

View File

@ -241,7 +241,7 @@ class pdf_eratosthene extends ModelePDFCommandes
{ {
$dir = $conf->product->dir_output.'/'.$midir; $dir = $conf->product->dir_output.'/'.$midir;
foreach ($objphoto->liste_photos($dir,1) as $key => $obj) foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
{ {
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
{ {

View File

@ -137,11 +137,9 @@ class pdf_espadon extends ModelePdfExpedition
// Get source company // Get source company
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
$this->tabTitleHeight = 5; // default height $this->tabTitleHeight = 5; // default height
} }
/** /**
@ -155,7 +153,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @return int 1=OK, 0=KO * @return int 1=OK, 0=KO
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{ {
// phpcs:enable // phpcs:enable
global $user,$conf,$langs,$hookmanager; global $user,$conf,$langs,$hookmanager;
@ -190,25 +188,25 @@ class pdf_espadon extends ModelePdfExpedition
$realpath=''; $realpath='';
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
{
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
{
if ($obj['photo_vignette'])
{ {
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo $filename=$obj['photo_vignette'];
{ }
if ($obj['photo_vignette']) else
{ {
$filename=$obj['photo_vignette']; $filename=$obj['photo'];
} }
else }
{ else
$filename=$obj['photo']; {
} $filename=$obj['photo'];
} }
else
{
$filename=$obj['photo'];
}
$realpath = $dir.$filename; $realpath = $dir.$filename;
break; break;
} }
if ($realpath) $realpatharray[$i]=$realpath; if ($realpath) $realpatharray[$i]=$realpath;
@ -263,7 +261,7 @@ class pdf_espadon extends ModelePdfExpedition
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
{ {
@ -282,7 +280,7 @@ class pdf_espadon extends ModelePdfExpedition
$pagenb=0; $pagenb=0;
$pdf->SetDrawColor(128, 128, 128); $pdf->SetDrawColor(128, 128, 128);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetSubject($outputlangs->transnoentities("Shipment"));
@ -428,7 +426,7 @@ class pdf_espadon extends ModelePdfExpedition
// We start with Photo of product line // We start with Photo of product line
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforsignature+$heightforinfotot))) // If photo too high, we moved completely on new page if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforsignature+$heightforinfotot))) // If photo too high, we moved completely on new page
{ {
$pdf->AddPage('','',true); $pdf->AddPage('', '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
@ -467,7 +465,7 @@ class pdf_espadon extends ModelePdfExpedition
{ {
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
{ {
$pdf->AddPage('','',true); $pdf->AddPage('', '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1); $pdf->setPage($pageposafter+1);
@ -510,37 +508,37 @@ class pdf_espadon extends ModelePdfExpedition
$weighttxt=''; $weighttxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight) if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
{ {
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units,"weight"); $weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units, "weight");
} }
$voltxt=''; $voltxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume) if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
{ {
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0,"volume"); $voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0, "volume");
} }
if ($this->getColumnStatus('weight')) if ($this->getColumnStatus('weight'))
{ {
$this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, array('html'=>1)); $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, array('html'=>1));
$nexY = max($pdf->GetY(),$nexY); $nexY = max($pdf->GetY(), $nexY);
} }
if ($this->getColumnStatus('qty_asked')) if ($this->getColumnStatus('qty_asked'))
{ {
$this->printStdColumnContent($pdf, $curY, 'qty_asked', $object->lines[$i]->qty_asked); $this->printStdColumnContent($pdf, $curY, 'qty_asked', $object->lines[$i]->qty_asked);
$nexY = max($pdf->GetY(),$nexY); $nexY = max($pdf->GetY(), $nexY);
} }
if ($this->getColumnStatus('qty_shipped')) if ($this->getColumnStatus('qty_shipped'))
{ {
$this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped); $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped);
$nexY = max($pdf->GetY(),$nexY); $nexY = max($pdf->GetY(), $nexY);
} }
if ($this->getColumnStatus('subprice')) if ($this->getColumnStatus('subprice'))
{ {
$this->printStdColumnContent($pdf, $curY, 'subprice', price($object->lines[$i]->subprice, 0, $outputlangs)); $this->printStdColumnContent($pdf, $curY, 'subprice', price($object->lines[$i]->subprice, 0, $outputlangs));
$nexY = max($pdf->GetY(),$nexY); $nexY = max($pdf->GetY(), $nexY);
} }
@ -616,7 +614,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->Close(); $pdf->Close();
$pdf->Output($file,'F'); $pdf->Output($file, 'F');
// Add pdfgeneration hook // Add pdfgeneration hook
$hookmanager->initHooks(array('pdfgeneration')); $hookmanager->initHooks(array('pdfgeneration'));
@ -638,13 +636,13 @@ class pdf_espadon extends ModelePdfExpedition
} }
else else
{ {
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0; return 0;
} }
} }
else else
{ {
$this->error=$langs->transnoentities("ErrorConstantNotDefined","EXP_OUTPUTDIR"); $this->error=$langs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR");
return 0; return 0;
} }
} }
@ -660,7 +658,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param Translate $outputlangs Objet langs * @param Translate $outputlangs Objet langs
* @return int Position pour suite * @return int Position pour suite
*/ */
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) public function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf,$mysoc; global $conf,$mysoc;
@ -728,7 +726,6 @@ class pdf_espadon extends ModelePdfExpedition
$y = $tab2_top + ($tab2_hl * $index); $y = $tab2_top + ($tab2_hl * $index);
$this->printStdColumnContent($pdf, $y, 'weight', $totalVolumetoshow); $this->printStdColumnContent($pdf, $y, 'weight', $totalVolumetoshow);
} }
} }
if ($this->getColumnStatus('qty_asked') && $totalOrdered) if ($this->getColumnStatus('qty_asked') && $totalOrdered)
@ -763,7 +760,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param int $hidebottom Hide bottom bar of array * @param int $hidebottom Hide bottom bar of array
* @return void * @return void
*/ */
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) public function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{ {
global $conf; global $conf;
@ -775,7 +772,7 @@ class pdf_espadon extends ModelePdfExpedition
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1) // Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2); $pdf->SetFont('', '', $default_font_size - 2);
if (empty($hidetop)) if (empty($hidetop))
@ -784,7 +781,7 @@ class pdf_espadon extends ModelePdfExpedition
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
} }
$pdf->SetDrawColor(128,128,128); $pdf->SetDrawColor(128, 128, 128);
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
// Output Rect // Output Rect
@ -848,7 +845,7 @@ class pdf_espadon extends ModelePdfExpedition
else else
{ {
$pdf->SetTextColor(200, 0, 0); $pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
} }
@ -943,10 +940,10 @@ class pdf_espadon extends ModelePdfExpedition
$text=$linkedobject->ref; $text=$linkedobject->ref;
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')'; if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
$Yoff = $Yoff+8; $Yoff = $Yoff+8;
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w,$Yoff); $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R'); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
$Yoff = $Yoff+3; $Yoff = $Yoff+3;
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w,$Yoff); $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R');
} }
} }
@ -957,7 +954,7 @@ class pdf_espadon extends ModelePdfExpedition
$carac_emetteur=''; $carac_emetteur='';
// Add internal contact of origin element if defined // Add internal contact of origin element if defined
$arrayidcontact=array(); $arrayidcontact=array();
if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL'); if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal', 'SALESREPFOLL');
if (is_array($arrayidcontact) && count($arrayidcontact) > 0) if (is_array($arrayidcontact) && count($arrayidcontact) > 0)
{ {
$object->fetch_user(reset($arrayidcontact)); $object->fetch_user(reset($arrayidcontact));
@ -1061,21 +1058,21 @@ class pdf_espadon extends ModelePdfExpedition
{ {
global $conf; global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
/** /**
* Define Array Column Field * Define Array Column Field
* *
* @param object $object common object * @param object $object common object
* @param Translate $outputlangs langs * @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc * @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @return null * @return null
*/ */
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager; global $conf, $hookmanager;
// Default field style for content // Default field style for content

View File

@ -224,7 +224,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
} }
$realpath=''; $realpath='';
foreach ($objphoto->liste_photos($dir,1) as $key => $obj) foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
{ {
$filename=$obj['photo']; $filename=$obj['photo'];
//if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette'];
@ -269,7 +269,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
@ -381,7 +380,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->startTransaction(); $pdf->startTransaction();
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
// Description // Description
$pageposafternote=$pdf->getPage(); $pageposafternote=$pdf->getPage();
@ -500,7 +499,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
// Define size of image if we need it // Define size of image if we need it
@ -593,7 +592,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{ {
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate); $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate);
$nexY = max($pdf->GetY(),$nexY); $nexY = max($pdf->GetY(), $nexY);
} }
// Unit price before discount // Unit price before discount
@ -640,7 +639,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$parameters=array( $parameters=array(
'object' => $object, 'object' => $object,21
'i' => $i, 'i' => $i,
'pdf' =>& $pdf, 'pdf' =>& $pdf,
'curY' =>& $curY, 'curY' =>& $curY,
@ -768,7 +767,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->Close(); $pdf->Close();
$pdf->Output($file,'F'); $pdf->Output($file, 'F');
// Add pdfgeneration hook // Add pdfgeneration hook
$hookmanager->initHooks(array('pdfgeneration')); $hookmanager->initHooks(array('pdfgeneration'));
@ -837,7 +836,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// If France, show VAT mention if not applicable // If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
{ {
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
@ -849,7 +848,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Show payments conditions // Show payments conditions
if (!empty($object->cond_reglement_code) || $object->cond_reglement) if (!empty($object->cond_reglement_code) || $object->cond_reglement)
{ {
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentConditions").':'; $titre = $outputlangs->transnoentities("PaymentConditions").':';
$pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->MultiCell(80, 4, $titre, 0, 'L');
@ -874,7 +873,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetFont('', '', $default_font_size - 2); $pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy); $pdf->SetXY($posxval, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
$posy=$pdf->GetY()+2; $posy=$pdf->GetY()+2;
} }
@ -929,7 +928,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetFillColor(248, 248, 248); $pdf->SetFillColor(248, 248, 248);
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
foreach( $this->tva as $tvakey => $tvaval ) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey > 0) // On affiche pas taux 0
{ {
@ -940,14 +939,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$tvacompl=''; $tvacompl='';
if (preg_match('/\*/',$tvakey)) if (preg_match('/\*/', $tvakey))
{ {
$tvakey=str_replace('*', '', $tvakey); $tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
} }
$totalvat =$outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; $totalvat =$outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey, 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
@ -968,7 +967,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
} }
@ -978,7 +977,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
} }
@ -1004,7 +1003,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$tvacompl=''; $tvacompl='';
if (preg_match('/\*/',$tvakey)) if (preg_match('/\*/',$tvakey))
{ {
$tvakey=str_replace('*','',$tvakey); $tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
} }
$totalvat =$outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; $totalvat =$outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
@ -1024,7 +1023,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{ {
if (in_array((string) $localtax_type, array('2','4','6'))) continue; if (in_array((string) $localtax_type, array('2','4','6'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval ) foreach($localtax_rate as $tvakey => $tvaval)
{ {
if ($tvakey != 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0
{ {
@ -1034,12 +1033,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl=''; $tvacompl='';
if (preg_match('/\*/',$tvakey)) if (preg_match('/\*/', $tvakey))
{ {
$tvakey=str_replace('*', '', $tvakey); $tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
} }
$totalvat =$outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; $totalvat =$outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl; $totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1053,14 +1052,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Total TTC // Total TTC
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224, 224, 224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$creditnoteamount=0; $creditnoteamount=0;
@ -1133,14 +1132,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
} }
$pdf->SetDrawColor(128, 128, 128); $pdf->SetDrawColor(128, 128, 128);
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
// Output Rect // Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
foreach ($this->cols as $colKey => $colDef) foreach ($this->cols as $colKey => $colDef)
{ {
@ -1264,7 +1263,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$posy+=5; $posy+=5;
$pdf->SetXY($posx, $posy); $pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60); $pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day", false, $outputlangs, true), '', 'R');
} }
else else
{ {
@ -1281,7 +1280,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{ {
$posy+=4; $posy+=4;
$pdf->SetXY($posx-90, $posy); $pdf->SetXY($posx-90, $posy);
$pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,$usehourmin,false,$outputlangs,true), '', 'R'); $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R');
} }
if ($object->thirdparty->code_fournisseur) if ($object->thirdparty->code_fournisseur)
@ -1301,7 +1300,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$usertmp=new User($this->db); $usertmp=new User($this->db);
$usertmp->fetch($arrayidcontact[0]); $usertmp->fetch($arrayidcontact[0]);
$posy+=4; $posy+=4;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60); $pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
} }
@ -1324,7 +1323,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Sender properties // Sender properties
$carac_emetteur=''; $carac_emetteur='';
// Add internal contact of proposal if defined // Add internal contact of proposal if defined
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL');
if (count($arrayidcontact) > 0) if (count($arrayidcontact) > 0)
{ {
$object->fetch_user($arrayidcontact[0]); $object->fetch_user($arrayidcontact[0]);
@ -1341,8 +1340,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Show sender frame // Show sender frame
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5); $pdf->SetXY($posx, $posy-5);
$pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
$pdf->SetXY($posx, $posy); $pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230); $pdf->SetFillColor(230, 230, 230);
@ -1357,7 +1356,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Show sender information // Show sender information
$pdf->SetXY($posx+2, $posy); $pdf->SetXY($posx+2, $posy);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
@ -1426,7 +1425,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{ {
global $conf; global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
@ -1441,7 +1440,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @return null * @return null
*/ */
function defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{ {
global $conf, $hookmanager; global $conf, $hookmanager;
@ -1628,7 +1627,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{ {
$this->cols = $hookmanager->resArray; $this->cols = $hookmanager->resArray;
} }
} }
/* /*
@ -1645,8 +1643,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param array $b PDF lines array fields configs * @param array $b PDF lines array fields configs
* @return int Return compare result * @return int Return compare result
*/ */
function columnSort($a, $b) { public function columnSort($a, $b)
{
if(empty($a['rank'])){ $a['rank'] = 0; } if(empty($a['rank'])){ $a['rank'] = 0; }
if(empty($b['rank'])){ $b['rank'] = 0; } if(empty($b['rank'])){ $b['rank'] = 0; }
if ($a['rank'] == $b['rank']) { if ($a['rank'] == $b['rank']) {
@ -1666,13 +1664,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @return null * @return null
*/ */
function prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0){ public function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf; global $conf;
$this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
// Sorting // Sorting
uasort($this->cols, array($this, 'columnSort')); uasort($this->cols, array($this, 'columnSort'));
@ -1685,16 +1682,16 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Count flexible column // Count flexible column
$totalDefinedColWidth = 0; $totalDefinedColWidth = 0;
$countFlexCol = 0; $countFlexCol = 0;
foreach ($this->cols as $colKey =>& $colDef) foreach ($this->cols as $colKey => &$colDef)
{ {
if(!$this->getColumnStatus($colKey)) continue; // continue if desable if (!$this->getColumnStatus($colKey)) continue; // continue if desable
if(!empty($colDef['scale'])){ if (!empty($colDef['scale'])){
// In case of column widht is defined by percentage // In case of column widht is defined by percentage
$colDef['width'] = abs($arrayWidth * $colDef['scale'] / 100 ); $colDef['width'] = abs($arrayWidth * $colDef['scale'] / 100);
} }
if(empty($colDef['width'])){ if (empty($colDef['width'])){
$countFlexCol++; $countFlexCol++;
} }
else{ else{
@ -1702,7 +1699,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
} }
} }
foreach ($this->cols as $colKey =>& $colDef) foreach ($this->cols as $colKey => &$colDef)
{ {
// setting empty conf with default // setting empty conf with default
if(!empty($colDef['title'])){ if(!empty($colDef['title'])){
@ -1742,10 +1739,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param string $colKey the column key * @param string $colKey the column key
* @return float width in mm * @return float width in mm
*/ */
function getColumnContentWidth($colKey) public function getColumnContentWidth($colKey)
{ {
$colDef = $this->cols[$colKey]; $colDef = $this->cols[$colKey];
return $colDef['width'] - $colDef['content']['padding'][3] - $colDef['content']['padding'][1]; return $colDef['width'] - $colDef['content']['padding'][3] - $colDef['content']['padding'][1];
} }
@ -1755,7 +1752,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param string $colKey the column key * @param string $colKey the column key
* @return float X position in mm * @return float X position in mm
*/ */
function getColumnContentXStart($colKey) public function getColumnContentXStart($colKey)
{ {
$colDef = $this->cols[$colKey]; $colDef = $this->cols[$colKey];
return $colDef['xStartPos'] + $colDef['content']['padding'][3]; return $colDef['xStartPos'] + $colDef['content']['padding'][3];
@ -1767,7 +1764,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param string $colKey the column key * @param string $colKey the column key
* @return int rank on success and -1 on error * @return int rank on success and -1 on error
*/ */
function getColumnRank($colKey) public function getColumnRank($colKey)
{ {
if(!isset($this->cols[$colKey]['rank'])) return -1; if(!isset($this->cols[$colKey]['rank'])) return -1;
return $this->cols[$colKey]['rank']; return $this->cols[$colKey]['rank'];
@ -1782,7 +1779,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param bool $insertAfterTarget insert before or after target column ? * @param bool $insertAfterTarget insert before or after target column ?
* @return int new rank on success and -1 on error * @return int new rank on success and -1 on error
*/ */
function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false) public function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false)
{ {
// prepare wanted rank // prepare wanted rank
$rank = -1; $rank = -1;
@ -1825,7 +1822,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param string $columnText column text * @param string $columnText column text
* @return int new rank on success and -1 on error * @return int new rank on success and -1 on error
*/ */
function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') public function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '')
{ {
global $hookmanager; global $hookmanager;
@ -1844,21 +1841,19 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$colDef = $this->cols[$colKey]; $colDef = $this->cols[$colKey];
$pdf->MultiCell($this->getColumnContentWidth($colKey), 2, $columnText, '', $colDef['content']['align']); $pdf->MultiCell($this->getColumnContentWidth($colKey), 2, $columnText, '', $colDef['content']['align']);
} }
} }
/** /**
* get column status from column key * get column status from column key
* *
* @param string $colKey the column key * @param string $colKey the column key
* @return float width in mm * @return float width in mm
*/ */
function getColumnStatus($colKey) public function getColumnStatus($colKey)
{ {
if( !empty($this->cols[$colKey]['status'])){ if( !empty($this->cols[$colKey]['status'])){
return true; return true;
} }
else return false; else return false;
} }
} }