diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 4efe7d18074..0a84ea371f3 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -145,7 +145,7 @@ class Facturation $i = 0; if (!is_null($newcartarray) && !empty($newcartarray)) { - $i=count($newcartarray); + $i=count($newcartarray); } $newcartarray[$i]['id']=$i; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 929b25690e5..eb263bdffae 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -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 */ diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 647d9d78e8e..017d4e22569 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -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); } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 7c87f1e4e36..da0f75a07ff 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -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) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6967034154d..395aef66639 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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 diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index ec8aa3978d9..39cfff534b7 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -116,7 +116,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Issuer - * @var Company object that emits + * @var Societe object that emits */ public $emetteur; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 16c4bf52d1c..44cfc9aae1d 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -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 } - - } /** diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 4ba7fc21abe..f1765debd1d 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -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")."
"; $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)?'
':'').$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; } - } - } - diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index e0de76bb7b7..945132e0a85 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -105,7 +105,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Issuer - * @var Company object that emits + * @var Societe object that emits */ public $emetteur; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 31b04cffcfe..e4f8d56f652 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -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 } - - } /** diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php index 9b5a1c2a62e..9c76a1a8f2a 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php @@ -110,7 +110,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders /** * Issuer - * @var Company object that emits + * @var Societe object that emits */ public $emetteur; @@ -157,8 +157,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Get source company $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined - + if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + // Define position of columns $this->posxdesc=$this->marge_gauche+1; // For module retrocompatibility support durring PDF transition: TODO remove this at the end @@ -200,7 +200,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders 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(); if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) @@ -214,12 +214,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $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; } else { - $pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } @@ -266,7 +266,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } @@ -281,9 +281,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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 $nblignes = count($object->lines); @@ -293,7 +293,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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) if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; - $pdf->SetAutoPageBreak(1,0); + $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) { @@ -310,7 +310,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->Open(); $pagenb=0; - $pdf->SetDrawColor(128,128,128); + $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Order")); @@ -328,17 +328,17 @@ class pdf_cornas extends ModelePDFSuppliersOrders break; } } - - + + // New page $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $top_shift = $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+$top_shift; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); @@ -351,13 +351,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $tab_top -= 2; - $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; @@ -366,31 +366,31 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Affiche notes $notetoshow=empty($object->note_public)?'':$object->note_public; - + $pagenb = $pdf->getPage(); if ($notetoshow) { $tab_width = $this->page_largeur-$this->marge_gauche-$this->marge_droite; $pageposbeforenote = $pagenb; - + $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); - + $tab_top -= 2; - + $pdf->startTransaction(); - + $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); // Description $pageposafternote=$pdf->getPage(); $posyafter = $pdf->GetY(); - + if($pageposafternote>$pageposbeforenote ) { $pdf->rollbackTransaction(true); - + // prepar pages to receive notes while ($pagenb < $pageposafternote) { $pdf->AddPage(); @@ -402,19 +402,19 @@ class pdf_cornas extends ModelePDFSuppliersOrders // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); } - + // back to start $pdf->setPage($pageposbeforenote); $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); - $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); $pageposafternote=$pdf->getPage(); - + $posyafter = $pdf->GetY(); - + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+20))) // There is no space left for total+free text { - $pdf->AddPage('','',true); + $pdf->AddPage('', '', true); $pagenb++; $pageposafternote++; $pdf->setPage($pageposafternote); @@ -423,15 +423,15 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); //$posyafter = $tab_top_newpage; } - - + + // apply note frame to previus pages $i = $pageposbeforenote; while ($i < $pageposafternote) { $pdf->setPage($i); - - - $pdf->SetDrawColor(128,128,128); + + + $pdf->SetDrawColor(128, 128, 128); // Draw note frame if($i>$pageposbeforenote){ $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter); @@ -441,21 +441,20 @@ class pdf_cornas extends ModelePDFSuppliersOrders $height_note = $this->page_hauteur - ($tab_top + $heightforfooter); $pdf->Rect($this->marge_gauche, $tab_top-1, $tab_width, $height_note + 1); } - + // Add footer $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - $this->_pagefoot($pdf,$object,$outputlangs,1); - + $this->_pagefoot($pdf, $object, $outputlangs, 1); + $i++; } - + // apply note frame to last page $pdf->setPage($pageposafternote); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); $height_note=$posyafter-$tab_top_newpage; $pdf->Rect($this->marge_gauche, $tab_top_newpage-1, $tab_width, $height_note+1); - } else // No pagebreak { @@ -463,23 +462,23 @@ class pdf_cornas extends ModelePDFSuppliersOrders $posyafter = $pdf->GetY(); $height_note=$posyafter-$tab_top; $pdf->Rect($this->marge_gauche, $tab_top-1, $tab_width, $height_note+1); - - + + if($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+20)) ) { // not enough space, need to add page - $pdf->AddPage('','',true); + $pdf->AddPage('', '', true); $pagenb++; $pageposafternote++; $pdf->setPage($pageposafternote); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - + $posyafter = $tab_top_newpage; } - + } - + $tab_height = $tab_height - $height_note; $tab_top = $posyafter +6; } @@ -493,8 +492,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders $nexY = $tab_top + 7; // Use new auto collum system - $this->prepareArrayColumnField($object,$outputlangs,$hidedetails,$hidedesc,$hideref); - + $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); + // Loop on each lines $pageposbeforeprintlines=$pdf->getPage(); $pagenb = $pageposbeforeprintlines; @@ -502,7 +501,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $curY = $nexY; $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 $imglinesize=array(); @@ -519,7 +518,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders // We start with Photo of product line if (!empty($imglinesize['width']) && !empty($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); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPage($pageposbefore+1); @@ -542,7 +541,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders 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 { @@ -550,14 +549,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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(); if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { 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($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPage($pageposafter+1); @@ -587,7 +586,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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 // VAT Rate if ($this->getColumnStatus('vat')) @@ -596,50 +595,50 @@ class pdf_cornas extends ModelePDFSuppliersOrders $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate); $nexY = max($pdf->GetY(),$nexY); } - + // Unit price before discount if ($this->getColumnStatus('subprice')) { $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax); - $nexY = max($pdf->GetY(),$nexY); + $nexY = max($pdf->GetY(), $nexY); } - + // Quantity // Enough for 6 chars if ($this->getColumnStatus('qty')) { $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'qty', $qty); - $nexY = max($pdf->GetY(),$nexY); + $nexY = max($pdf->GetY(), $nexY); } - - + + // Unit if ($this->getColumnStatus('unit')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $this->printStdColumnContent($pdf, $curY, 'unit', $unit); - $nexY = max($pdf->GetY(),$nexY); + $nexY = max($pdf->GetY(), $nexY); } - + // Discount on line if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent) { $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent); - $nexY = max($pdf->GetY(),$nexY); + $nexY = max($pdf->GetY(), $nexY); } - + // Total HT line if ($this->getColumnStatus('totalexcltax')) { $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax); - $nexY = max($pdf->GetY(),$nexY); + $nexY = max($pdf->GetY(), $nexY); } - - + + $parameters=array( 'object' => $object, 'i' => $i, @@ -649,8 +648,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); - $reshook=$hookmanager->executeHooks('printPDFline',$parameters,$this); // Note that $object may have been modified by hook - + $reshook=$hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook + // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; @@ -673,7 +672,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc,$object->thirdparty); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $mysoc, $object->thirdparty); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } @@ -694,7 +693,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders 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)); @@ -714,7 +713,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } - $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. @@ -730,7 +729,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } - $this->_pagefoot($pdf,$object,$outputlangs,1); + $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); @@ -765,7 +764,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); @@ -773,9 +772,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders // 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; @@ -791,13 +790,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders } else { - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); + $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR"); + $this->error=$langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } } @@ -855,7 +854,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('','', $default_font_size - 2); + $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); @@ -867,12 +866,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Show payment mode if (!empty($object->mode_reglement_code)) { - $pdf->SetFont('','B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('','', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - 2); $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); $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); @@ -904,7 +903,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tab2_top = $posy; $tab2_hl = 4; - $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetFont('', '', $default_font_size - 1); // Tableau total $col1x = 120; $col2x = 170; @@ -918,7 +917,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $index = 0; // Total HT - $pdf->SetFillColor(255,255,255); + $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); @@ -927,7 +926,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); // Show VAT by rates and total - $pdf->SetFillColor(248,248,248); + $pdf->SetFillColor(248, 248, 248); $this->atleastoneratenotnull=0; foreach( $this->tva as $tvakey => $tvaval ) @@ -943,11 +942,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (preg_match('/\*/',$tvakey)) { - $tvakey=str_replace('*','',$tvakey); + $tvakey=str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' '; + $totalvat =$outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1008,8 +1007,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; + $totalvat =$outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -1021,7 +1020,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ //Local tax 2 - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) + foreach($this->localtax2 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; @@ -1037,11 +1036,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tvacompl=''; if (preg_match('/\*/',$tvakey)) { - $tvakey=str_replace('*','',$tvakey); + $tvakey=str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $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->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -1062,7 +1061,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetTextColor(0,0,0); + $pdf->SetTextColor(0, 0, 0); $creditnoteamount=0; $depositsamount=0; @@ -1083,16 +1082,16 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); $index++; - $pdf->SetTextColor(0,0,60); - $pdf->SetFillColor(224,224,224); + $pdf->SetTextColor(0, 0, 60); + $pdf->SetFillColor(224, 224, 224); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1); - $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetTextColor(0,0,0); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetTextColor(0, 0, 0); } $index++; @@ -1124,12 +1123,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','', $default_font_size - 2); + $pdf->SetTextColor(0, 0, 0); + $pdf->SetFont('', '', $default_font_size - 2); if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); @@ -1137,8 +1136,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders 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->SetFont('','', $default_font_size - 1); + $pdf->SetDrawColor(128, 128, 128); + $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 @@ -1146,24 +1145,24 @@ class pdf_cornas extends ModelePDFSuppliersOrders foreach ($this->cols as $colKey => $colDef) { if(!$this->getColumnStatus($colKey)) continue; - + // get title label $colDef['title']['label'] = !empty($colDef['title']['label'])?$colDef['title']['label']:$outputlangs->transnoentities($colDef['title']['textkey']); - + // Add column separator if(!empty($colDef['border-left'])){ $pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height); } - + if (empty($hidetop)) { $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']); + $pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']); } } - + if (empty($hidetop)){ $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param } @@ -1197,8 +1196,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders }*/ //Print content - $pdf->SetTextColor(0,0,60); - $pdf->SetFont('','B',$default_font_size + 3); + $pdf->SetTextColor(0, 0, 60); + $pdf->SetFont('', 'B',$default_font_size + 3); $posx=$this->page_largeur-$this->marge_droite-100; $posy=$this->marge_haute; @@ -1216,8 +1215,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders } else { - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('','B', $default_font_size - 2); + $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("ErrorGoToModuleSetup"), 0, 'L'); } @@ -1229,8 +1228,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders } $pdf->SetFont('', 'B', $default_font_size + 3); - $pdf->SetXY($posx,$posy); - $pdf->SetTextColor(0,0,60); + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); $title=$outputlangs->transnoentities("SupplierOrder")." ".$outputlangs->convToOutputCharset($object->ref); $pdf->MultiCell(100, 3, $title, '', 'R'); $posy+=1; @@ -1238,14 +1237,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders if ($object->ref_supplier) { $posy+=4; - $pdf->SetFont('','B', $default_font_size); + $pdf->SetFont('', 'B', $default_font_size); $pdf->SetXY($posx,$posy); - $pdf->SetTextColor(0,0,60); + $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R'); $posy+=1; } - $pdf->SetFont('','', $default_font_size -1); + $pdf->SetFont('', '', $default_font_size -1); if (! empty($conf->global->PDF_SHOW_PROJECT)) { @@ -1253,9 +1252,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (! empty($object->project->ref)) { $posy+=4; - $pdf->SetXY($posx,$posy); + $pdf->SetXY($posx, $posy); $langs->load("projects"); - $pdf->SetTextColor(0,0,60); + $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); } } @@ -1263,33 +1262,33 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (! empty($object->date_commande)) { $posy+=5; - $pdf->SetXY($posx,$posy); - $pdf->SetTextColor(0,0,60); + $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'); } else { $posy+=5; - $pdf->SetXY($posx,$posy); - $pdf->SetTextColor(255,0,0); + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(255, 0, 0); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); } - $pdf->SetTextColor(0,0,60); + $pdf->SetTextColor(0, 0, 60); $usehourmin='day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; if (! empty($object->date_livraison)) { $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'); } if ($object->thirdparty->code_fournisseur) { $posy+=4; - $pdf->SetXY($posx,$posy); - $pdf->SetTextColor(0,0,60); + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); } @@ -1303,13 +1302,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders $usertmp->fetch($arrayidcontact[0]); $posy+=4; $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'); } } $posy+=1; - $pdf->SetTextColor(0,0,60); + $pdf->SetTextColor(0, 0, 60); $top_shift = 0; // Show list of linked objects @@ -1341,23 +1340,23 @@ class pdf_cornas extends ModelePDFSuppliersOrders $hautcadre=40; // Show sender frame - $pdf->SetTextColor(0,0,0); + $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posx,$posy-5); - $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); - $pdf->SetXY($posx,$posy); - $pdf->SetFillColor(230,230,230); + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); + $pdf->SetXY($posx, $posy); + $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); - $pdf->SetTextColor(0,0,60); + $pdf->SetTextColor(0, 0, 60); // 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(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); $posy=$pdf->getY(); // Show sender information - $pdf->SetXY($posx+2,$posy); + $pdf->SetXY($posx+2, $posy); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); @@ -1365,7 +1364,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders // If BILLING contact defined on order, we use it $usecontact=false; - $arrayidcontact=$object->getIdContact('external','BILLING'); + $arrayidcontact=$object->getIdContact('external', 'BILLING'); if (count($arrayidcontact) > 0) { $usecontact=true; @@ -1382,7 +1381,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object); + $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact?$object->contact:''), $usecontact, 'target', $object); // Show recipient $widthrecbox=100; @@ -1392,22 +1391,22 @@ class pdf_cornas extends ModelePDFSuppliersOrders 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->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L'); + $pdf->SetTextColor(0, 0, 0); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posx+2, $posy-5); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 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, 4, $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'); } @@ -1429,35 +1428,35 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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); } - - - + + + /** * 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){ - + 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 + '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 + 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ); - + /* * For exemple $this->cols['theColKey'] = array( @@ -1475,7 +1474,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders ), ); */ - + $rank=0; // do not use negative rank $this->cols['desc'] = array( 'rank' => $rank, @@ -1486,13 +1485,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders 'align' => 'L', // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label // 'label' => ' ', // the final label - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ), 'content' => array( 'align' => 'L', ), ); - + $rank = $rank + 10; $this->cols['photo'] = array( 'rank' => $rank, @@ -1503,17 +1502,17 @@ class pdf_cornas extends ModelePDFSuppliersOrders 'label' => ' ' ), 'content' => array( - 'padding' => array(0,0,0,0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + 'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ), 'border-left' => false, // remove left line separator ); - + if (! empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) { $this->cols['photo']['status'] = true; } - - + + $rank = $rank + 10; $this->cols['vat'] = array( 'rank' => $rank, @@ -1524,12 +1523,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders ), 'border-left' => true, // add left line separator ); - + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { $this->cols['vat']['status'] = true; } - + $rank = $rank + 10; $this->cols['subprice'] = array( 'rank' => $rank, @@ -1540,7 +1539,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders ), 'border-left' => true, // add left line separator ); - + $rank = $rank + 10; $this->cols['qty'] = array( 'rank' => $rank, @@ -1551,7 +1550,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders ), 'border-left' => true, // add left line separator ); - + $rank = $rank + 10; $this->cols['progress'] = array( 'rank' => $rank, @@ -1562,12 +1561,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders ), 'border-left' => false, // add left line separator ); - + if($this->situationinvoice) { $this->cols['progress']['status'] = true; } - + $rank = $rank + 10; $this->cols['unit'] = array( 'rank' => $rank, @@ -1581,7 +1580,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders if($conf->global->PRODUCT_USE_UNITS){ $this->cols['unit']['status'] = true; } - + $rank = $rank + 10; $this->cols['discount'] = array( 'rank' => $rank, @@ -1595,7 +1594,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders if ($this->atleastonediscount){ $this->cols['discount']['status'] = true; } - + $rank = $rank + 10; $this->cols['totalexcltax'] = array( 'rank' => $rank, @@ -1606,8 +1605,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders ), 'border-left' => true, // add left line separator ); - - + + $parameters=array( 'object' => $object, 'outputlangs' => $outputlangs, @@ -1615,8 +1614,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders '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'); @@ -1629,50 +1628,16 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $this->cols = $hookmanager->resArray; } - + } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /* * * DEBUT PARTIE NORMALEMENT DANS LA CLASSE CommonDocGenerator * * */ - + /** * uasort callback function to Sort colums fields * @@ -1681,54 +1646,54 @@ class pdf_cornas extends ModelePDFSuppliersOrders * @return int Return compare result */ 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); - - + + $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); + + // Sorting - uasort ( $this->cols, array( $this, 'columnSort' ) ); - + 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++; } @@ -1736,7 +1701,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $totalDefinedColWidth += $colDef['width']; } } - + foreach ($this->cols as $colKey =>& $colDef) { // setting empty conf with default @@ -1746,7 +1711,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders else{ $colDef['title'] = $this->defaultTitlesFieldsStyle; } - + // setting empty conf with default if(!empty($colDef['content'])){ $colDef['content'] = array_replace($this->defaultContentsFieldsStyle, $colDef['content']); @@ -1754,14 +1719,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders 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']; @@ -1770,7 +1735,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders } } } - + /** * get column content width from column key * @@ -1782,8 +1747,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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 * @@ -1795,7 +1760,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $colDef = $this->cols[$colKey]; return $colDef['xStartPos'] + $colDef['content']['padding'][3]; } - + /** * get column position rank from column key * @@ -1807,7 +1772,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders if(!isset($this->cols[$colKey]['rank'])) return -1; return $this->cols[$colKey]['rank']; } - + /** * get column position rank from column key * @@ -1821,21 +1786,21 @@ class pdf_cornas extends ModelePDFSuppliersOrders { // 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']) @@ -1843,14 +1808,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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 * @@ -1863,26 +1828,26 @@ class pdf_cornas extends ModelePDFSuppliersOrders function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') { global $hookmanager; - + $parameters=array( 'object' => $object, 'curY' =>& $curY, 'columnText' => $columnText, 'colKey' => $colKey ); - $reshook=$hookmanager->executeHooks('printStdColumnContent',$parameters,$this); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error,$hookmanager->errors,'errors'); + $reshook=$hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (!$reshook) { if(empty($columnText)) return; - $pdf->SetXY($this->getColumnContentXStart($colKey),$curY); // Set curent position + $pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position $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 * @@ -1896,5 +1861,4 @@ class pdf_cornas extends ModelePDFSuppliersOrders } else return false; } - }