浏览代码

NEW Add option PDF_DISABLE_MYCOMPANY_LOGO to disable logo on PDF

Laurent Destailleur 6 年之前
父节点
当前提交
f65df9e541

+ 17 - 14
htdocs/core/modules/commande/doc/pdf_einstein.modules.php

@@ -1261,27 +1261,30 @@ class pdf_einstein extends ModelePDFCommandes
 		$pdf->SetXY($this->marge_gauche,$posy);
 
 		// Logo
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
-		if ($this->emetteur->logo)
+		if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
 		{
-			if (is_readable($logo))
+			$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
+			if ($this->emetteur->logo)
 			{
-			    $height=pdf_getHeightForLogo($logo);
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				if (is_readable($logo))
+				{
+				    $height=pdf_getHeightForLogo($logo);
+				    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				}
+				else
+				{
+					$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("ErrorGoToGlobalSetup"), 0, 'L');
+				}
 			}
 			else
 			{
-				$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("ErrorGoToGlobalSetup"), 0, 'L');
+				$text=$this->emetteur->name;
+				$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
 			}
 		}
-		else
-		{
-			$text=$this->emetteur->name;
-			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
-		}
 
 		$pdf->SetFont('','B', $default_font_size + 3);
 		$pdf->SetXY($posx,$posy);

+ 84 - 81
htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php

@@ -136,7 +136,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 
 		// Define position of columns
 		$this->posxdesc=$this->marge_gauche+1;
-		
+
 
 		$this->tva=array();
 		$this->localtax1=array();
@@ -252,7 +252,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 				        break;
 				    }
 				}
-				
+
 				if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
 				{
 					$this->posxpicture+=($this->postotalht - $this->posxdiscount);
@@ -316,25 +316,25 @@ class pdf_eratosthene extends ModelePDFCommandes
 				{
 				    $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();
@@ -346,16 +346,16 @@ class pdf_eratosthene extends ModelePDFCommandes
 				            // 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->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);
@@ -367,14 +367,14 @@ class pdf_eratosthene extends ModelePDFCommandes
 				            $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);
 				            // Draw note frame
 				            if($i>$pageposbeforenote){
@@ -385,21 +385,21 @@ class pdf_eratosthene extends ModelePDFCommandes
 				                $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);
-				            
+
 				            $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
 				    {
@@ -407,8 +407,8 @@ class pdf_eratosthene extends ModelePDFCommandes
 				        $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
@@ -418,12 +418,12 @@ class pdf_eratosthene extends ModelePDFCommandes
 				            $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;
 				}
@@ -435,10 +435,10 @@ class pdf_eratosthene extends ModelePDFCommandes
 				$iniY = $tab_top + 7;
 				$curY = $tab_top + 7;
 				$nexY = $tab_top + 7;
-				
+
 				// Use new auto collum system
 				$this->prepareArrayColumnField($object,$outputlangs,$hidedetails,$hidedesc,$hideref);
-				
+
 				// Loop on each lines
 				$pageposbeforeprintlines=$pdf->getPage();
 				$pagenb = $pageposbeforeprintlines;
@@ -456,7 +456,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 					$curX = $this->posxdesc-1;
 
 					$showpricebeforepagebreak=1;
-					
+
 					if($this->getColumnStatus('desc'))
 					{
     					$pdf->startTransaction();
@@ -493,7 +493,7 @@ class pdf_eratosthene extends ModelePDFCommandes
     					}
     					$posYAfterDescription=$pdf->GetY();
 					}
-					
+
 					$nexY = $pdf->GetY();
 					$pageposafter=$pdf->getPage();
 
@@ -515,7 +515,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 					    $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
+
 					// Unit price before discount
 					if ($this->getColumnStatus('subprice'))
 					{
@@ -523,7 +523,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 					    $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
+
 					// Quantity
 					// Enough for 6 chars
 					if ($this->getColumnStatus('qty'))
@@ -532,8 +532,8 @@ class pdf_eratosthene extends ModelePDFCommandes
 					    $this->printStdColumnContent($pdf, $curY, 'qty', $qty);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
-					
+
+
 					// Unit
 					if ($this->getColumnStatus('unit'))
 					{
@@ -541,7 +541,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 					    $this->printStdColumnContent($pdf, $curY, 'unit', $unit);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
+
 					// Discount on line
 					if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent)
 					{
@@ -549,7 +549,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 					    $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
+
 					// Total HT line
 					if ($this->getColumnStatus('totalexcltax'))
 					{
@@ -557,8 +557,8 @@ class pdf_eratosthene extends ModelePDFCommandes
 					    $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
-					
+
+
 					$parameters=array(
 					    'object' => $object,
 					    'i' => $i,
@@ -569,7 +569,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 					    'hidedetails' => $hidedetails
 					);
 					$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;
@@ -1220,29 +1220,29 @@ class pdf_eratosthene extends ModelePDFCommandes
 		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']);
 		    }
 		}
-		
+
 		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
 		}
 
