Fix phpcs

This commit is contained in:
Laurent Destailleur 2019-04-08 16:00:01 +02:00
parent 917b9d69fa
commit 1274d71a10
11 changed files with 421 additions and 469 deletions

View File

@ -145,7 +145,7 @@ class Facturation
$i = 0;
if (!is_null($newcartarray) && !empty($newcartarray)) {
$i=count($newcartarray);
$i=count($newcartarray);
}
$newcartarray[$i]['id']=$i;

View File

@ -984,10 +984,11 @@ class Categorie extends CommonObject
* fullpath = chemin complet compose des id
*
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
* $markafterid can be an : int (id of category)
* string (categories ids seprated by comma)
* array (list of categories ids)
* @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
* $markafterid can be an :
* - int (id of category)
* - string (categories ids seprated by comma)
* - array (list of categories ids)
* @param int $include [=0] Removed or 1=Keep only
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/

View File

@ -952,24 +952,24 @@ class Invoices extends DolibarrApi
if ($this->invoice->paye) {
throw new RestException(500, 'Alreay payed');
}
$this->invoice->fetch($id);
$this->invoice->fetch_thirdparty();
// Check if there is already a discount (protection to avoid duplicate creation when resubmit post)
$discountcheck=new DiscountAbsolute($this->db);
$result=$discountcheck->fetch(0, $this->invoice->id);
$canconvert=0;
if ($this->invoice->type == Facture::TYPE_DEPOSIT && empty($discountcheck->id)) $canconvert=1; // we can convert deposit into discount if deposit is payed (completely, partially or not at all) and not already converted (see real condition into condition used to show button converttoreduc)
if (($this->invoice->type == Facture::TYPE_CREDIT_NOTE || $this->invoice->type == Facture::TYPE_STANDARD) && $this->invoice->paye == 0 && empty($discountcheck->id)) $canconvert=1; // we can convert credit note into discount if credit note is not payed back and not already converted and amount of payment is 0 (see real condition into condition used to show button converttoreduc)
if ($canconvert)
{
$this->db->begin();
$amount_ht = $amount_tva = $amount_ttc = array();
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
// Loop on each vat rate
$i = 0;
foreach ($this->invoice->lines as $line)
@ -985,13 +985,13 @@ class Invoices extends DolibarrApi
$i++;
}
}
// Insert one discount by VAT rate category
$discount = new DiscountAbsolute($this->db);
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE){
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
$discount->description = '(CREDIT_NOTE)';
}
elseif ($this->invoice->type == Facture::TYPE_DEPOSIT){
elseif ($this->invoice->type == Facture::TYPE_DEPOSIT) {
$discount->description = '(DEPOSIT)';
}
elseif ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION) {
@ -1000,16 +1000,16 @@ class Invoices extends DolibarrApi
else {
throw new RestException(500, 'Cant convert to reduc an Invoice of this type');
}
$discount->fk_soc = $this->invoice->socid;
$discount->fk_facture_source = $this->invoice->id;
$error = 0;
if ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION)
{
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
// Total payments
$sql = 'SELECT SUM(pf.amount) as total_paiements';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
@ -1019,10 +1019,10 @@ class Invoices extends DolibarrApi
$sql.= ' AND p.entity IN ('.getEntity('invoice').')';
$resql = $this->db->query($sql);
if (! $resql) dol_print_error($this->db);
$res = $this->db->fetch_object($resql);
$total_paiements = $res->total_paiements;
// Total credit note and deposit
$total_creditnote_and_deposit = 0;
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
@ -1033,11 +1033,11 @@ class Invoices extends DolibarrApi
if (!empty($resql)) {
while ($obj = $this->db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc;
} else dol_print_error($this->db);
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $this->invoice->total_ttc;
$discount->amount_tva = 0;
$discount->tva_tx = 0;
$result = $discount->create(DolibarrApiAccess::$user);
if ($result < 0)
{
@ -1055,7 +1055,7 @@ class Invoices extends DolibarrApi
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx);
$result = $discount->create(DolibarrApiAccess::$user);
if ($result < 0)
{
@ -1064,7 +1064,7 @@ class Invoices extends DolibarrApi
}
}
}
if (empty($error))
{
if($this->invoice->type != Facture::TYPE_DEPOSIT) {
@ -1089,7 +1089,7 @@ class Invoices extends DolibarrApi
throw new RestException(500, 'Discount creation error');
}
}
return $this->_cleanObjectDatas($this->invoice);
}

