Passed
Pull Request — master (#2)
by
unknown
26:19
created
htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  */
29 29
 
30 30
 require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
31
-require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';   // Requis car utilise dans les classes qui heritent
31
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent
32 32
 
33 33
 
34 34
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * @var string Error code (or message)
41 41
 	 */
42
-	public $error='';
42
+	public $error = '';
43 43
 
44 44
 
45 45
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
      *  @param  integer	$maxfilenamelength  Max length of value to show
51 51
      *  @return	array						List of templates
52 52
 	 */
53
-	static function liste_modeles($db,$maxfilenamelength=0)
53
+	static function liste_modeles($db, $maxfilenamelength = 0)
54 54
 	{
55 55
         // phpcs:enable
56 56
 		global $conf;
57 57
 
58
-		$type='supplier_proposal';
59
-		$liste=array();
58
+		$type = 'supplier_proposal';
59
+		$liste = array();
60 60
 
61 61
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
62
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
62
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
63 63
 
64 64
 		return $liste;
65 65
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	/**
75 75
 	 * @var string Error code (or message)
76 76
 	 */
77
-	public $error='';
77
+	public $error = '';
78 78
 
79 79
 	/**
80 80
 	 * Return if a module can be used or not
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 *	@param		Propal		$propal		Object commercial proposal
129 129
 	 *	@return     string      Valeur
130 130
 	 */
131
-	function getNextValue($objsoc,$propal)
131
+	function getNextValue($objsoc, $propal)
132 132
 	{
133 133
 		global $langs;
134 134
 		return $langs->trans("NotAvailable");
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modSyslog.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *	\brief      Fichier de description et activation du module de syslog
25 25
  */
26 26
 
27
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 28
 
29 29
 /**
30 30
  *	Class to enable/disable module Logs
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		// Module position in the family on 2 digits ('01', '10', '20', ...)
49 49
 		$this->module_position = '50';
50 50
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
51
-		$this->name = preg_replace('/^mod/i','',get_class($this));
51
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
52 52
 		// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
53 53
 		$this->description = "Activate debug logs (syslog)";
54 54
 		// Can be enabled / disabled only in the main company
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
59 59
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60 60
 		// Name of image file used for this module.
61
-		$this->picto='technic';
61
+		$this->picto = 'technic';
62 62
 
63 63
 		// Data directories to create when module is enabled
64 64
 		$this->dirs = array();
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 		$this->config_page_url = array("syslog.php");
68 68
 
69 69
 		// Dependencies
70
-		$this->hidden = false;			// A condition to hide module
71
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
72
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
73
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
74
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
70
+		$this->hidden = false; // A condition to hide module
71
+		$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
72
+		$this->requiredby = array(); // List of module ids to disable if this one is disabled
73
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with
74
+		$this->phpmin = array(5, 4); // Minimum version of PHP required by module
75 75
 
76 76
 		// Constants
77 77
 		$this->const = array();
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php 1 patch
Spacing   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	function __construct($db)
120 120
 	{
121
-		global $conf,$langs,$mysoc;
121
+		global $conf, $langs, $mysoc;
122 122
 
123 123
 		$this->db = $db;
124 124
 		$this->name = 'soleil';
@@ -126,29 +126,29 @@  discard block
 block discarded – undo
126 126
 
127 127
 		// Dimension page pour format A4
128 128
 		$this->type = 'pdf';
129
-		$formatarray=pdf_getFormat();
129
+		$formatarray = pdf_getFormat();
130 130
 		$this->page_largeur = $formatarray['width'];
131 131
 		$this->page_hauteur = $formatarray['height'];
132
-		$this->format = array($this->page_largeur,$this->page_hauteur);
133
-		$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
134
-		$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
135
-		$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
136
-		$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
137
-
138
-		$this->option_logo = 1;                    // Affiche logo
139
-		$this->option_tva = 0;                     // Gere option tva FACTURE_TVAOPTION
140
-		$this->option_modereg = 0;                 // Affiche mode reglement
141
-		$this->option_condreg = 0;                 // Affiche conditions reglement
142
-		$this->option_codeproduitservice = 0;      // Affiche code produit-service
143
-		$this->option_multilang = 1;               // Dispo en plusieurs langues
144
-		$this->option_draft_watermark = 1;		   //Support add of a watermark on drafts
132
+		$this->format = array($this->page_largeur, $this->page_hauteur);
133
+		$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
134
+		$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
135
+		$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
136
+		$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
137
+
138
+		$this->option_logo = 1; // Affiche logo
139
+		$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
140
+		$this->option_modereg = 0; // Affiche mode reglement
141
+		$this->option_condreg = 0; // Affiche conditions reglement
142
+		$this->option_codeproduitservice = 0; // Affiche code produit-service
143
+		$this->option_multilang = 1; // Dispo en plusieurs langues
144
+		$this->option_draft_watermark = 1; //Support add of a watermark on drafts
145 145
 
146 146
 		// Get source company
147
-		$this->emetteur=$mysoc;
148
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if not defined
147
+		$this->emetteur = $mysoc;
148
+		if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if not defined
149 149
 
150 150
 		// Define position of columns
151
-		$this->posxdesc=$this->marge_gauche+1;
151
+		$this->posxdesc = $this->marge_gauche + 1;
152 152
 	}
153 153
 
154 154
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	 *  @param		int				$hideref			Do not show ref
164 164
 	 *  @return		int									1=OK, 0=KO
165 165
 	 */
166
-	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
166
+	function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
167 167
 	{
168 168
         // phpcs:enable
169
-		global $user,$langs,$conf,$mysoc,$db,$hookmanager;
169
+		global $user, $langs, $conf, $mysoc, $db, $hookmanager;
170 170
 
171
-		if (! is_object($outputlangs)) $outputlangs=$langs;
171
+		if (!is_object($outputlangs)) $outputlangs = $langs;
172 172
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
173
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
173
+		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
174 174
 
175 175
 		// Load traductions files requiredby by page
176 176
 		$outputlangs->loadLangs(array("main", "interventions", "dict", "companies"));
@@ -183,20 +183,20 @@  discard block
 block discarded – undo
183 183
 			if ($object->specimen)
184 184
 			{
185 185
 				$dir = $conf->ficheinter->dir_output;
186
-				$file = $dir . "/SPECIMEN.pdf";
186
+				$file = $dir."/SPECIMEN.pdf";
187 187
 			}
188 188
 			else
189 189
 			{
190 190
 				$objectref = dol_sanitizeFileName($object->ref);
191
-				$dir = $conf->ficheinter->dir_output . "/" . $objectref;
192
-				$file = $dir . "/" . $objectref . ".pdf";
191
+				$dir = $conf->ficheinter->dir_output."/".$objectref;
192
+				$file = $dir."/".$objectref.".pdf";
193 193
 			}
194 194
 
195
-			if (! file_exists($dir))
195
+			if (!file_exists($dir))
196 196
 			{
197 197
 				if (dol_mkdir($dir) < 0)
198 198
 				{
199
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
199
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
200 200
 					return 0;
201 201
 				}
202 202
 			}
@@ -204,27 +204,27 @@  discard block
 block discarded – undo
204 204
 			if (file_exists($dir))
205 205
 			{
206 206
 				// Add pdfgeneration hook
207
-				if (! is_object($hookmanager))
207
+				if (!is_object($hookmanager))
208 208
 				{
209 209
 					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
210
-					$hookmanager=new HookManager($this->db);
210
+					$hookmanager = new HookManager($this->db);
211 211
 				}
212 212
 
213 213
 				$hookmanager->initHooks(array('pdfgeneration'));
214
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
214
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
215 215
 				global $action;
216
-				$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
216
+				$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
217 217
 
218 218
 				$nblignes = count($object->lines);
219 219
 
220 220
 				// Create pdf instance
221
-				$pdf=pdf_getInstance($this->format);
222
-				$default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
223
-				$heightforinfotot = 50;	// Height reserved to output the info and total part
224
-				$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
225
-				$heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
226
-				if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
227
-				$pdf->SetAutoPageBreak(1,0);
221
+				$pdf = pdf_getInstance($this->format);
222
+				$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
223
+				$heightforinfotot = 50; // Height reserved to output the info and total part
224
+				$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
225
+				$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
226
+				if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
227
+				$pdf->SetAutoPageBreak(1, 0);
228 228
 
229 229
 				if (class_exists('TCPDF'))
230 230
 				{
@@ -233,63 +233,63 @@  discard block
 block discarded – undo
233 233
 				}
234 234
 				$pdf->SetFont(pdf_getPDFFont($outputlangs));
235 235
 				// Set path to the background PDF File
236
-				if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
236
+				if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
237 237
 				{
238 238
 					$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
239 239
 					$tplidx = $pdf->importPage(1);
240 240
 				}
241 241
 
242 242
 				$pdf->Open();
243
-				$pagenb=0;
244
-				$pdf->SetDrawColor(128,128,128);
243
+				$pagenb = 0;
244
+				$pdf->SetDrawColor(128, 128, 128);
245 245
 
246 246
 				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
247 247
 				$pdf->SetSubject($outputlangs->transnoentities("InterventionCard"));
248 248
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
249 249
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
250 250
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard"));
251
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
251
+				if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
252 252
 
253
-				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
253
+				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
254 254
 
255 255
 				// New page
256 256
 				$pdf->AddPage();
257
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
257
+				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
258 258
 				$pagenb++;
259 259
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
260
-				$pdf->SetFont('','', $default_font_size - 1);
261
-				$pdf->SetTextColor(0,0,0);
260
+				$pdf->SetFont('', '', $default_font_size - 1);
261
+				$pdf->SetTextColor(0, 0, 0);
262 262
 
263 263
 				$tab_top = 90;
264
-				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
264
+				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
265 265
 				$tab_height = 130;
266 266
 				$tab_height_newpage = 150;
267 267
 
268 268
 				// Affiche notes
269
-				$notetoshow=empty($object->note_public)?'':$object->note_public;
269
+				$notetoshow = empty($object->note_public) ? '' : $object->note_public;
270 270
 				if ($notetoshow)
271 271
 				{
272
-					$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
272
+					$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
273 273
 					complete_substitutions_array($substitutionarray, $outputlangs, $object);
274 274
 					$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
275 275
 
276 276
 					$tab_top = 88;
277 277
 
278
-					$pdf->SetFont('','', $default_font_size - 1);
279
-					$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
278
+					$pdf->SetFont('', '', $default_font_size - 1);
279
+					$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
280 280
 					$nexY = $pdf->GetY();
281
-					$height_note=$nexY-$tab_top;
281
+					$height_note = $nexY - $tab_top;
282 282
 
283 283
 					// Rect prend une longueur en 3eme param
284
-					$pdf->SetDrawColor(192,192,192);
285
-					$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
284
+					$pdf->SetDrawColor(192, 192, 192);
285
+					$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
286 286
 
287 287
 					$tab_height = $tab_height - $height_note;
288
-					$tab_top = $nexY+6;
288
+					$tab_top = $nexY + 6;
289 289
 				}
290 290
 				else
291 291
 				{
292
-					$height_note=0;
292
+					$height_note = 0;
293 293
 				}
294 294
 
295 295
 				$iniY = $tab_top + 7;
@@ -297,25 +297,25 @@  discard block
 block discarded – undo
297 297
 				$nexY = $tab_top + 7;
298 298
 
299 299
 				$pdf->SetXY($this->marge_gauche, $tab_top);
300
-				$pdf->MultiCell(190,5,$outputlangs->transnoentities("Description"),0,'L',0);
301
-				$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur-$this->marge_droite, $tab_top + 5);
300
+				$pdf->MultiCell(190, 5, $outputlangs->transnoentities("Description"), 0, 'L', 0);
301
+				$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
302 302
 
303 303
 				$pdf->SetFont('', '', $default_font_size - 1);
304 304
 
305 305
 				$pdf->SetXY($this->marge_gauche, $tab_top + 5);
306
-				$text=$object->description;
306
+				$text = $object->description;
307 307
 				if ($object->duration > 0)
308 308
 				{
309
-				    $totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY);
310
-				    $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime;
309
+				    $totaltime = convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
310
+				    $text .= ($text ? ' - ' : '').$langs->trans("Total").": ".$totaltime;
311 311
 				}
312
-				$desc=dol_htmlentitiesbr($text,1);
312
+				$desc = dol_htmlentitiesbr($text, 1);
313 313
 				//print $outputlangs->convToOutputCharset($desc); exit;
314 314
 
315 315
 				$pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1);
316 316
 				$nexY = $pdf->GetY();
317 317
 
318
-				$pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY);
318
+				$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
319 319
 
320 320
 				$nblines = count($object->lines);
321 321
 
@@ -328,54 +328,54 @@  discard block
 block discarded – undo
328 328
 					if ($valide > 0 || $object->specimen)
329 329
 					{
330 330
 						$curY = $nexY;
331
-						$pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
332
-						$pdf->SetTextColor(0,0,0);
331
+						$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
332
+						$pdf->SetTextColor(0, 0, 0);
333 333
 
334 334
 						$pdf->setTopMargin($tab_top_newpage);
335
-						$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
336
-						$pageposbefore=$pdf->getPage();
335
+						$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
336
+						$pageposbefore = $pdf->getPage();
337 337
 
338 338
 						// Description of product line
339
-						$curX = $this->posxdesc-1;
339
+						$curX = $this->posxdesc - 1;
340 340
 
341 341
 						// Description of product line
342 342
                                                 if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR))