-		
+
 	}
 
 	/**
@@ -1281,27 +1281,30 @@ class pdf_eratosthene extends ModelePDFCommandes
 		$pdf->SetXY($this->marge_gauche,$posy);
 
 		// Logo
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
-		if ($this->emetteur->logo)
+		if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
 		{
-			if (is_readable($logo))
+			$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
+			if ($this->emetteur->logo)
 			{
-			    $height=pdf_getHeightForLogo($logo);
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				if (is_readable($logo))
+				{
+				    $height=pdf_getHeightForLogo($logo);
+				    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				}
+				else
+				{
+					$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("ErrorGoToGlobalSetup"), 0, 'L');
+				}
 			}
 			else
 			{
-				$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("ErrorGoToGlobalSetup"), 0, 'L');
+				$text=$this->emetteur->name;
+				$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
 			}
 		}
-		else
-		{
-			$text=$this->emetteur->name;
-			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
-		}
 
 		$pdf->SetFont('','B', $default_font_size + 3);
 		$pdf->SetXY($posx,$posy);
@@ -1469,9 +1472,9 @@ class pdf_eratosthene extends ModelePDFCommandes
 		$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
 		return pdf_pagefoot($pdf,$outputlangs,'ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
 	}
-	
 
-	
+
+
 	/**
 	 *   	Define Array Column Field
 	 *
@@ -1483,21 +1486,21 @@ class pdf_eratosthene extends ModelePDFCommandes
 	 *      @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(
@@ -1515,7 +1518,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	     ),
 	     );
 	     */
-	    
+
 	    $rank=0; // do not use negative rank
 	    $this->cols['desc'] = array(
 	        'rank' => $rank,
@@ -1532,7 +1535,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	            'align' => 'L',
 	        ),
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['photo'] = array(
 	        'rank' => $rank,
@@ -1547,13 +1550,13 @@ class pdf_eratosthene extends ModelePDFCommandes
 	        ),
 	        '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,
@@ -1564,12 +1567,12 @@ class pdf_eratosthene extends ModelePDFCommandes
 	        ),
 	        '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,
@@ -1580,7 +1583,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['qty'] = array(
 	        'rank' => $rank,
@@ -1591,7 +1594,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['progress'] = array(
 	        'rank' => $rank,
@@ -1602,12 +1605,12 @@ class pdf_eratosthene extends ModelePDFCommandes
 	        ),
 	        'border-left' => false, // add left line separator
 	    );
