Completed
Branch develop (3eae3a)
by
unknown
16:48
created
htdocs/admin/emailcollector_card.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	$targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag'
391 391
 
392 392
 	$connection = null;
393
-	$connectstringserver = $object->getConnectStringIMAP();	// Note: $object->host has been loaded by the fetch
393
+	$connectstringserver = $object->getConnectStringIMAP(); // Note: $object->host has been loaded by the fetch
394 394
 	$connectstringsource = '';
395 395
 	$connectstringtarget = '';
396 396
 
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
 					dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread);
557 557
 
558
-					$result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect);	// timeout seems ignored with ssl connect
558
+					$result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect
559 559
 					$result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread);
560 560
 					$result3 = imap_timeout(IMAP_WRITETIMEOUT, 5);
561 561
 					$result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5);
Please login to merge, or discard this patch.
htdocs/core/lib/website.lib.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 {
80 80
 	$str = str_replace('<?=', '<?php', $str);
81 81
 	$str = str_replace('<?php', '__LTINTPHP__', $str);
82
-	$str = str_replace('<?', '<?php', $str);			// replace the short_open_tag. It is recommended to set this is Off in php.ini
82
+	$str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this is Off in php.ini
83 83
 	$str = str_replace('__LTINTPHP__', '<?php', $str);
84 84
 
85 85
 	$newstr = '';
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 		// at end we replace the '!~!~!~' only if we are in final parent page.
332 332
 		$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep);
333 333
 		// Replace occurrence like _service_XXX.php with dolibarr URL
334
-		$content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/',	'\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_service_\2\1', $content, -1, $nbrep);
334
+		$content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=_service_\2\1', $content, -1, $nbrep);
335 335
 		// Replace occurrence like _library_XXX.php with dolibarr URL
336
-		$content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/',	'\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_library_\2\1', $content, -1, $nbrep);
336
+		$content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=_library_\2\1', $content, -1, $nbrep);
337 337
 		// Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL:  ...href="....php"
338 338
 		$content = preg_replace('/(href=")\/?([a-zA-Z0-9\-_#]+)(\"|\?)/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep);
339 339
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	}
432 432
 
433 433
 	if (getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY')) {
434
-		$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite ' . getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY'), $content);
434
+		$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY'), $content);
435 435
 	}
436 436
 
437 437
 	$content = dolReplaceSmileyCodeWithUTF8($content);
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 			$sql .= " WHERE rowid = ".((int) $websiteid);
469 469
 
470 470
 			$resql = $db->query($sql);
471
-			if (! $resql) {
471
+			if (!$resql) {
472 472
 				return -1;
473 473
 			}
474 474
 		}
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			unset($tmpwebsitepage);
556 556
 		}
557 557
 		if ($result > 0) {
558
-			$currenturi = $_SERVER["REQUEST_URI"];	// Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&nocache=1708177483
558
+			$currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&nocache=1708177483
559 559
 			$regtmp = array();
560 560
 			if (preg_match('/&pageref=([^&]+)/', $currenturi, $regtmp)) {
561 561
 				if ($regtmp[0] == $containerref) {
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	if ($newurl) {
577 577
 		if (!empty($parameters)) {
578 578
 			$separator = (parse_url($newurl, PHP_URL_QUERY) == null) ? '?' : '&';
579
-			$newurl = $newurl . $separator . http_build_query($parameters);
579
+			$newurl = $newurl.$separator.http_build_query($parameters);
580 580
 		}
581 581
 		if ($permanent) {
582 582
 			header("Status: 301 Moved Permanently", false, 301);
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 		$hashtags = trim(implode(' #', array_map('trim', explode(',', $websitepage->keywords))));
891 891
 
892 892
 		// Open Graph
893
-		$out .= '<meta name="og:type" content="website">'."\n";	// TODO If blogpost, use type article
893
+		$out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article
894 894
 		$out .= '<meta name="og:title" content="'.$websitepage->title.'">'."\n";
895 895
 		if ($websitepage->image) {
896 896
 			$out .= '<meta name="og:image" content="'.$website->virtualhost.$image.'">'."\n";
@@ -1007,9 +1007,9 @@  discard block
 block discarded – undo
1007 1007
 	$sql = "SELECT COUNT(rowid) as nb";
1008 1008
 	$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files";
1009 1009
 	$sql .= " WHERE entity IN (".getEntity($object->element).")";
1010
-	$sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id);	// Filter on object
1010
+	$sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object
1011 1011
 	$sql .= " AND ".$db->regexpsql('filename', $regexforimg, 1);
1012
-	$sql .= " AND share IS NOT NULL";	// Only image that are public
1012
+	$sql .= " AND share IS NOT NULL"; // Only image that are public
1013 1013
 
1014 1014
 	$resql = $db->query($sql);
1015 1015
 	if ($resql) {
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 	$sql = "SELECT rowid, ref, share, filename, cover, position";
1045 1045
 	$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files";
1046 1046
 	$sql .= " WHERE entity IN (".getEntity($object->element).")";
1047
-	$sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id);	// Filter on object
1047
+	$sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object
1048 1048
 	$sql .= " AND ".$db->regexpsql('filename', $regexforimg, 1);
1049 1049
 	$sql .= $db->order("cover,position,rowid", "ASC,ASC,ASC");
1050 1050
 
Please login to merge, or discard this patch.
htdocs/core/modules/facture/doc/pdf_octopus.modules.php 2 patches
Spacing   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * Dolibarr version of the loaded document
77 77
 	 * @var string
78 78
 	 */
79
-	public $version = 'disabled';	// Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
79
+	public $version = 'disabled'; // Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
80 80
 
81 81
 	/**
82 82
 	 * @var int height for info total
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
291 291
 		}
292 292
 
293
-		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE &&  !empty($object->situation_cycle_ref)))) {
293
+		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE && !empty($object->situation_cycle_ref)))) {
294 294
 			setEventMessage($langs->trans('WarningsObjectIsNotASituation'), 'warnings');
295 295
 			return 1;
296 296
 		}
@@ -409,15 +409,15 @@  discard block
 block discarded – undo
409 409
 				$pdf->SetAutoPageBreak(1, 0);
410 410
 
411 411
 				// compute height for situation invoices
412
-				$this->heightforinfotot = 45;	// Height reserved to output the info and total part and payment part
412
+				$this->heightforinfotot = 45; // Height reserved to output the info and total part and payment part
413 413
 				if (!getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS') && $nbpayments > 0) {
414 414
 					$this->heightforinfotot += 4 * ($nbpayments + 3);
415 415
 				}
416 416
 				if ($nbprevsituation > 0) {
417 417
 					$this->heightforinfotot += 4 * ($nbprevsituation + 3);
418 418
 				}
419
-				$this->heightforfreetext= (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5));	// Height reserved to output the free text on last page
420
-				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);	// Height reserved to output the footer (value include bottom margin)
419
+				$this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page
420
+				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
421 421
 
422 422
 				if (class_exists('TCPDF')) {
423 423
 					$pdf->setPrintHeader(false);
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 					if (!empty($conf->mycompany->multidir_output[$object->entity])) {
432 432
 						$logodir = $conf->mycompany->multidir_output[$object->entity];
433 433
 					}
434
-					$pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
434
+					$pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
435 435
 					$this->tplidx = $pdf->importPage(1);
436 436
 				}
437 437
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 				// $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher
524 524
 
525 525
 				// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
526
-				$this->tab_top = 90 + $top_shift + $shipp_shift;		// top_shift is an addition for linked objects or addons (0 in most cases)
526
+				$this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
527 527
 				$this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
528 528
 
529 529
 				// You can add more thing under header here, if you increase $extra_under_address_shift too.
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 
579 579
 				$this->_tableFirstPage($pdf, $tab_top, $this->page_hauteur - 100 - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
580 580
 
581
-				$bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
581
+				$bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
582 582
 
583 583
 				$this->_pagefoot($pdf, $object, $outputlangs, 1);
584 584
 
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 					if (!isset($this->tva[$vatrate])) {
1034 1034
 						$this->tva[$vatrate] = 0;
1035 1035
 					}
1036
-					$this->tva[$vatrate] += $tvaligne;	// ->tva is abandoned, we use now ->tva_array that is more complete
1036
+					$this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete
1037 1037
 					$vatcode = $object->lines[$i]->vat_src_code;
1038 1038
 					if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
1039 1039
 						$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 				}
1126 1126
 
1127 1127
 				$this->resumeLastPage($pdf, $object, 0, $tab_top, $outputlangs, $outputlangsbis);
1128
-				$bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
1128
+				$bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
1129 1129
 				$this->_pagefoot($pdf, $object, $outputlangs, 1);
1130 1130
 
1131 1131
 				$pdf->Close();
@@ -1333,8 +1333,8 @@  discard block
 block discarded – undo
1333 1333
 			$posy = $pdf->GetY() + 4;
1334 1334
 		}
1335 1335
 
1336
-		$posxval = 52;	// Position of values of properties shown on left side
1337
-		$posxend = 110;	// End of x for text on left side
1336
+		$posxval = 52; // Position of values of properties shown on left side
1337
+		$posxend = 110; // End of x for text on left side
1338 1338
 		if ($this->page_largeur < 210) { // To work with US executive format
1339 1339
 			$posxend -= 10;
1340 1340
 		}
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 
1365 1365
 			$pdf->SetFont('', '', $default_font_size - 2);
1366 1366
 			$pdf->SetXY($posxval, $posy);
1367
-			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
1367
+			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
1368 1368
 			$pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L');
1369 1369
 
1370 1370
 			$posy = $pdf->GetY() + 3; // for 2 lines
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 			$default_font_size--;
1563 1563
 		}
1564 1564
 
1565
-		$tab2_top = $posy-4;
1565
+		$tab2_top = $posy - 4;
1566 1566
 		$tab2_hl = 4;
1567 1567
 		$pdf->SetFont('', '', $default_font_size - 1);
1568 1568
 
@@ -1683,15 +1683,15 @@  discard block
 block discarded – undo
1683 1683
 				// VAT
1684 1684
 				$tvas = array();
1685 1685
 				$nblines = count($object->lines);
1686
-				for ($i=0; $i < $nblines; $i++) {
1686
+				for ($i = 0; $i < $nblines; $i++) {
1687 1687
 					$tvaligne = $object->lines[$i]->total_tva;
1688
-					$vatrate=(string) $object->lines[$i]->tva_tx;
1688
+					$vatrate = (string) $object->lines[$i]->tva_tx;
1689 1689
 
1690 1690
 					if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
1691
-						$vatrate.='*';
1691
+						$vatrate .= '*';
1692 1692
 					}
1693
-					if (! isset($tvas[$vatrate])) {
1694
-						$tvas[$vatrate]=0;
1693
+					if (!isset($tvas[$vatrate])) {
1694
+						$tvas[$vatrate] = 0;
1695 1695
 					}
1696 1696
 					$tvas[$vatrate] += $tvaligne;
1697 1697
 				}
@@ -1937,8 +1937,8 @@  discard block
 block discarded – undo
1937 1937
 		global $conf;
1938 1938
 
1939 1939
 		// Force to disable hidetop and hidebottom
1940
-		$hidebottom=0;
1941
-		$hidetop=0;
1940
+		$hidebottom = 0;
1941
+		$hidetop = 0;
1942 1942
 
1943 1943
 		$currency = !empty($currency) ? $currency : $conf->currency;
1944 1944
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -1954,16 +1954,16 @@  discard block
 block discarded – undo
1954 1954
 
1955 1955
 			// MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1956 1956
 			if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
1957
-				$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1957
+				$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1958 1958
 			}
1959
-			$tab_top+=4;
1959
+			$tab_top += 4;
1960 1960
 		}
1961 1961
 
1962 1962
 		$pdf->SetDrawColor(128, 128, 128);
1963 1963
 		$pdf->SetFont('', '', $default_font_size - 1);
1964 1964
 
1965 1965
 		// Output Rect
1966
-		$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
1966
+		$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
1967 1967
 
1968 1968
 		// situation invoice
1969 1969
 		$pdf->SetFont('', '', $default_font_size - 2);
@@ -1996,14 +1996,14 @@  discard block
 block discarded – undo
1996 1996
 			if (empty($hidetop)) {
1997 1997
 				$pdf->SetXY($xstartpos + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
1998 1998
 
1999
-				$textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1];
1999
+				$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
2000 2000
 				$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
2001 2001
 			}
2002 2002
 		}
2003 2003
 		$pdf->SetFont('', '', $default_font_size - 1);
2004 2004
 
2005 2005
 		if (empty($hidetop)) {
2006
-			$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);	// line prend une position y en 2eme param et 4eme param
2006
+			$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param
2007 2007
 		}
2008 2008
 	}
2009 2009
 
@@ -2119,7 +2119,7 @@  discard block
 block discarded – undo
2119 2119
 		$pdf->MultiCell($w, 3, $title, '', 'R');
2120 2120
 		if (!empty($subtitle)) {
2121 2121
 			$pdf->SetFont('', 'B', $default_font_size);
2122
-			$pdf->SetXY($posx, $posy+5);
2122
+			$pdf->SetXY($posx, $posy + 5);
2123 2123
 			$pdf->MultiCell($w, 6, $subtitle, '', 'R');
2124 2124
 			$posy += 2;
2125 2125
 		}
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
 			'overtitle' => array(
2574 2574
 				'textkey' => 'Chantier', // use lang key is useful in somme case with module
2575 2575
 				'align' => 'C',
2576
-				'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2576
+				'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2577 2577
 				'width' => 18
2578 2578
 			),
2579 2579
 		);
@@ -2600,11 +2600,11 @@  discard block
 block discarded – undo
2600 2600
 			'overtitle' => array(
2601 2601
 				'textkey' => $outputlangs->transnoentities('SituationInvoiceDate', $derniere_situation->situation_counter, dol_print_date($derniere_situation->date, "%d/%m/%Y")), // use lang key is useful in somme case with module
2602 2602
 				'align' => 'C',
2603
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2604
-				'width' => 10+15 //current width + amount cell width
2603
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2604
+				'width' => 10 + 15 //current width + amount cell width
2605 2605
 			),
2606 2606
 		);
2607
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2607
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2608 2608
 			$this->cols['prev_progress']['status'] = true;
2609 2609
 		}
2610 2610
 
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
 			),
2620 2620
 			'border-left' => true, // add left line separator
2621 2621
 		);
2622
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2622
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2623 2623
 			$this->cols['prev_progress_amount']['status'] = true;
2624 2624
 		}
2625 2625
 
@@ -2636,8 +2636,8 @@  discard block
 block discarded – undo
2636 2636
 			'overtitle' => array(
2637 2637
 				'textkey' => $outputlangs->transnoentities('SituationInvoiceDate', $object->situation_counter, dol_print_date($object->date, "%d/%m/%Y")), // use lang key is useful in somme case with module
2638 2638
 				'align' => 'C',
2639
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2640
-				'width' => 10+15
2639
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2640
+				'width' => 10 + 15
2641 2641
 			),
2642 2642
 		);
2643 2643
 
@@ -2728,9 +2728,9 @@  discard block
 block discarded – undo
2728 2728
 
2729 2729
 
2730 2730
 		// Force to disable hidetop and hidebottom
2731
-		$hidebottom=0;
2731
+		$hidebottom = 0;
2732 2732
 		if ($hidetop) {
2733
-			$hidetop=-1;
2733
+			$hidetop = -1;
2734 2734
 		}
2735 2735
 
2736 2736
 		$currency = !empty($currency) ? $currency : $conf->currency;
@@ -2742,15 +2742,15 @@  discard block
 block discarded – undo
2742 2742
 
2743 2743
 		if (empty($hidetop)) {
2744 2744
 			$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
2745
-			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-8);
2745
+			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 8);
2746 2746
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
2747 2747
 
2748
-			$width = $this->page_largeur-$this->marge_gauche-$this->marge_droite-83;
2748
+			$width = $this->page_largeur - $this->marge_gauche - $this->marge_droite - 83;
2749 2749
 
2750 2750
 			//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
2751 2751
 			if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
2752
-				$pdf->Rect($this->posx_cumul_anterieur-1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2753
-				$pdf->Rect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2752
+				$pdf->Rect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2753
+				$pdf->Rect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2754 2754
 			}
2755 2755
 		}
2756 2756
 
@@ -2759,47 +2759,47 @@  discard block
 block discarded – undo
2759 2759
 
2760 2760
 		// Output Rect
2761 2761
 		// KEEPTHIS => Affiche les bords extérieurs
2762
-		$this->printRectBtp($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
2762
+		$this->printRectBtp($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
2763 2763
 
2764
-		$pdf->line($this->posx_cumul_anterieur-1, $tab_top, $this->posx_cumul_anterieur-1, $tab_top + $tab_height);
2764
+		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top, $this->posx_cumul_anterieur - 1, $tab_top + $tab_height);
2765 2765
 		if (empty($hidetop)) {
2766
-			$pdf->SetXY($this->posx_cumul_anterieur-1, $tab_top+0.5);
2766
+			$pdf->SetXY($this->posx_cumul_anterieur - 1, $tab_top + 0.5);
2767 2767
 			$pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceOldCumulation"), '', 'C');
2768 2768
 		}
2769 2769
 
2770 2770
 		// PRINT COLUMNS TITLES
2771
-		$pdf->line($this->posx_new_cumul-1, $tab_top, $this->posx_new_cumul-1, $tab_top + $tab_height);
2771
+		$pdf->line($this->posx_new_cumul - 1, $tab_top, $this->posx_new_cumul - 1, $tab_top + $tab_height);
2772 2772
 		if (empty($hidetop)) {
2773
-			$pdf->SetXY($this->posx_new_cumul-1, $tab_top+0.5);
2773
+			$pdf->SetXY($this->posx_new_cumul - 1, $tab_top + 0.5);
2774 2774
 			$pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceNewCumulation"), '', 'C');
2775 2775
 		}
2776 2776
 
2777
-		$pdf->line($this->posx_current-1, $tab_top, $this->posx_current-1, $tab_top + $tab_height);
2777
+		$pdf->line($this->posx_current - 1, $tab_top, $this->posx_current - 1, $tab_top + $tab_height);
2778 2778
 		if (empty($hidetop)) {
2779
-			$pdf->SetXY($this->posx_current-1, $tab_top+0.5);
2779
+			$pdf->SetXY($this->posx_current - 1, $tab_top + 0.5);
2780 2780
 			$pdf->MultiCell(36, 2, $outputlangs->transnoentities("CurrentSituationTotal", $object->situation_counter), '', 'C');
2781 2781
 		}
2782 2782
 
2783 2783
 		// ADD HORIZONTAL LINES
2784
-		$pdf->line($this->posx_cumul_anterieur-1, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
2784
+		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
2785 2785
 
2786
-		$pdf->line($this->posx_cumul_anterieur-1, $tab_top+24, $this->page_largeur-$this->marge_droite, $tab_top+24);
2786
+		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 24, $this->page_largeur - $this->marge_droite, $tab_top + 24);
2787 2787
 
2788
-		$pdf->line($this->marge_gauche, $tab_top+55, $this->page_largeur-$this->marge_droite, $tab_top+55);
2788
+		$pdf->line($this->marge_gauche, $tab_top + 55, $this->page_largeur - $this->marge_droite, $tab_top + 55);
2789 2789
 
2790 2790
 		$pdf->line($this->marge_gauche, $tab_top + 65, $this->page_largeur - $this->marge_droite, $tab_top + 65);
2791 2791
 
2792 2792
 		if ($displayWarranty) {
2793
-			$pdf->line($this->marge_gauche, $tab_top+85, $this->page_largeur-$this->marge_droite, $tab_top+85);
2793
+			$pdf->line($this->marge_gauche, $tab_top + 85, $this->page_largeur - $this->marge_droite, $tab_top + 85);
2794 2794
 		}
2795 2795
 
2796 2796
 
2797 2797
 		// ADD TEXT INTO CELL
2798 2798
 		/********************** Titles ******************************/
2799
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+8);
2799
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 8);
2800 2800
 		$pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceMainTask"), '', 'L');
2801 2801
 
2802
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+12);
2802
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 12);
2803 2803
 		$pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceAdditionalTask"), '', 'L');
2804 2804
 
2805 2805
 		$form->load_cache_vatrates("'".$object->thirdparty->country_code."'");
@@ -2813,10 +2813,10 @@  discard block
 block discarded – undo
2813 2813
 			}