343 343
                                                 {
344
-						        $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true);
344
+						        $txt = $outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'dayhour', false, $outputlangs, true);
345 345
                                                 }
346 346
                                                 else
347 347
                                                 {
348
-                                                        $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'day',false,$outputlangs,true);
348
+                                                        $txt = $outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'day', false, $outputlangs, true);
349 349
                                                 }
350 350
 
351 351
 						if ($objectligne->duration > 0)
352 352
 						{
353
-							$txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration);
353
+							$txt .= " - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration);
354 354
 						}
355
-						$txt='<strong>'.dol_htmlentitiesbr($txt,1,$outputlangs->charset_output).'</strong>';
356
-						$desc=dol_htmlentitiesbr($objectligne->desc,1);
355
+						$txt = '<strong>'.dol_htmlentitiesbr($txt, 1, $outputlangs->charset_output).'</strong>';
356
+						$desc = dol_htmlentitiesbr($objectligne->desc, 1);
357 357
 
358 358
 						$pdf->startTransaction();
359
-						$pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0);
360
-						$pageposafter=$pdf->getPage();
359
+						$pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt, $desc), 0, 1, 0);
360
+						$pageposafter = $pdf->getPage();
361 361
 						if ($pageposafter > $pageposbefore)	// There is a pagebreak
362 362
 						{
363 363
 							$pdf->rollbackTransaction(true);
364
-							$pageposafter=$pageposbefore;
364
+							$pageposafter = $pageposbefore;
365 365
 							//print $pageposafter.'-'.$pageposbefore;exit;
366
-							$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
367
-							$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0);
368
-							$pageposafter=$pdf->getPage();
369
-							$posyafter=$pdf->GetY();
366
+							$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
367
+							$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt, $desc), 0, 1, 0);
368
+							$pageposafter = $pdf->getPage();
369
+							$posyafter = $pdf->GetY();
370 370
 							//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
371
-							if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
371
+							if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// There is no space left for total+free text
372 372
 							{
373
-								if ($i == ($nblines-1))	// No more lines, and no space left to show total, so we create a new page
373
+								if ($i == ($nblines - 1))	// No more lines, and no space left to show total, so we create a new page
374 374
 								{
375
-									$pdf->AddPage('','',true);
376
-									if (! empty($tplidx)) $pdf->useTemplate($tplidx);
375
+									$pdf->AddPage('', '', true);
376
+									if (!empty($tplidx)) $pdf->useTemplate($tplidx);
377 377
 									if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
378
-									$pdf->setPage($pageposafter+1);
378
+									$pdf->setPage($pageposafter + 1);
379 379
 								}
380 380
 							}
381 381
 						}
@@ -385,17 +385,17 @@  discard block
 block discarded – undo
385 385
 						}
386 386
 
387 387
 						$nexY = $pdf->GetY();
388
-						$pageposafter=$pdf->getPage();
388
+						$pageposafter = $pdf->getPage();
389 389
 						$pdf->setPage($pageposbefore);
390 390
 						$pdf->setTopMargin($this->marge_haute);
391
-						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
391
+						$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
392 392
 
393 393
 						// We suppose that a too long description is moved completely on next page
394 394
 						if ($pageposafter > $pageposbefore) {
395 395
 							$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
396 396
 						}
397 397
 
398
-						$pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
398
+						$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
399 399
 
400 400
 						// Detect if some page were added automatically and output _tableau for past pages
401 401
 						while ($pagenb < $pageposafter)
@@ -409,13 +409,13 @@  discard block
 block discarded – undo
409 409
 							{
410 410
 								$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
411 411
 							}
412
-							$this->_pagefoot($pdf,$object,$outputlangs,1);
412
+							$this->_pagefoot($pdf, $object, $outputlangs, 1);
413 413
 							$pagenb++;
414 414
 							$pdf->setPage($pagenb);
415
-							$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
415
+							$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
416 416
 							if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
417 417
 						}
418
-						if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
418
+						if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
419 419
 						{
420 420
 							if ($pagenb == 1)
421 421
 							{
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 							{
426 426
 								$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
427 427
 							}
428
-							$this->_pagefoot($pdf,$object,$outputlangs,1);
428
+							$this->_pagefoot($pdf, $object, $outputlangs, 1);
429 429
 							// New page
430 430
 							$pdf->AddPage();
431
-							if (! empty($tplidx)) $pdf->useTemplate($tplidx);
431
+							if (!empty($tplidx)) $pdf->useTemplate($tplidx);
432 432
 							$pagenb++;
433 433
 							if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
434 434
 						}
@@ -439,27 +439,27 @@  discard block
 block discarded – undo
439 439
 				if ($pagenb == 1)
440 440
 				{
441 441
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
442
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
442
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
443 443
 				}
444 444
 				else
445 445
 				{
446 446
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
447
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
447
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
448 448
 				}
449 449
 
450
-				$this->_pagefoot($pdf,$object,$outputlangs);
451
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
450
+				$this->_pagefoot($pdf, $object, $outputlangs);
451
+				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
452 452
 
453 453
 				$pdf->Close();
454
-				$pdf->Output($file,'F');
454
+				$pdf->Output($file, 'F');
455 455
 
456 456
 				// Add pdfgeneration hook
457 457
 				$hookmanager->initHooks(array('pdfgeneration'));
458
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
458
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
459 459
 				global $action;
460
-				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
460
+				$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
461 461
 
462
-				if (! empty($conf->global->MAIN_UMASK))
462
+				if (!empty($conf->global->MAIN_UMASK))
463 463
 				@chmod($file, octdec($conf->global->MAIN_UMASK));
464 464
 
465 465
 				$this->result = array('fullpath'=>$file);
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 			}
469 469
 			else
470 470
 			{
471
-				$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
471
+				$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
472 472
 				return 0;
473 473
 			}
474 474
 		}
475 475
 		else
476 476
 		{
477
-			$this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR");
477
+			$this->error = $langs->trans("ErrorConstantNotDefined", "FICHEINTER_OUTPUTDIR");
478 478
 			return 0;
479 479
 		}
480 480
 	}
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	 *   @param		int			$hidebottom		Hide bottom bar of array
492 492
 	 *   @return	void
493 493
 	 */
494
-	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
494
+	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
495 495
 	{
496 496
 		global $conf;
497 497
 
@@ -524,21 +524,21 @@  discard block
 block discarded – undo
524 524
 */
525 525
 
526 526
 		// Output Rect
527
-		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+1, 0, 0);	// Rect prend une longueur en 3eme param et 4eme param
527
+		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height + 1, 0, 0); // Rect prend une longueur en 3eme param et 4eme param
528 528
 
529 529
 		if (empty($hidebottom))
530 530
 		{
531
-			$pdf->SetXY(20,230);
532
-			$pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
531
+			$pdf->SetXY(20, 230);
532
+			$pdf->MultiCell(66, 5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"), 0, 'L', 0);
533 533
 
534
-			$pdf->SetXY(20,235);
535
-			$pdf->MultiCell(80,25, '', 1);
534
+			$pdf->SetXY(20, 235);
535
+			$pdf->MultiCell(80, 25, '', 1);
536 536
 
537
-			$pdf->SetXY(110,230);
538
-			$pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
537
+			$pdf->SetXY(110, 230);
538
+			$pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"), 0, 'L', 0);
539 539
 
540
-			$pdf->SetXY(110,235);
541
-			$pdf->MultiCell(80,25, '', 1);
540
+			$pdf->SetXY(110, 235);
541
+			$pdf->MultiCell(80, 25, '', 1);
542 542
 		}
543 543
 	}
