Fix phpcs

This commit is contained in:
Laurent Destailleur 2019-04-09 00:48:12 +02:00
parent c0b3ee23e5
commit a19cedfc13
3 changed files with 29 additions and 32 deletions

View File

@ -142,6 +142,7 @@ class pdf_espadon extends ModelePdfExpedition
$this->tabTitleHeight = 5; // default height
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@ -153,7 +154,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$conf,$langs,$hookmanager;
@ -568,7 +569,7 @@ class pdf_espadon extends ModelePdfExpedition
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf, $object,$outputlangs, 1);
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
@ -658,7 +659,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
public function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -760,7 +761,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
public function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@ -778,7 +779,7 @@ class pdf_espadon extends ModelePdfExpedition
if (empty($hidetop))
{
//$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);
@ -793,8 +794,6 @@ class pdf_espadon extends ModelePdfExpedition
if (empty($hidetop)){
$pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line prend une position y en 2eme param et 4eme param
}
}
/**
@ -831,7 +830,7 @@ class pdf_espadon extends ModelePdfExpedition
$posy=$this->marge_haute;
$posx=$this->page_largeur-$this->marge_droite-$w;
$pdf->SetXY($this->marge_gauche,$posy);
$pdf->SetXY($this->marge_gauche, $posy);
// Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
@ -846,7 +845,7 @@ class pdf_espadon extends ModelePdfExpedition
{
$pdf->SetTextColor(200, 0, 0);
$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');
}
}
@ -905,7 +904,7 @@ class pdf_espadon extends ModelePdfExpedition
$posy+=4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R');
}
if (! empty($object->thirdparty->code_client))
@ -984,7 +983,7 @@ class pdf_espadon extends ModelePdfExpedition
// Show sender name
$pdf->SetXY($posx+2, $posy+3);
$pdf->SetFont('', 'B',$default_font_size);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox-2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy=$pdf->getY();
@ -996,7 +995,7 @@ class pdf_espadon extends ModelePdfExpedition
// If SHIPPING contact defined, we use it
$usecontact=false;
$arrayidcontact=$object->$origin->getIdContact('external','SHIPPING');
$arrayidcontact=$object->$origin->getIdContact('external', 'SHIPPING');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
@ -1013,7 +1012,7 @@ class pdf_espadon extends ModelePdfExpedition
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur, $object->thirdparty, (!empty($object->contact)?$object->contact:null), $usecontact, 'targetwithdetails', $object);
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact)?$object->contact:null), $usecontact, 'targetwithdetails', $object);
// Show recipient
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
@ -1042,7 +1041,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
$pdf->SetTextColor(0,0,0);
$pdf->SetTextColor(0, 0, 0);
}
/**

View File

@ -475,7 +475,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$posyafter = $tab_top_newpage;
}
}
$tab_height = $tab_height - $height_note;
@ -856,8 +855,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement);
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
$lib_condition_paiement=str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
$posy=$pdf->GetY()+3;
}
@ -987,11 +986,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
//Local tax 1
foreach( $this->localtax1 as $localtax_type => $localtax_rate )
foreach ($this->localtax1 as $localtax_type => $localtax_rate)
{
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
{
@ -1001,7 +1000,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
if (preg_match('/\*/', $tvakey))
{
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
@ -1155,7 +1154,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
if (empty($hidetop))
{
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] );
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1];
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
@ -1196,12 +1195,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
//Print content
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B',$default_font_size + 3);
$pdf->SetFont('', 'B', $default_font_size + 3);
$posx=$this->page_largeur-$this->marge_droite-100;
$posy=$this->marge_haute;
$pdf->SetXY($this->marge_gauche,$posy);
$pdf->SetXY($this->marge_gauche, $posy);
// Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
@ -1216,7 +1215,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
@ -1237,7 +1236,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{
$posy+=4;
$pdf->SetFont('', 'B', $default_font_size);
$pdf->SetXY($posx,$posy);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R');
$posy+=1;
@ -1263,7 +1262,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$posy+=5;
$pdf->SetXY($posx, $posy);
$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
{
@ -1294,7 +1293,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Get contact
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
{
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
$arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL');
if (count($arrayidcontact) > 0)
{
$usertmp=new User($this->db);
@ -1440,7 +1439,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param int $hideref Do not show ref
* @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;
@ -1651,7 +1650,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
return 0;
}
return ($a['rank'] > $b['rank']) ? -1 : 1;
}
/**

View File

@ -101,7 +101,7 @@ if ($action == 'add_element_resource' && ! $cancel)
header("Location: ".$_SERVER['PHP_SELF'].'?element='.$element.'&element_id='.$objstat->id);
exit;
}
else if ($objstat)
elseif ($objstat)
{
setEventMessages($objstat->error, $objstat->errors, 'errors');
}
@ -421,7 +421,7 @@ else
dol_fiche_end();
}
}
// Specific to product/service module
if (($element_id || $element_ref) && ($element == 'product' || $element == 'service'))
{
@ -432,7 +432,7 @@ else
if (is_object($product))
{
$head = product_prepare_head($product);
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==Product::TYPE_SERVICE?'service':'product');