2814 2814
 			$i += 8;
2815 2815
 
2816
-			$pdf->SetXY($this->marge_gauche+10, $tab_top+24 + $i);
2816
+			$pdf->SetXY($this->marge_gauche + 10, $tab_top + 24 + $i);
2817 2817
 			$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalHT").' '.$TVatInfo['label'], '', 'L');
2818 2818
 
2819
-			if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2819
+			if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2820 2820
 				$pdf->SetXY($this->marge_gauche + 10, $tab_top + 28 + $i);
2821 2821
 				$pdf->MultiCell(80, 2, $outputlangs->transnoentities("VAT").' '.$TVatInfo['label'], '', 'L');
2822 2822
 			} else {
@@ -2824,25 +2824,25 @@  discard block
 block discarded – undo
2824 2824
 			}
2825 2825
 		}
2826 2826
 
2827
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+33+$i);
2827
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 33 + $i);
2828 2828
 		$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalTTC"), '', 'L');
2829 2829
 
2830 2830
 
2831 2831
 		$pdf->SetFont('', 'B', $default_font_size - 1);
2832
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+58);
2832
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 58);
2833 2833
 		$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalSituationInvoice"), '', 'L');
2834 2834
 		$pdf->SetFont('', '', $default_font_size - 2);
2835 2835
 
2836 2836
 		if ($displayWarranty) {
2837 2837
 			$pdf->SetXY($this->marge_gauche + 2, $tab_top + 74);
2838 2838
 			$pdf->MultiCell(80, 2, $outputlangs->trans("TotalSituationInvoiceWithRetainedWarranty", $object->retained_warranty), '', 'L');
2839
-			$nextY = $tab_top+93;
2839
+			$nextY = $tab_top + 93;
2840 2840
 		} else {
2841
-			$nextY = $tab_top+74;
2841
+			$nextY = $tab_top + 74;
2842 2842
 		}
2843 2843
 
2844 2844
 		$pdf->SetFont('', 'B', $default_font_size - 1);
2845
-		$pdf->SetXY($this->marge_gauche+2, $nextY);
2845
+		$pdf->SetXY($this->marge_gauche + 2, $nextY);
2846 2846
 		$pdf->MultiCell(80, 2, $outputlangs->transnoentities("SituationTotalRayToRest"), '', 'L');
2847 2847
 		$pdf->SetFont('', '', $default_font_size - 2);
2848 2848
 		/***********************************************************/
@@ -2854,17 +2854,17 @@  discard block
 block discarded – undo
2854 2854
 			'current'
2855 2855
 		);
2856 2856
 
2857
-		$x = $this->marge_gauche+85;
2857
+		$x = $this->marge_gauche + 85;
2858 2858
 		// unset($this->TDataSituation['derniere_situation']);
2859 2859
 		// print json_encode($object->lines);exit;
2860 2860
 		// print json_encode($this->TDataSituation);exit;