544 544
 
@@ -553,129 +553,129 @@  discard block
 block discarded – undo
553 553
 	 */
554 554
 	function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
555 555
 	{
556
-		global $conf,$langs;
556
+		global $conf, $langs;
557 557
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
558 558
 
559 559
 		// Load traductions files requiredby by page
560 560
 		$outputlangs->loadLangs(array("main", "dict", "companies", "interventions"));
561 561
 
562
-		pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
562
+		pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
563 563
 
564 564
 		//Affiche le filigrane brouillon - Print Draft Watermark
565
-		if($object->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) )
565
+		if ($object->statut == 0 && (!empty($conf->global->FICHINTER_DRAFT_WATERMARK)))
566 566
 		{
567
-			pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FICHINTER_DRAFT_WATERMARK);
567
+			pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FICHINTER_DRAFT_WATERMARK);
568 568
 		}
569 569
 
570 570
 		//Prepare la suite
571
-		$pdf->SetTextColor(0,0,60);
572
-		$pdf->SetFont('','B', $default_font_size + 3);
571
+		$pdf->SetTextColor(0, 0, 60);
572
+		$pdf->SetFont('', 'B', $default_font_size + 3);
573 573
 
574
-		$posx=$this->page_largeur-$this->marge_droite-100;
575
-		$posy=$this->marge_haute;
574
+		$posx = $this->page_largeur - $this->marge_droite - 100;
575
+		$posy = $this->marge_haute;
576 576
 
577
-		$pdf->SetXY($this->marge_gauche,$posy);
577
+		$pdf->SetXY($this->marge_gauche, $posy);
578 578
 
579 579
 		// Logo
580
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
580
+		$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
581 581
 		if ($this->emetteur->logo)
582 582
 		{
583 583
 			if (is_readable($logo))
584 584
 			{
585
-			    $height=pdf_getHeightForLogo($logo);
586
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
585
+			    $height = pdf_getHeightForLogo($logo);
586
+			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
587 587
 			}
588 588
 			else
589 589
 			{
590
-				$pdf->SetTextColor(200,0,0);
591
-				$pdf->SetFont('','B',$default_font_size - 2);
592
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
590
+				$pdf->SetTextColor(200, 0, 0);
591
+				$pdf->SetFont('', 'B', $default_font_size - 2);
592
+				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
593 593
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
594 594
 			}
595 595
 		}
596 596
 		else
597 597
 		{
598
-			$text=$this->emetteur->name;
598
+			$text = $this->emetteur->name;
599 599
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
600 600
 		}
601 601
 
602
-		$pdf->SetFont('','B',$default_font_size + 3);
603
-		$pdf->SetXY($posx,$posy);
604
-		$pdf->SetTextColor(0,0,60);
605
-		$title=$outputlangs->transnoentities("InterventionCard");
602
+		$pdf->SetFont('', 'B', $default_font_size + 3);
603
+		$pdf->SetXY($posx, $posy);
604
+		$pdf->SetTextColor(0, 0, 60);
605
+		$title = $outputlangs->transnoentities("InterventionCard");
606 606
 		$pdf->MultiCell(100, 4, $title, '', 'R');
607 607
 
608
-		$pdf->SetFont('','B',$default_font_size + 2);
608
+		$pdf->SetFont('', 'B', $default_font_size + 2);
609 609
 
610
-		$posy+=5;
611
-		$pdf->SetXY($posx,$posy);
612
-		$pdf->SetTextColor(0,0,60);
613
-		$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
610
+		$posy += 5;
611
+		$pdf->SetXY($posx, $posy);
612
+		$pdf->SetTextColor(0, 0, 60);
613
+		$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
614 614
 
615
-		$posy+=1;
616
-		$pdf->SetFont('','', $default_font_size);
615
+		$posy += 1;
616
+		$pdf->SetFont('', '', $default_font_size);
617 617
 
618
-		$posy+=4;
619
-		$pdf->SetXY($posx,$posy);
620
-		$pdf->SetTextColor(0,0,60);
621
-		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R');
618
+		$posy += 4;
619
+		$pdf->SetXY($posx, $posy);
620
+		$pdf->SetTextColor(0, 0, 60);
621
+		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->datec, "day", false, $outputlangs, true), '', 'R');
622 622
 
623 623
 		if ($object->thirdparty->code_client)
624 624
 		{
625
-			$posy+=4;
626
-			$pdf->SetXY($posx,$posy);
627
-			$pdf->SetTextColor(0,0,60);
628
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
625
+			$posy += 4;
626
+			$pdf->SetXY($posx, $posy);
627
+			$pdf->SetTextColor(0, 0, 60);
628
+			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
629 629
 		}
630 630
 
631 631
 		if ($showaddress)
632 632
 		{
633 633
 			// Sender properties
634
-			$carac_emetteur='';
634
+			$carac_emetteur = '';
635 635
 			// Add internal contact of proposal if defined
636
-			$arrayidcontact=$object->getIdContact('internal','INTERREPFOLL');
636
+			$arrayidcontact = $object->getIdContact('internal', 'INTERREPFOLL');
637 637
 			if (count($arrayidcontact) > 0)
638 638
 			{
639 639
 				$object->fetch_user($arrayidcontact[0]);
640
-				$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
640
+				$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
641 641
 			}
642 642
 
643 643
 			$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
644 644
 
645 645
 			// Show sender
646
-			$posy=42;
647
-			$posx=$this->marge_gauche;
648
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
649
-			$hautcadre=40;
646
+			$posy = 42;
647
+			$posx = $this->marge_gauche;
648
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
649
+			$hautcadre = 40;
650 650
 
651 651
 			// Show sender frame
652
-			$pdf->SetTextColor(0,0,0);
653
-			$pdf->SetFont('','', $default_font_size - 2);
654
-			$pdf->SetXY($posx,$posy-5);
655
-			$pdf->SetXY($posx,$posy);
656
-			$pdf->SetFillColor(230,230,230);
652
+			$pdf->SetTextColor(0, 0, 0);
653
+			$pdf->SetFont('', '', $default_font_size - 2);
654
+			$pdf->SetXY($posx, $posy - 5);
655
+			$pdf->SetXY($posx, $posy);
656
+			$pdf->SetFillColor(230, 230, 230);
657 657
 			$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
658 658
 
659 659
 			// Show sender name
660
-			$pdf->SetXY($posx+2,$posy+3);
661
-			$pdf->SetTextColor(0,0,60);
662
-			$pdf->SetFont('','B',$default_font_size);
660
+			$pdf->SetXY($posx + 2, $posy + 3);
661
+			$pdf->SetTextColor(0, 0, 60);
662
+			$pdf->SetFont('', 'B', $default_font_size);
663 663
 			$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
664
-			$posy=$pdf->getY();
664
+			$posy = $pdf->getY();
665 665
 
666 666
 			// Show sender information
667
-			$pdf->SetFont('','', $default_font_size - 1);
668
-			$pdf->SetXY($posx+2,$posy);
667
+			$pdf->SetFont('', '', $default_font_size - 1);
668
+			$pdf->SetXY($posx + 2, $posy);
669 669
 			$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
670 670
 
671 671
 
672 672
 			// If CUSTOMER contact defined, we use it
673
-			$usecontact=false;
674
-			$arrayidcontact=$object->getIdContact('external','CUSTOMER');
673
+			$usecontact = false;
674
+			$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
675 675
 			if (count($arrayidcontact) > 0)
676 676
 			{
677
-				$usecontact=true;
678
-				$result=$object->fetch_contact($arrayidcontact[0]);
677
+				$usecontact = true;
678
+				$result = $object->fetch_contact($arrayidcontact[0]);
679 679
 			}
680 680
 
681 681
 			//Recipient name
@@ -686,34 +686,34 @@  discard block
 block discarded – undo
686 686
 				$thirdparty = $object->thirdparty;
687 687
 			}
688 688
 
689
-			$carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs);
689
+			$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
690 690
 
691
-			$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object);
691
+			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact) ? $object->contact : ''), $usecontact, 'target', $object);
692 692
 
693 693
 			// Show recipient
694
-			$widthrecbox=100;
695
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
696
-			$posy=42;
697
-			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
698
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
694
+			$widthrecbox = 100;
695
+			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
696
+			$posy = 42;
697
+			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
698
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
699 699
 
700 700
 			// Show recipient frame
701
-			$pdf->SetTextColor(0,0,0);
702
-			$pdf->SetFont('','', $default_font_size - 2);
703
-			$pdf->SetXY($posx+2,$posy-5);
701
+			$pdf->SetTextColor(0, 0, 0);
702
+			$pdf->SetFont('', '', $default_font_size - 2);
703
+			$pdf->SetXY($posx + 2, $posy - 5);
704 704
 			$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
705
-			$pdf->SetTextColor(0,0,0);
705
+			$pdf->SetTextColor(0, 0, 0);
706 706
 
707 707
 			// Show recipient name
708
-			$pdf->SetXY($posx+2,$posy+3);
709
-			$pdf->SetFont('','B', $default_font_size);
708
+			$pdf->SetXY($posx + 2, $posy + 3);
709
+			$pdf->SetFont('', 'B', $default_font_size);
710 710
 			$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
711 711
 
712 712
 			$posy = $pdf->getY();
713 713
 
714 714
 			// Show recipient information
715
-			$pdf->SetFont('','', $default_font_size - 1);
716
-			$pdf->SetXY($posx+2,$posy);
715
+			$pdf->SetFont('', '', $default_font_size - 1);
716
+			$pdf->SetXY($posx + 2, $posy);
717 717
 			$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
718 718
 		}
719 719
 	}
@@ -727,10 +727,10 @@  discard block
 block discarded – undo
727 727
 	 *      @param	int			$hidefreetext		1=Hide free text
728 728
 	 *      @return	integer
729 729
 	 */