-	    
+
 	    if($this->situationinvoice)
 	    {
 	        $this->cols['progress']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['unit'] = array(
 	        'rank' => $rank,
@@ -1621,7 +1624,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	    if($conf->global->PRODUCT_USE_UNITS){
 	        $this->cols['unit']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['discount'] = array(
 	        'rank' => $rank,
@@ -1635,7 +1638,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	    if ($this->atleastonediscount){
 	        $this->cols['discount']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['totalexcltax'] = array(
 	        'rank' => $rank,
@@ -1646,8 +1649,8 @@ class pdf_eratosthene extends ModelePDFCommandes
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
-	    
+
+
 	    $parameters=array(
 	        'object' => $object,
 	        'outputlangs' => $outputlangs,
@@ -1655,7 +1658,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	        'hidedesc' => $hidedesc,
 	        'hideref' => $hideref
 	    );
-	    
+
 	    $reshook=$hookmanager->executeHooks('defineColumnField',$parameters,$this);    // Note that $object may have been modified by hook
 	    if ($reshook < 0)
 	    {
@@ -1669,7 +1672,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 	    {
 	        $this->cols = $hookmanager->resArray;
 	    }
-	    
+
 	}
-	
+
 }

+ 17 - 14
htdocs/core/modules/facture/doc/pdf_crabe.modules.php

@@ -1598,27 +1598,30 @@ class pdf_crabe extends ModelePDFFactures
 		$pdf->SetXY($this->marge_gauche,$posy);
 
 		// Logo
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
-		if ($this->emetteur->logo)
+		if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
 		{
-			if (is_readable($logo))
+			$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
+			if ($this->emetteur->logo)
 			{
-			    $height=pdf_getHeightForLogo($logo);
-				$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				if (is_readable($logo))
+				{
+				    $height=pdf_getHeightForLogo($logo);
+					$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				}
+				else
+				{
+					$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');
+				}
 			}
 			else
 			{
-				$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');
+				$text=$this->emetteur->name;
+				$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
 			}
 		}
-		else
-		{
-			$text=$this->emetteur->name;
-			$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
-		}
 
 		$pdf->SetFont('','B', $default_font_size + 3);
 		$pdf->SetXY($posx,$posy);

+ 165 - 162
htdocs/core/modules/facture/doc/pdf_sponge.modules.php

@@ -108,7 +108,7 @@ class pdf_sponge extends ModelePDFFactures
 	function __construct($db)
 	{
 		global $conf,$langs,$mysoc;
-		
+
 		// Translations
 		$langs->loadLangs(array("main", "bills"));
 
@@ -147,8 +147,8 @@ class pdf_sponge extends ModelePDFFactures
 
 		// Define position of columns
 		$this->posxdesc=$this->marge_gauche+1; // used for notes ans other stuff
-		
-		//  Use new system for position of columns, view  $this->defineColumnField() 
+
+		//  Use new system for position of columns, view  $this->defineColumnField()
 
 		$this->tva=array();
 		$this->localtax1=array();
@@ -173,27 +173,27 @@ class pdf_sponge extends ModelePDFFactures
 	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
 	{
 	    global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
-	    
+
 	    if (! is_object($outputlangs)) $outputlangs=$langs;
 	    // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
 	    if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
-	    
+
 	    // Translations
 	    $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
-	    
+
 	    $nblignes = count($object->lines);
-	    
+
 	    // 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_INVOICES_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))
@@ -206,14 +206,14 @@ class pdf_sponge extends ModelePDFFactures
 	                $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
@@ -231,28 +231,28 @@ class pdf_sponge extends ModelePDFFactures
 	                        {
 	                            $filename=$obj['photo'];
 	                        }
-	                        
+
 	                        $realpath = $dir.$filename;
 	                        $arephoto = true;
 	                        $this->atleastonephoto = true;
 	                    }
 	                }
 	            }
-	            
+
 	            if ($realpath && $arephoto) $realpatharray[$i]=$realpath;
 	        }
 	    }
-	    
+
 	    //if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
-	    
+
 	    if ($conf->facture->dir_output)
 	    {
 	        $object->fetch_thirdparty();
-	        
+
 	        $deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
 	        $amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
 	        $amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
-	        
+
 	        // Definition of $dir and $file
 	        if ($object->specimen)
 	        {
@@ -273,7 +273,7 @@ class pdf_sponge extends ModelePDFFactures
 	                return 0;
 	            }
 	        }
-	        
+
 	        if (file_exists($dir))
 	        {
 	            // Add pdfgeneration hook
@@ -286,47 +286,47 @@ class pdf_sponge extends ModelePDFFactures
 	            $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
-	            
+
 	            // Set nblignes with the new facture lines content after hook
 	            $nblignes = count($object->lines);
 	            $nbpayments = count($object->getListOfPayments());
-	            
+
 	            // Create pdf instance
 	            $pdf=pdf_getInstance($this->format);
 	            $default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
 	            $pdf->SetAutoPageBreak(1,0);
-	            
+
 	            $heightforinfotot = 50+(4*$nbpayments);	// Height reserved to output the info and total part and payment part
 	            $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 + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)?12:22);	// Height reserved to output the footer (value include bottom margin)
-	            
+
 	            if (class_exists('TCPDF'))
 	            {
 	                $pdf->setPrintHeader(false);
 	                $pdf->setPrintFooter(false);
 	            }
 	            $pdf->SetFont(pdf_getPDFFont($outputlangs));
-	            
+
 	            // Set path to the background PDF File
                 if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
 	            {
 	                $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
 	                $tplidx = $pdf->importPage(1);
 	            }
-	            
+
 	            $pdf->Open();
 	            $pagenb=0;
 	            $pdf->SetDrawColor(128,128,128);
-	            
+
 	            $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
 	            $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle"));
 	            $pdf->SetCreator("Dolibarr ".DOL_VERSION);
 	            $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
 	            $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
 	            if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
-	            
+
 	            $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
-	            
+
 	            // Does we have at least one line with discount $this->atleastonediscount
 	            foreach ($object->lines as $line) {
 	               if ($line->remise_percent){
@@ -334,30 +334,30 @@ class pdf_sponge extends ModelePDFFactures
 	                    break;
 	               }
 	            }
-	            
-	           
+
+
 	            // Situation invoice handling
 	            if ($object->situation_cycle_ref)
 	            {
 	                $this->situationinvoice = true;
 	            }
-	            
+
 	            // 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->MultiCell(0, 3, '');		// Set interline to 3
 	            $pdf->SetTextColor(0,0,0);
-	            
+
 	            $tab_top = 90+$top_shift;
 	            $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10);
 	            $tab_height = 130-$top_shift;
 	            $tab_height_newpage = 150;
 	            if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift;
-	            
+
 	            // Incoterm
 	            $height_incoterms = 0;
 	            if ($conf->incoterm->enabled)
@@ -366,21 +366,21 @@ class pdf_sponge extends ModelePDFFactures
 	                if ($desc_incoterms)
 	                {
 						$tab_top -= 2;
-	                    
+
 	                    $pdf->SetFont('','', $default_font_size - 1);
 	                    $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                    $height_incoterms=$nexY-$tab_top;
-	                    
+
 	                    // Rect prend une longueur en 3eme param
 	                    $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;
 	                    $height_incoterms += 4;
 	                }
 	            }
-	            
+
 	            // Affiche notes
 	            $notetoshow=empty($object->note_public)?'':$object->note_public;
 	            if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
@@ -394,7 +394,7 @@ class pdf_sponge extends ModelePDFFactures
 	                    if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature);
 	                }
 	            }