2861 2861
 		foreach ($TToDisplay as $col) {
2862 2862
 			// Travaux principaux
2863
-			$pdf->SetXY($x, $tab_top+8);
2863
+			$pdf->SetXY($x, $tab_top + 8);
2864 2864
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['HT'], 0, '', 1, -1, 2), '', 'R');
2865 2865
 
2866 2866
 			// Travaux supplémentaires
2867
-			$pdf->SetXY($x, $tab_top+12);
2867
+			$pdf->SetXY($x, $tab_top + 12);
2868 2868
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['travaux_sup'], 0, '', 1, -1, 2), '', 'R');
2869 2869
 
2870 2870
 			$i = -8;
@@ -2876,11 +2876,11 @@  discard block
 block discarded – undo
2876 2876
 				$i += 8;
2877 2877
 
2878 2878
 				// Total HT
2879
-				$pdf->SetXY($x, $tab_top+24+$i);
2879
+				$pdf->SetXY($x, $tab_top + 24 + $i);
2880 2880
 				$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['HT'], 0, '', 1, -1, 2), '', 'R');
2881 2881
 
2882 2882
 				// Total TVA
2883
-				if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2883
+				if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2884 2884
 					$pdf->SetXY($x, $tab_top + 28 + $i);
2885 2885
 					$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['TVA'], 0, '', 1, -1, 2), '', 'R');
2886 2886
 				} else {
@@ -2889,23 +2889,23 @@  discard block
 block discarded – undo
2889 2889
 			}
2890 2890
 
2891 2891
 			// Total TTC
2892
-			$pdf->SetXY($x, $tab_top+33+$i);
2892
+			$pdf->SetXY($x, $tab_top + 33 + $i);
2893 2893
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R');
2894 2894
 
2895 2895
 			// Total situation
2896 2896
 			$pdf->SetFont('', 'B', $default_font_size - 1);
2897
-			$pdf->SetXY($x, $tab_top+58);
2897
+			$pdf->SetXY($x, $tab_top + 58);
2898 2898
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R');
2899 2899
 			$pdf->SetFont('', '', $default_font_size - 2);
2900 2900
 
2901 2901
 
2902 2902
 			if ($displayWarranty) {
2903 2903
 				// Retained warranty
2904
-				$pdf->SetXY($x, $tab_top+74);
2904
+				$pdf->SetXY($x, $tab_top + 74);
2905 2905
 				$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['retenue_garantie'], 0, '', 1, -1, 2), '', 'R');
2906
-				$nextY = $tab_top+93;
2906
+				$nextY = $tab_top + 93;
2907 2907
 			} else {
2908
-				$nextY = $tab_top+74;
2908
+				$nextY = $tab_top + 74;
2909 2909
 			}
2910 2910
 
2911 2911
 			// Amount payable incl. VAT
@@ -2914,7 +2914,7 @@  discard block
 block discarded – undo
2914 2914
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['total_a_payer'], 0, '', 1, -1, 2), '', 'R');
2915 2915
 			$pdf->SetFont('', '', $default_font_size - 2);
2916 2916
 
2917
-			$x+=36;
2917
+			$x += 36;
2918 2918
 		}
2919 2919
 		/************************************************************/
2920 2920
 	}
@@ -2960,7 +2960,7 @@  discard block
 block discarded – undo
2960 2960
 
2961 2961
 		$TDataSituation = array();
2962 2962
 