730
-	function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
730
+	function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
731 731
 	{
732 732
 		global $conf;
733
-		$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
734
-		return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
733
+		$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
734
+		return pdf_pagefoot($pdf, $outputlangs, 'FICHINTER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
735 735
 	}
736 736
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/fichinter/mod_pacific.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *  \ingroup    fiche intervention
24 24
  *  \brief      File with Pacific numbering module for interventions
25 25
  */
26
-require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php';
26
+require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
27 27
 
28 28
 /**
29 29
  *	Class to manage numbering of intervention cards with rule Pacific.
@@ -34,26 +34,26 @@  discard block
 block discarded – undo
34 34
      * Dolibarr version of the loaded document
35 35
      * @public string
36 36
      */
37
-	public $version = 'dolibarr';        // 'development', 'experimental', 'dolibarr'
37
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
38 38
 
39
-	public $prefix='FI';
39
+	public $prefix = 'FI';
40 40
 
41 41
 	/**
42 42
 	 * @var string Error code (or message)
43 43
 	 */
44
-	public $error='';
44
+	public $error = '';
45 45
 
46 46
 	/**
47 47
 	 * @var string Nom du modele
48 48
 	 * @deprecated
49 49
 	 * @see name
50 50
 	 */
51
-	public $nom='pacific';
51
+	public $nom = 'pacific';
52 52
 
53 53
 	/**
54 54
 	 * @var string model name
55 55
 	 */
56
-	public $name='pacific';
56
+	public $name = 'pacific';
57 57
 
58 58
 
59 59
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     function info()
65 65
     {
66 66
     	global $langs;
67
-      	return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
67
+      	return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
68 68
     }
69 69
 
70 70
 	/**
@@ -85,32 +85,32 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	function canBeActivated()
87 87
 	{
88
-		global $langs,$conf,$db;
88
+		global $langs, $conf, $db;
89 89
 
90 90
 		$langs->load("bills");
91 91
 
92
-		$fayymm=''; $max='';
92
+		$fayymm = ''; $max = '';
93 93
 
94
-		$posindice=8;
94
+		$posindice = 8;
95 95
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
96
-		$sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
97
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
98
-		$sql.= " WHERE entity = ".$conf->entity;
96
+		$sql .= " FROM ".MAIN_DB_PREFIX."fichinter";
97
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
98
+		$sql .= " WHERE entity = ".$conf->entity;
99 99
 
100
-		$resql=$db->query($sql);
100
+		$resql = $db->query($sql);
101 101
 		if ($resql)
102 102
 		{
103 103
 			$row = $db->fetch_row($resql);
104
-			if ($row) { $fayymm = substr($row[0],0,6); $max=$row[0]; }
104
+			if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; }
105 105
 		}
106
-		if (! $fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm))
106
+		if (!$fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm))
107 107
 		{
108 108
 			return true;
109 109
 		}
110 110
 		else
111 111
 		{
112 112
 			$langs->load("errors");
113
-			$this->error=$langs->trans('ErrorNumRefModel',$max);
113
+			$this->error = $langs->trans('ErrorNumRefModel', $max);
114 114
 			return false;
115 115
 		}
116 116
 	}
@@ -122,31 +122,31 @@  discard block
 block discarded – undo
122 122
 	 *  @param  Object		$object		Object we need next value for
123 123
 	 *  @return string      			Value if KO, <0 if KO
124 124
 	 */
125
-	function getNextValue($objsoc=0,$object='')
125
+	function getNextValue($objsoc = 0, $object = '')
126 126
 	{
127
-		global $db,$conf;
127
+		global $db, $conf;
128 128
 
129 129
 		// D'abord on recupere la valeur max
130
-		$posindice=8;
130
+		$posindice = 8;
131 131
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
132
-		$sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
133
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
134
-		$sql.= " AND entity = ".$conf->entity;
132
+		$sql .= " FROM ".MAIN_DB_PREFIX."fichinter";
133
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
134
+		$sql .= " AND entity = ".$conf->entity;
135 135
 
136
-		$resql=$db->query($sql);
136
+		$resql = $db->query($sql);
137 137
 		if ($resql)
138 138
 		{
139 139
 			$obj = $db->fetch_object($resql);
140 140
 			if ($obj) $max = intval($obj->max);
141
-			else $max=0;
141
+			else $max = 0;
142 142
 		}
143 143
 
144 144
 		//$date=time();
145
-		$date=$object->datec;
146
-		$yymm = strftime("%y%m",$date);
145
+		$date = $object->datec;
146
+		$yymm = strftime("%y%m", $date);
147 147
 
148
-    	if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
149
-    	else $num = sprintf("%04s",$max+1);
148
+    	if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
149
+    	else $num = sprintf("%04s", $max + 1);
150 150
 
151 151
 		return $this->prefix.$yymm."-".$num;
152 152
 	}
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * 	@param	Object	$objforref	Object for number to search
159 159
 	 *  @return string      		Next free value
160 160
 	 */
161
-	function getNumRef($objsoc,$objforref)
161
+	function getNumRef($objsoc, $objforref)
162 162
 	{
163
-		return $this->getNextValue($objsoc,$objforref);
163
+		return $this->getNextValue($objsoc, $objforref);
164 164
 	}
165 165
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/fichinter/modules_fichinter.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @var string Error code (or message)
39 39
 	 */
40
-	public $error='';
40
+	public $error = '';
41 41
 
42 42
 
43 43
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
      *  @param  integer	$maxfilenamelength  Max length of value to show
49 49
      *  @return	array						List of templates
50 50
 	 */
51
-	static function liste_modeles($db,$maxfilenamelength=0)
51
+	static function liste_modeles($db, $maxfilenamelength = 0)
52 52
 	{
53 53
         // phpcs:enable
54 54
 		global $conf;
55 55
 
56
-		$type='ficheinter';
57
-		$liste=array();
56
+		$type = 'ficheinter';
57
+		$liste = array();
58 58
 
59 59
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
60
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
60
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
61 61
 
62 62
 		return $liste;
63 63
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	/**
73 73
 	 * @var string Error code (or message)
74 74
 	 */
75
-	public $error='';
75
+	public $error = '';
76 76
 
77 77
 	/**
78 78
 	 * 	Return if a module can be used or not
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
  *  @param  int			$hideref        Hide ref
163 163
  *  @return int         				0 if KO, 1 if OK
164 164
  */
165
-function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
165
+function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
166 166
 {
167 167
     // phpcs:enable
168
-	global $conf,$langs,$user;
168
+	global $conf, $langs, $user;
169 169
 	$langs->load("ficheinter");
170 170
 
171
-	$error=0;
171
+	$error = 0;
172 172
 
173
-	$srctemplatepath='';
173
+	$srctemplatepath = '';
174 174
 
175 175
 	// Positionne modele sur le nom du modele de fichinter a utiliser
176
-	if (! dol_strlen($modele))
176
+	if (!dol_strlen($modele))
177 177
 	{
178
-		if (! empty($conf->global->FICHEINTER_ADDON_PDF))
178
+		if (!empty($conf->global->FICHEINTER_ADDON_PDF))
179 179
 		{
180 180
 			$modele = $conf->global->FICHEINTER_ADDON_PDF;
181 181
 		}
@@ -186,29 +186,29 @@  discard block
 block discarded – undo
186 186
 	}
187 187
 
188 188
 	// If selected modele is a filename template (then $modele="modelname:filename")
189
-	$tmp=explode(':',$modele,2);
190
-    if (! empty($tmp[1]))
189
+	$tmp = explode(':', $modele, 2);
190
+    if (!empty($tmp[1]))
191 191
     {
192
-        $modele=$tmp[0];
193
-        $srctemplatepath=$tmp[1];
192
+        $modele = $tmp[0];
193
+        $srctemplatepath = $tmp[1];
194 194
     }
195 195
 
196 196
 	// Search template files
197
-	$file=''; $classname=''; $filefound=0;
198
-	$dirmodels=array('/');
199
-	if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
200
-	foreach($dirmodels as $reldir)
197
+	$file = ''; $classname = ''; $filefound = 0;
198
+	$dirmodels = array('/');
199
+	if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
200
+	foreach ($dirmodels as $reldir)
201 201
 	{
202
-    	foreach(array('doc','pdf') as $prefix)
202
+    	foreach (array('doc', 'pdf') as $prefix)
203 203
     	{
204 204
     	    $file = $prefix."_".$modele.".modules.php";
205 205
 
206 206
     		// On verifie l'emplacement du modele
207
-	        $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file,0);
207
+	        $file = dol_buildpath($reldir."core/modules/fichinter/doc/".$file, 0);
208 208
     		if (file_exists($file))
209 209
     		{
210
-    			$filefound=1;
211
-    			$classname=$prefix.'_'.$modele;
210
+    			$filefound = 1;
211
+    			$classname = $prefix.'_'.$modele;
212 212
     			break;
213 213
     		}
214 214
     	}
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 
225 225
 		// We save charset_output to restore it because write_file can change it if needed for
226 226
 		// output format that does not support UTF8.
227
-		$sav_charset_output=$outputlangs->charset_output;
227
+		$sav_charset_output = $outputlangs->charset_output;
228 228
 		if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
229 229
 		{
230
-			$outputlangs->charset_output=$sav_charset_output;
230
+			$outputlangs->charset_output = $sav_charset_output;
231 231
 
232 232
 			// We delete old preview
233 233
 			require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 		}
238 238
 		else
239 239
 		{
240
-			$outputlangs->charset_output=$sav_charset_output;
241
-			dol_print_error($db,"fichinter_pdf_create Error: ".$obj->error);
240
+			$outputlangs->charset_output = $sav_charset_output;
241
+			dol_print_error($db, "fichinter_pdf_create Error: ".$obj->error);
242 242
 			return 0;
243 243
 		}
244 244
 	}
245 245
 	else
246 246
 	{
247
-		print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
247
+		print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file);
248 248
 		return 0;
249 249
 	}
250 250
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/fichinter/mod_arctic.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *	\ingroup    fiche intervention
26 26
  *	\brief      File with Arctic numbering module for interventions
27 27
  */
28
-require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php';
28
+require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
29 29
 
30 30
 /**
31 31
  *	Class to manage numbering of intervention cards with rule Artic.
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * Dolibarr version of the loaded document
37 37
      * @public string
38 38
      */
39
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
39
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
40 40
 
41 41
 	/**
42 42
 	 * @var string Error message
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 	 * @deprecated
49 49
 	 * @see name
50 50
 	 */
51
-	public $nom='arctic';
51
+	public $nom = 'arctic';
52 52
 
53 53
 	/**
54 54
 	 * @var string model name
55 55
 	 */
56
-	public $name='arctic';
56
+	public $name = 'arctic';
57 57
 
58 58
 
59 59
 	/**
@@ -70,28 +70,28 @@  discard block
 block discarded – undo
70 70
 		$form = new Form($this->db);
71 71
 
72 72
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
73
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
74
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
75
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
76
-		$texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
77
-		$texte.= '<table class="nobordernopadding" width="100%">';
78
-
79
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
80
-		$tooltip.=$langs->trans("GenericMaskCodes2");
81
-		$tooltip.=$langs->trans("GenericMaskCodes3");
82
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
83
-		$tooltip.=$langs->trans("GenericMaskCodes5");
73
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
74
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
75
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
76
+		$texte .= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
77
+		$texte .= '<table class="nobordernopadding" width="100%">';
78
+
79
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
80
+		$tooltip .= $langs->trans("GenericMaskCodes2");
81
+		$tooltip .= $langs->trans("GenericMaskCodes3");
82
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
83
+		$tooltip .= $langs->trans("GenericMaskCodes5");
84 84
 
85 85
 		// Parametrage du prefix
86
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
87
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>';
86
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
87
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">', $tooltip, 1, 1).'</td>';
88 88
 
89
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
89
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
90 90
 
91
-		$texte.= '</tr>';
91
+		$texte .= '</tr>';
92 92
 
93
-		$texte.= '</table>';
94
-		$texte.= '</form>';
93
+		$texte .= '</table>';
94
+		$texte .= '</form>';
95 95
 
96 96
 		return $texte;
97 97
     }
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
      */
104 104
     function getExample()
105 105
     {
106
-     	global $conf,$langs,$mysoc;
106
+     	global $conf, $langs, $mysoc;
107 107
 
108
-    	$old_code_client=$mysoc->code_client;
109
-    	$mysoc->code_client='CCCCCCCCCC';
110
-     	$numExample = $this->getNextValue($mysoc,'');
111
-		$mysoc->code_client=$old_code_client;
108
+    	$old_code_client = $mysoc->code_client;
109
+    	$mysoc->code_client = 'CCCCCCCCCC';
110
+     	$numExample = $this->getNextValue($mysoc, '');
111
+		$mysoc->code_client = $old_code_client;
112 112
 
113
-		if (! $numExample)
113
+		if (!$numExample)
114 114
 		{
115 115
 			$numExample = $langs->trans('NotConfigured');
116 116
 		}
@@ -124,22 +124,22 @@  discard block
 block discarded – undo
124 124
 	 *  @param  Object		$object		Object we need next value for
125 125
 	 *  @return string      			Value if KO, <0 if KO
126 126
 	 */
127
-    function getNextValue($objsoc=0,$object='')
127
+    function getNextValue($objsoc = 0, $object = '')
128 128
     {
129
-		global $db,$conf;
129
+		global $db, $conf;
130 130
 
131
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
131
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
132 132
 
133 133
 		// On d�fini critere recherche compteur
134
-		$mask=$conf->global->FICHINTER_ARTIC_MASK;
134
+		$mask = $conf->global->FICHINTER_ARTIC_MASK;
135 135
 
136
-		if (! $mask)
136
+		if (!$mask)
137 137
 		{
138
-			$this->error='NotConfigured';
138
+			$this->error = 'NotConfigured';
139 139
 			return 0;
140 140
 		}
141 141
 
142
-		$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec);
142
+		$numFinal = get_next_value($db, $mask, 'fichinter', 'ref', '', $objsoc, $object->datec);
143 143
 
144 144
 		return  $numFinal;
145 145
   }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 * 	@param	Object		$objforref	Object for number to search
153 153
      *  @return string      			Next free value
154 154
      */
155
-    function getNumRef($objsoc,$objforref)
155
+    function getNumRef($objsoc, $objforref)
156 156
     {
157
-        return $this->getNextValue($objsoc,$objforref);
157
+        return $this->getNextValue($objsoc, $objforref);
158 158
     }
159 159
 }