-	            
+
 	            $pagenb = $pdf->getPage();
 	            if ($notetoshow)
 	            {
@@ -402,24 +402,24 @@ class pdf_sponge extends ModelePDFFactures
 
 	                $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);
-	                
-	                
+
+
 	                $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();
@@ -431,16 +431,16 @@ class pdf_sponge extends ModelePDFFactures
 	                        // 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->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);
@@ -452,14 +452,14 @@ class pdf_sponge extends ModelePDFFactures
 	                        $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);
 	                        // Draw note frame
 	                        if($i>$pageposbeforenote){
@@ -470,21 +470,21 @@ class pdf_sponge extends ModelePDFFactures
 	                            $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);
-	                        
+
 	                        $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
 	                {
@@ -492,8 +492,8 @@ class pdf_sponge extends ModelePDFFactures
 	                    $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
@@ -503,12 +503,12 @@ class pdf_sponge extends ModelePDFFactures
 	                        $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;
 	            }
@@ -516,36 +516,36 @@ class pdf_sponge extends ModelePDFFactures
 	            {
 	                $height_note=0;
 	            }
-	            
+
 	            $iniY = $tab_top + 7;
 	            $curY = $tab_top + 7;
 	            $nexY = $tab_top + 7;
-	            
+
 	            // Use new auto collum system
 	            $this->prepareArrayColumnField($object,$outputlangs,$hidedetails,$hidedesc,$hideref);
-	            
+
 	            // Loop on each lines
 	            $pageposbeforeprintlines=$pdf->getPage();
 	            $pagenb = $pageposbeforeprintlines;
 	            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);
-	                
+
 	                // Define size of image if we need it
 	                $imglinesize=array();
 	                if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]);
-	                
+
 	                $pdf->setTopMargin($tab_top_newpage);
 	                $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
 	                $pageposbefore=$pdf->getPage();
-	                
+
 	                $showpricebeforepagebreak=1;
 	                $posYAfterImage=0;
 	                $posYAfterDescription=0;
-	                
+
 	                if($this->getColumnStatus('photo'))
 	                {
     	                // We start with Photo of product line
@@ -554,11 +554,11 @@ class pdf_sponge extends ModelePDFFactures
     	                    $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
@@ -566,7 +566,7 @@ class pdf_sponge extends ModelePDFFactures
     	                    $posYAfterImage=$curY+$imglinesize['height'];
     	                }
 	                }
-	                
+
 	                // Description of product line
 	                if ($this->getColumnStatus('desc'))
 	                {
@@ -604,20 +604,20 @@ class pdf_sponge extends ModelePDFFactures
     	                }
     	                $posYAfterDescription=$pdf->GetY();
 	                }
-	                
+
 	                $nexY = $pdf->GetY();
 	                $pageposafter=$pdf->getPage();
 	                $pdf->setPage($pageposbefore);
 	                $pdf->setTopMargin($this->marge_haute);
 	                $pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
-	                
+
 	                // We suppose that a too long description or photo were moved completely on next page
 	                if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
-	                    $pdf->setPage($pageposafter); $curY = $tab_top_newpage; 
+	                    $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
 	                }
-	                
+
 	                $pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
-	                
+
 	                // VAT Rate
 	                if ($this->getColumnStatus('vat'))
 	                {
@@ -625,7 +625,7 @@ class pdf_sponge extends ModelePDFFactures
 	                    $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                }
-	                
+
 	                // Unit price before discount
 	                if ($this->getColumnStatus('subprice'))
 	                {
@@ -633,7 +633,7 @@ class pdf_sponge extends ModelePDFFactures
 	                    $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                }
-	                
+
 	                // Quantity
 	                // Enough for 6 chars
 	                if ($this->getColumnStatus('qty'))
@@ -642,7 +642,7 @@ class pdf_sponge extends ModelePDFFactures
 	                    $this->printStdColumnContent($pdf, $curY, 'qty', $qty);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                }
-	                
+
 	                // Situation progress
 	                if ($this->getColumnStatus('progress'))
 	                {
@@ -650,7 +650,7 @@ class pdf_sponge extends ModelePDFFactures
 	                    $this->printStdColumnContent($pdf, $curY, 'progress', $progress);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                }
-	                
+
 	                // Unit
 	                if ($this->getColumnStatus('unit'))
 	                {
@@ -658,7 +658,7 @@ class pdf_sponge extends ModelePDFFactures
 	                    $this->printStdColumnContent($pdf, $curY, 'unit', $unit);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                }
-	                
+
 	                // Discount on line
 	                if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent)
 	                {
@@ -666,7 +666,7 @@ class pdf_sponge extends ModelePDFFactures
 	                    $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                }
-	                
+
 	                // Total HT line
 	                if ($this->getColumnStatus('totalexcltax'))
 	                {
@@ -674,8 +674,8 @@ class pdf_sponge extends ModelePDFFactures
 	                    $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax);
 	                    $nexY = max($pdf->GetY(),$nexY);
 	                }