2963
-		if (! empty($facDerniereSituation)) {
2963
+		if (!empty($facDerniereSituation)) {
2964 2964
 			$TDataSituation['derniere_situation'] = $facDerniereSituation;
2965 2965
 			$TDataSituation['date_derniere_situation'] = $facDerniereSituation->date;
2966 2966
 		}
@@ -2969,9 +2969,9 @@  discard block
 block discarded – undo
2969 2969
 		$retenue_garantie_anterieure = 0;
2970 2970
 		// Init tous les champs à 0
2971 2971
 		$TDataSituation['cumul_anterieur'] = array(
2972
-			'HT' => 0,	//montant HT normal
2973
-			'TVA' => 0,   //montant de la TVA sur le HTnet
2974
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
2972
+			'HT' => 0, //montant HT normal
2973
+			'TVA' => 0, //montant de la TVA sur le HTnet
2974
+			'TTC' => 0, //montant TTC (HTnet + TVA)
2975 2975
 			'retenue_garantie' => 0,
2976 2976
 			'travaux_sup' => 0,
2977 2977
 			'HTnet' => 0, //montant HT
@@ -3001,7 +3001,7 @@  discard block
 block discarded – undo
3001 3001
 					$isFirstSituation = false;
3002 3002
 					if (!empty($l->fk_prev_id)) {
3003 3003
 						$prevSituationPercent = $l->get_prev_progress($previousInvoice->id, true);
3004
-					} elseif (! array_key_exists($i+1, $TPreviousInvoices)) {
3004
+					} elseif (!array_key_exists($i + 1, $TPreviousInvoices)) {
3005 3005
 						$isFirstSituation = true;
3006 3006
 					}
3007 3007
 
@@ -3010,8 +3010,8 @@  discard block
 block discarded – undo
3010 3010
 					$ltvatx = (float) sprintf("%01.3f", $l->tva_tx);
3011 3011
 
3012 3012
 					//1ere ligne
3013
-					$amounttva = $calc_ht * ($ltvatx/100);
3014
-					if (! isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3013
+					$amounttva = $calc_ht * ($ltvatx / 100);
3014
+					if (!isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3015 3015
 						$TDataSituation['cumul_anterieur'][$ltvatx]['HT'] = $calc_ht;
3016 3016
 						$TDataSituation['cumul_anterieur'][$ltvatx]['TVA'] = $amounttva;
3017 3017
 					} else {
@@ -3023,14 +3023,14 @@  discard block
 block discarded – undo
3023 3023
 					//le grand total de TVA
3024 3024
 					// $TDataSituation['cumul_anterieur']['TVA'] += $amounttva;
3025 3025
 
3026
-					if (empty($l->fk_prev_id) && ! $isFirstSituation) {
3026
+					if (empty($l->fk_prev_id) && !$isFirstSituation) {
3027 3027
 						// TODO: à clarifier, mais pour moi, un facture de situation précédente qui a des progressions à 0% c'est pas logique
3028 3028
 						$TDataSituation['cumul_anterieur']['travaux_sup'] += $calc_ht;
3029 3029
 					}
3030 3030
 				}
3031 3031
 			}
3032 3032
 
3033
-			if (! empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3033
+			if (!empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3034 3034
 				$retenue_garantie_anterieure += $previousInvoice->getRetainedWarrantyAmount();
3035 3035
 			}
3036 3036
 
@@ -3044,7 +3044,7 @@  discard block
 block discarded – undo
3044 3044
 		// print json_encode($facDerniereSituation->lines);exit;
3045 3045
 		$TDataSituation['current'] = $this->btpGetInvoiceAmounts($object->id);
3046 3046
 
3047
-		if (! empty($facDerniereSituation->lines)) {
3047
+		if (!empty($facDerniereSituation->lines)) {
3048 3048
 			$TFacLinesKey = array_keys($facDerniereSituation->lines);
3049 3049
 			$TObjectLinesKey = array_keys($object->lines);
3050 3050
 			$TDiffKey = array_diff($TObjectLinesKey, $TFacLinesKey);
@@ -3189,14 +3189,14 @@  discard block
 block discarded – undo
3189 3189
 	 */
3190 3190
 	public function printRectBtp(&$pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
3191 3191
 	{
3192
-		if (empty($hidetop) || $hidetop==-1) {
3193
-			$pdf->line($x, $y, $x+$l, $y);
3192
+		if (empty($hidetop) || $hidetop == -1) {
3193
+			$pdf->line($x, $y, $x + $l, $y);
3194 3194
 		}
3195
-		$pdf->line($x+$l, $y, $x+$l, $y+$h);
3195
+		$pdf->line($x + $l, $y, $x + $l, $y + $h);
3196 3196
 		if (empty($hidebottom)) {
3197
-			$pdf->line($x+$l, $y+$h, $x, $y+$h);
3197
+			$pdf->line($x + $l, $y + $h, $x, $y + $h);
3198 3198
 		}
3199
-		$pdf->line($x, $y+$h, $x, $y);
3199
+		$pdf->line($x, $y + $h, $x, $y);
3200 3200
 	}
3201 3201
 
3202 3202
 
@@ -3210,9 +3210,9 @@  discard block
 block discarded – undo
3210 3210
 	 */
3211 3211
 	public function btpGetInvoiceAmounts($id, $forceReadFromDB = false)
3212 3212
 	{
3213
-		global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
3213
+		global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes;
3214 3214
 
3215
-		$object=new Facture($db);
3215
+		$object = new Facture($db);
3216 3216
 		$object->fetch($id);
3217 3217
 
3218 3218
 		/* from dolibarr core
@@ -3228,16 +3228,16 @@  discard block
 block discarded – undo
3228 3228
 		$facDerniereSituation = $TPreviousInvoices[0];
3229 3229
 
3230 3230
 		$ret = array(
3231
-			'HT' => 0,	//montant HT normal
3231
+			'HT' => 0, //montant HT normal
3232 3232
 			'HTnet' => 0, //montant HT
3233
-			'TVA' => 0,   //montant de la TVA sur le HTnet
3234
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
3233
+			'TVA' => 0, //montant de la TVA sur le HTnet
3234
+			'TTC' => 0, //montant TTC (HTnet + TVA)
3235 3235
 			'retenue_garantie' => 0,
3236 3236
 			'travaux_sup' => 0,
3237 3237
 			'total_a_payer' => 0 //montant "a payer" sur la facture
3238 3238
 		);
3239 3239
 
3240
-		if (! empty($facDerniereSituation)) {
3240
+		if (!empty($facDerniereSituation)) {
3241 3241
 			$ret['derniere_situation'] = $facDerniereSituation;
3242 3242
 			$ret['date_derniere_situation'] = $facDerniereSituation->date;
3243 3243
 		}
@@ -3367,16 +3367,16 @@  discard block
 block discarded – undo
3367 3367
 			$pdf->SetFont('', '', $default_font_size - 1);
3368 3368
 
3369 3369
 			$label = $outputlangs->transnoentities("SituationInvoiceTotalProposal");
3370
-			$pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy+1);
3370
+			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy + 1);
3371 3371
 
3372
-			$amount = price($sign * ($total_ht + (! empty($propal->remise)?$propal->remise:0)));
3373
-			$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1);
3372
+			$amount = price($sign * ($total_ht + (!empty($propal->remise) ? $propal->remise : 0)));
3373
+			$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1);
3374 3374
 
3375 3375
 			$pdf->SetFont('', '', $default_font_size - 1);
3376 3376
 
3377 3377
 			// Output Rect
3378 3378
 			$pdf->SetDrawColor(128, 128, 128);
3379
-			$this->printRect($pdf, $posx, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 6);	// Rect prend une longueur en 3eme param et 4eme param
3379
+			$this->printRect($pdf, $posx, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 6); // Rect prend une longueur en 3eme param et 4eme param
3380 3380
 
3381 3381
 			$posy += 4;
3382 3382
 		} elseif (count($orders)) {
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
 			$remain_to_pay = $total_ht;
3387 3387
 		}
3388 3388
 
3389
-		$useborder=0;
3389
+		$useborder = 0;
3390 3390
 		$index = 0;
3391 3391
 
3392 3392
 		$height = 4;
@@ -3402,7 +3402,7 @@  discard block
 block discarded – undo
3402 3402
 		$pdf->SetXY($posx, $posy);
3403 3403
 
3404 3404
 
3405
-		$depositsamount=$object->getSumDepositsUsed();
3405
+		$depositsamount = $object->getSumDepositsUsed();
3406 3406
 		$deja_regle = $object->getSommePaiement();
3407 3407
 
3408 3408
 		$tot_deja_regle = ($depositsamount + $deja_regle);
@@ -3411,7 +3411,7 @@  discard block
 block discarded – undo
3411 3411
 
3412 3412
 		$force_to_zero = false;
3413 3413
 
3414
-		$idinv = 0;//count($previousinvoices);
3414
+		$idinv = 0; //count($previousinvoices);
3415 3415
 		while ($idinv < count($previousinvoices)) {
3416 3416
 			$invoice = $previousinvoices[$idinv];
3417 3417
 
@@ -3429,11 +3429,11 @@  discard block
 block discarded – undo
3429 3429
 			$ref = $outputlangs->transnoentities("InvoiceSituation").$outputlangs->convToOutputCharset(" n°".$invoice->situation_counter);
3430 3430
 
3431 3431
 			if ($invoice->situation_final) {
3432
-				$ref.= ' - DGD';
3432
+				$ref .= ' - DGD';
3433 3433
 				$force_to_zero = true;
3434 3434
 			}
3435 3435
 
3436
-			$pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $ref. ' '.$invoice->ref. ' '. $outputlangs->transnoentities("InvoiceDateUsed", dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs)), 0, 'L', 0);
3436
+			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $ref.' '.$invoice->ref.' '.$outputlangs->transnoentities("InvoiceDateUsed", dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs)), 0, 'L', 0);
3437 3437
 
3438 3438
 			$pdf->SetFont('', '', $default_font_size - 1);
3439 3439
 
@@ -3449,20 +3449,20 @@  discard block
 block discarded – undo
3449 3449
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
3450 3450
 
3451 3451
 			$total_ht = ($conf->multicurrency->enabled && $invoice->mylticurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht);
3452
-			$pdf->SetXY($posx+$width, $posy);
3453
-			$pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise)?$invoice->remise:0)), 0, $outputlangs), 0, 'R', 1);
3452
+			$pdf->SetXY($posx + $width, $posy);
3453
+			$pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise) ? $invoice->remise : 0)), 0, $outputlangs), 0, 'R', 1);
3454 3454
 
3455 3455
 			$tvas = array();
3456 3456
 			$nblines = count($invoice->lines);
3457
-			for ($i=0; $i < $nblines; $i++) {
3457
+			for ($i = 0; $i < $nblines; $i++) {
3458 3458
 				$tvaligne = $invoice->lines[$i]->total_tva;
3459 3459
 				$vatrate = (string) $invoice->lines[$i]->tva_tx;
3460 3460
 
3461 3461
 				if (($invoice->lines[$i]->info_bits & 0x01) == 0x01) {
3462
-					$vatrate.='*';
3462
+					$vatrate .= '*';
3463 3463
 				}
3464
-				if (! isset($tvas[$vatrate])) {
3465
-					$tvas[$vatrate]=0;
3464
+				if (!isset($tvas[$vatrate])) {
3465
+					$tvas[$vatrate] = 0;
3466 3466
 				}
3467 3467
 				$tvas[$vatrate] += $tvaligne;
3468 3468
 			}
@@ -3480,10 +3480,10 @@  discard block
 block discarded – undo
3480 3480
 						$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
3481 3481
 					}
3482 3482
 					$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
3483
-					$totalvat.= vatrate($tvakey, 1).$tvacompl;
3483
+					$totalvat .= vatrate($tvakey, 1).$tvacompl;
3484 3484
 					$pdf->MultiCell($width, $height, $totalvat, 0, 'L', 1);
3485 3485
 
3486
-					$pdf->SetXY($posx+$width, $posy + $height * $index);
3486
+					$pdf->SetXY($posx + $width, $posy + $height * $index);
3487 3487
 					$pdf->MultiCell($width2, $height, price($tvaval, 0, $outputlangs), 0, 'R', 1);
3488 3488
 				}
3489 3489
 			}
@@ -3500,7 +3500,7 @@  discard block
 block discarded – undo
3500 3500
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
3501 3501
 
3502 3502
 
3503
-			$pdf->SetXY($posx+$width, $posy + $height * $index);
3503
+			$pdf->SetXY($posx + $width, $posy + $height * $index);
3504 3504
 			$pdf->MultiCell($width2, $height, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
3505 3505
 
3506 3506
 			$retainedWarrantyRate = (float) ($object->retained_warranty ? price2num($object->retained_warranty) : price2num(getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', 0)));
@@ -3516,10 +3516,10 @@  discard block
 block discarded – undo
3516 3516
 				$pdf->SetFillColor(241, 241, 241);
3517 3517
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("RetainedWarrantyShort", $retainedWarrantyRate), $useborder, 'L', 1);
3518 3518
 
3519
-				$total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate/100), 'MT');
3520
-				$total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate/100), 'MT');
3519
+				$total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate / 100), 'MT');
3520
+				$total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate / 100), 'MT');
3521 3521
 
3522
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3522
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3523 3523
 				$pdf->MultiCell($width2, $height, price(-$sign * $total_ht_rg, 0, $outputlangs), $useborder, 'R', 1);
3524 3524
 
3525 3525
 				$total_ht_with_rg = $total_ht - $total_ht_rg;
@@ -3533,7 +3533,7 @@  discard block
 block discarded – undo
3533 3533
 				$pdf->SetFillColor(224, 224, 224);
3534 3534
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalSituationInvoiceWithRetainedWarranty"), $useborder, 'L', 1);
3535 3535
 
3536
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3536
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3537 3537
 				$pdf->MultiCell($width2, $height, price($sign * $total_ttc_with_rg, 0, $outputlangs), $useborder, 'R', 1);
3538 3538
 			}
3539 3539
 
@@ -3558,7 +3558,7 @@  discard block
 block discarded – undo
3558 3558
 
3559 3559
 			$pdf->SetXY($posx, $posy + $height * $index);
3560 3560
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("Paid"), 0, 'L', 0);
3561
-			$pdf->SetXY($posx+$width, $posy + $height * $index);
3561
+			$pdf->SetXY($posx + $width, $posy + $height * $index);
3562 3562
 			$pdf->MultiCell($width2, $height, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0);
3563 3563
 
3564 3564
 			// Credit note
@@ -3566,7 +3566,7 @@  discard block
 block discarded – undo
3566 3566
 				$index++;
3567 3567
 				$pdf->SetXY($posx, $posy + $height * $index);
3568 3568
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
3569
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3569
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3570 3570
 				$pdf->MultiCell($width2, $height, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
3571 3571
 			}
3572 3572
 
@@ -3577,10 +3577,10 @@  discard block
 block discarded – undo
3577 3577
 
3578 3578
 				$pdf->SetXY($posx, $posy + $height * $index);
3579 3579
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
3580
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3580
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3581 3581
 				$pdf->MultiCell($width2, $height, price($invoice->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1);
3582 3582
 
3583
-				$resteapayer=0;
3583
+				$resteapayer = 0;
3584 3584
 			}
3585 3585
 
3586 3586
 			$index++;
@@ -3588,7 +3588,7 @@  discard block
 block discarded – undo
3588 3588
 			$pdf->SetFillColor(224, 224, 224);
3589 3589
 			$pdf->SetXY($posx, $posy + $height * $index);
3590 3590
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
3591
-			$pdf->SetXY($posx+$width, $posy + $height * $index);
3591
+			$pdf->SetXY($posx + $width, $posy + $height * $index);
3592 3592
 			$pdf->MultiCell($width2, $height, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
3593 3593
 
3594 3594
 			$pdf->SetFont('', '', $default_font_size - 1);
@@ -3597,8 +3597,8 @@  discard block
 block discarded – undo
3597 3597
 			$index++;
3598 3598
 
3599 3599
 			if ($deja_regle > 0) {
3600
-				$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
3601
-				if ($invoice->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
3600
+				$title = $outputlangs->transnoentities("PaymentsAlreadyDone");
3601
+				if ($invoice->type == 2) $title = $outputlangs->transnoentities("PaymentsBackAlreadyDone");
3602 3602
 
3603 3603
 				$pdf->SetFont('', '', $default_font_size - 3);
3604 3604
 				$pdf->SetXY($posx, $posy + $height * $index);
@@ -3608,21 +3608,21 @@  discard block
 block discarded – undo
3608 3608
 
3609 3609
 				$index++;
3610 3610
 
3611
-				$width4 = ($this->page_largeur - $this->marge_droite - $posx)/4;
3611
+				$width4 = ($this->page_largeur - $this->marge_droite - $posx) / 4;
3612 3612
 
3613 3613
 				$pdf->SetFont('', '', $default_font_size - 4);
3614 3614
 				$pdf->SetXY($posx, $posy + $height * $index);
3615
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
3616
-				$pdf->SetXY($posx+$width4, $posy + $height * $index);
3617
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
3618
-				$pdf->SetXY($posx+$width4*2, $posy + $height * $index);
3619
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Type"), 0, 'L', 0);
3620
-				$pdf->SetXY($posx+$width4*3, $posy + $height * $index);
3621
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Num"), 0, 'L', 0);
3615
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
3616
+				$pdf->SetXY($posx + $width4, $posy + $height * $index);
3617
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
3618
+				$pdf->SetXY($posx + $width4 * 2, $posy + $height * $index);
3619
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Type"), 0, 'L', 0);
3620
+				$pdf->SetXY($posx + $width4 * 3, $posy + $height * $index);
3621
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Num"), 0, 'L', 0);
3622 3622
 
3623 3623
 				//$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
3624 3624
 
3625
-				$y=$height-1;
3625
+				$y = $height - 1;
3626 3626
 
3627 3627
 				$pdf->SetFont('', '', $default_font_size - 4);
3628 3628
 				/** @var Facture $invoice */
@@ -3631,15 +3631,15 @@  discard block
 block discarded – undo
3631 3631
 				if (count($payments)) {
3632 3632
 					foreach ($payments as $payment) {
3633 3633
 						$pdf->SetXY($posx, $posy + $height * $index + $y);
3634
-						$pdf->MultiCell($width4, $height-1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0);
3635
-						$pdf->SetXY($posx+$width4, $posy + $height * $index + $y);
3636
-						$pdf->MultiCell($width4, $height-1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0);
3637
-						$pdf->SetXY($posx+$width4*2, $posy + $height * $index + $y);
3638
-						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $payment['type']);
3634
+						$pdf->MultiCell($width4, $height - 1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0);
3635
+						$pdf->SetXY($posx + $width4, $posy + $height * $index + $y);
3636
+						$pdf->MultiCell($width4, $height - 1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0);
3637
+						$pdf->SetXY($posx + $width4 * 2, $posy + $height * $index + $y);
3638
+						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$payment['type']);
3639 3639
 
3640
-						$pdf->MultiCell($width4, $height-1, $oper, 0, 'L', 0);
3641
-						$pdf->SetXY($posx+$width4*3, $posy + $height * $index + $y);
3642
-						$pdf->MultiCell($width4, $height-1, $payment['num'], 0, 'L', 0);
3640
+						$pdf->MultiCell($width4, $height - 1, $oper, 0, 'L', 0);
3641
+						$pdf->SetXY($posx + $width4 * 3, $posy + $height * $index + $y);
3642
+						$pdf->MultiCell($width4, $height - 1, $payment['num'], 0, 'L', 0);
3643 3643
 
3644 3644
 						//$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3);
3645 3645
 						$y += ($height - 1);
@@ -3649,21 +3649,21 @@  discard block
 block discarded – undo
3649 3649
 
3650 3650
 			// Output Rect
3651 3651
 			$pdf->SetDrawColor(128, 128, 128);
3652
-			$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height * $index + $y);
3652
+			$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height * $index + $y);
3653 3653
 			$posy += $height * $index + $y;
3654 3654
 
3655
-			$pageposafter=$pdf->getPage();
3655
+			$pageposafter = $pdf->getPage();
3656 3656
 			if ($pageposafter > $pageposbefore) {	// There is a pagebreak
3657 3657
 				$pdf->rollbackTransaction(true);
3658 3658
 
3659
-				$pageposafter=$pageposbefore;
3659
+				$pageposafter = $pageposbefore;
3660 3660
 				$pdf->AddPage('', '', true);
3661 3661
 				if (!empty($this->tplidx)) {
3662 3662
 					$pdf->useTemplate($this->tplidx);
3663 3663
 				}
3664 3664
 				if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
3665
-				$pdf->setPage($pageposafter+1);
3666
-				$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3665
+				$pdf->setPage($pageposafter + 1);
3666
+				$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3667 3667
 
3668 3668
 				$posy = $this->tab_top_newpage + 1;
3669 3669
 			} else {
@@ -3695,18 +3695,18 @@  discard block
 block discarded – undo
3695 3695
 
3696 3696
 		$posy += 10;
3697 3697
 
3698
-		$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3698
+		$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3699 3699
 
3700 3700
 		$pdf->SetTextColor(0, 0, 60);
3701 3701
 		$pdf->SetFont('', '', $default_font_size - 1);
3702 3702
 		$pdf->SetXY($this->marge_gauche, $posy + 1);
3703 3703
 		$label = $outputlangs->transnoentities("SituationTotalRayToRest");
3704
-		$pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0);
3704
+		$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0);
3705 3705
 
3706 3706
 		$amount = price($remain_to_pay);
3707
-		$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1);
3707
+		$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1);
3708 3708
 
3709 3709
 		$pdf->SetDrawColor(128, 128, 128);
3710
-		$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 7);
3710
+		$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 7);
3711 3711
 	}
3712 3712
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3548,7 +3548,9 @@  discard block
 block discarded – undo
3548 3548
 			$deja_regle = $invoice->getSommePaiement();
3549 3549
 
3550 3550
 			$resteapayer = price2num($invoice->total_ttc - $deja_regle - $total_ttc_rg - $creditnoteamount - $depositsamount, 'MT');
3551
-			if ($invoice->paye) $resteapayer = 0;
3551
+			if ($invoice->paye) {
3552
+				$resteapayer = 0;
3553
+			}
3552 3554
 
3553 3555
 			$y = 0;
3554 3556
 
@@ -3598,7 +3600,9 @@  discard block
 block discarded – undo
3598 3600
 
3599 3601
 			if ($deja_regle > 0) {
3600 3602
 				$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
3601
-				if ($invoice->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
3603
+				if ($invoice->type == 2) {
3604
+					$title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
3605
+				}
3602 3606
 
3603 3607
 				$pdf->SetFont('', '', $default_font_size - 3);
3604 3608
 				$pdf->SetXY($posx, $posy + $height * $index);
@@ -3661,7 +3665,9 @@  discard block
 block discarded – undo
3661 3665
 				if (!empty($this->tplidx)) {
3662 3666
 					$pdf->useTemplate($this->tplidx);
3663 3667
 				}
3664
-				if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
3668
+				if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
3669
+					$this->_pagehead($pdf, $object, 0, $outputlangs);
3670
+				}
3665 3671
 				$pdf->setPage($pageposafter+1);
3666 3672
 				$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3667 3673
 
Please login to merge, or discard this patch.
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Put here all includes required by your class file
27
-include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
28
-
29
-require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
30
-require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
31
-require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
32
-
33
-require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';                   // Customer Proposal
34
-require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';                    // Sale Order
35
-require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php';               // Customer Invoice
36
-require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';                      // Contact / Address
37
-require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php';                // Shipping / Delivery
38
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php';           // Purchase Order
39
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php';            // Purchase Invoice
40
-require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php';                       // Project
41
-require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php';                  // Reception
42
-require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php';   // Recruiting
43
-require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';                      // Third-Party
44
-require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php';  // Supplier Proposal
45
-require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';                        // Ticket
27
+include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
28
+
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32
+
33
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // Customer Proposal
34
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Sale Order
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Customer Invoice
36
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Contact / Address
37
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipping / Delivery
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Purchase Order
39
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Purchase Invoice
40
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Project
41
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // Reception
42
+require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
43
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Third-Party
44
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
45
+require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; // Ticket
46 46
 //require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php';        // Expense Report
47 47
 //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php';                    // Holidays (leave request)
48 48
 
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
790 790
 			$flags .= '';
791 791
 		} else {
792
-			$flags .= '/' . $this->imap_encryption;
792
+			$flags .= '/'.$this->imap_encryption;
793 793
 		}
794 794
 
795 795
 		$flags .= '/novalidate-cert';
@@ -819,8 +819,8 @@  discard block
 block discarded – undo
819 819
 	{
820 820
 		if (function_exists('mb_convert_encoding')) {
821 821
 			// change spaces by entropy because mb_convert fail with spaces
822
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
823
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
822
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
823
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
824 824
 			// if mb_convert work
825 825
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
826 826
 				// change characters
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 				}
1441 1441
 
1442 1442
 				if ($rule['type'] == 'from') {
1443
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1443
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1444 1444
 					if (count($tmprulevaluearray) >= 2) {
1445 1445
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1446 1446
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 					}
1451 1451
 				}
1452 1452
 				if ($rule['type'] == 'to') {
1453
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1453
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1454 1454
 					if (count($tmprulevaluearray) >= 2) {
1455 1455
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1456 1456
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 					$tmpsourcedir = $this->getEncodedUtf7($sourcedir);
1579 1579
 				}
1580 1580
 
1581
-				$f = $client->getFolders(false, $tmpsourcedir);	// Note the search of directory do a search on sourcedir*
1581
+				$f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir*
1582 1582
 				if ($f) {
1583 1583
 					$folder = $f[0];
1584 1584
 					if ($folder instanceof Webklex\PHPIMAP\Folder) {
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
 			}
1638 1638
 		}
1639 1639
 
1640
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1640
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1641 1641
 
1642 1642
 		// Loop on each email found
1643 1643
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) {
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 						$isreplytook = 0;
1810 1810
 						foreach ($rulesreplyto as $key => $rulereplyto) {
1811 1811
 							if (preg_match('/'.preg_quote($rulereplyto, '/').'/', $headers['Reply-To'])) {
1812
-								$isreplytook ++;
1812
+								$isreplytook++;
1813 1813
 							}
1814 1814
 						}
1815 1815
 
@@ -1869,7 +1869,7 @@  discard block
 block discarded – undo
1869 1869
 						$attachments = [];
1870 1870
 					}
1871 1871
 				} else {
1872
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1872
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1873 1873
 				}
1874 1874
 				'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments';
1875 1875
 
@@ -1965,11 +1965,11 @@  discard block
 block discarded – undo
1965 1965
 					$to = $overview['to'];
1966 1966
 					$sendtocc = empty($overview['cc']) ? '' : $overview['cc'];
1967 1967
 					$sendtobcc = empty($overview['bcc']) ? '' : $overview['bcc'];
1968
-					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt');    // if $overview['timezone'] is "+00:00"
1968
+					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00"
1969 1969
 					$subject = $overview['subject'];
1970 1970
 				} else {
1971 1971
 					$fromstring = $overview[0]->from;
1972
-					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")) ;
1972
+					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : ""));
1973 1973
 