160 160
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modExternalSite.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * \brief      Description and activation file for module ExternalSite
26 26
  */
27 27
 
28
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
28
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29 29
 
30 30
 
31 31
 /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		// It is used to sort modules in module setup page
52 52
 		$this->family = "interface";
53 53
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
54
-		$this->name = preg_replace('/^mod/i','',get_class($this));
54
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
55 55
 		// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
56 56
 		$this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame.";
57 57
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
60 60
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
61 61
 		// Name of png file (without png) used for this module
62
-		$this->picto='bookmark';
62
+		$this->picto = 'bookmark';
63 63
 		// Call to inside lang's file
64 64
 		$this->langfiles = array("externalsite");
65 65
 
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
 		$this->config_page_url = array("externalsite.php@externalsite");
71 71
 
72 72
 		// Dependencies
73
-		$this->depends = array();		// List of modules id that must be enabled if this module is enabled
74
-		$this->requiredby = array();	// List of modules id to disable if this one is disabled
73
+		$this->depends = array(); // List of modules id that must be enabled if this module is enabled
74
+		$this->requiredby = array(); // List of modules id to disable if this one is disabled
75 75
 
76 76
 		// Constants
77 77
 		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
78 78
 		// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
79 79
 		//                             1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0)
80 80
 		// );
81
-		$this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0));
81
+		$this->const = array(0=>array('EXTERNALSITE_LABEL', 'chaine', 'ExternalSite', 'To declare label to use into external site menu entry', 0));
82 82
 
83 83
 		// Boxes
84
-		$this->boxes = array();			// List of boxes
85
-		$r=0;
84
+		$this->boxes = array(); // List of boxes
85
+		$r = 0;
86 86
 
87 87
 		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
88 88
 		// Example:
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
     	//$r++;
93 93
 
94 94
 		// Permissions
95
-		$this->rights_class = 'externalsite';	// Permission key
96
-		$this->rights = array();		// Permission array used by this module
95
+		$this->rights_class = 'externalsite'; // Permission key
96
+		$this->rights = array(); // Permission array used by this module
97 97
 
98 98
         // Menus
99 99
 		//------
100
-		$r=0;
100
+		$r = 0;
101 101
 
102
-		$this->menu[$r]=array(
102
+		$this->menu[$r] = array(
103 103
 			'fk_menu'=>0,
104 104
 			'type'=>'top',
105 105
 			'titre'=>'__[EXTERNALSITE_LABEL]__',
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/livraison/mod_livraison_jade.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *   \brief      Fichier contenant la classe du modele de numerotation de reference de bon de livraison Jade
25 25
  */
26 26
 
27
-require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/modules_livraison.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php';
28 28
 
29 29
 
30 30
 /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * Dolibarr version of the loaded document
39 39
      * @public string
40 40
      */
41
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
41
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
42 42
 
43 43
 	/**
44 44
 	 * @var string Error message
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	 * @deprecated
51 51
 	 * @see name
52 52
 	 */
53
-	public $nom='Jade';
53
+	public $nom = 'Jade';
54 54
 
55 55
 	/**
56 56
 	 * @var string model name
57 57
 	 */
58
-	public $name='Jade';
58
+	public $name = 'Jade';
59 59
 
60
-    public $prefix='BL';
60
+    public $prefix = 'BL';
61 61
 
62 62
 
63 63
 	/**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	function info()
69 69
 	{
70 70
 		global $langs;
71
-		return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
71
+		return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
72 72
 	}
73 73
 
74 74
 	/**
@@ -89,29 +89,29 @@  discard block
 block discarded – undo
89 89
      */
90 90
     function canBeActivated()
91 91
     {
92
-        global $langs,$conf,$db;
92
+        global $langs, $conf, $db;
93 93
 
94 94
         $langs->load("bills");
95 95
 
96 96
         // Check invoice num
97
-        $fayymm=''; $max='';
97
+        $fayymm = ''; $max = '';
98 98
 
99
-        $posindice=8;
100
-        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";   // This is standard SQL
101
-        $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
102
-        $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
103
-        $sql.= " AND entity = ".$conf->entity;
99
+        $posindice = 8;
100
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
101
+        $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
102
+        $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
103
+        $sql .= " AND entity = ".$conf->entity;
104 104
 
105
-        $resql=$db->query($sql);
105
+        $resql = $db->query($sql);
106 106
         if ($resql)
107 107
         {
108 108
             $row = $db->fetch_row($resql);
109
-            if ($row) { $fayymm = substr($row[0],0,6); $max=$row[0]; }
109
+            if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; }
110 110
         }
111
-        if ($fayymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm))
111
+        if ($fayymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm))
112 112
         {
113 113
             $langs->load("errors");
114
-            $this->error=$langs->trans('ErrorNumRefModel',$max);
114
+            $this->error = $langs->trans('ErrorNumRefModel', $max);
115 115
             return false;
116 116
         }
117 117
 
@@ -125,36 +125,36 @@  discard block
 block discarded – undo
125 125
 	 *  @param  Object		$object		Object we need next value for
126 126
 	 *  @return string      			Value if KO, <0 if KO
127 127
 	 */
128
-    function getNextValue($objsoc,$object)
128
+    function getNextValue($objsoc, $object)
129 129
     {
130
-        global $db,$conf;
130
+        global $db, $conf;
131 131
 
132 132
         // D'abord on recupere la valeur max
133
-        $posindice=8;
134
-        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";   // This is standard SQL
135
-        $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
136
-        $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
137
-        $sql.= " AND entity = ".$conf->entity;
133
+        $posindice = 8;
134
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
135
+        $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
136
+        $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
137
+        $sql .= " AND entity = ".$conf->entity;
138 138
 
139
-        $resql=$db->query($sql);
139
+        $resql = $db->query($sql);
140 140
         dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG);
141 141
         if ($resql)
142 142
         {
143 143
             $obj = $db->fetch_object($resql);
144 144
             if ($obj) $max = intval($obj->max);
145
-            else $max=0;
145
+            else $max = 0;
146 146
         }
147 147
         else
148 148
         {
149 149
             return -1;
150 150
         }
151 151
 
152
-        $date=$object->date_delivery;
153
-        if (empty($date)) $date=dol_now();
154
-        $yymm = strftime("%y%m",$date);
152
+        $date = $object->date_delivery;
153
+        if (empty($date)) $date = dol_now();
154
+        $yymm = strftime("%y%m", $date);
155 155
 
156
-        if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
157
-        else $num = sprintf("%04s",$max+1);
156
+        if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
157
+        else $num = sprintf("%04s", $max + 1);
158 158
 
159 159
         dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
160 160
         return $this->prefix.$yymm."-".$num;
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
      *  @param  Object		$object			Object livraison
170 170
      *  @return string      				Texte descriptif
171 171
      */
172
-    function livraison_get_num($objsoc=0,$object='')
172
+    function livraison_get_num($objsoc = 0, $object = '')
173 173
     {
174 174
         // phpcs:enable
175
-        return $this->getNextValue($objsoc,$object);
175
+        return $this->getNextValue($objsoc, $object);
176 176
     }