-	                
-	                
+
+
 	                $parameters=array(
 	                    'object' => $object,
 	                    'i' => $i,
@@ -686,9 +686,9 @@ class pdf_sponge extends ModelePDFFactures
 	                    'hidedetails' => $hidedetails
 	                );
 	                $reshook=$hookmanager->executeHooks('printPDFline',$parameters,$this);    // Note that $object may have been modified by hook
-	                
-	                
-	                
+
+
+
 	                $sign=1;
 	                if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
 	                // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
@@ -701,20 +701,20 @@ class pdf_sponge extends ModelePDFFactures
 	                    if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne= $sign * $object->lines[$i]->multicurrency_total_tva;
 	                    else $tvaligne= $sign * $object->lines[$i]->total_tva;
 	                }
-	                
+
 	                $localtax1ligne=$object->lines[$i]->total_localtax1;
 	                $localtax2ligne=$object->lines[$i]->total_localtax2;
 	                $localtax1_rate=$object->lines[$i]->localtax1_tx;
 	                $localtax2_rate=$object->lines[$i]->localtax2_tx;
 	                $localtax1_type=$object->lines[$i]->localtax1_type;
 	                $localtax2_type=$object->lines[$i]->localtax2_type;
-	                
+
 	                if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
 	                if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
 	                if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
-	                
+
 	                $vatrate=(string) $object->lines[$i]->tva_tx;
-	                
+
 	                // Retrieve type from database for backward compatibility with old records
 	                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
@@ -723,19 +723,19 @@ class pdf_sponge extends ModelePDFFactures
 	                    $localtax1_type = $localtaxtmp_array[0];
 	                    $localtax2_type = $localtaxtmp_array[2];
 	                }
-	                
+
 	                // retrieve global local tax
 	                if ($localtax1_type && $localtax1ligne != 0)
 	                    $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
 	                    if ($localtax2_type && $localtax2ligne != 0)
 	                        $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
-	                        
+
 	                        if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
 	                        if (! isset($this->tva[$vatrate])) 				$this->tva[$vatrate]=0;
 	                        $this->tva[$vatrate] += $tvaligne;
-	                        
+
 	                        $nexY = max($nexY,$posYAfterImage);
-	                        
+
 	                        // Add line
 	                        if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
 	                        {
@@ -745,9 +745,9 @@ class pdf_sponge extends ModelePDFFactures
 	                            $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
 	                            $pdf->SetLineStyle(array('dash'=>0));
 	                        }
-	                        
+
 	                        $nexY+=2;    // Passe espace entre les lignes
-	                        
+
 	                        // Detect if some page were added automatically and output _tableau for past pages
 	                        while ($pagenb < $pageposafter)
 	                        {
@@ -766,7 +766,7 @@ class pdf_sponge extends ModelePDFFactures
 	                            $pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
 	                            if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
 	                        }
-	                        
+
 	                        if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
 	                        {
 	                            if ($pagenb == $pageposafter)
@@ -784,9 +784,9 @@ class pdf_sponge extends ModelePDFFactures
 	                            $pagenb++;
 	                            if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
 	                        }
-	                  
+
 	            }
-	            
+
 	            // Show square
 	            if ($pagenb == $pageposbeforeprintlines)
 	            {
@@ -798,38 +798,38 @@ class pdf_sponge extends ModelePDFFactures
 	                $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
 	                $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
 	            }
-	            
+
 	            // Affiche zone infos
 	            $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
-	            
+
 	            // Affiche zone totaux
 	            $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
-	            
+
 	            // Affiche zone versements
 	            if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
 	            {
 	                $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
 	            }
-	            
+
 	            // Pied de page
 	            $this->_pagefoot($pdf,$object,$outputlangs);
 	            if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
-	            
+
 	            $pdf->Close();
-	            
+
 	            $pdf->Output($file,'F');
-	            
+
 	            // Add pdfgeneration hook
 	            $hookmanager->initHooks(array('pdfgeneration'));
 	            $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
-	            
+
 	            if (! empty($conf->global->MAIN_UMASK))
 	                @chmod($file, octdec($conf->global->MAIN_UMASK));
-	                
+
 	                $this->result = array('fullpath'=>$file);
-	                
+
 	                return 1;   // No error
 	        }
 	        else
@@ -1511,29 +1511,29 @@ class pdf_sponge extends ModelePDFFactures
 		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']);
 		    }
 		}
-		
+
 		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
 		}
 