1974 1974
 					$sender = !empty($overview[0]->sender) ? $overview[0]->sender : '';
1975 1975
 					$to = $overview[0]->to;
@@ -2040,17 +2040,17 @@  discard block
 block discarded – undo
2040 2040
 				foreach ($arrayofreferences as $reference) {
2041 2041
 					//print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n";
2042 2042
 					if (!empty($trackidfoundintorecipienttype)) {
2043
-						$resultsearchtrackid = -1;		// trackid found
2043
+						$resultsearchtrackid = -1; // trackid found
2044 2044
 						$reg[1] = $trackidfoundintorecipienttype;
2045 2045
 						$reg[2] = $trackidfoundintorecipientid;
2046 2046
 					} elseif (!empty($trackidfoundintomsgidtype)) {
2047
-						$resultsearchtrackid = -1;		// trackid found
2047
+						$resultsearchtrackid = -1; // trackid found
2048 2048
 						$reg[1] = $trackidfoundintomsgidtype;
2049 2049
 						$reg[2] = $trackidfoundintomsgidid;
2050 2050
 					} else {
2051
-						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg);	// trackid found or not
2051
+						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not
2052 2052
 						if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) {
2053
-							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg);	// trackid found
2053
+							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found
2054 2054
 						}
2055 2055
 					}
2056 2056
 
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 								} else {
2212 2212
 									foreach ($arrayofreferences as $key => $referencetmp) {
2213 2213
 										if (!str_contains($objectemail->origin_references, $referencetmp)) {
2214
-											$objectemail->origin_references.= " ".$referencetmp;
2214
+											$objectemail->origin_references .= " ".$referencetmp;
2215 2215
 											$changeonticket_references = true;
2216 2216
 										}
2217 2217
 									}
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
 
2347 2347
 						// Make Operation
2348 2348
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2349
-						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type);	// If a Dolibarr tracker id is found, we should now the id of object
2349
+						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object
2350 2350
 
2351 2351
 						$actioncode = 'EMAIL_IN';
2352 2352
 						// If we scan the Sent box, we use the code for out email
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
 									$operationslog .= '<br>Ticket not found using trackid='.$trackid.' or msgid='.$msgid;
2391 2391
 									$ticketalreadyexists = 0;
2392 2392
 								} else {
2393
-									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid;	// We change the operation type to do
2393
+									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid; // We change the operation type to do
2394 2394
 									$ticketalreadyexists = 1;
2395 2395
 									$operation['type'] = 'recordevent';
2396 2396
 								}
@@ -2627,11 +2627,11 @@  discard block
 block discarded – undo
2627 2627
 									$result = $contactstatic->fetch(0, null, '', $from);