177 177
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php 1 patch
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	function __construct($db)
121 121
 	{
122
-		global $conf,$langs,$mysoc;
122
+		global $conf, $langs, $mysoc;
123 123
 
124 124
 		// Translations
125 125
 		$langs->loadLangs(array("main", "bills", "sendings", "companies"));
@@ -130,47 +130,47 @@  discard block
 block discarded – undo
130 130
 
131 131
 		// Dimension page pour format A4
132 132
 		$this->type = 'pdf';
133
-		$formatarray=pdf_getFormat();
133
+		$formatarray = pdf_getFormat();
134 134
 		$this->page_largeur = $formatarray['width'];
135 135
 		$this->page_hauteur = $formatarray['height'];
136
-		$this->format = array($this->page_largeur,$this->page_hauteur);
137
-		$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
138
-		$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
139
-		$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
140
-		$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
136
+		$this->format = array($this->page_largeur, $this->page_hauteur);
137
+		$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
138
+		$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
139
+		$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
140
+		$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
141 141
 
142
-		$this->option_logo = 1;                    // Affiche logo FAC_PDF_LOGO
143
-		$this->option_tva = 1;                     // Gere option tva FACTURE_TVAOPTION
144
-		$this->option_codeproduitservice = 1;      // Affiche code produit-service
142
+		$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
143
+		$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
144
+		$this->option_codeproduitservice = 1; // Affiche code produit-service
145 145
 
146
-		$this->franchise=!$mysoc->tva_assuj;
146
+		$this->franchise = !$mysoc->tva_assuj;
147 147
 
148 148
 		// Get source company
149
-		$this->emetteur=$mysoc;
150
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
149
+		$this->emetteur = $mysoc;
150
+		if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
151 151
 
152 152
 		// Define position of columns
153
-		$this->posxdesc=$this->marge_gauche+1;
154
-		$this->posxcomm=112;
153
+		$this->posxdesc = $this->marge_gauche + 1;
154
+		$this->posxcomm = 112;
155 155
 		//$this->posxtva=112;
156 156
 		//$this->posxup=126;
157
-		$this->posxqty=165;
158
-		$this->posxremainingqty=185;
157
+		$this->posxqty = 165;
158
+		$this->posxremainingqty = 185;
159 159
 		//$this->posxdiscount=162;
160 160
 		//$this->postotalht=174;
161 161
 		if ($this->page_largeur < 210) // To work with US executive format
162 162
 		{
163
-			$this->posxcomm-=20;
163
+			$this->posxcomm -= 20;
164 164
 			//$this->posxtva-=20;
165 165
 			//$this->posxup-=20;
166
-			$this->posxqty-=20;
166
+			$this->posxqty -= 20;
167 167
 			//$this->posxdiscount-=20;
168 168
 			//$this->postotalht-=20;
169 169
 		}
170 170
 
171
-		$this->tva=array();
172
-		$this->atleastoneratenotnull=0;
173
-		$this->atleastonediscount=0;
171
+		$this->tva = array();
172
+		$this->atleastoneratenotnull = 0;
173
+		$this->atleastonediscount = 0;
174 174
 	}
175 175
 
176 176
 
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
      *  @param		int			$hideref			Do not show ref
187 187
      *  @return     int             			1=OK, 0=KO
188 188
      */
189
-	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
189
+	function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
190 190
 	{
191 191
         // phpcs:enable
192
-		global $user,$langs,$conf,$mysoc,$hookmanager;
192
+		global $user, $langs, $conf, $mysoc, $hookmanager;
193 193
 
194
-		if (! is_object($outputlangs)) $outputlangs=$langs;
194
+		if (!is_object($outputlangs)) $outputlangs = $langs;
195 195
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
196
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
196
+		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
197 197
 
198 198
 		// Load translation files required by the page
199 199
 		$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries"));
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 			if ($object->specimen)
207 207
 			{
208 208
 				$dir = $conf->expedition->dir_output."/receipt";
209
-				$file = $dir . "/SPECIMEN.pdf";
209
+				$file = $dir."/SPECIMEN.pdf";
210 210
 			}
211 211
 			else
212 212
 			{
213 213
 				$objectref = dol_sanitizeFileName($object->ref);
214
-				$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
215
-				$file = $dir . "/" . $objectref . ".pdf";
214
+				$dir = $conf->expedition->dir_output."/receipt/".$objectref;
215
+				$file = $dir."/".$objectref.".pdf";
216 216
 			}
217 217
 
218
-			if (! file_exists($dir))
218
+			if (!file_exists($dir))
219 219
 			{
220 220
 				if (dol_mkdir($dir) < 0)
221 221
 				{
222
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
222
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
223 223
 					return 0;
224 224
 				}
225 225
 			}
@@ -227,26 +227,26 @@  discard block
 block discarded – undo
227 227
 			if (file_exists($dir))
228 228
 			{
229 229
 				// Add pdfgeneration hook
230
-				if (! is_object($hookmanager))
230
+				if (!is_object($hookmanager))
231 231
 				{
232 232
 					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
233
-					$hookmanager=new HookManager($this->db);
233
+					$hookmanager = new HookManager($this->db);
234 234
 				}
235 235
 				$hookmanager->initHooks(array('pdfgeneration'));
236
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
236
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
237 237
 				global $action;
238
-				$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
238
+				$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
239 239
 
240 240
 				$nblines = count($object->lines);
241 241
 
242 242
 				// Create pdf instance
243
-				$pdf=pdf_getInstance($this->format);
244
-                $default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
245
-                $heightforinfotot = 30;	// Height reserved to output the info and total part
246
-		        $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
247
-	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
248
-	            if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
249
-                $pdf->SetAutoPageBreak(1,0);
243
+				$pdf = pdf_getInstance($this->format);
244
+                $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
245
+                $heightforinfotot = 30; // Height reserved to output the info and total part
246
+		        $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
247
+	            $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
248
+	            if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
249
+                $pdf->SetAutoPageBreak(1, 0);
250 250
 
251 251
                 if (class_exists('TCPDF'))
252 252
                 {
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
                 }
256 256
                 $pdf->SetFont(pdf_getPDFFont($outputlangs));
257 257
                 // Set path to the background PDF File
258
-                if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
258
+                if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
259 259
                 {
260 260
                     $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
261 261
                     $tplidx = $pdf->importPage(1);
262 262
                 }
263 263
 
264 264
 				// We get the shipment that is the origin of delivery receipt
265
-				$expedition=new Expedition($this->db);
265
+				$expedition = new Expedition($this->db);
266 266
 				$result = $expedition->fetch($object->origin_id);
267 267
 				// Now we get the order that is origin of shipment
268 268
 				$commande = new Commande($this->db);
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
 				{
271 271
 					$commande->fetch($expedition->origin_id);
272 272
 				}
273
-				$object->commande=$commande;	// We set order of shipment onto delivery.
273
+				$object->commande = $commande; // We set order of shipment onto delivery.
274 274
 				$object->commande->loadExpeditions();
275 275
 
276 276
 
277 277
 				$pdf->Open();
278
-				$pagenb=0;
279
-				$pdf->SetDrawColor(128,128,128);
278
+				$pagenb = 0;
279
+				$pdf->SetDrawColor(128, 128, 128);
280 280
 
281 281
 				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
282 282
 				$pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
283 283
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
284 284
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
285 285
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
286
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
286
+				if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
287 287
 
288
-				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
288
+				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
289 289
 
290 290
 				/*
291 291
 				// Positionne $this->atleastonediscount si on a au moins une remise
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
 
310 310
 				// New page
311 311
 				$pdf->AddPage();
312
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
312
+				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
313 313
 				$pagenb++;
314 314
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
315
-				$pdf->SetFont('','', $default_font_size - 1);
316
-				$pdf->MultiCell(0, 3, '');		// Set interline to 3
317
-				$pdf->SetTextColor(0,0,0);
315
+				$pdf->SetFont('', '', $default_font_size - 1);
316
+				$pdf->MultiCell(0, 3, ''); // Set interline to 3
317
+				$pdf->SetTextColor(0, 0, 0);
318 318
 
319 319
 				$tab_top = 90;
320
-				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
320
+				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
321 321
 				$tab_height = 130;
322 322
 				$tab_height_newpage = 150;
323 323
 
@@ -330,40 +330,40 @@  discard block
 block discarded – undo
330 330
 					{
331 331
 						$tab_top = 88;
332 332
 
333
-						$pdf->SetFont('','', $default_font_size - 1);
334
-						$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
333
+						$pdf->SetFont('', '', $default_font_size - 1);
334
+						$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
335 335
 						$nexY = $pdf->GetY();
336
-						$height_incoterms=$nexY-$tab_top;
336
+						$height_incoterms = $nexY - $tab_top;
337 337
 
338 338
 						// Rect prend une longueur en 3eme param
339
-						$pdf->SetDrawColor(192,192,192);
340
-						$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
339
+						$pdf->SetDrawColor(192, 192, 192);
340
+						$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
341 341
 
342
-						$tab_top = $nexY+6;
342
+						$tab_top = $nexY + 6;
343 343
 						$height_incoterms += 4;
344 344
 					}
345 345
 				}
346 346
 
347 347
 				// Affiche notes
348
-				if (! empty($object->note_public))
348
+				if (!empty($object->note_public))
349 349
 				{
350 350
 					$tab_top = 88 + $height_incoterms;
351 351
 
352
-					$pdf->SetFont('','', $default_font_size - 1);
353
-					$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
352
+					$pdf->SetFont('', '', $default_font_size - 1);
353
+					$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
354 354
 					$nexY = $pdf->GetY();
355
-					$height_note=$nexY-$tab_top;
355
+					$height_note = $nexY - $tab_top;
356 356
 
357 357
 					// Rect prend une longueur en 3eme param
358
-					$pdf->SetDrawColor(192,192,192);
359
-					$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
358
+					$pdf->SetDrawColor(192, 192, 192);
359
+					$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
360 360
 
361 361
 					$tab_height = $tab_height - $height_note;
362
-					$tab_top = $nexY+6;
362
+					$tab_top = $nexY + 6;
363 363
 				}
364 364
 				else
365 365
 				{
366
-					$height_note=0;
366
+					$height_note = 0;
367 367
 				}
368 368
 
369 369
 				$iniY = $tab_top + 11;
@@ -371,46 +371,46 @@  discard block
 block discarded – undo
371 371
 				$nexY = $tab_top + 11;
372 372
 
373 373
 				// Loop on each lines
374
-				for ($i = 0 ; $i < $nblines ; $i++)
374
+				for ($i = 0; $i < $nblines; $i++)
375 375
 				{
376 376
 					$curY = $nexY;
377
-					$pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
378
-					$pdf->SetTextColor(0,0,0);
377
+					$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
378
+					$pdf->SetTextColor(0, 0, 0);
379 379
 
380 380
 					$pdf->setTopMargin($tab_top_newpage);
381
-					$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
382
-					$pageposbefore=$pdf->getPage();
381
+					$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
382
+					$pageposbefore = $pdf->getPage();
383 383
 
384 384
 					// Description of product line
385
-					$curX = $this->posxdesc-1;
385
+					$curX = $this->posxdesc - 1;
386 386
 
387
-                    $showpricebeforepagebreak=1;
387
+                    $showpricebeforepagebreak = 1;
388 388
 
389 389
                     $pdf->startTransaction();
390
-                    pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc);
391
-                    $pageposafter=$pdf->getPage();
390
+                    pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm - $curX, 3, $curX, $curY, $hideref, $hidedesc);
391
+                    $pageposafter = $pdf->getPage();
392 392
                     if ($pageposafter > $pageposbefore)	// There is a pagebreak
393 393
                     {
394 394
                     	$pdf->rollbackTransaction(true);
395
-                    	$pageposafter=$pageposbefore;
395
+                    	$pageposafter = $pageposbefore;
396 396
                     	//print $pageposafter.'-'.$pageposbefore;exit;
397
-                    	$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
398
-                    	pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc);
399
-                    	$posyafter=$pdf->GetY();
400
-                    	if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
397
+                    	$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
398
+                    	pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm - $curX, 4, $curX, $curY, $hideref, $hidedesc);
399
+                    	$posyafter = $pdf->GetY();
400
+                    	if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// There is no space left for total+free text
401 401
                     	{
402
-                    		if ($i == ($nblines-1))	// No more lines, and no space left to show total, so we create a new page
402
+                    		if ($i == ($nblines - 1))	// No more lines, and no space left to show total, so we create a new page
403 403
                     		{
404
-                    			$pdf->AddPage('','',true);
405
-                    			if (! empty($tplidx)) $pdf->useTemplate($tplidx);
404
+                    			$pdf->AddPage('', '', true);
405
+                    			if (!empty($tplidx)) $pdf->useTemplate($tplidx);
406 406
                     			if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
407
-                    			$pdf->setPage($pageposafter+1);
407
+                    			$pdf->setPage($pageposafter + 1);
408 408
                     		}
409 409
                     	}
410 410
                     	else
411 411
                     	{
412 412
                     		// We found a page break
413
-                    		$showpricebeforepagebreak=0;
413
+                    		$showpricebeforepagebreak = 0;
414 414
                     	}
415 415
                     }
416 416
                     else	// No pagebreak
@@ -419,17 +419,17 @@  discard block
 block discarded – undo
419 419
                     }
420 420
 
421 421
 					$nexY = $pdf->GetY();
422
-                    $pageposafter=$pdf->getPage();
422
+                    $pageposafter = $pdf->getPage();
423 423
 					$pdf->setPage($pageposbefore);
424 424
 					$pdf->setTopMargin($this->marge_haute);
425
-					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
425
+					$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
426 426
 
427 427
 					// We suppose that a too long description is moved completely on next page
428 428
 					if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
429 429
 						$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
430 430
 					}
431 431
 
432
-					$pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
432
+					$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
433 433
 
434 434
 					/*
435 435
 					 // TVA
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 					// Remaining to ship
449 449
 					$pdf->SetXY($this->posxremainingqty, $curY);
450 450
 					$qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
451
-					$pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');
451
+					$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');
452 452
 					/*
453 453
 					 // Remise sur ligne
454 454
 					 $pdf->SetXY($this->posxdiscount, $curY);
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
 					 */
471 471
 
472 472
 					// Add line
473
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
473
+					if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
474 474
 					{
475 475
 						$pdf->setPage($pageposafter);
476
-						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
476
+						$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
477 477
 						//$pdf->SetDrawColor(190,190,200);
478
-						$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
478
+						$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
479 479
 						$pdf->SetLineStyle(array('dash'=>0));
480 480
 					}
481 481
 
482
-					$nexY+=2;    // Passe espace entre les lignes
482
+					$nexY += 2; // Passe espace entre les lignes
483 483
 
484 484
 					// Detect if some page were added automatically and output _tableau for past pages
485 485
 					while ($pagenb < $pageposafter)
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
 						{
494 494
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
495 495
 						}
496
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
496
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
497 497
 						$pagenb++;
498 498
 						$pdf->setPage($pagenb);
499
-						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
499
+						$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
500 500
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
501 501
 					}
502
-					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
502
+					if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
503 503
 					{
504 504
 						if ($pagenb == 1)
505 505
 						{
@@ -509,10 +509,10 @@  discard block
 block discarded – undo
509 509
 						{
510 510
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
511 511
 						}
512
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
512
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
513 513
 						// New page
514 514
 						$pdf->AddPage();
515
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
515
+						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
516 516
 						$pagenb++;
517 517
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
518 518
 					}
@@ -522,21 +522,21 @@  discard block
 block discarded – undo
522 522
 				if ($pagenb == 1)
523 523
 				{
524 524
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
525
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
525
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
526 526
 				}
527 527
 				else
528 528
 				{
529 529
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
530
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
530
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
531 531
 				}
532 532
 
533 533
 				// Affiche zone infos
534 534
 				$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
535 535
 
536 536
 				// Pied de page
537
-				$this->_pagefoot($pdf,$object,$outputlangs);
537
+				$this->_pagefoot($pdf, $object, $outputlangs);
538 538
 
539
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
539
+				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
540 540
 
541 541
 				// Check product remaining to be delivered
542 542
 				// TODO doit etre modifie
@@ -601,34 +601,34 @@  discard block
 block discarded – undo
601 601
 
602 602
 				$pdf->Close();
603 603
 
604
-				$pdf->Output($file,'F');
604
+				$pdf->Output($file, 'F');
605 605
 
606 606
 				// Add pdfgeneration hook
607
-				if (! is_object($hookmanager))
607
+				if (!is_object($hookmanager))
608 608
 				{
609 609
 					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
610
-					$hookmanager=new HookManager($this->db);
610
+					$hookmanager = new HookManager($this->db);
611 611
 				}
612 612
 				$hookmanager->initHooks(array('pdfgeneration'));
613
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
613
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
614 614
 				global $action;
615
-				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
615
+				$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
616 616
 
617
-				if (! empty($conf->global->MAIN_UMASK))
617
+				if (!empty($conf->global->MAIN_UMASK))
618 618
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
619 619
 
620 620
 				$this->result = array('fullpath'=>$file);
621 621
 
622
-				return 1;	// pas d'erreur
622
+				return 1; // pas d'erreur
623 623
 			}
624 624
 			else
625 625
 			{
626
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
626
+				$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
627 627
 				return 0;
628 628
 			}
629 629
 		}