-		
+
 	}
 
 	/**
@@ -1548,7 +1548,7 @@ class pdf_sponge extends ModelePDFFactures
 	function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
 	{
 		global $conf, $langs;
-		
+
 		// Translations
 		$outputlangs->loadLangs(array("main", "bills", "propal", "companies"));
 
@@ -1573,27 +1573,30 @@ class pdf_sponge extends ModelePDFFactures
 		$pdf->SetXY($this->marge_gauche,$posy);
 
 		// Logo
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
-		if ($this->emetteur->logo)
+		if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
 		{
-			if (is_readable($logo))
+			$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
+			if ($this->emetteur->logo)
 			{
-			    $height=pdf_getHeightForLogo($logo);
-				$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				if (is_readable($logo))
+				{
+				    $height=pdf_getHeightForLogo($logo);
+					$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				}
+				else
+				{
+					$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');
+				}
 			}
 			else
 			{
-				$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');
+				$text=$this->emetteur->name;
+				$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
 			}
 		}
-		else
-		{
-			$text=$this->emetteur->name;
-			$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
-		}
 
 		$pdf->SetFont('','B', $default_font_size + 3);
 		$pdf->SetXY($posx,$posy);
@@ -1822,9 +1825,9 @@ class pdf_sponge extends ModelePDFFactures
 		return pdf_pagefoot($pdf,$outputlangs,'INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
 	}
 
-	
-	
-	
+
+
+
 	/**
 	 *   	Define Array Column Field
 	 *
@@ -1836,21 +1839,21 @@ class pdf_sponge extends ModelePDFFactures
 	 *      @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 
+	        '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(
@@ -1859,19 +1862,19 @@ class pdf_sponge extends ModelePDFFactures
 	        'title' => array(
 	            'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
 	            'label' => ' ', // the final label : used fore final generated text
-	            'align' => 'L', // text alignement :  R,C,L 
+	            'align' => 'L', // text alignement :  R,C,L
 	            'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
 	        ),
 	        'content' => array(
-	            'align' => 'L', // text alignement :  R,C,L 
+	            'align' => 'L', // text alignement :  R,C,L
 	            'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
 	        ),
 	    );
 	    */
-	    
+
 	    $rank=0; // do not use negative rank
 	    $this->cols['desc'] = array(
-	        'rank' => $rank, 
+	        'rank' => $rank,
 	        'width' => false, // only for desc
 	        'status' => true,
 	        'title' => array(
@@ -1885,7 +1888,7 @@ class pdf_sponge extends ModelePDFFactures
 	            'align' => 'L',
 	        ),
 	    );