View File

@ -1071,14 +1071,14 @@ abstract class CommonDocGenerator
}
/**
* print standard column content
* Print standard column content
*
* @param PDF $pdf pdf object
* @param float $tab_top tab top position
* @param float $tab_height default tab height
* @param $outputlangs
* @param int $hidetop
* @return float height of col tab titles
* @param PDF $pdf Pdf object
* @param float $tab_top Tab top position
* @param float $tab_height Default tab height
* @param Translate $outputlangs Output language
* @param int $hidetop Hide top
* @return float Height of col tab titles
*/
function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
{

View File

@ -3806,9 +3806,10 @@ class Form
* @param string $htmlname HTML field name
* @param int $maxlength Maximum length for labels
* @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
* $markafterid can be an : int (id of category)
* string (categories ids seprated by comma)
* array (list of categories ids)
* $markafterid can be an :
* - int (id of category)
* - string (categories ids seprated by comma)
* - array (list of categories ids)
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $include [=0] Removed or 1=Keep only
* @return string

View File

@ -116,7 +116,7 @@ class pdf_einstein extends ModelePDFCommandes
/**
* Issuer
* @var Company object that emits
* @var Societe object that emits
*/
public $emetteur;

View File

@ -83,32 +83,32 @@ class pdf_eratosthene extends ModelePDFCommandes
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_hauteur
*/
public $page_hauteur;
/**
* @var array format
*/
public $format;
/**
* @var int marge_gauche
*/
public $marge_gauche;
/**
* @var int marge_droite
*/
public $marge_droite;
/**
* @var int marge_haute
*/
public $marge_haute;
/**
* @var int marge_basse
*/
@ -209,38 +209,38 @@ class pdf_eratosthene extends ModelePDFCommandes
if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){
$hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
}
// Loop on each lines to detect if there is at least one image to show
$realpatharray=array();
$this->atleastonephoto = false;
if (! empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE))
{
$objphoto = new Product($this->db);
for ($i = 0 ; $i < $nblignes ; $i++)
{
if (empty($object->lines[$i]->fk_product)) continue;
$objphoto->fetch($object->lines[$i]->fk_product);
//var_dump($objphoto->ref);exit;
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{
$pdir[0] = get_exdir($objphoto->id,2,0,0,$objphoto,'product') . $objphoto->id ."/photos/";
$pdir[1] = get_exdir(0,0,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/';
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/";
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/';
}
else
{
$pdir[0] = get_exdir(0,0,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default
$pdir[1] = get_exdir($objphoto->id,2,0,0,$objphoto,'product') . $objphoto->id ."/photos/"; // alternative
$pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; // alternative
}
$arephoto = false;
foreach ($pdir as $midir)
{
if (! $arephoto)
{
$dir = $conf->product->dir_output.'/'.$midir;
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
@ -258,19 +258,19 @@ class pdf_eratosthene extends ModelePDFCommandes
{
$filename=$obj['photo'];
}
$realpath = $dir.$filename;
$arephoto = true;
$this->atleastonephoto = true;
}
}
}
if ($realpath && $arephoto) $realpatharray[$i]=$realpath;
}
}
if ($conf->commande->dir_output)
{
@ -541,11 +541,11 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->startTransaction();
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
$iniY = $tab_top + $this->tabTitleHeight + 2;
$curY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight + 2;
// Loop on each lines
$pageposbeforeprintlines=$pdf->getPage();
$pagenb = $pageposbeforeprintlines;
@ -554,7 +554,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$curY = $nexY;
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);
// Define size of image if we need it
$imglinesize=array();
if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]);
@ -569,20 +569,20 @@ class pdf_eratosthene extends ModelePDFCommandes
$showpricebeforepagebreak=1;
$posYAfterImage=0;
$posYAfterDescription=0;
if($this->getColumnStatus('photo'))
{
// We start with Photo of product line
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page
{
$pdf->AddPage('','',true);
$pdf->AddPage('', '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
}
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height']))
{
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
@ -628,11 +628,11 @@ class pdf_eratosthene extends ModelePDFCommandes
$posYAfterDescription=$pdf->GetY();
}
$nexY = max($pdf->GetY(),$posYAfterImage);
$nexY = max($pdf->GetY(), $posYAfterImage);
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
@ -1088,7 +1088,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total
$pdf->SetFillColor(248, 248, 248);
@ -1354,12 +1354,10 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
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
}
}
/**

View File

@ -105,7 +105,7 @@ class pdf_espadon extends ModelePdfExpedition
/**
* Issuer
* @var Company object that emits
* @var Societe object that emits
*/
public $emetteur;
@ -127,7 +127,7 @@ class pdf_espadon extends ModelePdfExpedition
$formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->format = array($this->page_largeur, $this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
@ -139,9 +139,9 @@ class pdf_espadon extends ModelePdfExpedition
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
$this->tabTitleHeight = 5; // default height
}
/**
@ -184,18 +184,18 @@ class pdf_espadon extends ModelePdfExpedition
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
$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'])
{
$filename= $obj['photo_vignette'];
$filename=$obj['photo_vignette'];
}
else
{
@ -236,7 +236,7 @@ class pdf_espadon extends ModelePdfExpedition
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
@ -250,9 +250,9 @@ class pdf_espadon extends ModelePdfExpedition
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Set nblignes with the new facture lines content after hook
$nblignes = count($object->lines);
@ -280,7 +280,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetDrawColor(128, 128, 128);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
@ -298,9 +298,9 @@ class pdf_espadon extends ModelePdfExpedition
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetTextColor(0, 0, 0);
$tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
@ -316,13 +316,13 @@ class pdf_espadon extends ModelePdfExpedition
{
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
$nexY = $pdf->GetY();
$height_incoterms=$nexY-$tab_top;
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->SetDrawColor(192, 192, 192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
$tab_top = $nexY+6;
@ -335,7 +335,7 @@ class pdf_espadon extends ModelePdfExpedition
$tab_top = 88 + $height_incoterms;
$tab_top_alt = $tab_top;
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
@ -350,7 +350,7 @@ class pdf_espadon extends ModelePdfExpedition
if ($object->shipping_method_id > 0)
{
// Get code using getLabelFromKey
$code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
$code=$outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
$label='';
if ($object->tracking_url != $object->tracking_number) $label.=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
$label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code));
@ -360,7 +360,7 @@ class pdf_espadon extends ModelePdfExpedition
$label.=" : ";
$label.=$object->tracking_url;
}
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top_alt, $label, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
@ -371,7 +371,7 @@ class pdf_espadon extends ModelePdfExpedition
// Notes
if (! empty($object->note_public))
{
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->SetFont('', '', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1);
}
@ -379,7 +379,7 @@ class pdf_espadon extends ModelePdfExpedition
$height_note=$nexY-$tab_top;
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->SetDrawColor(192, 192, 192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note;
@ -389,17 +389,17 @@ class pdf_espadon extends ModelePdfExpedition
{
$height_note=0;
}
// Use new auto collum system
$this->prepareArrayColumnField($object,$outputlangs,$hidedetails,$hidedesc,$hideref);
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
// Simulation de tableau pour connaitre la hauteur de la ligne de titre
$pdf->startTransaction();
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
$iniY = $tab_top + $this->tabTitleHeight + 2;
$curY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight + 2;
@ -408,8 +408,8 @@ class pdf_espadon extends ModelePdfExpedition
for ($i = 0; $i < $nblignes; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);
// Define size of image if we need it
$imglinesize=array();
@ -432,12 +432,12 @@ class pdf_espadon extends ModelePdfExpedition
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
//if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
}
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height']))
{
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
@ -450,7 +450,7 @@ class pdf_espadon extends ModelePdfExpedition
if($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->getColumnContentWidth('desc'),3,$this->getColumnContentXStart('desc'),$curY,$hideref,$hidedesc);
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
@ -458,8 +458,8 @@ class pdf_espadon extends ModelePdfExpedition
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->getColumnContentWidth('desc'),3,$this->getColumnContentXStart('desc'),$curY,$hideref,$hidedesc);
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
@ -503,11 +503,10 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
// weight
$weighttxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
{
@ -518,32 +517,32 @@ class pdf_espadon extends ModelePdfExpedition
{
$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'))
{
$this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, array('html'=>1));
$nexY = max($pdf->GetY(),$nexY);
}
if ($this->getColumnStatus('qty_asked'))
{
$this->printStdColumnContent($pdf, $curY, 'qty_asked', $object->lines[$i]->qty_asked);
$nexY = max($pdf->GetY(),$nexY);
}
if ($this->getColumnStatus('qty_shipped'))
{
$this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped);
$nexY = max($pdf->GetY(),$nexY);
}
if ($this->getColumnStatus('subprice'))
{
$this->printStdColumnContent($pdf, $curY, 'subprice', price($object->lines[$i]->subprice, 0, $outputlangs));
$nexY = max($pdf->GetY(),$nexY);
}
$nexY+=3;
@ -553,7 +552,7 @@ class pdf_espadon extends ModelePdfExpedition
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80,80,80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY-1, $this->page_largeur - $this->marge_droite, $nexY-1);
$pdf->SetLineStyle(array('dash'=>0));
@ -571,7 +570,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.
@ -587,7 +586,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);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
@ -612,8 +611,8 @@ class pdf_espadon extends ModelePdfExpedition
$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
@ -621,9 +620,9 @@ class pdf_espadon extends ModelePdfExpedition
// Add pdfgeneration hook
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = $hookmanager->error;
@ -672,7 +671,7 @@ class pdf_espadon extends ModelePdfExpedition
$tab2_top = $posy;
$tab2_hl = 4;
$pdf->SetFont('','B', $default_font_size - 1);
$pdf->SetFont('', 'B', $default_font_size - 1);
// Tableau total
$col1x = $this->posxweightvol-50; $col2x = $this->posxweightvol;
@ -707,14 +706,14 @@ class pdf_espadon extends ModelePdfExpedition
if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
if ($object->trueVolume) $totalVolumetoshow=showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
if ($this->getColumnStatus('desc'))
{
$this->printStdColumnContent($pdf, $tab2_top, 'desc', $outputlangs->transnoentities("Total"));
}
if ($this->getColumnStatus('weight'))
{
@ -723,37 +722,31 @@ class pdf_espadon extends ModelePdfExpedition
$this->printStdColumnContent($pdf, $tab2_top, 'weight', $totalWeighttoshow);
$index++;
}
if ($totalVolumetoshow)
{
$y = $tab2_top + ($tab2_hl * $index);
$this->printStdColumnContent($pdf, $y, 'weight', $totalVolumetoshow);
}
}
if ($this->getColumnStatus('qty_asked') && $totalOrdered)
{
$this->printStdColumnContent($pdf, $tab2_top, 'qty_asked', $totalOrdered);
}
if ($this->getColumnStatus('qty_shipped') && $totalToShip)
{
$this->printStdColumnContent($pdf, $tab2_top, 'qty_shipped', $totalToShip);
}
if ($this->getColumnStatus('subprice'))
{
$this->printStdColumnContent($pdf, $tab2_top, 'subprice', price($object->total_ht, 0, $outputlangs));
}
$pdf->SetTextColor(0,0,0);
$pdf->SetTextColor(0, 0, 0);
return ($tab2_top + ($tab2_hl * $index));
}
@ -783,7 +776,7 @@ class pdf_espadon extends ModelePdfExpedition
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','',$default_font_size - 2);
$pdf->SetFont('', '', $default_font_size - 2);
if (empty($hidetop))
{
@ -792,18 +785,18 @@ class pdf_espadon extends ModelePdfExpedition
}
$pdf->SetDrawColor(128,128,128);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetFont('', '', $default_font_size - 1);
// 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
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
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
}
}
@ -824,17 +817,17 @@ class pdf_espadon extends ModelePdfExpedition
$default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
// Show Draft Watermark
if($object->statut==0 && (! empty($conf->global->SHIPPING_DRAFT_WATERMARK)) )
{
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->SHIPPING_DRAFT_WATERMARK);
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SHIPPING_DRAFT_WATERMARK);
}
//Prepare la suite
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
$w = 110;
@ -854,7 +847,7 @@ class pdf_espadon extends ModelePdfExpedition
}
else
{
$pdf->SetTextColor(200,0,0);
$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("ErrorGoToGlobalSetup"), 0, 'L');
@ -883,7 +876,7 @@ class pdf_espadon extends ModelePdfExpedition
//$pdf->Image($logo,10, 5, 0, 24);
}
$pdf->SetDrawColor(128,128,128);
$pdf->SetDrawColor(128, 128, 128);
if (! empty($conf->barcode->enabled))
{
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
@ -895,39 +888,39 @@ class pdf_espadon extends ModelePdfExpedition
$posx=$this->page_largeur - $w - $this->marge_droite;
$posy=$this->marge_haute;
$pdf->SetFont('','B', $default_font_size + 2);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('', 'B', $default_font_size + 2);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$title=$outputlangs->transnoentities("SendingSheet");
$pdf->MultiCell($w, 4, $title, '', 'R');
$pdf->SetFont('','', $default_font_size + 1);
$pdf->SetFont('', '', $default_font_size + 1);
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R');
// Date planned delivery
if (! empty($object->date_delivery))
{
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$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');
}
if (! empty($object->thirdparty->code_client))
{
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
}
$pdf->SetFont('','', $default_font_size + 3);
$pdf->SetFont('', '', $default_font_size + 3);
$Yoff=25;
// Add list of linked orders
@ -946,7 +939,7 @@ class pdf_espadon extends ModelePdfExpedition
{
//$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetFont('', '', $default_font_size - 2);
$text=$linkedobject->ref;
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
$Yoff = $Yoff+8;
@ -954,7 +947,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
$Yoff = $Yoff+3;
$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');
}
}
@ -982,25 +975,25 @@ class pdf_espadon extends ModelePdfExpedition
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("Sender").":", 0, 'L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(230,230,230);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy-5);
$pdf->MultiCell(66, 5, $outputlangs->transnoentities("Sender").":", 0, 'L');
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(255,255,255);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(255, 255, 255);
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B',$default_font_size);
$pdf->SetXY($posx+2, $posy+3);
$pdf->SetFont('', 'B',$default_font_size);
$pdf->MultiCell($widthrecbox-2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy=$pdf->getY();
// Show sender information
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2, $posy);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell($widthrecbox-2, 4, $carac_emetteur, 0, 'L');
@ -1023,7 +1016,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;
@ -1033,22 +1026,22 @@ class pdf_espadon extends ModelePdfExpedition
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx+2, $posy-5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient").":", 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->SetXY($posx+2, $posy+3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L');
$posy = $pdf->getY();
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetXY($posx+2, $posy);
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
@ -1075,28 +1068,28 @@ class pdf_espadon extends ModelePdfExpedition
* Define Array Column Field
*
* @param object $object common object
* @param outputlangs $outputlangs langs
* @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 defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){
global $conf, $hookmanager;
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
$this->defaultTitlesFieldsStyle = array(
'align' => 'C', // R,C,L
'padding' => array(0.5,0,0.5,0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
/*
* For exemple
$this->cols['theColKey'] = array(
@ -1114,7 +1107,7 @@ class pdf_espadon extends ModelePdfExpedition
),
);
*/
$rank=0; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
@ -1131,7 +1124,7 @@ class pdf_espadon extends ModelePdfExpedition
'align' => 'L',
),
);
$rank = $rank + 10;
$this->cols['photo'] = array(
'rank' => $rank,
@ -1146,12 +1139,12 @@ class pdf_espadon extends ModelePdfExpedition
),
'border-left' => false, // remove left line separator
);
if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE) && !empty($this->atleastonephoto))
{
$this->cols['photo']['status'] = true;
}
$rank = $rank + 10;
$this->cols['weight'] = array(
'rank' => $rank,
@ -1163,7 +1156,7 @@ class pdf_espadon extends ModelePdfExpedition
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['subprice'] = array(
'rank' => $rank,
@ -1173,8 +1166,8 @@ class pdf_espadon extends ModelePdfExpedition
'textkey' => 'PriceUHT'
),
'border-left' => true, // add left line separator
);
);
$rank = $rank + 10;
$this->cols['totalexcltax'] = array(
'rank' => $rank,
@ -1185,7 +1178,7 @@ class pdf_espadon extends ModelePdfExpedition
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['qty_asked'] = array(
'rank' => $rank,
@ -1199,7 +1192,7 @@ class pdf_espadon extends ModelePdfExpedition
'align' => 'C',
),
);
$rank = $rank + 10;
$this->cols['qty_shipped'] = array(
'rank' => $rank,
@ -1213,8 +1206,8 @@ class pdf_espadon extends ModelePdfExpedition
'align' => 'C',
),
);
$parameters=array(
'object' => $object,
'outputlangs' => $outputlangs,
@ -1222,8 +1215,8 @@ class pdf_espadon extends ModelePdfExpedition
'hidedesc' => $hidedesc,
'hideref' => $hideref
);
$reshook=$hookmanager->executeHooks('defineColumnField',$parameters,$this); // Note that $object may have been modified by hook
$reshook=$hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
if ($reshook < 0)
{
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -1236,8 +1229,5 @@ class pdf_espadon extends ModelePdfExpedition
{
$this->cols = $hookmanager->resArray;
}
}
}

View File

@ -105,7 +105,7 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Issuer
* @var Company object that emits
* @var Societe object that emits
*/
public $emetteur;

View File

@ -180,7 +180,7 @@ class pdf_sponge extends ModelePDFFactures
// Define position of columns
$this->posxdesc=$this->marge_gauche+1; // used for notes ans other stuff
$this->tabTitleHeight = 5; // default height
// Use new system for position of columns, view $this->defineColumnField()
@ -224,7 +224,7 @@ class pdf_sponge extends ModelePDFFactures
if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){
$hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
}
// Loop on each lines to detect if there is at least one image to show
$realpatharray=array();
$this->atleastonephoto = false;
@ -564,11 +564,11 @@ class pdf_sponge extends ModelePDFFactures
$pdf->startTransaction();
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
$iniY = $tab_top + $this->tabTitleHeight + 2;
$curY = $tab_top + $this->tabTitleHeight + 2;
$nexY = $tab_top + $this->tabTitleHeight + 2;
// Loop on each lines
$pageposbeforeprintlines=$pdf->getPage();
$pagenb = $pageposbeforeprintlines;
@ -1555,12 +1555,10 @@ class pdf_sponge extends ModelePDFFactures
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
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
}
}
/**

File diff suppressed because it is too large Load Diff