630 630
 
631
-		$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
631
+		$this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR");
632 632
 		return 0;
633 633
 	}
634 634
 
@@ -645,20 +645,20 @@  discard block
 block discarded – undo
645 645
 	function _tableau_info(&$pdf, $object, $posy, $outputlangs)
646 646
 	{
647 647
         // phpcs:enable
648
-		global $conf,$mysoc;
648
+		global $conf, $mysoc;
649 649
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
650 650
 
651
-		$pdf->SetFont('','', $default_font_size);
651
+		$pdf->SetFont('', '', $default_font_size);
652 652
 		$pdf->SetXY($this->marge_gauche, $posy);
653 653
 
654
-		$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
654
+		$larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
655 655
 		$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
656 656
 		$pdf->SetXY($this->marge_gauche + 2, $posy + 2);
657
-		$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
657
+		$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":", '', 'L');
658 658
 
659
-		$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
660
-		$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
661
-		$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
659
+		$pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25);
660
+		$pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
661
+		$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L');
662 662
 	}
663 663
 
664 664
 	/**
@@ -673,56 +673,56 @@  discard block
 block discarded – undo
673 673
 	 *   @param		int			$hidebottom		Hide bottom bar of array
674 674
 	 *   @return	void
675 675
 	 */
676
-	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
676
+	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
677 677
 	{
678
-		global $conf,$mysoc;
678
+		global $conf, $mysoc;
679 679
 
680 680
 		// Force to disable hidetop and hidebottom
681
-		$hidebottom=0;
682
-		if ($hidetop) $hidetop=-1;
681
+		$hidebottom = 0;
682
+		if ($hidetop) $hidetop = -1;
683 683
 
684 684
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
685 685
 
686 686
 		// Amount in (at tab_top - 1)
687
-		$pdf->SetTextColor(0,0,0);
688
-		$pdf->SetFont('','', $default_font_size - 2);
687
+		$pdf->SetTextColor(0, 0, 0);
688
+		$pdf->SetFont('', '', $default_font_size - 2);
689 689
 
690 690
 		// Output Rec
691
-		$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
691
+		$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
692 692
 
693 693
 		if (empty($hidetop))
694 694
 		{
695
-			$pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10);
695
+			$pdf->line($this->marge_gauche, $tab_top + 10, $this->page_largeur - $this->marge_droite, $tab_top + 10);
696 696
 		}
697 697
 
698
-		$pdf->SetDrawColor(128,128,128);
699
-		$pdf->SetFont('','', $default_font_size - 1);
698
+		$pdf->SetDrawColor(128, 128, 128);
699
+		$pdf->SetFont('', '', $default_font_size - 1);
700 700
 
701 701
 		if (empty($hidetop))
702 702
 		{
703
-			$pdf->SetXY($this->posxdesc-1, $tab_top+1);
704
-			$pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
703
+			$pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
704
+			$pdf->MultiCell($this->posxcomm - $this->posxdesc, 2, $outputlangs->transnoentities("Designation"), '', 'L');
705 705
 		}
706 706
 
707 707
 		// Modif SEB pour avoir une col en plus pour les commentaires clients
708 708
 		$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
709 709
 		if (empty($hidetop)) {
710
-			$pdf->SetXY($this->posxcomm, $tab_top+1);
711
-			$pdf->MultiCell($this->posxqty - $this->posxcomm,2, $outputlangs->transnoentities("Comments"),'','L');
710
+			$pdf->SetXY($this->posxcomm, $tab_top + 1);
711
+			$pdf->MultiCell($this->posxqty - $this->posxcomm, 2, $outputlangs->transnoentities("Comments"), '', 'L');
712 712
 		}