-	    
+
 	    // PHOTO
         $rank = $rank + 10;
         $this->cols['photo'] = array(
@@ -1894,20 +1897,20 @@ class pdf_sponge extends ModelePDFFactures
             'status' => false,
             'title' => array(
                 'textkey' => 'Photo',
-                'label' => ' ' 
+                'label' => ' '
             ),
             'content' => array(
                 '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_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto))
 	    {
 	        $this->cols['photo']['status'] = true;
 	    }
-	    
-	    
+
+
 	    $rank = $rank + 10;
 	    $this->cols['vat'] = array(
 	        'rank' => $rank,
@@ -1918,12 +1921,12 @@ class pdf_sponge extends ModelePDFFactures
 	        ),
 	        '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,
@@ -1934,7 +1937,7 @@ class pdf_sponge extends ModelePDFFactures
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['qty'] = array(
 	        'rank' => $rank,
@@ -1945,7 +1948,7 @@ class pdf_sponge extends ModelePDFFactures
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['progress'] = array(
 	        'rank' => $rank,
@@ -1956,12 +1959,12 @@ class pdf_sponge extends ModelePDFFactures
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
+
 	    if($this->situationinvoice)
 	    {
 	        $this->cols['progress']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['unit'] = array(
 	        'rank' => $rank,
@@ -1975,7 +1978,7 @@ class pdf_sponge extends ModelePDFFactures
 	    if($conf->global->PRODUCT_USE_UNITS){
 	        $this->cols['unit']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['discount'] = array(
 	        'rank' => $rank,
@@ -1989,7 +1992,7 @@ class pdf_sponge extends ModelePDFFactures
 	    if ($this->atleastonediscount){
 	        $this->cols['discount']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['totalexcltax'] = array(
 	        'rank' => $rank,
@@ -2000,8 +2003,8 @@ class pdf_sponge extends ModelePDFFactures
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
-	    
+
+
 	    $parameters=array(
 	        'object' => $object,
 	        'outputlangs' => $outputlangs,
@@ -2009,7 +2012,7 @@ class pdf_sponge extends ModelePDFFactures
 	        'hidedesc' => $hidedesc,
 	        'hideref' => $hideref
 	    );
-	    
+
 	    $reshook=$hookmanager->executeHooks('defineColumnField',$parameters,$this);    // Note that $object may have been modified by hook
 	    if ($reshook < 0)
 	    {
@@ -2023,8 +2026,8 @@ class pdf_sponge extends ModelePDFFactures
 	    {
 	        $this->cols = $hookmanager->resArray;
 	    }
-	    
+
 	}
-	
-	
+
+
 }

+ 17 - 14
htdocs/core/modules/propale/doc/pdf_azur.modules.php

@@ -1463,27 +1463,30 @@ class pdf_azur extends ModelePDFPropales
 		$pdf->SetXY($this->marge_gauche,$posy);
 
 		// Logo
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
-		if ($this->emetteur->logo)
+		if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
 		{
-			if (is_readable($logo))
+			$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
+			if ($this->emetteur->logo)
 			{
-			    $height=pdf_getHeightForLogo($logo);
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				if (is_readable($logo))
+				{
+				    $height=pdf_getHeightForLogo($logo);
+				    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				}
+				else
+				{
+					$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("ErrorGoToGlobalSetup"), 0, 'L');
+				}
 			}
 			else
 			{
-				$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("ErrorGoToGlobalSetup"), 0, 'L');
+				$text=$this->emetteur->name;
+				$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
 			}
 		}
-		else
-		{
-			$text=$this->emetteur->name;
-			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
-		}
 
 		$pdf->SetFont('','B',$default_font_size + 3);
 		$pdf->SetXY($posx,$posy);

+ 90 - 87
htdocs/core/modules/propale/doc/pdf_cyan.modules.php

@@ -68,7 +68,7 @@ class pdf_cyan extends ModelePDFPropales
 	function __construct($db)
 	{
 		global $conf,$langs,$mysoc;
-		
+
 		// Translations
 		$langs->loadLangs(array("main", "bills"));
 
@@ -107,8 +107,8 @@ class pdf_cyan extends ModelePDFPropales
 
 		// Define position of columns
 		$this->posxdesc=$this->marge_gauche+1;
-		
-		
+
+
 
 		$this->tva=array();
 		$this->localtax1=array();
@@ -286,8 +286,8 @@ class pdf_cyan extends ModelePDFPropales
 				        break;
 				    }
 				}
-				
-				
+
+
 
 				// New page
 				$pdf->AddPage();
@@ -308,7 +308,7 @@ class pdf_cyan extends ModelePDFPropales
 
 	            $tab_top = 90+$top_shift;
 				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10);
-				
+
 
 				// Incoterm
 				$height_incoterms = 0;
@@ -353,7 +353,7 @@ class pdf_cyan extends ModelePDFPropales
 				    if ($tmpuser->email) $notetoshow.=',  Mail: '.$tmpuser->email;
 				    if ($tmpuser->office_phone) $notetoshow.=', Tel: '.$tmpuser->office_phone;
 				}
-				
+
 				$pagenb = $pdf->getPage();
 				if ($notetoshow)
 				{
@@ -361,24 +361,24 @@ class pdf_cyan extends ModelePDFPropales
 
 				    $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);
 
 
 					$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();
@@ -390,16 +390,16 @@ class pdf_cyan extends ModelePDFPropales
 					        // 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->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);
@@ -411,14 +411,14 @@ class pdf_cyan extends ModelePDFPropales
 					        $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);
 					        // Draw note frame
 					        if($i>$pageposbeforenote){
@@ -429,21 +429,21 @@ class pdf_cyan extends ModelePDFPropales
 					            $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);
-					        
+
 					        $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
 					{
@@ -451,8 +451,8 @@ class pdf_cyan extends ModelePDFPropales
 					    $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
@@ -462,12 +462,12 @@ class pdf_cyan extends ModelePDFPropales
 					        $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;
 				}
@@ -479,10 +479,10 @@ class pdf_cyan extends ModelePDFPropales
 				$iniY = $tab_top + 7;
 				$curY = $tab_top + 7;
 				$nexY = $tab_top + 7;
-				
+
 				// Use new auto collum system
 				$this->prepareArrayColumnField($object,$outputlangs,$hidedetails,$hidedesc,$hideref);
-				
+
 				// Loop on each lines
 				$pageposbeforeprintlines=$pdf->getPage();
 				$pagenb = $pageposbeforeprintlines;
@@ -513,12 +513,12 @@ class pdf_cyan extends ModelePDFPropales
     						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
@@ -526,7 +526,7 @@ class pdf_cyan extends ModelePDFPropales
     						$posYAfterImage=$curY+$imglinesize['height'];
     					}
 					}
-					
+
 					// Description of product line
 					if($this->getColumnStatus('desc'))
 					{
@@ -540,7 +540,7 @@ class pdf_cyan extends ModelePDFPropales
     						//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);
-    
+
     						$pageposafter=$pdf->getPage();
     						$posyafter=$pdf->GetY();
     						//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
@@ -596,7 +596,7 @@ class pdf_cyan extends ModelePDFPropales
 					    $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
+
 					// Quantity
 					// Enough for 6 chars
 					if ($this->getColumnStatus('qty'))
@@ -605,8 +605,8 @@ class pdf_cyan extends ModelePDFPropales
 					    $this->printStdColumnContent($pdf, $curY, 'qty', $qty);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
-					
+
+
 					// Unit
 					if ($this->getColumnStatus('unit'))
 					{
@@ -614,7 +614,7 @@ class pdf_cyan extends ModelePDFPropales
 					    $this->printStdColumnContent($pdf, $curY, 'unit', $unit);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
+
 					// Discount on line
 					if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent)
 					{
@@ -622,7 +622,7 @@ class pdf_cyan extends ModelePDFPropales
 					    $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
+
 					// Total HT line
 					if ($this->getColumnStatus('totalexcltax'))
 					{
@@ -630,8 +630,8 @@ class pdf_cyan extends ModelePDFPropales
 					    $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax);
 					    $nexY = max($pdf->GetY(),$nexY);
 					}
-					
-					
+
+
 					$parameters=array(
 					    'object' => $object,
 					    'i' => $i,
@@ -642,8 +642,8 @@ class pdf_cyan extends ModelePDFPropales
 					    'hidedetails' => $hidedetails
 					);
 					$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;
@@ -1389,29 +1389,29 @@ class pdf_cyan extends ModelePDFPropales
 		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']);
 		    }
 		}