2628 2628
 									if ($result < 0) {
2629 2629
 										$errorforactions++;
2630
-										$this->error = 'Error when getting contact with email ' . $from;
2630
+										$this->error = 'Error when getting contact with email '.$from;
2631 2631
 										$this->errors[] = $this->error;
2632 2632
 										break;
2633 2633
 									} elseif ($result == 0) {
2634
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2634
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2635 2635
 										$contactstatic = new Contact($this->db);
2636 2636
 
2637 2637
 										// Create contact
@@ -2646,28 +2646,28 @@  discard block
 block discarded – undo
2646 2646
 										} else {
2647 2647
 											// Search country by name or code
2648 2648
 											if (!empty($contactstatic->country)) {
2649
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2649
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2650 2650
 												$result = getCountry('', 3, $this->db, '', 1, $contactstatic->country);
2651 2651
 												if ($result == 'NotDefined') {
2652 2652
 													$errorforactions++;
2653
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2653
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2654 2654
 												} elseif (!($result > 0)) {
2655 2655
 													$errorforactions++;
2656
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2656
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2657 2657
 													$this->errors[] = $this->db->lasterror();
2658 2658
 												} else {
2659 2659
 													$contactstatic->country_id = $result;
2660 2660
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2661 2661
 												}
2662 2662
 											} elseif (!empty($contactstatic->country_code)) {
2663
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2663
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2664 2664
 												$result = getCountry($contactstatic->country_code, 3, $this->db);
2665 2665
 												if ($result == 'NotDefined') {
2666 2666
 													$errorforactions++;
2667
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2667
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2668 2668
 												} elseif (!($result > 0)) {
2669 2669
 													$errorforactions++;
2670
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2670
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2671 2671
 													$this->errors[] = $this->db->lasterror();
2672 2672
 												} else {
2673 2673
 													$contactstatic->country_id = $result;
@@ -2678,28 +2678,28 @@  discard block
 block discarded – undo
2678 2678
 											if (!$errorforactions) {
2679 2679
 												// Search state by name or code (for country if defined)
2680 2680
 												if (!empty($contactstatic->state)) {
2681
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2681
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2682 2682
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2683 2683
 													if (empty($result)) {
2684 2684
 														$errorforactions++;
2685
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2685
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2686 2686
 													} elseif (!($result > 0)) {
2687 2687
 														$errorforactions++;
2688
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2688
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2689 2689
 														$this->errors[] = $this->db->lasterror();
2690 2690
 													} else {
2691 2691
 														$contactstatic->state_id = $result;
2692 2692
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2693 2693
 													}
2694 2694
 												} elseif (!empty($contactstatic->state_code)) {
2695
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2695
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2696 2696
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2697 2697
 													if (empty($result)) {
2698 2698
 														$errorforactions++;
2699
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2699
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2700 2700
 													} elseif (!($result > 0)) {
2701 2701
 														$errorforactions++;
2702
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2702
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2703 2703
 														$this->errors[] = $this->db->lasterror();
2704 2704
 													} else {
2705 2705
 														$contactstatic->state_id = $result;
@@ -2764,8 +2764,8 @@  discard block
 block discarded – undo
2764 2764
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2765 2765
 								$actioncomm->note_private = $descriptionfull;
2766 2766
 								$actioncomm->fk_project  = $projectstatic->id;
2767
-								$actioncomm->datep       = $dateemail;	// date of email
2768
-								$actioncomm->datef       = $dateemail;	// date of email
2767
+								$actioncomm->datep       = $dateemail; // date of email
2768
+								$actioncomm->datef       = $dateemail; // date of email
2769 2769
 								$actioncomm->percentage  = -1; // Not applicable
2770 2770
 								$actioncomm->socid       = $thirdpartystatic->id;
2771 2771
 								$actioncomm->contact_id = $contactstatic->id;
@@ -2964,7 +2964,7 @@  discard block
 block discarded – undo
2964 2964
 								}
2965 2965
 								$hookmanager->initHooks(array('emailcolector'));
2966 2966
 								$parameters = array('arrayobject' => $arrayobject);
2967
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
2967
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
2968 2968
 								if ($reshook > 0) {
2969 2969
 									$arrayobject = $hookmanager->resArray;
2970 2970
 								}
@@ -2973,10 +2973,10 @@  discard block
 block discarded – undo
2973 2973
 
2974 2974
 								foreach ($arrayobject as $key => $objectdesc) {
2975 2975
 									$sql = 'SELECT DISTINCT t.rowid ';
2976
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t';
2976
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t';
2977 2977
 									$sql .= ' WHERE ';
2978 2978
 									foreach ($objectdesc['fields'] as $field) {
2979
-										$sql .= "('" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR ";
2979
+										$sql .= "('".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR ";
2980 2980
 									}
2981 2981
 									$sql = substr($sql, 0, -4);
2982 2982
 
@@ -2996,8 +2996,8 @@  discard block
 block discarded – undo
2996 2996
 									foreach ($ids as $val) {
2997 2997
 										$res = $objectmanaged->fetch($val);
2998 2998
 										if ($res) {
2999
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
3000
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
2999
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
3000
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
3001 3001
 										} else {
3002 3002
 											$this->errors[] = 'object not found';
3003 3003
 										}
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
 								foreach ($dirs as $target) {
3007 3007
 									$prefix = $this->actions[$this->id]['actionparam'];
3008 3008
 									foreach ($data as $filename => $content) {
3009
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
3009
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
3010 3010
 										if ($resr == -1) {
3011 3011
 											$this->errors[] = 'Doc not saved';
3012 3012
 										}
@@ -3053,7 +3053,7 @@  discard block
 block discarded – undo
3053 3053
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
3054 3054
 
3055 3055
 								$projecttocreate->title = $subject;
3056
-								$projecttocreate->date_start = $date;	// date of email
3056
+								$projecttocreate->date_start = $date; // date of email
3057 3057
 								$projecttocreate->date_end = 0;
3058 3058
 								$projecttocreate->opp_status = $id_opp_status;
3059 3059
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3315,7 +3315,7 @@  discard block
 block discarded – undo
3315 3315
 								$candidaturetocreate->note_private = $descriptionfull;
3316 3316
 								$candidaturetocreate->entity = $conf->entity;
3317 3317
 								$candidaturetocreate->email_msgid = $msgid;
3318
-								$candidaturetocreate->email_date = $date;		// date of email
3318
+								$candidaturetocreate->email_date = $date; // date of email
3319 3319
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3320 3320
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3321 3321
 
@@ -3705,8 +3705,8 @@  discard block
 block discarded – undo
3705 3705
 				 * append increment number to the original filename
3706 3706
 				 */
3707 3707
 				while (file_exists($destdir.$file_name.".".$extension)) {
3708
-					$file_name = $file_name_original . ' (' . $num . ')';
3709
-					$file_name_complete = $file_name . "." . $extension;
3708
+					$file_name = $file_name_original.' ('.$num.')';
3709
+					$file_name_complete = $file_name.".".$extension;
3710 3710
 					$destination = $destdir.$file_name_complete;
3711 3711
 					$num++;
3712 3712
 				}
@@ -3820,7 +3820,7 @@  discard block
 block discarded – undo
3820 3820
 	 */
3821 3821
 	private function saveAttachment($destdir, $filename, $content)
3822 3822
 	{
3823
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
3823
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
3824 3824
 
3825 3825
 		$tmparraysize = getDefaultImageSizes();
3826 3826
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.
htdocs/public/payment/newpayment.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 	if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
306 306
 		if ($tmpsource && $REF) {
307 307
 			// Use the source in the hash to avoid duplicates if the references are identical
308
-			$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $tmpsource.$REF, $SECUREKEY, '2');
308
+			$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$tmpsource.$REF, $SECUREKEY, '2');
309 309
 			// Do a second test for retro-compatibility (token may have been hashed with membersubscription in external module)
310 310
 			if ($tmpsource != $source) {
311
-				$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $source.$REF, $SECUREKEY, '2');
311
+				$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$source.$REF, $SECUREKEY, '2');
312 312
 			}
313 313
 		} else {
314 314
 			$tokenisok = dol_verifyHash($conf->global->PAYMENT_SECURITY_TOKEN, $SECUREKEY, '2');
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		$tokenisok = ($conf->global->PAYMENT_SECURITY_TOKEN == $SECUREKEY);
318 318
 	}
319 319
 
320
-	if (! $tokenisok) {
320
+	if (!$tokenisok) {
321 321
 		if (!getDolGlobalString('PAYMENT_SECURITY_ACCEPT_ANY_TOKEN')) {
322 322
 			$valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility
323 323
 		} else {
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 $paramcreditor = 'ONLINE_PAYMENT_CREDITOR';
347 347
 $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix;
348 348
 if (!empty($conf->global->$paramcreditorlong)) {
349
-	$creditor = getDolGlobalString($paramcreditorlong);	// use label long of the seller to show
349
+	$creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show
350 350
 } elseif (!empty($conf->global->$paramcreditor)) {
351
-	$creditor = getDolGlobalString($paramcreditor);		// use label short of the seller to show
351
+	$creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show
352 352
 }
353 353
 
354 354
 $mesg = '';
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 	$remoteip = getUserRemoteIP();
797 797
 
798 798
 	$_SESSION["onlinetoken"] = $stripeToken;
799
-	$_SESSION["FinalPaymentAmt"] = $amount;			// amount really paid (coming from Stripe). Will be used for check in paymentok.php.
800
-	$_SESSION["currencyCodeType"] = $currency;		// currency really used for payment (coming from Stripe). Will be used for check in paymentok.php.
799
+	$_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php.
800
+	$_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php.
801 801
 	$_SESSION["paymentType"] = '';
802 802
 	$_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip
803 803
 	$_SESSION['payerID'] = is_object($customer) ? $customer->id : '';
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 
844 844
 $head = '';
845 845
 if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) {
846
-	$head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n";
846
+	$head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n";
847 847
 }
848 848
 
849 849
 $conf->dol_hide_topmenu = 1;
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 	if (preg_match('/^\((.*)\)$/', $conf->global->PAYMENT_NEWFORM_TEXT, $reg)) {
969 969
 		$text .= $langs->trans($reg[1])."<br>\n";
970 970
 	} else {
971
-		$text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT') . "<br>\n";
971
+		$text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT')."<br>\n";
972 972
 	}
973 973
 	$text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
974 974
 }
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 print $text;
980 980
 
981 981
 // Output payment summary form
982
-print '<tr><td align="center">';	// class=center does not have the payment button centered so we keep align here.
982
+print '<tr><td align="center">'; // class=center does not have the payment button centered so we keep align here.
983 983
 print '<table class="centpercent left" id="tablepublicpayment">';
984 984
 print '<tr class="hideonsmartphone"><td colspan="2" align="left" class="opacitymedium">'.$langs->trans("ThisIsInformationOnPayment").' :</td></tr>'."\n";
985 985
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 		// Currency
1020 1020
 		print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1021 1021
 	} else {
1022
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1022
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1023 1023
 		print '<input type="hidden" name="amount" value="'.$amount.'">';
1024 1024
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1025 1025
 	}
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 		// Currency
1121 1121
 		print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1122 1122
 	} else {
1123
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1123
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1124 1124
 		print '<input type="hidden" name="amount" value="'.$amount.'">';
1125 1125
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1126 1126
 	}
@@ -1252,12 +1252,12 @@  discard block
 block discarded – undo
1252 1252
 			print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
1253 1253
 			print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1254 1254
 		} else {
1255
-			print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1255
+			print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1256 1256
 			print '<input type="hidden" name="amount" value="'.$amount.'">';
1257 1257
 			print '<input type="hidden" name="newamount" value="'.$amount.'">';
1258 1258
 		}
1259 1259
 	} else {
1260
-		print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1260
+		print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1261 1261
 	}
1262 1262
 	print '<input type="hidden" name="currency" value="'.$currency.'">';
1263 1263
 	print '</td></tr>'."\n";
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 		// Currency
1462 1462
 		print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1463 1463
 	} else {
1464
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1464
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1465 1465
 		print '<input type="hidden" name="amount" value="'.$amount.'">';
1466 1466
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1467 1467
 	}
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
1664 1664
 	// This place no longer allows amount edition
1665 1665
 	if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) {
1666
-		print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1666
+		print ' - <a href="'.getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1667 1667
 	}
1668 1668
 	print '</td><td class="CTableRow2">';
1669 1669
 	if (getDolGlobalString('MEMBER_MIN_AMOUNT') && $amount) {
@@ -1679,9 +1679,9 @@  discard block
 block discarded – undo
1679 1679
 			print '<input type="text" class="width75" name="newamount" value="'.price($amount, 1, $langs, 1, -1, -1).'">';
1680 1680
 		}
1681 1681
 	} else {
1682
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1682
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1683 1683
 		if ($minimumamount > $amount) {
1684
-			print ' &nbsp; <span class="opacitymedium small">'. $langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>';
1684
+			print ' &nbsp; <span class="opacitymedium small">'.$langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>';
1685 1685
 		}
1686 1686
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1687 1687
 	}
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
 			print ' ('.$langs->trans("ToComplete");
1803 1803
 		}
1804 1804
 		if (getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO')) {
1805
-			print ' - <a href="' . getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1805
+			print ' - <a href="'.getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1806 1806
 		}