713 713
 
714 714
 		// Qty
715 715
 		$pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height);
716 716
 		if (empty($hidetop)) {
717
-			$pdf->SetXY($this->posxqty, $tab_top+1);
718
-			$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"),'','R');
717
+			$pdf->SetXY($this->posxqty, $tab_top + 1);
718
+			$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"), '', 'R');
719 719
 		}
720 720
 
721 721
 		// Remain to ship
722 722
 		$pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height);
723 723
 		if (empty($hidetop)) {
724
-			$pdf->SetXY($this->posxremainingqty, $tab_top+1);
725
-			$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"),'','R');
724
+			$pdf->SetXY($this->posxremainingqty, $tab_top + 1);
725
+			$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"), '', 'R');
726 726
 		}
727 727
 	}
728 728
 
@@ -737,77 +737,77 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
739 739
 	{
740
-		global $conf,$langs,$hookmanager;
740
+		global $conf, $langs, $hookmanager;
741 741
 
742 742
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
743 743
 
744
-		pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
744
+		pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
745 745
 
746 746
 		// Show Draft Watermark
747
-		if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
747
+		if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK)))
748 748
 		{
749
-			pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
749
+			pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
750 750
 		}
751 751
 
752
-		$pdf->SetTextColor(0,0,60);
753
-		$pdf->SetFont('','B', $default_font_size + 3);
752
+		$pdf->SetTextColor(0, 0, 60);
753
+		$pdf->SetFont('', 'B', $default_font_size + 3);
754 754
 
755
-		$posy=$this->marge_haute;
756
-		$posx=$this->page_largeur-$this->marge_droite-100;
755
+		$posy = $this->marge_haute;
756
+		$posx = $this->page_largeur - $this->marge_droite - 100;
757 757
 
758
-		$pdf->SetXY($this->marge_gauche,$posy);
758
+		$pdf->SetXY($this->marge_gauche, $posy);
759 759
 
760 760
 		// Logo
761
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
761
+		$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
762 762
 		if ($this->emetteur->logo)
763 763
 		{
764 764
 			if (is_readable($logo))
765 765
 			{
766
-			    $height=pdf_getHeightForLogo($logo);
767
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
766
+			    $height = pdf_getHeightForLogo($logo);
767
+			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
768 768
 			}
769 769
 			else
770 770
 			{
771
-				$pdf->SetTextColor(200,0,0);
772
-				$pdf->SetFont('','B', $default_font_size - 2);
773
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
771
+				$pdf->SetTextColor(200, 0, 0);
772
+				$pdf->SetFont('', 'B', $default_font_size - 2);
773
+				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
774 774
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
775 775
 			}
776 776
 		}
777 777
 		else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
778 778
 
779
-		$pdf->SetFont('','B', $default_font_size + 2);
780
-		$pdf->SetXY($posx,$posy);
781
-		$pdf->SetTextColor(0,0,60);
779
+		$pdf->SetFont('', 'B', $default_font_size + 2);
780
+		$pdf->SetXY($posx, $posy);
781
+		$pdf->SetTextColor(0, 0, 60);
782 782
 		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
783 783
 
784
-		$pdf->SetFont('','',$default_font_size + 2);
784
+		$pdf->SetFont('', '', $default_font_size + 2);
785 785
 
786
-		$posy+=5;
787
-		$pdf->SetXY($posx,$posy);
788
-		$pdf->SetTextColor(0,0,60);
786
+		$posy += 5;
787
+		$pdf->SetXY($posx, $posy);
788
+		$pdf->SetTextColor(0, 0, 60);
789 789
 		if ($object->date_valid)
790 790
 		{
791
-			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,"%d %b %Y",false,$outputlangs,true), '', 'R');
791
+			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R');
792 792
 		}
793 793
 		else
794 794
 		{
795
-			$pdf->SetTextColor(255,0,0);
795
+			$pdf->SetTextColor(255, 0, 0);
796 796
 			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
797
-			$pdf->SetTextColor(0,0,60);
797
+			$pdf->SetTextColor(0, 0, 60);
798 798
 		}
799 799
 
800 800
 		if ($object->thirdparty->code_client)
801 801
 		{
802
-			$posy+=5;
803
-			$pdf->SetXY($posx,$posy);
804
-			$pdf->SetTextColor(0,0,60);
805
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
802
+			$posy += 5;
803
+			$pdf->SetXY($posx, $posy);
804
+			$pdf->SetTextColor(0, 0, 60);
805
+			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
806 806
 		}
807 807
 
808
-		$pdf->SetTextColor(0,0,60);
808
+		$pdf->SetTextColor(0, 0, 60);
809 809
 
810
-		$posy+=2;
810
+		$posy += 2;
811 811
 
812 812
 		// Show list of linked objects
813 813
 		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
@@ -815,51 +815,51 @@  discard block
 block discarded – undo
815 815
 		if ($showaddress)
816 816
 		{
817 817
 			// Sender properties
818
-			$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur, $object->thirdparty, '', 0, 'source', $object);
818
+			$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
819 819
 
820 820
 			// Show sender
821
-			$posy=42;
822
-			$posx=$this->marge_gauche;
823
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
824
-			$hautcadre=40;
821
+			$posy = 42;
822
+			$posx = $this->marge_gauche;
823
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
824
+			$hautcadre = 40;
825 825
 
826 826
 			// Show sender frame
827
-			$pdf->SetTextColor(0,0,0);
828
-			$pdf->SetFont('','', $default_font_size - 2);
829
-			$pdf->SetXY($posx,$posy-5);
830
-			$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
831
-			$pdf->SetXY($posx,$posy);
832
-			$pdf->SetFillColor(230,230,230);
827
+			$pdf->SetTextColor(0, 0, 0);
828
+			$pdf->SetFont('', '', $default_font_size - 2);
829
+			$pdf->SetXY($posx, $posy - 5);
830
+			$pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
831
+			$pdf->SetXY($posx, $posy);
832
+			$pdf->SetFillColor(230, 230, 230);
833 833
 			$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
834
-			$pdf->SetTextColor(0,0,60);
834
+			$pdf->SetTextColor(0, 0, 60);
835 835
 
836 836
 			// Show sender name
837
-			$pdf->SetXY($posx+2,$posy+3);
838
-			$pdf->SetFont('','B',$default_font_size);
837
+			$pdf->SetXY($posx + 2, $posy + 3);
838
+			$pdf->SetFont('', 'B', $default_font_size);
839 839
 			$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
840
-			$posy=$pdf->getY();
840
+			$posy = $pdf->getY();
841 841
 
842 842
 			// Show sender information
843
-			$pdf->SetXY($posx+2,$posy);
844
-			$pdf->SetFont('','', $default_font_size - 1);
843
+			$pdf->SetXY($posx + 2, $posy);
844
+			$pdf->SetFont('', '', $default_font_size - 1);
845 845
 			$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
846 846
 
847 847
 			// Client destinataire
848
-			$posy=42;
849
-			$posx=102;
850
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
851
-			$pdf->SetTextColor(0,0,0);
852
-			$pdf->SetFont('','', $default_font_size - 2);
853
-			$pdf->SetXY($posx,$posy-5);
854
-			$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
848
+			$posy = 42;
849
+			$posx = 102;
850
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
851
+			$pdf->SetTextColor(0, 0, 0);
852
+			$pdf->SetFont('', '', $default_font_size - 2);
853
+			$pdf->SetXY($posx, $posy - 5);
854
+			$pdf->MultiCell(80, 5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
855 855
 
856 856
 			// If SHIPPING contact defined on order, we use it
857
-			$usecontact=false;
858
-			$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
857
+			$usecontact = false;
858
+			$arrayidcontact = $object->commande->getIdContact('external', 'SHIPPING');
859 859
 			if (count($arrayidcontact) > 0)
860 860
 			{
861
-				$usecontact=true;
862
-				$result=$object->fetch_contact($arrayidcontact[0]);
861
+				$usecontact = true;
862
+				$result = $object->fetch_contact($arrayidcontact[0]);
863 863
 			}
864 864
 
865 865
 			//Recipient name
@@ -870,38 +870,38 @@  discard block
 block discarded – undo
870 870
 				$thirdparty = $object->thirdparty;
871 871
 			}
872 872
 
873
-			$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
873
+			$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
874 874
 
875
-			$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
875
+			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
876 876
 
877 877
 			// Show recipient
878
-			$widthrecbox=100;
879
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
880
-			$posy=42;
881
-			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
882
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
878
+			$widthrecbox = 100;
879
+			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
880
+			$posy = 42;
881
+			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
882
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
883 883
 
884 884
 			// Show recipient frame
885
-			$pdf->SetTextColor(0,0,0);
886
-			$pdf->SetFont('','', $default_font_size - 2);
887
-			$pdf->SetXY($posx+2,$posy-5);
885
+			$pdf->SetTextColor(0, 0, 0);
886
+			$pdf->SetFont('', '', $default_font_size - 2);
887
+			$pdf->SetXY($posx + 2, $posy - 5);
888 888
 			//$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
889 889
 			$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
890 890
 
891 891
 			// Show recipient name
892
-			$pdf->SetXY($posx+2,$posy+3);
893
-			$pdf->SetFont('','B', $default_font_size);
892
+			$pdf->SetXY($posx + 2, $posy + 3);
893
+			$pdf->SetFont('', 'B', $default_font_size);
894 894
 			$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
895 895
 
896 896
 			$posy = $pdf->getY();
897 897
 
898 898
 			// Show recipient information
899
-			$pdf->SetFont('','', $default_font_size - 1);
900
-			$pdf->SetXY($posx+2,$posy);
899
+			$pdf->SetFont('', '', $default_font_size - 1);
900
+			$pdf->SetXY($posx + 2, $posy);
901 901
 			$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
902 902
 		}
903 903
 
904
-		$pdf->SetTextColor(0,0,60);
904
+		$pdf->SetTextColor(0, 0, 60);
905 905
 	}
906 906
 
907 907
 	/**
@@ -913,10 +913,10 @@  discard block
 block discarded – undo
913 913
 	 *      @param	int			$hidefreetext		1=Hide free text
914 914
 	 *      @return	int								Return height of bottom margin including footer text
915 915
 	 */
916
-	function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
916
+	function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
917 917
 	{
918 918
 		global $conf;
919
-		$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
920
-		return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
919
+		$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
920
+		return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
921 921
 	}
922 922
 }
Please login to merge, or discard this patch.