-		
+
 		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
 		}
 
-		
+
 	}
 
 	/**
@@ -1451,27 +1451,30 @@ class pdf_cyan extends ModelePDFPropales
 		$pdf->SetXY($this->marge_gauche,$posy);
 
 		// Logo
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
-		if ($this->emetteur->logo)
+		if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
 		{
-			if (is_readable($logo))
+			$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
+			if ($this->emetteur->logo)
 			{
-			    $height=pdf_getHeightForLogo($logo);
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				if (is_readable($logo))
+				{
+				    $height=pdf_getHeightForLogo($logo);
+				    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
+				}
+				else
+				{
+					$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("ErrorGoToGlobalSetup"), 0, 'L');
+				}
 			}
 			else
 			{
-				$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("ErrorGoToGlobalSetup"), 0, 'L');
+				$text=$this->emetteur->name;
+				$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
 			}
 		}
-		else
-		{
-			$text=$this->emetteur->name;
-			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
-		}
 
 		$pdf->SetFont('','B',$default_font_size + 3);
 		$pdf->SetXY($posx,$posy);
@@ -1686,8 +1689,8 @@ class pdf_cyan extends ModelePDFPropales
 
 		return ($tab_hl*7);
 	}
-	
-	
+
+
 	/**
 	 *   	Define Array Column Field
 	 *
@@ -1699,21 +1702,21 @@ class pdf_cyan extends ModelePDFPropales
 	 *      @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(
@@ -1731,7 +1734,7 @@ class pdf_cyan extends ModelePDFPropales
 	     ),
 	     );
 	     */
-	    
+
 	    $rank=0; // do not use negative rank
 	    $this->cols['desc'] = array(
 	        'rank' => $rank,
@@ -1748,7 +1751,7 @@ class pdf_cyan extends ModelePDFPropales
 	            'align' => 'L',
 	        ),
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['photo'] = array(
 	        'rank' => $rank,
@@ -1763,13 +1766,13 @@ class pdf_cyan extends ModelePDFPropales
 	        ),
 	        '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['vat'] = array(
 	        'rank' => $rank,
@@ -1780,12 +1783,12 @@ class pdf_cyan extends ModelePDFPropales
 	        ),
 	        '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,
@@ -1796,7 +1799,7 @@ class pdf_cyan extends ModelePDFPropales
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['qty'] = array(
 	        'rank' => $rank,
@@ -1807,7 +1810,7 @@ class pdf_cyan extends ModelePDFPropales
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['progress'] = array(
 	        'rank' => $rank,
@@ -1818,12 +1821,12 @@ class pdf_cyan extends ModelePDFPropales
 	        ),
 	        'border-left' => false, // add left line separator
 	    );
-	    
+
 	    if($this->situationinvoice)
 	    {
 	        $this->cols['progress']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['unit'] = array(
 	        'rank' => $rank,
@@ -1837,7 +1840,7 @@ class pdf_cyan extends ModelePDFPropales
 	    if($conf->global->PRODUCT_USE_UNITS){
 	        $this->cols['unit']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['discount'] = array(
 	        'rank' => $rank,
@@ -1851,7 +1854,7 @@ class pdf_cyan extends ModelePDFPropales
 	    if ($this->atleastonediscount){
 	        $this->cols['discount']['status'] = true;
 	    }
-	    
+
 	    $rank = $rank + 10;
 	    $this->cols['totalexcltax'] = array(
 	        'rank' => $rank,
@@ -1862,8 +1865,8 @@ class pdf_cyan extends ModelePDFPropales
 	        ),
 	        'border-left' => true, // add left line separator
 	    );
-	    
-	    
+
+
 	    $parameters=array(
 	        'object' => $object,
 	        'outputlangs' => $outputlangs,
@@ -1871,7 +1874,7 @@ class pdf_cyan extends ModelePDFPropales
 	        'hidedesc' => $hidedesc,
 	        'hideref' => $hideref
 	    );
-	    
+
 	    $reshook=$hookmanager->executeHooks('defineColumnField',$parameters,$this);    // Note that $object may have been modified by hook
 	    if ($reshook < 0)
 	    {
@@ -1885,7 +1888,7 @@ class pdf_cyan extends ModelePDFPropales
 	    {
 	        $this->cols = $hookmanager->resArray;
 	    }
-	    
+
 	}
-	
+
 }