1807 1807
 		if (!getDolGlobalString('DONATION_NEWFORM_AMOUNT')) {
1808 1808
 			print ')';
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
 			$valtoshow = max(getDolGlobalString('DONATION_MIN_AMOUNT'), $valtoshow);
1841 1841
 			$amount = $valtoshow;
1842 1842
 		}
1843
-		print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1843
+		print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1844 1844
 		print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
1845 1845
 		print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
1846 1846
 	}
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
 	print '</b>';
1917 1917
 	print '</td></tr>'."\n";
1918 1918
 
1919
-	if (! is_object($attendee->project)) {
1919
+	if (!is_object($attendee->project)) {
1920 1920
 		$text = 'ErrorProjectNotFound';
1921 1921
 	} else {
1922 1922
 		$text = $langs->trans("PaymentEvent").' - '.$attendee->project->title;
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
1934 1934
 	print '</td><td class="CTableRow2">';
1935 1935
 	$valtoshow = $amount;
1936
-	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1936
+	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1937 1937
 	print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
1938 1938
 	print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
1939 1939
 	print '<input type="hidden" name="currency" value="'.$currency.'">';
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
2018 2018
 	print '</td><td class="CTableRow2">';
2019 2019
 	$valtoshow = $amount;
2020
-	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
2020
+	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
2021 2021
 	print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
2022 2022
 	print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
2023 2023
 	print '<input type="hidden" name="currency" value="'.$currency.'">';
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
 
2269 2269
 		//print '<br>';
2270 2270
 
2271
-		print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = ' . getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = ' . getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n";
2271
+		print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = '.getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = '.getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n";
2272 2272
 		print '<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">'."\n";
2273 2273
 
2274 2274
 		print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
Please login to merge, or discard this patch.
htdocs/workstation/class/api_workstations.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		}
130 130
 
131 131
 		//this query will return total products with the filters given
132
-		$sqlTotals =  str_replace('SELECT t.rowid, t.ref', 'SELECT count(t.rowid) as total', $sql);
132
+		$sqlTotals = str_replace('SELECT t.rowid, t.ref', 'SELECT count(t.rowid) as total', $sql);
133 133
 
134 134
 		$sql .= $this->db->order($sortfield, $sortorder);
135 135
 		if ($limit) {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			$obj_ret['pagination'] = array(
175 175
 				'total' => (int) $total,
176 176
 				'page' => $page, //count starts from 0
177
-				'page_count' => ceil((int) $total/$limit),
177
+				'page_count' => ceil((int) $total / $limit),
178 178
 				'limit' => $limit
179 179
 			);
180 180
 		}
Please login to merge, or discard this patch.
test/phpunit/SecurityTest.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -24,36 +24,36 @@  discard block
 block discarded – undo
24 24
  *		\remarks	To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 
31
-if (! defined('NOREQUIRESOC')) {
31
+if (!defined('NOREQUIRESOC')) {
32 32
 	define('NOREQUIRESOC', '1');
33 33
 }
34
-if (! defined('NOCSRFCHECK')) {
34
+if (!defined('NOCSRFCHECK')) {
35 35
 	define('NOCSRFCHECK', '1');
36 36
 }
37
-if (! defined('NOTOKENRENEWAL')) {
37
+if (!defined('NOTOKENRENEWAL')) {
38 38
 	define('NOTOKENRENEWAL', '1');
39 39
 }
40
-if (! defined('NOREQUIREMENU')) {
40
+if (!defined('NOREQUIREMENU')) {
41 41
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
42 42
 }
43
-if (! defined('NOREQUIREHTML')) {
43
+if (!defined('NOREQUIREHTML')) {
44 44
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
45 45
 }
46
-if (! defined('NOREQUIREAJAX')) {
46
+if (!defined('NOREQUIREAJAX')) {
47 47
 	define('NOREQUIREAJAX', '1');
48 48
 }
49
-if (! defined("NOLOGIN")) {
50
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
49
+if (!defined("NOLOGIN")) {
50
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
51 51
 }
52
-if (! defined("NOSESSION")) {
52
+if (!defined("NOSESSION")) {
53 53
 	define("NOSESSION", '1');
54 54
 }
55 55
 
56
-require_once dirname(__FILE__).'/../../htdocs/main.inc.php';	// We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
56
+require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
57 57
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
58 58
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
59 59
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 		$result = testSqlAndScriptInject($test, 0);
228 228
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee');
229 229
 
230
-		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">";		// Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
231
-		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">";	// Same
230
+		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
231
+		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">"; // Same
232 232
 
233 233
 		$test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>';
234 234
 		$result = testSqlAndScriptInject($test, 0);
@@ -262,21 +262,21 @@  discard block
 block discarded – undo
262 262
 		$result = testSqlAndScriptInject($test, 0);
263 263
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll');
264 264
 
265
-		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>';	// Add the char %F6 into the variable
265
+		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable
266 266
 		$result = testSqlAndScriptInject($test, 0);
267 267
 		//print "test=".$test." result=".$result."\n";
268 268
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm');
269 269
 
270 270
 
271 271
 		$test = "Text with ' encoded with the numeric html entity converted into text entity &#39; (like when submitted by CKEditor)";
272
-		$result = testSqlAndScriptInject($test, 0);	// result must be 0
272
+		$result = testSqlAndScriptInject($test, 0); // result must be 0
273 273
 		$this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not');
274 274
 
275 275
 		$test = '<a href="j&Tab;a&Tab;v&Tab;asc&NewLine;ri&Tab;pt:&lpar;a&Tab;l&Tab;e&Tab;r&Tab;t&Tab;(document.cookie)&rpar;">XSS</a>';
276 276
 		$result = testSqlAndScriptInject($test, 0);
277 277
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not');
278 278
 
279
-		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc";	// Add the char %F6 into the variable
279
+		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable
280 280
 		$result = testSqlAndScriptInject($test, 2);
281 281
 		//print "test=".$test." result=".$result."\n";
282 282
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char');
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function testGETPOST()
291 291
 	{
292
-		global $conf,$user,$langs,$db;
292
+		global $conf, $user, $langs, $db;
293 293
 		$conf = $this->savconf;
294 294
 		$user = $this->savuser;
295 295
 		$langs = $this->savlangs;
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		$_GET["param1"] = "222";
307 307
 		$_POST["param1"] = "333";
308 308
 		$_GET["param2"] = 'a/b#e(pr)qq-rr\cc';
309
-		$_GET["param3"] = '"&#110;a/b#e(pr)qq-rr\cc';    // Same than param2 + " and &#110;
309
+		$_GET["param3"] = '"&#110;a/b#e(pr)qq-rr\cc'; // Same than param2 + " and &#110;
310 310
 		$_GET["param4a"] = '..&#47;../dir';
311 311
 		$_GET["param4b"] = '..&#92;..\dirwindows';
312 312
 		$_GET["param4c"] = '\a123 \123 \u123 \x123';
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 		$_POST["param6"] = "&quot;&gt;<svg o&#110;load='console.log(&quot;123&quot;)'&gt;";
315 315
 		$_POST["param6b"] = '<<<../>../>../svg><<<../>../>../animate =alert(1)>abc';
316 316
 		$_GET["param7"] = '"c:\this is a path~1\aaa&#110; &#x&#x31;&#x31;&#x30;;" abc<bad>def</bad>';
317
-		$_POST["param8a"] = "Hacker<svg o&#110;load='console.log(&quot;123&quot;)'";	// html tag is not closed so it is not detected as html tag but is still harmfull
318
-		$_POST['param8b'] = '<img src=x onerror=alert(document.location) t=';		// this is html obfuscated by non closing tag
317
+		$_POST["param8a"] = "Hacker<svg o&#110;load='console.log(&quot;123&quot;)'"; // html tag is not closed so it is not detected as html tag but is still harmfull
318
+		$_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag
319 319
 		$_POST['param8c'] = '< with space after is ok';
320 320
 		$_POST['param8d'] = '<abc123 is html to clean';
321
-		$_POST['param8e'] = '<123abc is not html to clean';	// other similar case: '<2021-12-12'
321
+		$_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12'
322 322
 		$_POST['param8f'] = 'abc<<svg <><<animate onbegin=alert(document.domain) a';
323 323
 		$_POST["param9"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\'';
324 324
 		$_POST["param10"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\'';
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 
339 339
 
340 340
 
341
-		$result = GETPOST('id', 'int');              // Must return nothing
341
+		$result = GETPOST('id', 'int'); // Must return nothing
342 342
 		print __METHOD__." result=".$result."\n";
343 343
 		$this->assertEquals('', $result);
344 344
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 		// Test with alpha
354 354
 
355
-		$result = GETPOST("param0", 'alpha');		// a simple format, so " completely removed
355
+		$result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed
356 356
 		$resultexpected = 'A real string with aaa and and \' and & inside content';
357 357
 		print __METHOD__." result=".$result."\n";
358 358
 		$this->assertEquals($resultexpected, $result, 'Test on param0');
@@ -361,19 +361,19 @@  discard block
 block discarded – undo
361 361
 		print __METHOD__." result=".$result."\n";
362 362
 		$this->assertEquals('a/b#e(pr)qq-rr\cc', $result, 'Test on param2');
363 363
 
364
-		$result = GETPOST("param3", 'alpha');  // Must return string sanitized from char "
364
+		$result = GETPOST("param3", 'alpha'); // Must return string sanitized from char "
365 365
 		print __METHOD__." result=".$result."\n";
366 366
 		$this->assertEquals('na/b#e(pr)qq-rr\cc', $result, 'Test on param3');
367 367
 
368
-		$result = GETPOST("param4a", 'alpha');  // Must return string sanitized from ../
368
+		$result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../
369 369
 		print __METHOD__." result=".$result."\n";
370 370
 		$this->assertEquals('dir', $result);
371 371
 
372
-		$result = GETPOST("param4b", 'alpha');  // Must return string sanitized from ../
372
+		$result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../
373 373
 		print __METHOD__." result=".$result."\n";
374 374
 		$this->assertEquals('dirwindows', $result);
375 375
 
376
-		$result = GETPOST("param4c", 'alpha');  // Must return string sanitized from ../
376
+		$result = GETPOST("param4c", 'alpha'); // Must return string sanitized from ../
377 377
 		print __METHOD__." result=".$result."\n";
378 378
 		$this->assertEquals('\a123 /123 /u123 /x123', $result);
379 379
 
@@ -383,19 +383,19 @@  discard block
 block discarded – undo
383 383
 		print __METHOD__." result=".$result."\n";
384 384
 		$this->assertEquals($result, $_GET["param1"]);
385 385
 
386
-		$result = GETPOST("param2", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
386
+		$result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
387 387
 		print __METHOD__." result=".$result."\n";
388 388
 		$this->assertEquals($result, '');
389 389
 
390
-		$result = GETPOST("param3", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
390
+		$result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
391 391
 		print __METHOD__." result=".$result."\n";
392 392
 		$this->assertEquals($result, '');
393 393
 
394
-		$result = GETPOST("param4a", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
394
+		$result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
395 395
 		print __METHOD__." result=".$result."\n";
396 396
 		$this->assertEquals('', $result);
397 397
 
398
-		$result = GETPOST("param4b", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
398
+		$result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
399 399
 		print __METHOD__." result=".$result."\n";
400 400
 		$this->assertEquals('', $result);
401 401
 
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 		print __METHOD__." result=".$result."\n";
507 507
 		$this->assertEquals("Text with ' encoded with the numeric html entity converted into text entity &#39; (like when submitted by CKEditor)", $result, 'Test 14');
508 508
 
509
-		$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
509
+		$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
510 510
 		print __METHOD__." result=".$result."\n";
511
-		$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15');	// The GETPOST return a harmull string
511
+		$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string
512 512
 
513 513
 		$result = GETPOST("param19", 'restricthtml');
514 514
 		print __METHOD__." result=".$result."\n";
@@ -525,17 +525,17 @@  discard block
 block discarded – undo
525 525
 		print __METHOD__." result for param0=".$result."\n";
526 526
 		$this->assertEquals($resultexpected, $result, 'Test on param0');
527 527
 
528
-		$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
528
+		$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
529 529
 		print __METHOD__." result for param15=".$result."\n";
530 530
 		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
531 531
 		//$this->assertEquals('<img onerror> src=&gt;0xbeefed', $result, 'Test 15b');	// ... on other PHP and libxml versions, we got a HTML that has been cleaned
532 532
 
533
-		$result = GETPOST("param6", 'restricthtml');		// param6 = "&quot;&gt;<svg o&#110;load='console.log(&quot;123&quot;)'&gt;"
533
+		$result = GETPOST("param6", 'restricthtml'); // param6 = "&quot;&gt;<svg o&#110;load='console.log(&quot;123&quot;)'&gt;"
534 534
 		print __METHOD__." result for param6=".$result." - before=".$_POST["param6"]."\n";
535 535
 		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
536 536
 		//$this->assertEquals('"&gt;', $result);										// ... on other PHP and libxml versions, we got a HTML that has been cleaned
537 537
 
538
-		$result = GETPOST("param7", 'restricthtml');		// param7 = "c:\this is a path~1\aaa&#110; &#x&#x31;&#x31;&#x30;;" abc<bad>def</bad>
538
+		$result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaa&#110; &#x&#x31;&#x31;&#x30;;" abc<bad>def</bad>
539 539
 		print __METHOD__." result param7 = ".$result."\n";
540 540
 		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
541 541
 		//$this->assertEquals('"c:\this is a path~1\aaan 110;" abcdef', $result);		// ... on other PHP and libxml versions, we got a HTML that has been cleaned
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 			print __METHOD__." result for param0=".$result."\n";
553 553
 			$this->assertEquals($resultexpected, $result, 'Test on param0');
554 554
 
555
-			$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
555
+			$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
556 556
 			print __METHOD__." result=".$result."\n";
557 557
 
558 558
 			$result = GETPOST("param6", 'restricthtml');
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 			print __METHOD__." result for param0=".$result."\n";
577 577
 			$this->assertEquals($resultexpected, $result, 'Test on param0');
578 578
 
579
-			$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
579
+			$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
580 580
 			print __METHOD__." result=".$result."\n";
581 581
 
582 582
 			$result = GETPOST("param6", 'restricthtml');
@@ -789,21 +789,21 @@  discard block
 block discarded – undo
789 789
 	{
790 790
 		global $conf;
791 791
 
792
-		$genpass1 = getRandomPassword(true);				// Should be a string return by dol_hash (if no option set, will be md5)
792
+		$genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5)
793 793
 		print __METHOD__." genpass1=".$genpass1."\n";
794 794
 		$this->assertEquals(strlen($genpass1), 32);
795 795
 
796
-		$genpass1 = getRandomPassword(true, array('I'));	// Should be a string return by dol_hash (if no option set, will be md5)
796
+		$genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5)
797 797
 		print __METHOD__." genpass1=".$genpass1."\n";
798 798
 		$this->assertEquals(strlen($genpass1), 32);
799 799
 
800 800
 		$conf->global->USER_PASSWORD_GENERATED = 'None';
801
-		$genpass2 = getRandomPassword(false);				// Should return an empty string
801
+		$genpass2 = getRandomPassword(false); // Should return an empty string
802 802
 		print __METHOD__." genpass2=".$genpass2."\n";
803 803
 		$this->assertEquals($genpass2, '');
804 804
 
805 805
 		$conf->global->USER_PASSWORD_GENERATED = 'Standard';
806
-		$genpass3 = getRandomPassword(false);				// Should return a password of 12 chars
806
+		$genpass3 = getRandomPassword(false); // Should return a password of 12 chars
807 807
 		print __METHOD__." genpass3=".$genpass3."\n";
808 808
 		$this->assertEquals(strlen($genpass3), 12);
809 809
 
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 	 */
818 818
 	public function testRestrictedArea()
819 819
 	{
820
-		global $conf,$user,$langs,$db;
820
+		global $conf, $user, $langs, $db;
821 821
 		$conf = $this->savconf;
822 822
 		$user = $this->savuser;
823 823
 		$langs = $this->savlangs;
@@ -848,40 +848,40 @@  discard block
 block discarded – undo
848 848
 		$tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']);
849 849
 		$this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should.");
850 850
 
851
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
852
-		$tmp = getURLContent($url, 'GET', '', 0);	// We do NOT follow
851
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
852
+		$tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow
853 853
 		print __METHOD__." url=".$url."\n";
854 854
 		$this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response');
855 855
 
856
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
857
-		$tmp = getURLContent($url);		// We DO follow a page with return 300 so result should be 200
856
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
857
+		$tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200
858 858
 		print __METHOD__." url=".$url."\n";
859 859
 		$this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code']));
860 860
 
861 861
 		$url = 'http://localhost';
862
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
862
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
863 863
 		print __METHOD__." url=".$url."\n";
864
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL');	// Test we receive an error because localtest.me is not an external URL
864
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
865 865
 
866 866
 		$url = 'http://127.0.0.1';
867
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
867
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
868 868
 		print __METHOD__." url=".$url."\n";
869
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.0.1 is not an external URL
869
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
870 870
 
871 871
 		$url = 'http://127.0.2.1';
872
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
872
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
873 873
 		print __METHOD__." url=".$url."\n";
874
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.2.1 is not an external URL
874
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
875 875
 
876 876
 		$url = 'https://169.254.0.1';
877
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
877
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
878 878
 		print __METHOD__." url=".$url."\n";
879
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 169.254.0.1 is not an external URL
879
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
880 880
 
881 881
 		$url = 'http://[::1]';
882
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
882
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
883 883
 		print __METHOD__." url=".$url."\n";
884
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because [::1] is not an external URL
884
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
885 885
 
886 886
 		/*$url = 'localtest.me';
887 887
 		 $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
@@ -890,9 +890,9 @@  discard block
 block discarded – undo
890 890
 		 */
891 891
 
892 892
 		$url = 'http://192.0.0.192';
893
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL but on an IP in blacklist
893
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist
894 894
 		print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n";
895
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not');	// Test we receive an error because ip is in blacklist
895
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist
896 896
 
897 897
 		return 0;
898 898
 	}
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 	 */
905 905
 	public function testDolSanitizeUrl()
906 906
 	{
907
-		global $conf,$user,$langs,$db;
907
+		global $conf, $user, $langs, $db;
908 908
 		$conf = $this->savconf;
909 909
 		$user = $this->savuser;
910 910
 		$langs = $this->savlangs;
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 	 */
931 931
 	public function testDolSanitizeEmail()
932 932
 	{
933
-		global $conf,$user,$langs,$db;
933
+		global $conf, $user, $langs, $db;
934 934
 		$conf = $this->savconf;
935 935
 		$user = $this->savuser;
936 936
 		$langs = $this->savlangs;
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 	 */
961 961
 	public function testDolSanitizeFileName()
962 962
 	{
963
-		global $conf,$user,$langs,$db;
963
+		global $conf, $user, $langs, $db;
964 964
 		$conf = $this->savconf;
965 965
 		$user = $this->savuser;
966 966
 		$langs = $this->savlangs;
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 	 */
984 984
 	public function testDolEval()
985 985
 	{
986
-		global $conf,$user,$langs,$db;
986
+		global $conf, $user, $langs, $db;
987 987
 		$conf = $this->savconf;
988 988
 		$user = $this->savuser;
989 989
 		$langs = $this->savlangs;
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
994 994
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
995 995
 
996
-		$result = dol_eval('1==\x01', 1, 0);	// Check that we can't make dol_eval on string containing \ char.
996
+		$result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char.
997 997
 		print "result0 = ".$result."\n";
998 998
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result);
999 999
 
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 		print "result13 = ".$result."\n";
1073 1073
 		$this->assertEquals('358080.38', $result);
1074 1074
 
1075
-		global $leftmenu;	// Used into strings to eval
1075
+		global $leftmenu; // Used into strings to eval
1076 1076
 
1077 1077
 		$leftmenu = 'AAA';
1078 1078
 		$result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1');
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		print "result17 = ".$result."\n";
1101 1101
 		$this->assertTrue($result);
1102 1102
 
1103
-		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0);	// Should return false and not a 'Bad string syntax to evaluate ...'
1103
+		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...'
1104 1104
 		print "result18 = ".$result."\n";
1105 1105
 		$this->assertFalse($result);
1106 1106
 
@@ -1130,12 +1130,12 @@  discard block
 block discarded – undo
1130 1130
 		global $conf;
1131 1131
 
1132 1132
 		// Set options for cleaning data
1133
-		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;	// disabled, does not work on HTML5 and some libxml versions
1133
+		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions
1134 1134
 		// Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible
1135 1135
 		if (extension_loaded('tidy') && class_exists("tidy")) {
1136 1136
 			$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
1137 1137
 		}
1138
-		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;	// disabled, does not work on HTML5 and some libxml versions
1138
+		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions
1139 1139
 
1140 1140
 
1141 1141
 
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1);
1149 1149
 		$result = dolPrintHTML($stringtotest);
1150 1150
 		print __METHOD__." result=".$result."\n";
1151
-		$this->assertEquals($stringfixed, $result, 'Error');    // Expected '' because should failed because login 'auto' does not exists
1151
+		$this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists
1152 1152
 
1153 1153
 
1154 1154
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
@@ -1205,11 +1205,11 @@  discard block
 block discarded – undo
1205 1205
 		$this->assertEquals('a', $result);
1206 1206
 
1207 1207
 		// Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range
1208
-		$arraytmp = array(0 => '&#9989;', 1 => '9989;');	// Encoded as decimal
1208
+		$arraytmp = array(0 => '&#9989;', 1 => '9989;'); // Encoded as decimal
1209 1209
 		$result = realCharForNumericEntities($arraytmp);
1210 1210
 		$this->assertEquals('✅', $result);
1211 1211
 
1212
-		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;');	// Encoded as hexadecimal
1212
+		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;'); // Encoded as hexadecimal
1213 1213
 		$result = realCharForNumericEntities($arraytmp);
1214 1214
 		$this->assertEquals('✅', $result);
1215 1215
 
@@ -1271,16 +1271,16 @@  discard block
 block discarded – undo
1271 1271
 		print __METHOD__." login=".$login."\n";
1272 1272
 		$this->assertEquals($login, '');
1273 1273
 
1274
-		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr'));            // Should works because admin/admin exists
1274
+		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists
1275 1275
 		print __METHOD__." login=".$login."\n";
1276 1276
 		$this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed');
1277 1277
 
1278
-		$login = checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr'));    // Should work because of second authentication method
1278
+		$login = checkLoginPassEntity('admin', 'admin', 1, array('http', 'dolibarr')); // Should work because of second authentication method
1279 1279
 		print __METHOD__." login=".$login."\n";
1280 1280
 		$this->assertEquals($login, 'admin');
1281 1281
 
1282 1282
 		$login = checkLoginPassEntity('admin', 'admin', 1, array('forceuser'));
1283 1283
 		print __METHOD__." login=".$login."\n";
1284
-		$this->assertEquals('', $login, 'Error');    // Expected '' because should failed because login 'auto' does not exists
1284
+		$this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists
1285 1285
 	}
1286 1286
 }
Please login to merge, or discard this patch.