Fix phpcs
This commit is contained in:
parent
01adaf253c
commit
047d130081
@ -823,8 +823,8 @@ abstract class CommonDocGenerator
|
||||
if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
|
||||
$pdf->line($x, $y+$h, $x, $y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* uasort callback function to Sort colums fields
|
||||
*
|
||||
@ -832,55 +832,54 @@ abstract class CommonDocGenerator
|
||||
* @param array $b PDF lines array fields configs
|
||||
* @return int Return compare result
|
||||
*/
|
||||
function columnSort($a, $b) {
|
||||
|
||||
function columnSort($a, $b)
|
||||
{
|
||||
if(empty($a['rank'])){ $a['rank'] = 0; }
|
||||
if(empty($b['rank'])){ $b['rank'] = 0; }
|
||||
if ($a['rank'] == $b['rank']) {
|
||||
return 0;
|
||||
}
|
||||
return ($a['rank'] > $b['rank']) ? -1 : 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare Array Column Field
|
||||
*
|
||||
* @param object $object common object
|
||||
* @param outputlangs $outputlangs langs
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param object $object common object
|
||||
* @param Translate $outputlangs langs
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return null
|
||||
*/
|
||||
function prepareArrayColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){
|
||||
|
||||
function prepareArrayColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$this->defineColumnField($object,$outputlangs,$hidedetails,$hidedesc,$hideref);
|
||||
|
||||
|
||||
|
||||
|
||||
// Sorting
|
||||
uasort ( $this->cols, array( $this, 'columnSort' ) );
|
||||
|
||||
|
||||
// Positionning
|
||||
$curX = $this->page_largeur-$this->marge_droite; // start from right
|
||||
|
||||
|
||||
// Array witdh
|
||||
$arrayWidth = $this->page_largeur-$this->marge_droite-$this->marge_gauche;
|
||||
|
||||
|
||||
// Count flexible column
|
||||
$totalDefinedColWidth = 0;
|
||||
$countFlexCol = 0;
|
||||
foreach ($this->cols as $colKey =>& $colDef)
|
||||
{
|
||||
if(!$this->getColumnStatus($colKey)) continue; // continue if desable
|
||||
|
||||
|
||||
if(!empty($colDef['scale'])){
|
||||
// In case of column widht is defined by percentage
|
||||
$colDef['width'] = abs($arrayWidth * $colDef['scale'] / 100 );
|
||||
}
|
||||
|
||||
|
||||
if(empty($colDef['width'])){
|
||||
$countFlexCol++;
|
||||
}
|
||||
@ -888,7 +887,7 @@ abstract class CommonDocGenerator
|
||||
$totalDefinedColWidth += $colDef['width'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->cols as $colKey =>& $colDef)
|
||||
{
|
||||
// setting empty conf with default
|
||||
@ -898,7 +897,7 @@ abstract class CommonDocGenerator
|
||||
else{
|
||||
$colDef['title'] = $this->defaultTitlesFieldsStyle;
|
||||
}
|
||||
|
||||
|
||||
// setting empty conf with default
|
||||
if(!empty($colDef['content'])){
|
||||
$colDef['content'] = array_replace($this->defaultContentsFieldsStyle, $colDef['content']);
|
||||
@ -906,14 +905,14 @@ abstract class CommonDocGenerator
|
||||
else{
|
||||
$colDef['content'] = $this->defaultContentsFieldsStyle;
|
||||
}
|
||||
|
||||
|
||||
if($this->getColumnStatus($colKey))
|
||||
{
|
||||
// In case of flexible column
|
||||
if(empty($colDef['width'])){
|
||||
$colDef['width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
|
||||
}
|
||||
|
||||
|
||||
// Set positions
|
||||
$lastX = $curX;
|
||||
$curX = $lastX - $colDef['width'];
|
||||
@ -922,7 +921,7 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get column content width from column key
|
||||
*
|
||||
@ -934,8 +933,8 @@ abstract class CommonDocGenerator
|
||||
$colDef = $this->cols[$colKey];
|
||||
return $colDef['width'] - $colDef['content']['padding'][3] - $colDef['content']['padding'][1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get column content X (abscissa) left position from column key
|
||||
*
|
||||
@ -947,7 +946,7 @@ abstract class CommonDocGenerator
|
||||
$colDef = $this->cols[$colKey];
|
||||
return $colDef['xStartPos'] + $colDef['content']['padding'][3];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get column position rank from column key
|
||||
*
|
||||
@ -959,7 +958,7 @@ abstract class CommonDocGenerator
|
||||
if(!isset($this->cols[$colKey]['rank'])) return -1;
|
||||
return $this->cols[$colKey]['rank'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get column position rank from column key
|
||||
*
|
||||
@ -973,21 +972,21 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
// prepare wanted rank
|
||||
$rank = -1;
|
||||
|
||||
|
||||
// try to get rank from target column
|
||||
if(!empty($targetCol)){
|
||||
$rank = $this->getColumnRank($targetCol);
|
||||
if($rank>=0 && $insertAfterTarget){ $rank++; }
|
||||
}
|
||||
|
||||
|
||||
// get rank from new column definition
|
||||
if($rank<0 && !empty($defArray['rank'])){
|
||||
$rank = $defArray['rank'];
|
||||
}
|
||||
|
||||
|
||||
// error: no rank
|
||||
if($rank<0){ return -1; }
|
||||
|
||||
|
||||
foreach ($this->cols as $colKey =>& $colDef)
|
||||
{
|
||||
if( $rank <= $colDef['rank'])
|
||||
@ -995,14 +994,14 @@ abstract class CommonDocGenerator
|
||||
$colDef['rank'] = $colDef['rank'] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$defArray['rank'] = $rank;
|
||||
$this->cols[$newColKey] = $defArray; // array_replace is used to preserve keys
|
||||
|
||||
|
||||
return $rank;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* print standard column content
|
||||
*
|
||||
@ -1015,7 +1014,7 @@ abstract class CommonDocGenerator
|
||||
function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '')
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
|
||||
$parameters=array(
|
||||
'object' => $object,
|
||||
'curY' =>& $curY,
|
||||
@ -1031,10 +1030,10 @@ abstract class CommonDocGenerator
|
||||
$colDef = $this->cols[$colKey];
|
||||
$pdf->MultiCell( $this->getColumnContentWidth($colKey),2, $columnText,'',$colDef['content']['align']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get column status from column key
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user