Completed
Branch develop (860f89)
by
unknown
24:38
created
htdocs/admin/mails_senderprofile_list.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 
83 83
 // Default sort order (if not yet defined by previous GETPOST)
84 84
 if (!$sortfield) {
85
-	reset($object->fields);			// Reset is required to avoid key() to return null.
86
-	$sortfield = "t.position"; 		// Set here default search field. By default 1st field in definition.
85
+	reset($object->fields); // Reset is required to avoid key() to return null.
86
+	$sortfield = "t.position"; // Set here default search field. By default 1st field in definition.
87 87
 }
88 88
 if (!$sortorder) {
89 89
 	$sortorder = "ASC";
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 }
543 543
 
544 544
 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
545
-$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup
545
+$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
546 546
 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
547 547
 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
548 548
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
633 633
 		$cssforfield .= ($cssforfield ? ' ' : '').'right';
634 634
 	}
635
-	$cssforfield = preg_replace('/small\s*/', '', $cssforfield);	// the 'small' css must not be used for the title label
635
+	$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
636 636
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
637 637
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
638 638
 		$totalarray['nbfield']++;
Please login to merge, or discard this patch.
htdocs/core/modules/facture/doc/pdf_octopus.modules.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * Dolibarr version of the loaded document
79 79
 	 * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental'
80 80
 	 */
81
-	public $version = 'disabled';	// Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
81
+	public $version = 'disabled'; // Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
82 82
 
83 83
 	/**
84 84
 	 * @var int height for info total
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		}
248 248
 
249 249
 		if ($mysoc === null) {
250
-			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
250
+			dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR);
251 251
 			return;
252 252
 		}
253 253
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies", "compta"));
298 298
 		}
299 299
 
300
-		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE &&  !empty($object->situation_cycle_ref)))) {
300
+		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE && !empty($object->situation_cycle_ref)))) {
301 301
 			setEventMessage($langs->trans('WarningsObjectIsNotASituation'), 'warnings');
302 302
 			return 1;
303 303
 		}
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
 				$pdf->SetAutoPageBreak(1, 0);
417 417
 
418 418
 				// compute height for situation invoices
419
-				$this->heightforinfotot = 45;	// Height reserved to output the info and total part and payment part
419
+				$this->heightforinfotot = 45; // Height reserved to output the info and total part and payment part
420 420
 				if (!getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS') && $nbpayments > 0) {
421 421
 					$this->heightforinfotot += 4 * ($nbpayments + 3);
422 422
 				}
423 423
 				if ($nbprevsituation > 0) {
424 424
 					$this->heightforinfotot += 4 * ($nbprevsituation + 3);
425 425
 				}
426
-				$this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5));	// Height reserved to output the free text on last page
427
-				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);	// Height reserved to output the footer (value include bottom margin)
426
+				$this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page
427
+				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
428 428
 
429 429
 				if (class_exists('TCPDF')) {
430 430
 					$pdf->setPrintHeader(false);
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 					if (!empty($conf->mycompany->multidir_output[$object->entity])) {
439 439
 						$logodir = $conf->mycompany->multidir_output[$object->entity];
440 440
 					}
441
-					$pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
441
+					$pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
442 442
 					$this->tplidx = $pdf->importPage(1);
443 443
 				}
444 444
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 				// $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher
531 531
 
532 532
 				// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
533
-				$this->tab_top = 90 + $top_shift + $shipp_shift;		// top_shift is an addition for linked objects or addons (0 in most cases)
533
+				$this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
534 534
 				$this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
535 535
 
536 536
 				// You can add more thing under header here, if you increase $extra_under_address_shift too.
@@ -1040,11 +1040,11 @@  discard block
 block discarded – undo
1040 1040
 					if (!isset($this->tva[$vatrate])) {
1041 1041
 						$this->tva[$vatrate] = 0;
1042 1042
 					}
1043
-					$this->tva[$vatrate] += $tvaligne;	// ->tva is abandoned, we use now ->tva_array that is more complete
1043
+					$this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete
1044 1044
 					$vatcode = $object->lines[$i]->vat_src_code;
1045 1045
 					if (getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) {
1046 1046
 						if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) {
1047
-							$this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0;
1047
+							$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] = 0;
1048 1048
 						}
1049 1049
 						$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht);
1050 1050
 					} else {
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 				// Pagefoot
1137 1137
 				$this->_pagefoot($pdf, $object, $outputlangs);
1138 1138
 				if (method_exists($pdf, 'AliasNbPages')) {
1139
-					$pdf->AliasNbPages();  // @phan-suppress-current-line PhanUndeclaredMethod
1139
+					$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
1140 1140
 				}
1141 1141
 
1142 1142
 				$this->resumeLastPage($pdf, $object, 0, $tab_top, $outputlangs, $outputlangsbis);
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 			foreach ($this->tva_array as $tvakey => $tvaval) {
1373 1373
 				$pdf->SetFont('', '', $default_font_size - 2);
1374 1374
 				$pdf->SetXY($this->marge_gauche, $posy);
1375
-				$titre = round((float) $tvakey, 2) . "%";
1375
+				$titre = round((float) $tvakey, 2)."%";
1376 1376
 				$pdf->MultiCell(25, 4, $titre, 0, 'L');
1377 1377
 
1378 1378
 				$pdf->SetFont('', '', $default_font_size - 2);
@@ -1410,8 +1410,8 @@  discard block
 block discarded – undo
1410 1410
 			$posy = $pdf->GetY() + 4;
1411 1411
 		}
1412 1412
 
1413
-		$posxval = 52;	// Position of values of properties shown on left side
1414
-		$posxend = 110;	// End of x for text on left side
1413
+		$posxval = 52; // Position of values of properties shown on left side
1414
+		$posxend = 110; // End of x for text on left side
1415 1415
 		if ($this->page_largeur < 210) { // To work with US executive format
1416 1416
 			$posxend -= 10;
1417 1417
 		}
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 
1442 1442
 			$pdf->SetFont('', '', $default_font_size - 2);
1443 1443
 			$pdf->SetXY($posxval, $posy);
1444
-			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
1444
+			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
1445 1445
 			$pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L');
1446 1446
 
1447 1447
 			$posy = $pdf->GetY() + 3; // for 2 lines
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 						include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php';
1609 1609
 						$invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type);
1610 1610
 
1611
-						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0);
1611
+						$pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": ".$outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0);
1612 1612
 					}
1613 1613
 				}
1614 1614
 			}
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
 						if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
1795 1795
 							$vatrate .= '*';
1796 1796
 						}
1797
-						if (! isset($tvas[$vatrate])) {
1797
+						if (!isset($tvas[$vatrate])) {
1798 1798
 							$tvas[$vatrate] = 0;
1799 1799
 						}
1800 1800
 						$tvas[$vatrate] += $tvaligne;
@@ -2063,7 +2063,7 @@  discard block
 block discarded – undo
2063 2063
 		if (empty($hidetop)) {
2064 2064
 			// Show category of operations
2065 2065
 			if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) {
2066
-				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
2066
+				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
2067 2067
 				$pdf->SetXY($this->marge_gauche, $tab_top - 4);
2068 2068
 				$pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations);
2069 2069
 			}
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
 		$pdf->SetFont('', '', $default_font_size - 1);
2084 2084
 
2085 2085
 		// Output Rect
2086
-		$this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D');	// Rect prend une longueur en 3eme param et 4eme param
2086
+		$this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param
2087 2087
 
2088 2088
 		// situation invoice
2089 2089
 		$pdf->SetFont('', '', $default_font_size - 2);
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
 		$pdf->SetFont('', '', $default_font_size - 1);
2124 2124
 
2125 2125
 		if (empty($hidetop)) {
2126
-			$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
2126
+			$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
2127 2127
 		}
2128 2128
 	}
2129 2129
 
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
 			'overtitle' => array(
2701 2701
 				'textkey' => 'Chantier', // use lang key is useful in somme case with module
2702 2702
 				'align' => 'C',
2703
-				'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2703
+				'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2704 2704
 				'width' => 18
2705 2705
 			),
2706 2706
 		);
@@ -2725,13 +2725,13 @@  discard block
 block discarded – undo
2725 2725
 			),
2726 2726
 			'border-left' => true, // add left line separator
2727 2727
 			'overtitle' => array(
2728
-				'textkey' => 'S'.$derniere_situation->situation_counter . ' - ' . dol_print_date($derniere_situation->date, "%d/%m/%Y"),
2728
+				'textkey' => 'S'.$derniere_situation->situation_counter.' - '.dol_print_date($derniere_situation->date, "%d/%m/%Y"),
2729 2729
 				'align' => 'C',
2730
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2730
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2731 2731
 				'width' => 10 + 15 //current width + amount cell width
2732 2732
 			),
2733 2733
 		);
2734
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2734
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2735 2735
 			$this->cols['prev_progress']['status'] = true;
2736 2736
 		}
2737 2737
 
@@ -2746,7 +2746,7 @@  discard block
 block discarded – undo
2746 2746
 			),
2747 2747
 			'border-left' => true, // add left line separator
2748 2748
 		);
2749
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2749
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2750 2750
 			$this->cols['prev_progress_amount']['status'] = true;
2751 2751
 		}
2752 2752
 
@@ -2761,9 +2761,9 @@  discard block
 block discarded – undo
2761 2761
 			),
2762 2762
 			'border-left' => true, // add left line separator
2763 2763
 			'overtitle' => array(
2764
-				'textkey' => 'S'.$object->situation_counter . ' - ' . dol_print_date($object->date, "%d/%m/%Y"),
2764
+				'textkey' => 'S'.$object->situation_counter.' - '.dol_print_date($object->date, "%d/%m/%Y"),
2765 2765
 				'align' => 'C',
2766
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2766
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2767 2767
 				'width' => 10 + 15
2768 2768
 			),
2769 2769
 		);
@@ -2887,7 +2887,7 @@  discard block
 block discarded – undo
2887 2887
 
2888 2888
 		// Output Rect
2889 2889
 		// KEEPTHIS => Affiche les bords extérieurs
2890
-		$this->printRoundedRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D');	// Rect prend une longueur en 3eme param et 4eme param
2890
+		$this->printRoundedRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param
2891 2891
 
2892 2892
 		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top, $this->posx_cumul_anterieur - 1, $tab_top + $tab_height);
2893 2893
 		if (empty($hidetop)) {
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
 			$pdf->SetXY($this->marge_gauche + 10, $tab_top + 24 + $i);
2945 2945
 			$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalHT").' '.$TVatInfo['label'], '', 'L');
2946 2946
 
2947
-			if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2947
+			if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2948 2948
 				$pdf->SetXY($this->marge_gauche + 10, $tab_top + 28 + $i);
2949 2949
 				$pdf->MultiCell(80, 2, $outputlangs->transnoentities("VAT").' '.$TVatInfo['label'], '', 'L');
2950 2950
 			} else {
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
 				$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['HT'], 0, '', 1, -1, 2), '', 'R');
3009 3009
 
3010 3010
 				// Total TVA
3011
-				if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
3011
+				if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
3012 3012
 					$pdf->SetXY($x, $tab_top + 28 + $i);
3013 3013
 					$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['TVA'], 0, '', 1, -1, 2), '', 'R');
3014 3014
 				} else {
@@ -3086,7 +3086,7 @@  discard block
 block discarded – undo
3086 3086
 
3087 3087
 		$TDataSituation = array();
3088 3088
 
3089
-		if (! empty($facDerniereSituation)) {
3089
+		if (!empty($facDerniereSituation)) {
3090 3090
 			$TDataSituation['derniere_situation'] = $facDerniereSituation;
3091 3091
 			$TDataSituation['date_derniere_situation'] = $facDerniereSituation->date;
3092 3092
 		}
@@ -3095,9 +3095,9 @@  discard block
 block discarded – undo
3095 3095
 		$retenue_garantie_anterieure = 0;
3096 3096
 		// Init tous les champs à 0
3097 3097
 		$TDataSituation['cumul_anterieur'] = array(
3098
-			'HT' => 0,	//montant HT normal
3099
-			'TVA' => 0,   //montant de la TVA sur le HTnet
3100
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
3098
+			'HT' => 0, //montant HT normal
3099
+			'TVA' => 0, //montant de la TVA sur le HTnet
3100
+			'TTC' => 0, //montant TTC (HTnet + TVA)
3101 3101
 			'retenue_garantie' => 0,
3102 3102
 			'travaux_sup' => 0,
3103 3103
 			'HTnet' => 0, //montant HT
@@ -3127,7 +3127,7 @@  discard block
 block discarded – undo
3127 3127
 					$isFirstSituation = false;
3128 3128
 					if (!empty($l->fk_prev_id)) {
3129 3129
 						$prevSituationPercent = $l->get_prev_progress($previousInvoice->id, true);
3130
-					} elseif (! array_key_exists($i + 1, $TPreviousInvoices)) {
3130
+					} elseif (!array_key_exists($i + 1, $TPreviousInvoices)) {
3131 3131
 						$isFirstSituation = true;
3132 3132
 					}
3133 3133
 
@@ -3137,7 +3137,7 @@  discard block
 block discarded – undo
3137 3137
 
3138 3138
 					//1ere ligne
3139 3139
 					$amounttva = $calc_ht * ($ltvatx / 100);
3140
-					if (! isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3140
+					if (!isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3141 3141
 						$TDataSituation['cumul_anterieur'][$ltvatx]['HT'] = $calc_ht;
3142 3142
 						$TDataSituation['cumul_anterieur'][$ltvatx]['TVA'] = $amounttva;
3143 3143
 					} else {
@@ -3149,14 +3149,14 @@  discard block
 block discarded – undo
3149 3149
 					//le grand total de TVA
3150 3150
 					// $TDataSituation['cumul_anterieur']['TVA'] += $amounttva;
3151 3151
 
3152
-					if (empty($l->fk_prev_id) && ! $isFirstSituation) {
3152
+					if (empty($l->fk_prev_id) && !$isFirstSituation) {
3153 3153
 						// TODO: à clarifier, mais pour moi, un facture de situation précédente qui a des progressions à 0% c'est pas logique
3154 3154
 						$TDataSituation['cumul_anterieur']['travaux_sup'] += $calc_ht;
3155 3155
 					}
3156 3156
 				}
3157 3157
 			}
3158 3158
 
3159
-			if (! empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3159
+			if (!empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3160 3160
 				$retenue_garantie_anterieure += $previousInvoice->getRetainedWarrantyAmount();
3161 3161
 			}
3162 3162
 
@@ -3170,7 +3170,7 @@  discard block
 block discarded – undo
3170 3170
 		// print json_encode($facDerniereSituation->lines);exit;
3171 3171
 		$TDataSituation['current'] = $this->btpGetInvoiceAmounts($object->id);
3172 3172
 
3173
-		if (! empty($facDerniereSituation->lines)) {
3173
+		if (!empty($facDerniereSituation->lines)) {
3174 3174
 			$TFacLinesKey = array_keys($facDerniereSituation->lines);
3175 3175
 			$TObjectLinesKey = array_keys($object->lines);
3176 3176
 			$TDiffKey = array_diff($TObjectLinesKey, $TFacLinesKey);
@@ -3382,16 +3382,16 @@  discard block
 block discarded – undo
3382 3382
 		$facDerniereSituation = $TPreviousInvoices[0];
3383 3383
 
3384 3384
 		$ret = array(
3385
-			'HT' => 0,	//montant HT normal
3385
+			'HT' => 0, //montant HT normal
3386 3386
 			'HTnet' => 0, //montant HT
3387
-			'TVA' => 0,   //montant de la TVA sur le HTnet
3388
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
3387
+			'TVA' => 0, //montant de la TVA sur le HTnet
3388
+			'TTC' => 0, //montant TTC (HTnet + TVA)
3389 3389
 			'retenue_garantie' => 0,
3390 3390
 			'travaux_sup' => 0,
3391 3391
 			'total_a_payer' => 0 //montant "a payer" sur la facture
3392 3392
 		);
3393 3393
 
3394
-		if (! empty($facDerniereSituation)) {
3394
+		if (!empty($facDerniereSituation)) {
3395 3395
 			$ret['derniere_situation'] = $facDerniereSituation;
3396 3396
 			$ret['date_derniere_situation'] = $facDerniereSituation->date;
3397 3397
 		}
@@ -3525,7 +3525,7 @@  discard block
 block discarded – undo
3525 3525
 			$label = $outputlangs->transnoentities("SituationInvoiceTotalProposal");
3526 3526
 			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy + 1);
3527 3527
 
3528
-			$amount = price($sign * ($total_ht + (! empty($propal->remise) ? $propal->remise : 0)));
3528
+			$amount = price($sign * ($total_ht + (!empty($propal->remise) ? $propal->remise : 0)));
3529 3529
 			$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1);
3530 3530
 
3531 3531
 			$pdf->SetFont('', '', $default_font_size - 1);
@@ -3568,7 +3568,7 @@  discard block
 block discarded – undo
3568 3568
 
3569 3569
 		$force_to_zero = false;
3570 3570
 
3571
-		$idinv = 0;//count($previousinvoices);
3571
+		$idinv = 0; //count($previousinvoices);
3572 3572
 		while ($idinv < count($previousinvoices)) {
3573 3573
 			$invoice = $previousinvoices[$idinv];
3574 3574
 
@@ -3590,7 +3590,7 @@  discard block
 block discarded – undo
3590 3590
 				$force_to_zero = true;
3591 3591
 			}
3592 3592
 
3593
-			$ref .= ' - '. $invoice->ref;
3593
+			$ref .= ' - '.$invoice->ref;
3594 3594
 			$ref .= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')';
3595 3595
 			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $ref, 0, 'L', 0);
3596 3596
 
@@ -3621,7 +3621,7 @@  discard block
 block discarded – undo
3621 3621
 				if (($invoice->lines[$i]->info_bits & 0x01) == 0x01) {
3622 3622
 					$vatrate .= '*';
3623 3623
 				}
3624
-				if (! isset($tvas[$vatrate])) {
3624
+				if (!isset($tvas[$vatrate])) {
3625 3625
 					$tvas[$vatrate] = 0;
3626 3626
 				}
3627 3627
 				$tvas[$vatrate] += $tvaligne;
@@ -3799,7 +3799,7 @@  discard block
 block discarded – undo
3799 3799
 						$pdf->SetXY($posx + $width4, $posy + $height * $index + $y);
3800 3800
 						$pdf->MultiCell($width4, $height - 1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0);
3801 3801
 						$pdf->SetXY($posx + $width4 * 2, $posy + $height * $index + $y);
3802
-						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $payment['type']);
3802
+						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$payment['type']);
3803 3803
 
3804 3804
 						$pdf->MultiCell($width4, $height - 1, $oper, 0, 'L', 0);
3805 3805
 						$pdf->SetXY($posx + $width4 * 3, $posy + $height * $index + $y);
@@ -3830,7 +3830,7 @@  discard block
 block discarded – undo
3830 3830
 					$this->_pagehead($pdf, $object, 0, $outputlangs);
3831 3831
 				}
3832 3832
 				$pdf->setPage($pageposafter + 1);
3833
-				$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3833
+				$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3834 3834
 
3835 3835
 				$posy = $this->tab_top_newpage + 1;
3836 3836
 			} else {
@@ -3862,7 +3862,7 @@  discard block
 block discarded – undo
3862 3862
 
3863 3863
 		$posy += 10;
3864 3864
 
3865
-		$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3865
+		$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3866 3866
 
3867 3867
 		$pdf->SetTextColor(0, 0, 60);
3868 3868
 		$pdf->SetFont('', '', $default_font_size - 1);
Please login to merge, or discard this patch.
htdocs/projet/tasks/time.php 1 patch
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 // Load Dolibarr environment
35 35
 require '../../main.inc.php';
36
-require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
40
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
41
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
40
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php';
44 44
 
45 45
 /**
46 46
  * @var Conf $conf
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
177 177
 }
178 178
 
179
-include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
179
+include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
180 180
 
181 181
 // Purge search criteria
182 182
 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 }
359 359
 
360 360
 if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer'))) {
361
-	$object->fetchTimeSpent(GETPOSTINT('lineid'));    // load properties like $object->timespent_xxx
361
+	$object->fetchTimeSpent(GETPOSTINT('lineid')); // load properties like $object->timespent_xxx
362 362
 
363 363
 	if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
364
-		$result = $object->delTimeSpent($user);    // delete line with $object->timespent_id
364
+		$result = $object->delTimeSpent($user); // delete line with $object->timespent_id
365 365
 
366 366
 		if ($result < 0) {
367 367
 			$langs->load("errors");
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		if (count($tasksarray) > 0) {
382 382
 			$id = $tasksarray[0]->id;
383 383
 		} else {
384
-			header("Location: " . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . ($withproject ? '&withproject=1' : '') . (empty($mode) ? '' : '&mode=' . $mode));
384
+			header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode));
385 385
 			exit;
386 386
 		}
387 387
 	}
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 	if (!($projectstatic->thirdparty->id > 0)) {
419 419
 		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors');
420 420
 	} else {
421
-		include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
422
-		include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
423
-		include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
421
+		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
422
+		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
423
+		include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
424 424
 
425 425
 		$tmpinvoice = new Facture($db);
426 426
 		$tmptimespent = new Task($db);
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 				$arrayoftasks = array();
487 487
 				foreach ($toselect as $key => $value) {
488 488
 					// Get userid, timepent
489
-					$object->fetchTimeSpent($value);    // $value is ID of 1 line in timespent table
489
+					$object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table
490 490
 					$arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;
491 491
 					$arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
492 492
 				}
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 						}
560 560
 
561 561
 						// Add lines
562
-						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject);
562
+						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject);
563 563
 						if ($lineid < 0) {
564 564
 							$error++;
565 565
 							setEventMessages(null, $tmpinvoice->errors, 'errors');
@@ -592,16 +592,16 @@  discard block
 block discarded – undo
592 592
 
593 593
 					$arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration;
594 594
 					$arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm;
595
-					$arrayoftasks[$object->timespent_id]['note'] = $ftask->ref . ' - ' . $ftask->label . ' - ' . $username;
595
+					$arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username;
596 596
 					$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $object->timespent_note);
597 597
 
598 598
 					if (!empty($withdetail)) {
599 599
 						if (!empty($object->timespent_withhour)) {
600
-							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_datehour));
600
+							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_datehour));
601 601
 						} else {
602
-							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_date));
602
+							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_date));
603 603
 						}
604
-						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration") . ': ' . convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY));
604
+						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration").': '.convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY));
605 605
 					}
606 606
 					$arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user;
607 607
 					$arrayoftasks[$object->timespent_id]['fk_product'] = $object->timespent_fk_product;
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 				$arrayoftasks = array();
680 680
 				foreach ($toselect as $key => $value) {
681 681
 					// Get userid, timepent
682
-					$object->fetchTimeSpent($value);        // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object)
682
+					$object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object)
683 683
 					// $object->id is now the task id
684 684
 					$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;
685 685
 					$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 						// Add lines
756 756
 						$date_start = '';
757 757
 						$date_end = '';
758
-						$lineName = $ftask->ref . ' - ' . $ftask->label;
758
+						$lineName = $ftask->ref.' - '.$ftask->label;
759 759
 						$lineid = $tmpinvoice->addline($lineName, $pu_ht_for_task, price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject, $date_start, $date_end, 0, 0, '', 'HT', 0, 1, -1, 0, '', 0, 0, null, $pa_ht);
760 760
 						if ($lineid < 0) {
761 761
 							$error++;
@@ -765,8 +765,8 @@  discard block
 block discarded – undo
765 765
 
766 766
 						if (!$error) {
767 767
 							// Update lineid into line of timespent
768
-							$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'element_time SET invoice_line_id = ' . ((int) $lineid) . ', invoice_id = ' . ((int) $tmpinvoice->id);
769
-							$sql .= ' WHERE rowid IN (' . $db->sanitize(implode(',', $toselect)) . ')';
768
+							$sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id);
769
+							$sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')';
770 770
 							$result = $db->query($sql);
771 771
 							if (!$result) {
772 772
 								$error++;
@@ -802,12 +802,12 @@  discard block
 block discarded – undo
802 802
 	if (!($projectstatic->thirdparty->id > 0)) {
803 803
 		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateIntervention"), null, 'errors');
804 804
 	} else {
805
-		include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
806
-		include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
807
-		include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
805
+		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
806
+		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
807
+		include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
808 808
 
809 809
 
810
-		require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
810
+		require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
811 811
 		$tmpinter = new Fichinter($db);
812 812
 		$tmptimespent = new Task($db);
813 813
 		$fuser = new User($db);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 		$tmpinter->socid = $projectstatic->thirdparty->id;
820 820
 		$tmpinter->date = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
821 821
 		$tmpinter->fk_project = $projectstatic->id;
822
-		$tmpinter->description = $projectstatic->title . (!empty($projectstatic->description) ? '-' . $projectstatic->label : '');
822
+		$tmpinter->description = $projectstatic->title.(!empty($projectstatic->description) ? '-'.$projectstatic->label : '');
823 823
 
824 824
 		if ($interToUse) {
825 825
 			$tmpinter->fetch($interToUse);
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 				$qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
853 853
 
854 854
 				// Add lines
855
-				$lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label . (!empty($value['note']) ? ' - ' . $value['note'] : ''), $value['date'], $value['timespent']);
855
+				$lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label.(!empty($value['note']) ? ' - '.$value['note'] : ''), $value['date'], $value['timespent']);
856 856
 			}
857 857
 		}
858 858
 
@@ -883,9 +883,9 @@  discard block
 block discarded – undo
883 883
 //$result = $projectstatic->fetch($object->fk_project);
884 884
 $arrayofselected = is_array($toselect) ? $toselect : array();
885 885
 
886
-$title = $object->ref . ' - ' . $langs->trans("TimeSpent");
886
+$title = $object->ref.' - '.$langs->trans("TimeSpent");
887 887
 if (!empty($withproject)) {
888
-	$title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': ' . $projectstatic->ref : '');
888
+	$title .= ' | '.$langs->trans("Project").(!empty($projectstatic->ref) ? ': '.$projectstatic->ref : '');
889 889
 }
890 890
 $help_url = '';
891 891
 
@@ -934,13 +934,13 @@  discard block
 block discarded – undo
934 934
 
935 935
 			$param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : '');
936 936
 			if ($search_user) {
937
-				$param .= '&search_user=' . ((int) $search_user);
937
+				$param .= '&search_user='.((int) $search_user);
938 938
 			}
939 939
 			if ($search_month) {
940
-				$param .= '&search_month=' . ((int) $search_month);
940
+				$param .= '&search_month='.((int) $search_month);
941 941
 			}
942 942
 			if ($search_year) {
943
-				$param .= '&search_year=' . ((int) $search_year);
943
+				$param .= '&search_year='.((int) $search_year);
944 944
 			}
945 945
 
946 946
 			// Project card
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
 			$morehtmlref .= $projectstatic->title;
953 953
 			// Thirdparty
954 954
 			if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
955
-				$morehtmlref .= '<br>' . $projectstatic->thirdparty->getNomUrl(1, 'project');
955
+				$morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
956 956
 			}
957 957
 			$morehtmlref .= '</div>';
958 958
 
959 959
 			// Define a complementary filter for search of next/prev ref.
960 960
 			if (!$user->hasRight('projet', 'all', 'lire')) {
961 961
 				$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
962
-				$projectstatic->next_prev_filter = "rowid:IN:" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
962
+				$projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
963 963
 			}
964 964
 
965 965
 			dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
@@ -977,25 +977,25 @@  discard block
 block discarded – undo
977 977
 				print '</td>';
978 978
 				print '<td>';
979 979
 				if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
980
-					print '<input type="checkbox" disabled name="usage_opportunity"' . (GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')) . '"> ';
980
+					print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
981 981
 					$htmltext = $langs->trans("ProjectFollowOpportunity");
982 982
 					print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
983 983
 					print '<br>';
984 984
 				}
985 985
 				if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
986
-					print '<input type="checkbox" disabled name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')) . '"> ';
986
+					print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
987 987
 					$htmltext = $langs->trans("ProjectFollowTasks");
988 988
 					print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
989 989
 					print '<br>';
990 990
 				}
991 991
 				if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
992
-					print '<input type="checkbox" disabled name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')) . '"> ';
992
+					print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
993 993
 					$htmltext = $langs->trans("ProjectBillTimeDescription");
994 994
 					print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
995 995
 					print '<br>';
996 996
 				}
997 997
 				if (isModEnabled('eventorganization')) {
998
-					print '<input type="checkbox" disabled name="usage_organize_event"' . (GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')) . '"> ';
998
+					print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> ';
999 999
 					$htmltext = $langs->trans("EventOrganizationDescriptionLong");
1000 1000
 					print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
1001 1001
 				}
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 			}
1004 1004
 
1005 1005
 			// Visibility
1006
-			print '<tr><td class="titlefield">' . $langs->trans("Visibility") . '</td><td>';
1006
+			print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
1007 1007
 			if ($projectstatic->public) {
1008 1008
 				print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
1009 1009
 				print $langs->trans('SharedProject');
@@ -1014,14 +1014,14 @@  discard block
 block discarded – undo
1014 1014
 			print '</td></tr>';
1015 1015
 
1016 1016
 			// Budget
1017
-			print '<tr><td>' . $langs->trans("Budget") . '</td><td>';
1017
+			print '<tr><td>'.$langs->trans("Budget").'</td><td>';
1018 1018
 			if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) {
1019
-				print '<span class="amount">' . price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency) . '</span>';
1019
+				print '<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
1020 1020
 			}
1021 1021
 			print '</td></tr>';
1022 1022
 
1023 1023
 			// Date start - end project
1024
-			print '<tr><td>' . $langs->trans("Dates") . '</td><td>';
1024
+			print '<tr><td>'.$langs->trans("Dates").'</td><td>';
1025 1025
 			$start = dol_print_date($projectstatic->date_start, 'day');
1026 1026
 			print($start ? $start : '?');
1027 1027
 			$end = dol_print_date($projectstatic->date_end, 'day');
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 			$cols = 2;
1037 1037
 			$savobject = $object;
1038 1038
 			$object = $projectstatic;
1039
-			include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
1039
+			include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1040 1040
 			$object = $savobject;
1041 1041
 
1042 1042
 			print '</table>';
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
 			// Categories
1056 1056
 			if (isModEnabled('category')) {
1057
-				print '<tr><td class="valignmiddle">' . $langs->trans("Categories") . '</td><td>';
1057
+				print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
1058 1058
 				print $form->showCategories($projectstatic->id, 'project', 1);
1059 1059
 				print "</td></tr>";
1060 1060
 			}
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 
1084 1084
 				if (!empty($projectidforalltimes)) {
1085 1085
 					// We are on tab 'Time Spent' of project
1086
-					$backtourl = $_SERVER['PHP_SELF'] . '?projectid=' . $projectstatic->id . ($withproject ? '&withproject=1' : '');
1087
-					$linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . '&projectid=' . $projectstatic->id . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl);
1086
+					$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : '');
1087
+					$linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl);
1088 1088
 				} else {
1089 1089
 					// We are on tab 'Time Spent' of task
1090
-					$backtourl = $_SERVER['PHP_SELF'] . '?id=' . $object->id . ($withproject ? '&withproject=1' : '');
1091
-					$linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . ($object->id > 0 ? '&id=' . $object->id : '&projectid=' . $projectstatic->id) . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl);
1090
+					$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : '');
1091
+					$linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl);
1092 1092
 				}
1093 1093
 			} else {
1094 1094
 				$linktocreatetimeBtnStatus = -2;
@@ -1133,19 +1133,19 @@  discard block
 block discarded – undo
1133 1133
 		print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
1134 1134
 
1135 1135
 		if ($action == 'deleteline') {
1136
-			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : '');
1136
+			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOSTINT("lineid").($withproject ? '&withproject=1' : '');
1137 1137
 			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
1138 1138
 		}
1139 1139
 
1140 1140
 		$param = ($withproject ? '&withproject=1' : '');
1141
-		$param .= ($param ? '&' : '') . 'id=' . $object->id;        // ID of task
1142
-		$linkback = $withproject ? '<a href="' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . '">' . $langs->trans("BackToList") . '</a>' : '';
1141
+		$param .= ($param ? '&' : '').'id='.$object->id; // ID of task
1142
+		$linkback = $withproject ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>' : '';
1143 1143
 
1144 1144
 		if (!GETPOST('withproject') || empty($projectstatic->id)) {
1145 1145
 			$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
1146
-			$object->next_prev_filter = "fk_projet:IN:" . $db->sanitize($projectsListId);
1146
+			$object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId);
1147 1147
 		} else {
1148
-			$object->next_prev_filter = "fk_projet:=:" . ((int) $projectstatic->id);
1148
+			$object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id);
1149 1149
 		}
1150 1150
 
1151 1151
 		$morehtmlref = '';
@@ -1153,12 +1153,12 @@  discard block
 block discarded – undo
1153 1153
 		// Project
1154 1154
 		if (empty($withproject)) {
1155 1155
 			$morehtmlref .= '<div class="refidno">';
1156
-			$morehtmlref .= $langs->trans("Project") . ': ';
1156
+			$morehtmlref .= $langs->trans("Project").': ';
1157 1157
 			$morehtmlref .= $projectstatic->getNomUrl(1);
1158 1158
 			$morehtmlref .= '<br>';
1159 1159
 
1160 1160
 			// Third party
1161
-			$morehtmlref .= $langs->trans("ThirdParty") . ': ';
1161
+			$morehtmlref .= $langs->trans("ThirdParty").': ';
1162 1162
 			if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) {
1163 1163
 				$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
1164 1164
 			}
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 		print '<table class="border centpercent tableforfield">';
1175 1175
 
1176 1176
 		// Task parent
1177
-		print '<tr><td>' . $langs->trans("ChildOfTask") . '</td><td>';
1177
+		print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>';
1178 1178
 		if ($object->fk_task_parent > 0) {
1179 1179
 			$tasktmp = new Task($db);
1180 1180
 			$tasktmp->fetch($object->fk_task_parent);
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 		print '</td></tr>';
1184 1184
 
1185 1185
 		// Date start - Date end task
1186
-		print '<tr><td class="titlefield">' . $langs->trans("DateStart") . ' - ' . $langs->trans("Deadline") . '</td><td>';
1186
+		print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").'</td><td>';
1187 1187
 		$start = dol_print_date($object->date_start, 'dayhour');
1188 1188
 		print($start ? $start : '?');
1189 1189
 		$end = dol_print_date($object->date_end, 'dayhour');
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		print '</td></tr>';
1196 1196
 
1197 1197
 		// Planned workload
1198
-		print '<tr><td>' . $langs->trans("PlannedWorkload") . '</td><td>';
1198
+		print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
1199 1199
 		if ($object->planned_workload) {
1200 1200
 			print convertSecondToTime($object->planned_workload, 'allhourmin');
1201 1201
 		}
@@ -1210,21 +1210,21 @@  discard block
 block discarded – undo
1210 1210
 		print '<table class="border tableforfield centpercent">';
1211 1211
 
1212 1212
 		// Progress declared
1213
-		print '<tr><td class="titlefield">' . $langs->trans("ProgressDeclared") . '</td><td>';
1214
-		print $object->progress != '' ? $object->progress . ' %' : '';
1213
+		print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td>';
1214
+		print $object->progress != '' ? $object->progress.' %' : '';
1215 1215
 		print '</td></tr>';
1216 1216
 
1217 1217
 		// Progress calculated
1218
-		print '<tr><td>' . $langs->trans("ProgressCalculated") . '</td><td>';
1218
+		print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td>';
1219 1219
 		if ($object->planned_workload) {
1220 1220
 			$tmparray = $object->getSummaryOfTimeSpent();
1221 1221
 			if ($tmparray['total_duration'] > 0) {
1222
-				print round($tmparray['total_duration'] / $object->planned_workload * 100, 2) . ' %';
1222
+				print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';
1223 1223
 			} else {
1224 1224
 				print '0 %';
1225 1225
 			}
1226 1226
 		} else {
1227
-			print '<span class="opacitymedium">' . $langs->trans("WorkloadNotDefined") . '</span>';
1227
+			print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>';
1228 1228
 		}
1229 1229
 		print '</td>';
1230 1230
 
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 		print dol_get_fiche_end();
1241 1241
 	} else {
1242 1242
 		if ($action == 'deleteline') {
1243
-			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : '');
1243
+			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOSTINT("lineid").($withproject ? '&withproject=1' : '');
1244 1244
 			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
1245 1245
 		}
1246 1246
 	}
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 
1255 1255
 		if ($action == 'deleteline' && !empty($projectidforalltimes)) {
1256 1256
 			// We must use projectidprojectid if on list of timespent of project and id=taskid if on list of timespent of a task
1257
-			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($projectstatic->id > 0 ? 'projectid=' . $projectstatic->id : ($object->id > 0 ? "id=" . $object->id : '')) . '&lineid=' . GETPOSTINT('lineid') . ($withproject ? '&withproject=1' : '') . "&contextpage=" . urlencode($contextpage);
1257
+			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($projectstatic->id > 0 ? 'projectid='.$projectstatic->id : ($object->id > 0 ? "id=".$object->id : '')).'&lineid='.GETPOSTINT('lineid').($withproject ? '&withproject=1' : '')."&contextpage=".urlencode($contextpage);
1258 1258
 			$formconfirm = $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
1259 1259
 		}
1260 1260
 
@@ -1273,10 +1273,10 @@  discard block
 block discarded – undo
1273 1273
 		// Definition of fields for list
1274 1274
 		$arrayfields = array();
1275 1275
 		$arrayfields['t.element_date'] = array('label' => $langs->trans("Date"), 'checked' => 1);
1276
-		$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1','checked' => 1);
1276
+		$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1', 'checked' => 1);
1277 1277
 		$arrayfields['s.name_alias'] = array('label' => $langs->trans("AliasNameShort"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1');
1278 1278
 		if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {	// Not a dedicated task
1279
-			if (! empty($allprojectforuser)) {
1279
+			if (!empty($allprojectforuser)) {
1280 1280
 				$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1];
1281 1281
 				$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1];
1282 1282
 			}
@@ -1292,83 +1292,83 @@  discard block
 block discarded – undo
1292 1292
 		$arrayfields['value'] = array('label' => $langs->trans("Value"), 'checked' => 1, 'enabled' => isModEnabled("salaries"));
1293 1293
 		$arrayfields['valuebilled'] = array('label' => $langs->trans("Billed"), 'checked' => 1, 'enabled' => (((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
1294 1294
 		// Extra fields
1295
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
1295
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
1296 1296
 
1297 1297
 		$arrayfields = dol_sort_array($arrayfields, 'position');
1298
-		'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';  // dol_sort_array looses type for Phan
1298
+		'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
1299 1299
 
1300 1300
 		$param = '';
1301 1301
 		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
1302
-			$param .= '&contextpage=' . urlencode($contextpage);
1302
+			$param .= '&contextpage='.urlencode($contextpage);
1303 1303
 		}
1304 1304
 		if ($limit > 0 && $limit != $conf->liste_limit) {
1305 1305
 			$param .= '&limit='.((int) $limit);
1306 1306
 		}
1307 1307
 		if ($search_month > 0) {
1308
-			$param .= '&search_month=' . urlencode((string) ($search_month));
1308
+			$param .= '&search_month='.urlencode((string) ($search_month));
1309 1309
 		}
1310 1310
 		if ($search_year > 0) {
1311
-			$param .= '&search_year=' . urlencode((string) ($search_year));
1311
+			$param .= '&search_year='.urlencode((string) ($search_year));
1312 1312
 		}
1313 1313
 		if (!empty($search_user)) { 	// We keep param if -1 because default value is forced to user id if not set
1314 1314
 			$param .= '&search_user='.urlencode($search_user);
1315 1315
 		}
1316 1316
 		if ($search_task_ref != '') {
1317
-			$param .= '&search_task_ref=' . urlencode($search_task_ref);
1317
+			$param .= '&search_task_ref='.urlencode($search_task_ref);
1318 1318
 		}
1319 1319
 		if ($search_company != '') {
1320
-			$param .= '&amp;$search_company=' . urlencode($search_company);
1320
+			$param .= '&amp;$search_company='.urlencode($search_company);
1321 1321
 		}
1322 1322
 		if ($search_company_alias != '') {
1323
-			$param .= '&amp;$search_company_alias=' . urlencode($search_company_alias);
1323
+			$param .= '&amp;$search_company_alias='.urlencode($search_company_alias);
1324 1324
 		}
1325 1325
 		if ($search_project_ref != '') {
1326
-			$param .= '&amp;$search_project_ref=' . urlencode($search_project_ref);
1326
+			$param .= '&amp;$search_project_ref='.urlencode($search_project_ref);
1327 1327
 		}
1328 1328
 		if ($search_project_label != '') {
1329
-			$param .= '&amp;$search_project_label=' . urlencode($search_project_label);
1329
+			$param .= '&amp;$search_project_label='.urlencode($search_project_label);
1330 1330
 		}
1331 1331
 		if ($search_task_label != '') {
1332
-			$param .= '&search_task_label=' . urlencode($search_task_label);
1332
+			$param .= '&search_task_label='.urlencode($search_task_label);
1333 1333
 		}
1334 1334
 		if ($search_note != '') {
1335
-			$param .= '&search_note=' . urlencode($search_note);
1335
+			$param .= '&search_note='.urlencode($search_note);
1336 1336
 		}
1337 1337
 		if ($search_duration != '') {
1338
-			$param .= '&amp;search_field2=' . urlencode((string) ($search_duration));
1338
+			$param .= '&amp;search_field2='.urlencode((string) ($search_duration));
1339 1339
 		}
1340 1340
 		if ($optioncss != '') {
1341
-			$param .= '&optioncss=' . urlencode($optioncss);
1341
+			$param .= '&optioncss='.urlencode($optioncss);
1342 1342
 		}
1343 1343
 		if ($search_date_startday) {
1344
-			$param .= '&search_date_startday=' . urlencode((string) ($search_date_startday));
1344
+			$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
1345 1345
 		}
1346 1346
 		if ($search_date_startmonth) {
1347
-			$param .= '&search_date_startmonth=' . urlencode((string) ($search_date_startmonth));
1347
+			$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
1348 1348
 		}
1349 1349
 		if ($search_date_startyear) {
1350
-			$param .= '&search_date_startyear=' . urlencode((string) ($search_date_startyear));
1350
+			$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
1351 1351
 		}
1352 1352
 		if ($search_date_endday) {
1353
-			$param .= '&search_date_endday=' . urlencode((string) ($search_date_endday));
1353
+			$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
1354 1354
 		}
1355 1355
 		if ($search_date_endmonth) {
1356
-			$param .= '&search_date_endmonth=' . urlencode((string) ($search_date_endmonth));
1356
+			$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
1357 1357
 		}
1358 1358
 		if ($search_date_endyear) {
1359
-			$param .= '&search_date_endyear=' . urlencode((string) ($search_date_endyear));
1359
+			$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
1360 1360
 		}
1361 1361
 		if ($search_timespent_starthour) {
1362
-			$param .= '&search_timespent_duration_starthour=' . urlencode((string) ($search_timespent_starthour));
1362
+			$param .= '&search_timespent_duration_starthour='.urlencode((string) ($search_timespent_starthour));
1363 1363
 		}
1364 1364
 		if ($search_timespent_startmin) {
1365
-			$param .= '&search_timespent_duration_startmin=' . urlencode((string) ($search_timespent_startmin));
1365
+			$param .= '&search_timespent_duration_startmin='.urlencode((string) ($search_timespent_startmin));
1366 1366
 		}
1367 1367
 		if ($search_timespent_endhour) {
1368
-			$param .= '&search_timespent_duration_endhour=' . urlencode((string) ($search_timespent_endhour));
1368
+			$param .= '&search_timespent_duration_endhour='.urlencode((string) ($search_timespent_endhour));
1369 1369
 		}
1370 1370
 		if ($search_timespent_endmin) {
1371
-			$param .= '&search_timespent_duration_endmin=' . urlencode((string) ($search_timespent_endmin));
1371
+			$param .= '&search_timespent_duration_endmin='.urlencode((string) ($search_timespent_endmin));
1372 1372
 		}
1373 1373
 
1374 1374
 		/*
@@ -1376,24 +1376,24 @@  discard block
 block discarded – undo
1376 1376
 		 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1377 1377
 		 */
1378 1378
 		if ($id) {
1379
-			$param .= '&id=' . urlencode((string) ($id));
1379
+			$param .= '&id='.urlencode((string) ($id));
1380 1380
 		}
1381 1381
 		if ($projectid) {
1382
-			$param .= '&projectid=' . urlencode((string) ($projectid));
1382
+			$param .= '&projectid='.urlencode((string) ($projectid));
1383 1383
 		}
1384 1384
 		if ($withproject) {
1385
-			$param .= '&withproject=' . urlencode((string) ($withproject));
1385
+			$param .= '&withproject='.urlencode((string) ($withproject));
1386 1386
 		}
1387 1387
 		// Add $param from hooks
1388 1388
 		$parameters = array('param' => &$param);
1389 1389
 		$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1390 1390
 		$param .= $hookmanager->resPrint;
1391 1391
 
1392
-		print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
1392
+		print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
1393 1393
 		if ($optioncss != '') {
1394
-			print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
1394
+			print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1395 1395
 		}
1396
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
1396
+		print '<input type="hidden" name="token" value="'.newToken().'">';
1397 1397
 		print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1398 1398
 		if ($action == 'editline') {
1399 1399
 			print '<input type="hidden" name="action" value="updateline">';
@@ -1408,13 +1408,13 @@  discard block
 block discarded – undo
1408 1408
 		} else {
1409 1409
 			print '<input type="hidden" name="action" value="list">';
1410 1410
 		}
1411
-		print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
1412
-		print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
1411
+		print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1412
+		print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1413 1413
 
1414
-		print '<input type="hidden" name="id" value="' . $id . '">';
1415
-		print '<input type="hidden" name="projectid" value="' . $projectidforalltimes . '">';
1416
-		print '<input type="hidden" name="withproject" value="' . $withproject . '">';
1417
-		print '<input type="hidden" name="tab" value="' . $tab . '">';
1414
+		print '<input type="hidden" name="id" value="'.$id.'">';
1415
+		print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
1416
+		print '<input type="hidden" name="withproject" value="'.$withproject.'">';
1417
+		print '<input type="hidden" name="tab" value="'.$tab.'">';
1418 1418
 		print '<input type="hidden" name="page_y" value="">';
1419 1419
 
1420 1420
 		// Form to convert time spent into invoice
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 					'onelineperperiod' => 'OneLinePerTimeSpentLine',
1442 1442
 				);
1443 1443
 				print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
1444
-				print "\n" . '<script type="text/javascript">';
1444
+				print "\n".'<script type="text/javascript">';
1445 1445
 				print '
1446 1446
 				$(document).ready(function () {
1447 1447
 					setDetailVisibility();
@@ -1458,8 +1458,8 @@  discard block
 block discarded – undo
1458 1458
             		}
1459 1459
             	});
1460 1460
             			';
1461
-				print '</script>' . "\n";
1462
-				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>' . $langs->trans('AddDetailDateAndDuration') . '</span>';
1461
+				print '</script>'."\n";
1462
+				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>'.$langs->trans('AddDetailDateAndDuration').'</span>';
1463 1463
 				print '</td>';
1464 1464
 				print '</tr>';
1465 1465
 
@@ -1509,14 +1509,14 @@  discard block
 block discarded – undo
1509 1509
 
1510 1510
 				print '<br>';
1511 1511
 				print '<div class="center">';
1512
-				print '<input type="submit" class="button" id="createbills" name="createbills" value="' . $langs->trans('GenerateBill') . '">  ';
1513
-				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
1512
+				print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('GenerateBill').'">  ';
1513
+				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
1514 1514
 				print '</div>';
1515 1515
 				print '<br>';
1516 1516
 			} else {
1517
-				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateInvoice") . '</div>';
1517
+				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'</div>';
1518 1518
 				print '<div class="center">';
1519
-				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
1519
+				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
1520 1520
 				print '</div>';
1521 1521
 				$massaction = '';
1522 1522
 			}
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 				print '<table class="noborder centpercent">';
1530 1530
 				print '<tr>';
1531 1531
 				print '<td class="titlefield">';
1532
-				print img_picto('', 'intervention', 'class="pictofixedwidth"') . $langs->trans('InterToUse');
1532
+				print img_picto('', 'intervention', 'class="pictofixedwidth"').$langs->trans('InterToUse');
1533 1533
 				print '</td>';
1534 1534
 				print '<td>';
1535 1535
 				$forminter = new FormIntervention($db);
@@ -1539,14 +1539,14 @@  discard block
 block discarded – undo
1539 1539
 				print '</table>';
1540 1540
 
1541 1541
 				print '<div class="center">';
1542
-				print '<input type="submit" class="button" id="createinter" name="createinter" value="' . $langs->trans('GenerateInter') . '">  ';
1543
-				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">';
1542
+				print '<input type="submit" class="button" id="createinter" name="createinter" value="'.$langs->trans('GenerateInter').'">  ';
1543
+				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
1544 1544
 				print '</div>';
1545 1545
 				print '<br>';
1546 1546
 			} else {
1547
-				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateIntervention") . '</div>';
1547
+				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateIntervention").'</div>';
1548 1548
 				print '<div class="center">';
1549
-				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">';
1549
+				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
1550 1550
 				print '</div>';
1551 1551
 				$massaction = '';
1552 1552
 			}
@@ -1616,14 +1616,14 @@  discard block
 block discarded – undo
1616 1616
 			$sql .= " AND t.fk_element =".((int) $object->id);
1617 1617
 		} elseif (!empty($projectidforalltimes)) {
1618 1618
 			// Limit on one project
1619
-			$sql .= " AND pt.fk_projet IN (" . $db->sanitize($projectidforalltimes) . ")";
1619
+			$sql .= " AND pt.fk_projet IN (".$db->sanitize($projectidforalltimes).")";
1620 1620
 		} elseif (!empty($allprojectforuser)) {
1621 1621
 			// Limit on on user
1622 1622
 			if (empty($search_user)) {
1623 1623
 				$search_user = $user->id;
1624 1624
 			}
1625 1625
 			if ($search_user > 0) {
1626
-				$sql .= " AND t.fk_user = " . ((int) $search_user);
1626
+				$sql .= " AND t.fk_user = ".((int) $search_user);
1627 1627
 			}
1628 1628
 		}
1629 1629
 
@@ -1676,13 +1676,13 @@  discard block
 block discarded – undo
1676 1676
 			if ($search_timespent_starthour || $search_timespent_startmin) {
1677 1677
 				$timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds
1678 1678
 				$timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds
1679
-				$sql .= " AND t.element_duration >= " . $timespent_duration_start;
1679
+				$sql .= " AND t.element_duration >= ".$timespent_duration_start;
1680 1680
 			}
1681 1681
 
1682 1682
 			if ($search_timespent_endhour || $search_timespent_endmin) {
1683 1683
 				$timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds
1684 1684
 				$timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds
1685
-				$sql .= " AND t.element_duration <= " . $timespent_duration_end;
1685
+				$sql .= " AND t.element_duration <= ".$timespent_duration_end;
1686 1686
 			}
1687 1687
 		}
1688 1688
 
@@ -1730,13 +1730,13 @@  discard block
 block discarded – undo
1730 1730
 
1731 1731
 		if ($num >= 0) {
1732 1732
 			if (!empty($projectidforalltimes)) {
1733
-				print '<!-- List of time spent for project -->' . "\n";
1733
+				print '<!-- List of time spent for project -->'."\n";
1734 1734
 
1735 1735
 				$title = $langs->trans("ListTaskTimeUserProject");
1736 1736
 
1737 1737
 				print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'clock', 0, $linktocreatetime, '', $limit, 0, 0, 1);
1738 1738
 			} else {
1739
-				print '<!-- List of time spent -->' . "\n";
1739
+				print '<!-- List of time spent -->'."\n";
1740 1740
 
1741 1741
 				$title = $langs->trans("ListTaskTimeForTask");
1742 1742
 
@@ -1758,26 +1758,26 @@  discard block
 block discarded – undo
1758 1758
 		 * Form to add a new line of time spent
1759 1759
 		 */
1760 1760
 		if ($action == 'createtime' && $user->hasRight('projet', 'time')) {
1761
-			print '<!-- table to add time spent -->' . "\n";
1761
+			print '<!-- table to add time spent -->'."\n";
1762 1762
 			if (!empty($id)) {
1763
-				print '<input type="hidden" name="taskid" value="' . $id . '">';
1763
+				print '<input type="hidden" name="taskid" value="'.$id.'">';
1764 1764
 			}
1765 1765
 
1766 1766
 			print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
1767 1767
 			print '<table class="noborder nohover centpercent">';
1768 1768
 
1769 1769
 			print '<tr class="liste_titre">';
1770
-			print '<td>' . $langs->trans("Date") . '</td>';
1770
+			print '<td>'.$langs->trans("Date").'</td>';
1771 1771
 			if (!empty($allprojectforuser)) {
1772
-				print '<td>' . $langs->trans("Project") . '</td>';
1772
+				print '<td>'.$langs->trans("Project").'</td>';
1773 1773
 			}
1774 1774
 			if (empty($id)) {
1775
-				print '<td>' . $langs->trans("Task") . '</td>';
1775
+				print '<td>'.$langs->trans("Task").'</td>';
1776 1776
 			}
1777
-			print '<td>' . $langs->trans("By") . '</td>';
1778
-			print '<td>' . $langs->trans("Note") . '</td>';
1779
-			print '<td>' . $langs->trans("NewTimeSpent") . '</td>';
1780
-			print '<td>' . $langs->trans("ProgressDeclared") . '</td>';
1777
+			print '<td>'.$langs->trans("By").'</td>';
1778
+			print '<td>'.$langs->trans("Note").'</td>';
1779
+			print '<td>'.$langs->trans("NewTimeSpent").'</td>';
1780
+			print '<td>'.$langs->trans("ProgressDeclared").'</td>';
1781 1781
 			if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
1782 1782
 				print '<td></td>';
1783 1783
 
@@ -1831,14 +1831,14 @@  discard block
 block discarded – undo
1831 1831
 				print $form->select_dolusers((GETPOSTINT('userid') ? GETPOSTINT('userid') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'minwidth150imp maxwidth200');
1832 1832
 			} else {
1833 1833
 				if ($nboftasks) {
1834
-					print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . ' ' . $langs->trans('FirstAddRessourceToAllocateTime');
1834
+					print img_error($langs->trans('FirstAddRessourceToAllocateTime')).' '.$langs->trans('FirstAddRessourceToAllocateTime');
1835 1835
 				}
1836 1836
 			}
1837 1837
 			print '</td>';
1838 1838
 
1839 1839
 			// Note
1840 1840
 			print '<td>';
1841
-			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="' . ROWS_2 . '">' . (GETPOST('timespent_note') ? GETPOST('timespent_note') : '') . '</textarea>';
1841
+			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="'.ROWS_2.'">'.(GETPOST('timespent_note') ? GETPOST('timespent_note') : '').'</textarea>';
1842 1842
 			print '</td>';
1843 1843
 
1844 1844
 			// Duration - Time spent
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
 		$selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1907 1907
 
1908 1908
 		print '<div class="div-table-responsive">';
1909
-		print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
1909
+		print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1910 1910
 
1911 1911
 		// Fields title search
1912 1912
 		// --------------------------------------------------------------------
@@ -1931,20 +1931,20 @@  discard block
 block discarded – undo
1931 1931
 		}
1932 1932
 		// Thirdparty
1933 1933
 		if (!empty($arrayfields['p.fk_soc']['checked'])) {
1934
-			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="' . dol_escape_htmltag($search_company) . '"></td>';
1934
+			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
1935 1935
 		}
1936 1936
 
1937 1937
 		// Thirdparty alias
1938 1938
 		if (!empty($arrayfields['s.name_alias']['checked'])) {
1939
-			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="' . dol_escape_htmltag($search_company_alias) . '"></td>';
1939
+			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'"></td>';
1940 1940
 		}
1941 1941
 
1942 1942
 		if (!empty($allprojectforuser)) {
1943 1943
 			if (!empty($arrayfields['p.project_ref']['checked'])) {
1944
-				print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_ref" value="' . dol_escape_htmltag($search_project_ref) . '"></td>';
1944
+				print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
1945 1945
 			}
1946 1946
 			if (!empty($arrayfields['p.project_label']['checked'])) {
1947
-				print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_label" value="' . dol_escape_htmltag($search_project_label) . '"></td>';
1947
+				print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_label" value="'.dol_escape_htmltag($search_project_label).'"></td>';
1948 1948
 			}
1949 1949
 		}
1950 1950
 		// Task
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
 		}
1963 1963
 		// Note
1964 1964
 		if (!empty($arrayfields['t.note']['checked'])) {
1965
-			print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_note" value="' . dol_escape_htmltag($search_note) . '"></td>';
1965
+			print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_note" value="'.dol_escape_htmltag($search_note).'"></td>';
1966 1966
 		}
1967 1967
 		// Duration
1968 1968
 		if (!empty($arrayfields['t.element_duration']['checked'])) {
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
 			if ($search_timespent_starthour || $search_timespent_startmin) {
1974 1974
 				$durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60);
1975 1975
 			}
1976
-			print '<div class="nowraponall">' . $langs->trans('from') . ' ';
1976
+			print '<div class="nowraponall">'.$langs->trans('from').' ';
1977 1977
 			print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1);
1978 1978
 			print '</div>';
1979 1979
 
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
 			if ($search_timespent_endhour || $search_timespent_endmin) {
1982 1982
 				$durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60);
1983 1983
 			}
1984
-			print '<div class="nowraponall">' . $langs->trans('to') . ' ';
1984
+			print '<div class="nowraponall">'.$langs->trans('to').' ';
1985 1985
 			print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1);
1986 1986
 			print '</div>';
1987 1987
 
@@ -1997,7 +1997,7 @@  discard block
 block discarded – undo
1997 1997
 		}
1998 1998
 		// Value billed
1999 1999
 		if (!empty($arrayfields['valuebilled']['checked'])) {
2000
-			print '<td class="liste_titre center">' . $form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1) . '</td>';
2000
+			print '<td class="liste_titre center">'.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).'</td>';
2001 2001
 		}
2002 2002
 
2003 2003
 		/*
@@ -2015,7 +2015,7 @@  discard block
 block discarded – undo
2015 2015
 			print $searchpicto;
2016 2016
 			print '</td>';
2017 2017
 		}
2018
-		print '</tr>' . "\n";
2018
+		print '</tr>'."\n";
2019 2019
 
2020 2020
 
2021 2021
 		$totalarray = array();
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
 			if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2134 2134
 				print '<td class="center nowraponall">';
2135 2135
 				if (($action == 'editline' || $action == 'splitline') && GETPOSTINT('lineid') == $task_time->rowid) {
2136
-					print '<input type="hidden" name="lineid" value="' . GETPOSTINT('lineid') . '">';
2136
+					print '<input type="hidden" name="lineid" value="'.GETPOSTINT('lineid').'">';
2137 2137
 					print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
2138 2138
 					print '<br>';
2139 2139
 					print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 						print '</a>';
2145 2145
 
2146 2146
 						if (getDolGlobalString('PROJECT_ALLOW_SPLIT_TIMESPENT')) {
2147
-							print '<a class="reposition editfielda paddingleft" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">';
2147
+							print '<a class="reposition editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
2148 2148
 							print img_split('', 'class="pictofixedwidth paddingleft"');
2149 2149
 							print '</a>';
2150 2150
 						}
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 
2163 2163
 							// Disable select if task not billable or already invoiced
2164 2164
 							$disabled = (intval($task_time->billable) != 1 || $invoiced);
2165
-							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
2165
+							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
2166 2166
 							if ($disabled) {
2167 2167
 								// If disabled, a dbl-click very close outside the control
2168 2168
 								// will re-enable it, so that user is not blocked if needed.
2169
-								print '<span id="cbsp'. $task_time->rowid . '">'.$ctrl.'</span>';
2170
-								print '<script>$("#cbsp' . $task_time->rowid . '").dblclick(()=>{ $("#cb' . $task_time->rowid . '").removeAttr("disabled") })</script>';
2169
+								print '<span id="cbsp'.$task_time->rowid.'">'.$ctrl.'</span>';
2170
+								print '<script>$("#cbsp'.$task_time->rowid.'").dblclick(()=>{ $("#cb'.$task_time->rowid.'").removeAttr("disabled") })</script>';
2171 2171
 							} else {
2172 2172
 								print $ctrl;
2173 2173
 							}
@@ -2289,7 +2289,7 @@  discard block
 block discarded – undo
2289 2289
 					}
2290 2290
 				}
2291 2291
 			} elseif ($action !== 'createtime') {
2292
-				print '<input type="hidden" name="taskid" value="' . $id . '">';
2292
+				print '<input type="hidden" name="taskid" value="'.$id.'">';
2293 2293
 			}
2294 2294
 
2295 2295
 			// Task label
@@ -2318,9 +2318,9 @@  discard block
 block discarded – undo
2318 2318
 					}
2319 2319
 					if (count($contactsoftask) > 0) {
2320 2320
 						print img_object('', 'user', 'class="pictofixedwidth hideonsmartphone"');
2321
-						print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'minwidth100 maxwidth100');	// maxwidth must be lowed than minwidth of the td
2321
+						print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'minwidth100 maxwidth100'); // maxwidth must be lowed than minwidth of the td
2322 2322
 					} else {
2323
-						print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
2323
+						print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
2324 2324
 					}
2325 2325
 				} else {
2326 2326
 					$userstatic->id = $task_time->fk_user;
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 			if (!empty($arrayfields['t.note']['checked'])) {
2343 2343
 				if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
2344 2344
 					print '<td class="small">';
2345
-					print '<textarea name="timespent_note_line" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';
2345
+					print '<textarea name="timespent_note_line" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';
2346 2346
 					print '</td>';
2347 2347
 				} else {
2348 2348
 					print '<td class="small tdoverflowmax150 classfortooltip" title="'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($task_time->note)).'">';
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
 					$totalarray['nbfield']++;
2354 2354
 				}
2355 2355
 			} elseif ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
2356
-				print '<input type="hidden" name="timespent_note_line" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';
2356
+				print '<input type="hidden" name="timespent_note_line" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';
2357 2357
 			}
2358 2358
 
2359 2359
 			// Time spent
@@ -2414,7 +2414,7 @@  discard block
 block discarded – undo
2414 2414
 				$value = price2num($task_time->thm * $task_time->element_duration / 3600, 'MT', 1);
2415 2415
 
2416 2416
 				print '<td class="nowraponall right">';
2417
-				print '<span class="amount" title="' . $langs->trans("THM") . ': ' . price($task_time->thm) . '">';
2417
+				print '<span class="amount" title="'.$langs->trans("THM").': '.price($task_time->thm).'">';
2418 2418
 				print price($value, 1, $langs, 1, -1, -1, $conf->currency);
2419 2419
 				print '</span>';
2420 2420
 				print '</td>';
@@ -2470,7 +2470,7 @@  discard block
 block discarded – undo
2470 2470
 							}
2471 2471
 						}
2472 2472
 					} else {
2473
-						print '<span class="opacitymedium">' . $langs->trans("NA") . '</span>';
2473
+						print '<span class="opacitymedium">'.$langs->trans("NA").'</span>';
2474 2474
 					}
2475 2475
 				}
2476 2476
 				print '</td>';
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
 						print '</a>';
2505 2505
 
2506 2506
 						if (getDolGlobalString('PROJECT_ALLOW_SPLIT_TIMESPENT')) {
2507
-							print '<a class="reposition editfielda paddingleft" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">';
2507
+							print '<a class="reposition editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
2508 2508
 							print img_split('', 'class="pictofixedwidth paddingleft"');
2509 2509
 							print '</a>';
2510 2510
 						}
@@ -2522,12 +2522,12 @@  discard block
 block discarded – undo
2522 2522
 
2523 2523
 							// Disable select if task not billable or already invoiced
2524 2524
 							$disabled = (intval($task_time->billable) != 1 || $invoiced);
2525
-							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
2525
+							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
2526 2526
 							if ($disabled) {
2527 2527
 								// If disabled, a dbl-click very close outside the control
2528 2528
 								// will re-enable it, so that user is not blocked if needed.
2529
-								print '<span id="cbsp'. $task_time->rowid . '">'.$ctrl.'</span>';
2530
-								print '<script>$("#cbsp' . $task_time->rowid . '").dblclick(()=>{ $("#cb' . $task_time->rowid . '").removeAttr("disabled") })</script>';
2529
+								print '<span id="cbsp'.$task_time->rowid.'">'.$ctrl.'</span>';
2530
+								print '<script>$("#cbsp'.$task_time->rowid.'").dblclick(()=>{ $("#cb'.$task_time->rowid.'").removeAttr("disabled") })</script>';
2531 2531
 							} else {
2532 2532
 								print $ctrl;
2533 2533
 							}
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
 							print img_object('', 'user', 'class="hideonsmartphone"');
2626 2626
 							print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask);
2627 2627
 						} else {
2628
-							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
2628
+							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
2629 2629
 						}
2630 2630
 					} else {
2631 2631
 						$userstatic->id = $task_time->fk_user;
@@ -2642,13 +2642,13 @@  discard block
 block discarded – undo
2642 2642
 				if (!empty($arrayfields['t.note']['checked'])) {
2643 2643
 					print '<td class="tdoverflowmax300">';
2644 2644
 					if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2645
-						print '<textarea name="timespent_note_line" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';
2645
+						print '<textarea name="timespent_note_line" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';
2646 2646
 					} else {
2647 2647
 						print dol_nl2br($task_time->note);
2648 2648
 					}
2649 2649
 					print '</td>';
2650 2650
 				} elseif ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2651
-					print '<input type="hidden" name="timespent_note_line" rows="' . ROWS_1 . '" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';
2651
+					print '<input type="hidden" name="timespent_note_line" rows="'.ROWS_1.'" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';
2652 2652
 				}
2653 2653
 
2654 2654
 				// Time spent
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
 							print img_object('', 'user', 'class="hideonsmartphone"');
2790 2790
 							print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask);
2791 2791
 						} else {
2792
-							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
2792
+							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
2793 2793
 						}
2794 2794
 					} else {
2795 2795
 						$userstatic->id = $task_time->fk_user;
@@ -2806,13 +2806,13 @@  discard block
 block discarded – undo
2806 2806
 				if (!empty($arrayfields['t.note']['checked'])) {
2807 2807
 					print '<td class="small tdoverflowmax300"">';
2808 2808
 					if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2809
-						print '<textarea name="timespent_note_line_2" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';
2809
+						print '<textarea name="timespent_note_line_2" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';
2810 2810
 					} else {
2811 2811
 						print dol_nl2br($task_time->note);
2812 2812
 					}
2813 2813
 					print '</td>';
2814 2814
 				} elseif ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2815
-					print '<input type="hidden" name="timespent_note_line_2" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';
2815
+					print '<input type="hidden" name="timespent_note_line_2" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';
2816 2816
 				}
2817 2817
 
2818 2818
 				// Time spent
@@ -2886,14 +2886,14 @@  discard block
 block discarded – undo
2886 2886
 				$i++;
2887 2887
 				if ($i == 1) {
2888 2888
 					if ($num < $limit && empty($offset)) {
2889
-						print '<td class="left">' . $langs->trans("Total") . '</td>';
2889
+						print '<td class="left">'.$langs->trans("Total").'</td>';
2890 2890
 					} else {
2891 2891
 						print '<td class="left">'.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).'</td>';
2892 2892
 					}
2893 2893
 				} elseif (isset($totalarray['totaldurationfield']) && $totalarray['totaldurationfield'] == $i) {
2894
-					print '<td class="right">' . convertSecondToTime($totalarray['totalduration'], 'allhourmin') . '</td>';
2894
+					print '<td class="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>';
2895 2895
 				} elseif (isset($totalarray['totalvaluefield']) && $totalarray['totalvaluefield'] == $i) {
2896
-					print '<td class="right">' . price($totalarray['totalvalue']) . '</td>';
2896
+					print '<td class="right">'.price($totalarray['totalvalue']).'</td>';
2897 2897
 					//} elseif ($totalarray['totalvaluebilledfield'] == $i) { print '<td class="center">'.price($totalarray['totalvaluebilled']).'</td>';
2898 2898
 				} else {
2899 2899
 					print '<td></td>';
@@ -2909,8 +2909,8 @@  discard block
 block discarded – undo
2909 2909
 					$totalnboffields++;
2910 2910
 				}
2911 2911
 			}
2912
-			print '<tr class="oddeven"><td colspan="' . $totalnboffields . '">';
2913
-			print '<span class="opacitymedium">' . $langs->trans("None") . '</span>';
2912
+			print '<tr class="oddeven"><td colspan="'.$totalnboffields.'">';
2913
+			print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
2914 2914
 			print '</td></tr>';
2915 2915
 		}
2916 2916
 
Please login to merge, or discard this patch.
htdocs/compta/prelevement/class/bonprelevement.class.php 1 patch
Spacing   +452 added lines, -452 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
  * \brief      File of withdrawal receipts class
30 30
  */
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
34
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/salary.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/user/class/userbankaccount.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
34
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
43 43
 
44 44
 
45 45
 /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 
150 150
 	const STATUS_DRAFT = 0;
151 151
 	const STATUS_TRANSFERED = 1;
152
-	const STATUS_CREDITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
153
-	const STATUS_DEBITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
152
+	const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
153
+	const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
154 154
 
155 155
 
156 156
 	/**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
 		if ($result == 0) {
341 341
 			if ($line_id > 0) {
342
-				$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement (";
342
+				$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
343 343
 				if ($type != 'bank-transfer') {
344 344
 					$sql .= "fk_facture";
345 345
 				} else {
@@ -352,24 +352,24 @@  discard block
 block discarded – undo
352 352
 				$sql .= ",fk_prelevement_lignes";
353 353
 				$sql .= ") VALUES (";
354 354
 				$sql .= ((int) $invoice_id);
355
-				$sql .= ", " . ((int) $line_id);
355
+				$sql .= ", ".((int) $line_id);
356 356
 				$sql .= ")";
357 357
 
358 358
 				if ($this->db->query($sql)) {
359 359
 					$result = 0;
360 360
 				} else {
361 361
 					$result = -1;
362
-					$this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror;
363
-					dol_syslog(get_class($this) . "::AddFacture Error $result");
362
+					$this->errors[] = get_class($this)."::AddFacture ".$this->db->lasterror;
363
+					dol_syslog(get_class($this)."::AddFacture Error $result");
364 364
 				}
365 365
 			} else {
366 366
 				$result = -2;
367
-				$this->errors[] = get_class($this) . "::AddFacture linedid Empty";
368
-				dol_syslog(get_class($this) . "::AddFacture Error $result");
367
+				$this->errors[] = get_class($this)."::AddFacture linedid Empty";
368
+				dol_syslog(get_class($this)."::AddFacture Error $result");
369 369
 			}
370 370
 		} else {
371 371
 			$result = -3;
372
-			dol_syslog(get_class($this) . "::AddFacture Error $result");
372
+			dol_syslog(get_class($this)."::AddFacture Error $result");
373 373
 		}
374 374
 
375 375
 		return $result;
@@ -392,23 +392,23 @@  discard block
 block discarded – undo
392 392
 	public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
393 393
 	{
394 394
 		$result = -1;
395
-		$concat = 0;	// ??? what is this for. Seems not used.
395
+		$concat = 0; // ??? what is this for. Seems not used.
396 396
 
397 397
 		if ($concat == 1) {
398 398
 			/*
399 399
 			 * We aggregate the lines
400 400
 			 */
401 401
 			$sql = "SELECT rowid";
402
-			$sql .= " FROM  " . MAIN_DB_PREFIX . "prelevement_lignes";
403
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
402
+			$sql .= " FROM  ".MAIN_DB_PREFIX."prelevement_lignes";
403
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
404 404
 			if ($sourcetype == 'salary') {
405
-				$sql .= " AND fk_soc = " . ((int) $client_id);
405
+				$sql .= " AND fk_soc = ".((int) $client_id);
406 406
 			} else {
407
-				$sql .= " AND fk_user = " . ((int) $client_id);
407
+				$sql .= " AND fk_user = ".((int) $client_id);
408 408
 			}
409
-			$sql .= " AND code_banque = '" . $this->db->escape($code_banque) . "'";
410
-			$sql .= " AND code_guichet = '" . $this->db->escape($code_guichet) . "'";
411
-			$sql .= " AND number = '" . $this->db->escape($number) . "'";
409
+			$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
410
+			$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
411
+			$sql .= " AND number = '".$this->db->escape($number)."'";
412 412
 
413 413
 			$resql = $this->db->query($sql);
414 414
 			if ($resql) {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 			/*
421 421
 			 * No aggregate
422 422
 			 */
423
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes (";
423
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
424 424
 			$sql .= "fk_prelevement_bons";
425 425
 			$sql .= ", fk_soc";
426 426
 			$sql .= ", client_nom";
@@ -432,21 +432,21 @@  discard block
 block discarded – undo
432 432
 			$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
433 433
 			$sql .= ") VALUES (";
434 434
 			$sql .= $this->id;
435
-			$sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0");	// fk_soc can't be null
436
-			$sql .= ", '" . $this->db->escape($client_nom) . "'";
437
-			$sql .= ", " . ((float) price2num($amount));
438
-			$sql .= ", '" . $this->db->escape($code_banque) . "'";
439
-			$sql .= ", '" . $this->db->escape($code_guichet) . "'";
440
-			$sql .= ", '" . $this->db->escape($number) . "'";
441
-			$sql .= ", '" . $this->db->escape($number_key) . "'";
442
-			$sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : '');
435
+			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
436
+			$sql .= ", '".$this->db->escape($client_nom)."'";
437
+			$sql .= ", ".((float) price2num($amount));
438
+			$sql .= ", '".$this->db->escape($code_banque)."'";
439
+			$sql .= ", '".$this->db->escape($code_guichet)."'";
440
+			$sql .= ", '".$this->db->escape($number)."'";
441
+			$sql .= ", '".$this->db->escape($number_key)."'";
442
+			$sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : '');
443 443
 			$sql .= ")";
444 444
 			if ($this->db->query($sql)) {
445
-				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_lignes");
445
+				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
446 446
 				$result = 0;
447 447
 			} else {
448
-				$this->errors[] = get_class($this) . "::addline Error -2 " . $this->db->lasterror;
449
-				dol_syslog(get_class($this) . "::addline Error -2");
448
+				$this->errors[] = get_class($this)."::addline Error -2 ".$this->db->lasterror;
449
+				dol_syslog(get_class($this)."::addline Error -2");
450 450
 				$result = -2;
451 451
 			}
452 452
 		}
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
 		$sql .= ", p.type";
490 490
 		$sql .= ", p.fk_bank_account";
491 491
 		$sql .= ", p.statut as status";
492
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
493
-		$sql .= " WHERE p.entity IN (" . getEntity('invoice') . ")";
492
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
493
+		$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
494 494
 		if ($rowid > 0) {
495
-			$sql .= " AND p.rowid = " . ((int) $rowid);
495
+			$sql .= " AND p.rowid = ".((int) $rowid);
496 496
 		} else {
497
-			$sql .= " AND p.ref = '" . $this->db->escape($ref) . "'";
497
+			$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
498 498
 		}
499 499
 
500
-		dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
500
+		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
501 501
 		$result = $this->db->query($sql);
502 502
 		if ($result) {
503 503
 			if ($this->db->num_rows($result)) {
@@ -523,13 +523,13 @@  discard block
 block discarded – undo
523 523
 				if (empty($this->status)) {		// Value is sometimes null in database
524 524
 					$this->status = 0;
525 525
 				}
526
-				$this->statut         = $this->status; // For backward compatibility
526
+				$this->statut = $this->status; // For backward compatibility
527 527
 
528 528
 				$this->fetched = 1;
529 529
 
530 530
 				return 1;
531 531
 			} else {
532
-				dol_syslog(get_class($this) . "::Fetch no record found");
532
+				dol_syslog(get_class($this)."::Fetch no record found");
533 533
 				return 0;
534 534
 			}
535 535
 		} else {
@@ -570,19 +570,19 @@  discard block
 block discarded – undo
570 570
 			if ($date < $this->date_trans) {
571 571
 				$langs->load("errors");
572 572
 				$this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission');
573
-				dol_syslog("bon-prelevment::set_infocredit 1027 " . $this->error);
573
+				dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
574 574
 				return -1027;
575 575
 			}
576 576
 
577 577
 			$this->db->begin();
578 578
 
579
-			$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
580
-			$sql .= " SET fk_user_credit = " . ((int) $user->id);
581
-			$sql .= ", statut = " . self::STATUS_CREDITED;
582
-			$sql .= ", date_credit = '" . $this->db->idate($date) . "'";
583
-			$sql .= " WHERE rowid = " . ((int) $this->id);
584
-			$sql .= " AND entity = " . ((int) $conf->entity);
585
-			$sql .= " AND statut = " . self::STATUS_TRANSFERED;
579
+			$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
580
+			$sql .= " SET fk_user_credit = ".((int) $user->id);
581
+			$sql .= ", statut = ".self::STATUS_CREDITED;
582
+			$sql .= ", date_credit = '".$this->db->idate($date)."'";
583
+			$sql .= " WHERE rowid = ".((int) $this->id);
584
+			$sql .= " AND entity = ".((int) $conf->entity);
585
+			$sql .= " AND statut = ".self::STATUS_TRANSFERED;
586 586
 
587 587
 			$resql = $this->db->query($sql);
588 588
 			if ($resql) {
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 						$error++;
697 697
 						$this->error = $paiement->error;
698 698
 						$this->errors = $paiement->errors;
699
-						dol_syslog(get_class($this) . "::set_infocredit AddPayment Error " . $this->error);
699
+						dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
700 700
 					} else {
701 701
 						if ($this->type == 'bank-transfer') {
702 702
 							if ($type == 'salary') {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 						} else {
712 712
 							$modeforaddpayment = 'payment';
713 713
 							$labelforaddpayment = '(CustomerInvoicePayment)';
714
-							$addbankurl = 'direct-debit';	// = 'directdebit'
714
+							$addbankurl = 'direct-debit'; // = 'directdebit'
715 715
 						}
716 716
 
717 717
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 							$error++;
727 727
 							$this->error = $paiement->error;
728 728
 							$this->errors = $paiement->errors;
729
-							dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error " . $this->error);
729
+							dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
730 730
 						}
731 731
 					}
732 732
 				}
@@ -734,24 +734,24 @@  discard block
 block discarded – undo
734 734
 				// Update withdrawal line
735 735
 				// TODO: Translate to ligneprelevement.class.php
736 736
 				if (!$error) {
737
-					$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes";
737
+					$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
738 738
 					$sql .= " SET statut = 2";
739
-					$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
739
+					$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
740 740
 
741 741
 					if (!$this->db->query($sql)) {
742
-						dol_syslog(get_class($this) . "::set_infocredit Update lines Error");
742
+						dol_syslog(get_class($this)."::set_infocredit Update lines Error");
743 743
 						$error++;
744 744
 					}
745 745
 				}
746 746
 			} else {
747 747
 				$this->error = $this->db->lasterror();
748
-				dol_syslog(get_class($this) . "::set_infocredit Update Bons Error");
748
+				dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
749 749
 				$error++;
750 750
 			}
751 751
 
752 752
 			// End of procedure
753 753
 			if ($error == 0) {
754
-				$this->date_credit = $date;		// date credit or debit
754
+				$this->date_credit = $date; // date credit or debit
755 755
 				$this->statut = self::STATUS_CREDITED;
756 756
 				$this->status = self::STATUS_CREDITED;
757 757
 
@@ -782,17 +782,17 @@  discard block
 block discarded – undo
782 782
 
783 783
 		$error = 0;
784 784
 
785
-		dol_syslog(get_class($this) . "::set_infotrans Start", LOG_INFO);
785
+		dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO);
786 786
 
787 787
 		if ($this->db->begin()) {
788
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons ";
789
-			$sql .= " SET fk_user_trans = " . $user->id;
790
-			$sql .= " , date_trans = '" . $this->db->idate($date) . "'";
791
-			$sql .= " , method_trans = " . ((int) $method);
792
-			$sql .= " , statut = " . self::STATUS_TRANSFERED;
793
-			$sql .= " WHERE rowid = " . ((int) $this->id);
794
-			$sql .= " AND entity = " . ((int) $conf->entity);
795
-			$sql .= " AND statut = " . self::STATUS_DRAFT;
788
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
789
+			$sql .= " SET fk_user_trans = ".$user->id;
790
+			$sql .= " , date_trans = '".$this->db->idate($date)."'";
791
+			$sql .= " , method_trans = ".((int) $method);
792
+			$sql .= " , statut = ".self::STATUS_TRANSFERED;
793
+			$sql .= " WHERE rowid = ".((int) $this->id);
794
+			$sql .= " AND entity = ".((int) $conf->entity);
795
+			$sql .= " AND statut = ".self::STATUS_DRAFT;
796 796
 
797 797
 			if ($this->db->query($sql)) {
798 798
 				$this->method_trans = $method;
@@ -817,12 +817,12 @@  discard block
 block discarded – undo
817 817
 				return 0;
818 818
 			} else {
819 819
 				$this->db->rollback();
820
-				dol_syslog(get_class($this) . "::set_infotrans ROLLBACK", LOG_ERR);
820
+				dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR);
821 821
 
822 822
 				return -1;
823 823
 			}
824 824
 		} else {
825
-			dol_syslog(get_class($this) . "::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
825
+			dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
826 826
 			return -2;
827 827
 		}
828 828
 	}
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 		$arr = array();
843 843
 
844
-		dol_syslog(get_class($this) . "::getListInvoices");
844
+		dol_syslog(get_class($this)."::getListInvoices");
845 845
 
846 846
 		// Returns all invoices presented within same order
847 847
 		$sql = "SELECT ";
@@ -857,13 +857,13 @@  discard block
 block discarded – undo
857 857
 		if ($amounts) {
858 858
 			$sql .= ", SUM(pl.amount)";
859 859
 		}
860
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb,";
861
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
862
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
860
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
861
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
862
+		$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
863 863
 		$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
864 864
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
865
-		$sql .= " AND pb.rowid = " . ((int) $this->id);
866
-		$sql .= " AND pb.entity = " . ((int) $conf->entity);
865
+		$sql .= " AND pb.rowid = ".((int) $this->id);
866
+		$sql .= " AND pb.entity = ".((int) $conf->entity);
867 867
 		if ($amounts) {
868 868
 			if ($this->type == 'bank-transfer') {
869 869
 				if ($type == 'salary') {
@@ -917,17 +917,17 @@  discard block
 block discarded – undo
917 917
 		$sql = "SELECT sum(pd.amount) as nb";
918 918
 		if ($type !== 'salary') {
919 919
 			if ($mode != 'bank-transfer') {
920
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f,";
920
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
921 921
 			} else {
922
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f,";
922
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
923 923
 			}
924 924
 		} else {
925
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s,";
925
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s,";
926 926
 		}
927
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_demande as pd";
928
-		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (" . getEntity('invoice') . ")" : " WHERE s.entity IN (" . getEntity('salary') . ")");
927
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd";
928
+		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")");
929 929
 		if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
930
-			$sql .= ($type !== 'salary' ? " AND f.fk_statut = " . Facture::STATUS_VALIDATED : " AND s.paye = " . Salary::STATUS_UNPAID);
930
+			$sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID);
931 931
 		}
932 932
 		if ($type !== 'salary') {
933 933
 			if ($mode != 'bank-transfer') {
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 			return $obj->nb;
953 953
 		} else {
954 954
 			$error = 1;
955
-			dol_syslog(get_class($this) . "::SommeAPrelever Erreur -1");
955
+			dol_syslog(get_class($this)."::SommeAPrelever Erreur -1");
956 956
 			dol_syslog($this->db->error());
957 957
 
958 958
 			return -1;
@@ -988,26 +988,26 @@  discard block
 block discarded – undo
988 988
 		// phpcs:enable
989 989
 		if ($forsalary == 1) {
990 990
 			$sql = "SELECT count(s.rowid) as nb";
991
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s";
991
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
992 992
 		} else {
993 993
 			$sql = "SELECT count(f.rowid) as nb";
994 994
 
995 995
 			if ($type == 'bank-transfer') {
996
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
996
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
997 997
 			} else {
998
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
998
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
999 999
 			}
1000 1000
 		}
1001
-		$sql .= ", " . MAIN_DB_PREFIX . "prelevement_demande as pd";
1001
+		$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pd";
1002 1002
 		if ($forsalary == 1) {
1003
-			$sql .= " WHERE s.entity IN (" . getEntity('invoice') . ")";
1003
+			$sql .= " WHERE s.entity IN (".getEntity('invoice').")";
1004 1004
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
1005 1005
 				$sql .= " AND s.paye = 0";
1006 1006
 			}
1007 1007
 		} else {
1008
-			$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
1008
+			$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
1009 1009
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
1010
-				$sql .= " AND f.fk_statut = " . Facture::STATUS_VALIDATED;
1010
+				$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
1011 1011
 			}
1012 1012
 		}
1013 1013
 		if ($forsalary == 1) {
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 			$sql .= " AND s.paye = 0";
1028 1028
 		}
1029 1029
 
1030
-		dol_syslog(get_class($this) . "::NbFactureAPrelever");
1030
+		dol_syslog(get_class($this)."::NbFactureAPrelever");
1031 1031
 		$resql = $this->db->query($sql);
1032 1032
 
1033 1033
 		if ($resql) {
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 			return $obj->nb;
1038 1038
 		} else {
1039
-			$this->error = get_class($this) . "::NbFactureAPrelever Erreur -1 sql=" . $this->db->error();
1039
+			$this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
1040 1040
 			return -1;
1041 1041
 		}
1042 1042
 	}
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 		// phpcs:enable
1069 1069
 		global $conf, $langs, $user;
1070 1070
 
1071
-		dol_syslog(__METHOD__ . " Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." did=".$did." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG);
1071
+		dol_syslog(__METHOD__." Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." did=".$did." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG);
1072 1072
 
1073
-		require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
1074
-		require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
1073
+		require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
1074
+		require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
1075 1075
 
1076 1076
 		// Check params
1077 1077
 		if ($type != 'bank-transfer') {
@@ -1105,14 +1105,14 @@  discard block
 block discarded – undo
1105 1105
 		// Check if there is an iban associated to the bank transfer request or if we take the default
1106 1106
 		if ($did > 0) {
1107 1107
 			$sql = "SELECT pd.fk_societe_rib";
1108
-			$sql .= " FROM " . $this->db->prefix() . "prelevement_demande as pd";
1108
+			$sql .= " FROM ".$this->db->prefix()."prelevement_demande as pd";
1109 1109
 			$sql .= " WHERE pd.rowid = ".((int) $did);
1110 1110
 
1111 1111
 			$resql = $this->db->query($sql);
1112 1112
 
1113 1113
 			if (!$resql) {
1114 1114
 				$this->error = $this->db->lasterror();
1115
-				dol_syslog(__METHOD__ . " Read fk_societe_rib error " . $this->db->lasterror(), LOG_ERR);
1115
+				dol_syslog(__METHOD__." Read fk_societe_rib error ".$this->db->lasterror(), LOG_ERR);
1116 1116
 				return -1;
1117 1117
 			}
1118 1118
 
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 			if ($obj) {
1121 1121
 				$thirdpartyBANId = $obj->fk_societe_rib;
1122 1122
 
1123
-				dol_syslog(__METHOD__ . " Found an BAN ID to use: ".$thirdpartyBANId);
1123
+				dol_syslog(__METHOD__." Found an BAN ID to use: ".$thirdpartyBANId);
1124 1124
 			}
1125 1125
 
1126 1126
 			$this->db->free($resql);
@@ -1146,10 +1146,10 @@  discard block
 block discarded – undo
1146 1146
 		$factures_errors = array();
1147 1147
 
1148 1148
 		if (!$error) {
1149
-			dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG);
1149
+			dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG);
1150 1150
 
1151 1151
 			$sql = "SELECT f.rowid, pd.rowid as pfdrowid";
1152
-			$sql .= ", f.".$this->db->sanitize($socOrUser);		// fk_soc or fk_user
1152
+			$sql .= ", f.".$this->db->sanitize($socOrUser); // fk_soc or fk_user
1153 1153
 			$sql .= ", pd.code_banque, pd.code_guichet, pd.number, pd.cle_rib";
1154 1154
 			$sql .= ", pd.amount";
1155 1155
 			if ($sourcetype != 'salary') {
@@ -1159,13 +1159,13 @@  discard block
 block discarded – undo
1159 1159
 				$sql .= ", CONCAT(s.firstname,' ',s.lastname) as name";
1160 1160
 				$sql .= ", f.ref, sr.bic, sr.iban_prefix, 'FRST' as frstrecur";
1161 1161
 			}
1162
-			$sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f";	// f is salary, facture or facture_fourn
1163
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable);
1164
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser);
1165
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser);
1162
+			$sql .= " FROM ".$this->db->prefix().$sqlTable." as f"; // f is salary, facture or facture_fourn
1163
+			$sql .= " LEFT JOIN ".$this->db->prefix()."prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable);
1164
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser);
1165
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser);
1166 1166
 			if ($sourcetype != 'salary') {
1167 1167
 				if (!empty($thirdpartyBANId)) {
1168
-					$sql .= " AND sr.rowid = " . ((int) $thirdpartyBANId);
1168
+					$sql .= " AND sr.rowid = ".((int) $thirdpartyBANId);
1169 1169
 				} else {
1170 1170
 					$sql .= " AND sr.default_rib = 1";
1171 1171
 				}
@@ -1185,10 +1185,10 @@  discard block
 block discarded – undo
1185 1185
 			$sql .= " AND pd.traite = 0";
1186 1186
 			$sql .= " AND pd.ext_payment_id IS NULL";
1187 1187
 			if ($sourcetype != 'salary') {
1188
-				$sql .= " AND sr.type = 'ban'";		// TODO Add AND sr.type = 'ban' for users too
1188
+				$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
1189 1189
 			}
1190 1190
 			if ($did > 0) {
1191
-				$sql .= " AND pd.rowid = " . ((int) $did);
1191
+				$sql .= " AND pd.rowid = ".((int) $did);
1192 1192
 			}
1193 1193
 
1194 1194
 			$resql = $this->db->query($sql);
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 				$i = 0;
1198 1198
 
1199 1199
 				while ($i < $num) {
1200
-					$row = $this->db->fetch_row($resql);	// TODO Replace with fetch_object()
1200
+					$row = $this->db->fetch_row($resql); // TODO Replace with fetch_object()
1201 1201
 					'@phan-var-force array<int<0,12>,string> $row';
1202 1202
 
1203 1203
 					// All fields: 0=rowid, 1=pfdrowid, 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key, 7=amount, 8=name, 9=ref, 10=bic, 11=iban, 12=frstrecur
@@ -1208,35 +1208,35 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 					if ($row[7] == 0) {
1210 1210
 						$error++;
1211
-						dol_syslog(__METHOD__ . " Read invoices/salary error Found a null amount", LOG_ERR);
1212
-						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id " . $row[0] . ", found a null amount";
1211
+						dol_syslog(__METHOD__." Read invoices/salary error Found a null amount", LOG_ERR);
1212
+						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id ".$row[0].", found a null amount";
1213 1213
 						break;
1214 1214
 					}
1215 1215
 					$i++;
1216 1216
 				}
1217 1217
 
1218 1218
 				$this->db->free($resql);
1219
-				dol_syslog(__METHOD__ . " Read invoices/salary, " . $i . " invoices/salary to withdraw", LOG_DEBUG);
1219
+				dol_syslog(__METHOD__." Read invoices/salary, ".$i." invoices/salary to withdraw", LOG_DEBUG);
1220 1220
 			} else {
1221 1221
 				$this->error = $this->db->lasterror();
1222
-				dol_syslog(__METHOD__ . " Read invoices/salary error " . $this->db->lasterror(), LOG_ERR);
1222
+				dol_syslog(__METHOD__." Read invoices/salary error ".$this->db->lasterror(), LOG_ERR);
1223 1223
 				return -1;
1224 1224
 			}
1225 1225
 		}
1226 1226
 
1227 1227
 		if (!$error) {
1228 1228
 			// Make some checks
1229
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1230
-			require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
1231
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
1232
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
1229
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1230
+			require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1231
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1232
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
1233 1233
 
1234 1234
 			$tmpsoc = new Societe($this->db);
1235 1235
 			$tmpuser = new User($this->db);
1236 1236
 
1237 1237
 			// Check BAN
1238 1238
 			$i = 0;
1239
-			dol_syslog(__METHOD__ . " Check BAN for each invoices or salary", LOG_DEBUG);
1239
+			dol_syslog(__METHOD__." Check BAN for each invoices or salary", LOG_DEBUG);
1240 1240
 
1241 1241
 			if (count($factures) > 0) {
1242 1242
 				foreach ($factures as $key => $fac) {
@@ -1267,31 +1267,31 @@  discard block
 block discarded – undo
1267 1267
 							if ($type != 'bank-transfer') {
1268 1268
 								$tmpsoc->id = (int) $fac[2];
1269 1269
 								$tmpsoc->name = $fac[8];
1270
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/compta/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1271
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1272
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1270
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1271
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1272
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1273 1273
 								$error++;
1274 1274
 							}
1275 1275
 							if ($type == 'bank-transfer' && $sourcetype != 'salary') {
1276 1276
 								$tmpsoc->id = (int) $fac[2];
1277 1277
 								$tmpsoc->name = $fac[8];
1278
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1279
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1280
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1278
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1279
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1280
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1281 1281
 								$error++;
1282 1282
 							}
1283 1283
 							if ($type == 'bank-transfer' && $sourcetype == 'salary') {
1284 1284
 								$tmpuser->id = (int) $fac[2];
1285 1285
 								$tmpuser->firstname = $fac[8];
1286
-								$salary_url = "<a href='" . DOL_URL_ROOT . '/salaries/card.php?id=' . $fac[0] . "'>" . $fac[0] . "</a>";
1287
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1288
-								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1286
+								$salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>";
1287
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1288
+								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1289 1289
 								$error++;
1290 1290
 							}
1291
-							dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING);
1291
+							dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING);
1292 1292
 						}
1293 1293
 					} else {
1294
-						dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING);
1294
+						dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING);
1295 1295
 					}
1296 1296
 					/*
1297 1297
 					} else {
@@ -1300,14 +1300,14 @@  discard block
 block discarded – undo
1300 1300
 					*/
1301 1301
 				}
1302 1302
 			} else {
1303
-				dol_syslog(__METHOD__ . " Check BAN No invoice to process", LOG_WARNING);
1303
+				dol_syslog(__METHOD__." Check BAN No invoice to process", LOG_WARNING);
1304 1304
 			}
1305 1305
 		}
1306 1306
 
1307 1307
 		$ok = 0;
1308 1308
 
1309 1309
 		// Withdraw invoices in factures_prev array
1310
-		$out = count($factures_prev) . " invoices or salaries will be included.";
1310
+		$out = count($factures_prev)." invoices or salaries will be included.";
1311 1311
 		//print $out."\n";
1312 1312
 		dol_syslog($out);
1313 1313
 
@@ -1341,32 +1341,32 @@  discard block
 block discarded – undo
1341 1341
 			 * Process order generation
1342 1342
 			 */
1343 1343
 			if (!$error) {
1344
-				$ref = substr($year, -2) . $month;
1344
+				$ref = substr($year, -2).$month;
1345 1345
 
1346 1346
 				// Get next free number for the ref of bon prelevement
1347
-				$sql = "SELECT substring(ref from char_length(ref) - 1)";	// To extract "YYMMXX" from "TYYMMXX"
1348
-				$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons";
1349
-				$sql .= " WHERE ref LIKE '_" . $this->db->escape($ref) . "%'";
1350
-				$sql .= " AND entity = " . ((int) $conf->entity);
1347
+				$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
1348
+				$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
1349
+				$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
1350
+				$sql .= " AND entity = ".((int) $conf->entity);
1351 1351
 				$sql .= " ORDER BY ref DESC LIMIT 1";
1352 1352
 
1353
-				dol_syslog(get_class($this) . " get next free number", LOG_DEBUG);
1353
+				dol_syslog(get_class($this)." get next free number", LOG_DEBUG);
1354 1354
 				$resql = $this->db->query($sql);
1355 1355
 
1356 1356
 				if ($resql) {
1357 1357
 					$row = $this->db->fetch_row($resql);
1358 1358
 
1359 1359
 					// Build the new ref
1360
-					$ref = "T" . $ref . sprintf("%02d", (intval($row[0]) + 1));
1360
+					$ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1));
1361 1361
 
1362 1362
 					// $conf->abc->dir_output may be:
1363 1363
 					// /home/ldestailleur/git/dolibarr_15.0/documents/abc/
1364 1364
 					// or
1365 1365
 					// /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany.
1366 1366
 					if ($type != 'bank-transfer') {
1367
-						$dir = $conf->prelevement->dir_output . '/receipts';
1367
+						$dir = $conf->prelevement->dir_output.'/receipts';
1368 1368
 					} else {
1369
-						$dir = $conf->paymentbybanktransfer->dir_output . '/receipts';
1369
+						$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
1370 1370
 					}
1371 1371
 					if (!is_dir($dir)) {
1372 1372
 						dol_mkdir($dir);
@@ -1374,41 +1374,41 @@  discard block
 block discarded – undo
1374 1374
 
1375 1375
 					if (isModEnabled('multicompany')) {
1376 1376
 						$labelentity = $conf->entity;
1377
-						$this->filename = $dir . '/' . $ref . '-' . $labelentity . '.xml';
1377
+						$this->filename = $dir.'/'.$ref.'-'.$labelentity.'.xml';
1378 1378
 					} else {
1379
-						$this->filename = $dir . '/' . $ref . '.xml';
1379
+						$this->filename = $dir.'/'.$ref.'.xml';
1380 1380
 					}
1381 1381
 
1382 1382
 					// Create withdraw order in database
1383
-					$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons (";
1383
+					$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
1384 1384
 					$sql .= "ref, entity, datec, type, fk_bank_account";
1385 1385
 					$sql .= ") VALUES (";
1386
-					$sql .= "'" . $this->db->escape($ref) . "'";
1387
-					$sql .= ", " . ((int) $conf->entity);
1388
-					$sql .= ", '" . $this->db->idate($now) . "'";
1389
-					$sql .= ", '" . ($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order') . "'";
1390
-					$sql .= ", " . ((int) $fk_bank_account);
1386
+					$sql .= "'".$this->db->escape($ref)."'";
1387
+					$sql .= ", ".((int) $conf->entity);
1388
+					$sql .= ", '".$this->db->idate($now)."'";
1389
+					$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
1390
+					$sql .= ", ".((int) $fk_bank_account);
1391 1391
 					$sql .= ")";
1392 1392
 
1393 1393
 					$resql = $this->db->query($sql);
1394 1394
 
1395 1395
 
1396 1396
 					if ($resql) {
1397
-						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons");
1397
+						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
1398 1398
 						$this->id = $prev_id;
1399 1399
 						$this->ref = $ref;
1400 1400
 					} else {
1401 1401
 						$error++;
1402
-						dol_syslog(__METHOD__ . " Create withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1402
+						dol_syslog(__METHOD__." Create withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1403 1403
 					}
1404 1404
 				} else {
1405 1405
 					$error++;
1406
-					dol_syslog(__METHOD__ . " Get last withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1406
+					dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1407 1407
 				}
1408 1408
 			}
1409 1409
 
1410 1410
 			if (!$error) {
1411
-				dol_syslog(__METHOD__ . " Now loop on each document to insert them in llx_prelevement_demande");
1411
+				dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
1412 1412
 
1413 1413
 				// Add lines for the bon
1414 1414
 				if (count($factures_prev) > 0) {
@@ -1437,17 +1437,17 @@  discard block
 block discarded – undo
1437 1437
 						}
1438 1438
 
1439 1439
 						// Update invoice requests as done
1440
-						$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande";
1440
+						$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
1441 1441
 						$sql .= " SET traite = 1";
1442
-						$sql .= ", date_traite = '" . $this->db->idate($now) . "'";
1443
-						$sql .= ", fk_prelevement_bons = " . ((int) $this->id);
1444
-						$sql .= " WHERE rowid = " . ((int) $fac[1]);
1442
+						$sql .= ", date_traite = '".$this->db->idate($now)."'";
1443
+						$sql .= ", fk_prelevement_bons = ".((int) $this->id);
1444
+						$sql .= " WHERE rowid = ".((int) $fac[1]);
1445 1445
 
1446 1446
 						$resql = $this->db->query($sql);
1447 1447
 						if (!$resql) {
1448 1448
 							$error++;
1449 1449
 							$this->errors[] = $this->db->lasterror();
1450
-							dol_syslog(__METHOD__ . " Update Error=" . $this->db->lasterror(), LOG_ERR);
1450
+							dol_syslog(__METHOD__." Update Error=".$this->db->lasterror(), LOG_ERR);
1451 1451
 						}
1452 1452
 					}
1453 1453
 				}
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
 				 * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
1459 1459
 				 */
1460 1460
 
1461
-				dol_syslog(__METHOD__ . " Init direct debit or credit transfer file for " . count($factures_prev) . " invoices", LOG_DEBUG);
1461
+				dol_syslog(__METHOD__." Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
1462 1462
 
1463 1463
 				if (count($factures_prev) > 0) {
1464 1464
 					$this->date_echeance = $datetimeprev;
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
 						$this->emetteur_iban               = $account->iban;
1475 1475
 						$this->emetteur_bic                = $account->bic;
1476 1476
 
1477
-						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);	// Example "FR78ZZZ123456"
1477
+						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456"
1478 1478
 
1479 1479
 						$this->raison_sociale = $account->owner_name;
1480 1480
 					}
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 						$error++;
1494 1494
 					}
1495 1495
 				}
1496
-				dol_syslog(__METHOD__ . " Bank order file has been generated under filename " . $this->filename, LOG_DEBUG);
1496
+				dol_syslog(__METHOD__." Bank order file has been generated under filename ".$this->filename, LOG_DEBUG);
1497 1497
 			}
1498 1498
 
1499 1499
 
@@ -1501,15 +1501,15 @@  discard block
 block discarded – undo
1501 1501
 			 * Update total defined after generation of file
1502 1502
 			 */
1503 1503
 			if (!$error) {
1504
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
1505
-				$sql .= " SET amount = " . price2num($this->total);
1506
-				$sql .= " WHERE rowid = " . ((int) $this->id);
1507
-				$sql .= " AND entity = " . ((int) $conf->entity);
1504
+				$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
1505
+				$sql .= " SET amount = ".price2num($this->total);
1506
+				$sql .= " WHERE rowid = ".((int) $this->id);
1507
+				$sql .= " AND entity = ".((int) $conf->entity);
1508 1508
 				$resql = $this->db->query($sql);
1509 1509
 
1510 1510
 				if (!$resql) {
1511 1511
 					$error++;
1512
-					dol_syslog(__METHOD__ . " Error update total: " . $this->db->error(), LOG_ERR);
1512
+					dol_syslog(__METHOD__." Error update total: ".$this->db->error(), LOG_ERR);
1513 1513
 				}
1514 1514
 			}
1515 1515
 
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 
1530 1530
 			if (!$error) {
1531 1531
 				$this->db->commit();
1532
-				return count($factures_prev);	// The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1532
+				return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1533 1533
 			} else {
1534 1534
 				$this->db->rollback();
1535 1535
 				return -1;
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
 		}
1569 1569
 
1570 1570
 		if (!$error) {
1571
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id) . ")";
1571
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
1572 1572
 			$resql1 = $this->db->query($sql);
1573 1573
 			if (!$resql1) {
1574 1574
 				dol_print_error($this->db);
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
 		}
1577 1577
 
1578 1578
 		if (!$error) {
1579
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id);
1579
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id);
1580 1580
 			$resql2 = $this->db->query($sql);
1581 1581
 			if (!$resql2) {
1582 1582
 				dol_print_error($this->db);
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 		}
1585 1585
 
1586 1586
 		if (!$error) {
1587
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_bons WHERE rowid = " . ((int) $this->id);
1587
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".((int) $this->id);
1588 1588
 			$resql3 = $this->db->query($sql);
1589 1589
 			if (!$resql3) {
1590 1590
 				dol_print_error($this->db);
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 		}
1593 1593
 
1594 1594
 		if (!$error) {
1595
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = " . ((int) $this->id);
1595
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
1596 1596
 			$resql4 = $this->db->query($sql);
1597 1597
 			if (!$resql4) {
1598 1598
 				dol_print_error($this->db);
@@ -1634,22 +1634,22 @@  discard block
 block discarded – undo
1634 1634
 			$labeltoshow = 'PaymentByBankTransfer';
1635 1635
 		}
1636 1636
 
1637
-		$label = img_picto('', $this->picto) . ' <u>' . $langs->trans($labeltoshow) . '</u> ' . $this->getLibStatut(5);
1637
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans($labeltoshow).'</u> '.$this->getLibStatut(5);
1638 1638
 		$label .= '<br>';
1639
-		$label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
1639
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
1640 1640
 		if (isset($this->amount)) {
1641
-			$label .= '<br><b>' . $langs->trans("Amount") . ":</b> " . price($this->amount);
1641
+			$label .= '<br><b>'.$langs->trans("Amount").":</b> ".price($this->amount);
1642 1642
 		}
1643 1643
 		if (isset($this->date_trans)) {
1644
-			$label .= '<br><b>' . $langs->trans("TransData") . ":</b> " . dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1644
+			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1645 1645
 		}
1646 1646
 		/*if (isset($this->date_credit)) {
1647 1647
 			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_credit, 'dayhour', 'tzuserrel');
1648 1648
 		}*/
1649 1649
 
1650
-		$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1650
+		$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1651 1651
 		if (!empty($this->type) && $this->type == 'bank-transfer') {
1652
-			$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1652
+			$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1653 1653
 		}
1654 1654
 
1655 1655
 		if ($option != 'nolink') {
@@ -1667,21 +1667,21 @@  discard block
 block discarded – undo
1667 1667
 		if (empty($notooltip)) {
1668 1668
 			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1669 1669
 				$label = $langs->trans("ShowMyObject");
1670
-				$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
1670
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1671 1671
 			}
1672
-			$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
1673
-			$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
1672
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1673
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1674 1674
 		} else {
1675
-			$linkclose = ($morecss ? ' class="' . $morecss . '"' : '');
1675
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1676 1676
 		}
1677 1677
 
1678
-		$linkstart = '<a href="' . $url . '"';
1679
-		$linkstart .= $linkclose . '>';
1678
+		$linkstart = '<a href="'.$url.'"';
1679
+		$linkstart .= $linkclose.'>';
1680 1680
 		$linkend = '</a>';
1681 1681
 
1682 1682
 		$result .= $linkstart;
1683 1683
 		if ($withpicto) {
1684
-			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1684
+			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1685 1685
 		}
1686 1686
 		if ($withpicto != 2) {
1687 1687
 			$result .= $this->ref;
@@ -1710,8 +1710,8 @@  discard block
 block discarded – undo
1710 1710
 	 */
1711 1711
 	public function deleteNotificationById($rowid)
1712 1712
 	{
1713
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1714
-		$sql .= " WHERE rowid = " . ((int) $rowid);
1713
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1714
+		$sql .= " WHERE rowid = ".((int) $rowid);
1715 1715
 
1716 1716
 		if ($this->db->query($sql)) {
1717 1717
 			return 0;
@@ -1735,8 +1735,8 @@  discard block
 block discarded – undo
1735 1735
 			$userid = $user;
1736 1736
 		}
1737 1737
 
1738
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1739
-		$sql .= " WHERE fk_user=" . ((int) $userid) . " AND fk_action='" . $this->db->escape($action) . "'";
1738
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1739
+		$sql .= " WHERE fk_user=".((int) $userid)." AND fk_action='".$this->db->escape($action)."'";
1740 1740
 
1741 1741
 		if ($this->db->query($sql)) {
1742 1742
 			return 0;
@@ -1768,15 +1768,15 @@  discard block
 block discarded – undo
1768 1768
 		if ($this->deleteNotification($user, $action) == 0) {
1769 1769
 			$now = dol_now();
1770 1770
 
1771
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1772
-			$sql .= " VALUES ('" . $this->db->idate($now) . "', " . ((int) $userid) . ", 'NULL', 'NULL', '" . $this->db->escape($action) . "')";
1771
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1772
+			$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')";
1773 1773
 
1774
-			dol_syslog("adnotiff: " . $sql);
1774
+			dol_syslog("adnotiff: ".$sql);
1775 1775
 			if ($this->db->query($sql)) {
1776 1776
 				$result = 0;
1777 1777
 			} else {
1778 1778
 				$result = -1;
1779
-				dol_syslog(get_class($this) . "::addNotification Error $result");
1779
+				dol_syslog(get_class($this)."::addNotification Error $result");
1780 1780
 			}
1781 1781
 		}
1782 1782
 
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
 
1813 1813
 		$result = 0;
1814 1814
 
1815
-		dol_syslog(get_class($this) . "::generate build file=" . $this->filename . " type=" . $type);
1815
+		dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type);
1816 1816
 
1817 1817
 		$this->file = fopen($this->filename, "w");
1818 1818
 		if ($this->file == false) {
@@ -1858,20 +1858,20 @@  discard block
 block discarded – undo
1858 1858
 				$sql .= " f.ref as reffac, p.fk_facture as idfac,";
1859 1859
 				$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1860 1860
 				$sql .= " FROM";
1861
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1862
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1863
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1864
-				$sql .= " " . MAIN_DB_PREFIX . "societe as soc,";
1865
-				$sql .= " " . MAIN_DB_PREFIX . "c_country as c,";
1866
-				$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1867
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1861
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1862
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1863
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1864
+				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
1865
+				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
1866
+				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1867
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1868 1868
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1869 1869
 				$sql .= " AND p.fk_facture = f.rowid";
1870 1870
 				$sql .= " AND f.fk_soc = soc.rowid";
1871 1871
 				$sql .= " AND soc.fk_pays = c.rowid";
1872 1872
 				$sql .= " AND rib.fk_soc = f.fk_soc";
1873 1873
 				if (!empty($thirdpartyBANId)) {
1874
-					$sql .= " AND rib.rowid = " . ((int) $thirdpartyBANId);
1874
+					$sql .= " AND rib.rowid = ".((int) $thirdpartyBANId);
1875 1875
 				} else {
1876 1876
 					$sql .= " AND rib.default_rib = 1";
1877 1877
 				}
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
 					$nbtotalDrctDbtTxInf = $i;
1907 1907
 				} else {
1908 1908
 					$this->error = $this->db->lasterror();
1909
-					fwrite($this->file, 'ERROR DEBITOR ' . $sql . $CrLf); // DEBITOR = Customers
1909
+					fwrite($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
1910 1910
 					$result = -2;
1911 1911
 				}
1912 1912
 
@@ -1923,26 +1923,26 @@  discard block
 block discarded – undo
1923 1923
 				 * SECTION CREATION SEPA FILE - ISO200022
1924 1924
 				 */
1925 1925
 				// SEPA File Header
1926
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1927
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
1928
-				fwrite($this->file, '	<CstmrDrctDbtInitn>' . $CrLf);
1926
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1927
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
1928
+				fwrite($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
1929 1929
 				// SEPA Group header
1930
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1931
-				fwrite($this->file, '			<MsgId>' . ('DOL/' . $dateTime_YMD . '/DD' . $this->id) . '</MsgId>' . $CrLf);
1932
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1933
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1934
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1935
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1936
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1937
-				fwrite($this->file, '				<Id>' . $CrLf);
1938
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1939
-				fwrite($this->file, '					<Othr>' . $CrLf);
1940
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1941
-				fwrite($this->file, '					</Othr>' . $CrLf);
1942
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1943
-				fwrite($this->file, '				</Id>' . $CrLf);
1944
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1945
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1930
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1931
+				fwrite($this->file, '			<MsgId>'.('DOL/'.$dateTime_YMD.'/DD'.$this->id).'</MsgId>'.$CrLf);
1932
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1933
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1934
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1935
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1936
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1937
+				fwrite($this->file, '				<Id>'.$CrLf);
1938
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1939
+				fwrite($this->file, '					<Othr>'.$CrLf);
1940
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1941
+				fwrite($this->file, '					</Othr>'.$CrLf);
1942
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1943
+				fwrite($this->file, '				</Id>'.$CrLf);
1944
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1945
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1946 1946
 				// SEPA File Emetteur
1947 1947
 				if ($result != -2) {
1948 1948
 					fwrite($this->file, $fileEmetteurSection);
@@ -1952,9 +1952,9 @@  discard block
 block discarded – undo
1952 1952
 					fwrite($this->file, $fileDebiteurSection);
1953 1953
 				}
1954 1954
 				// SEPA FILE FOOTER
1955
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1956
-				fwrite($this->file, '	</CstmrDrctDbtInitn>' . $CrLf);
1957
-				fwrite($this->file, '</Document>' . $CrLf);
1955
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1956
+				fwrite($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
1957
+				fwrite($this->file, '</Document>'.$CrLf);
1958 1958
 			} else {
1959 1959
 				/**
1960 1960
 				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
@@ -1986,13 +1986,13 @@  discard block
 block discarded – undo
1986 1986
 					$sql .= " s.ref as reffac, p.fk_salary as idfac,";
1987 1987
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
1988 1988
 					$sql .= " FROM";
1989
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1990
-					$sql .= " " . MAIN_DB_PREFIX . "salary as s,";
1991
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1992
-					$sql .= " " . MAIN_DB_PREFIX . "user as u";
1993
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid,";
1994
-					$sql .= " " . MAIN_DB_PREFIX . "user_rib as rib";
1995
-					$sql .= " WHERE pl.fk_prelevement_bons=" . ((int) $this->id);
1989
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1990
+					$sql .= " ".MAIN_DB_PREFIX."salary as s,";
1991
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1992
+					$sql .= " ".MAIN_DB_PREFIX."user as u";
1993
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
1994
+					$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
1995
+					$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
1996 1996
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1997 1997
 					$sql .= " AND p.fk_salary = s.rowid";
1998 1998
 					$sql .= " AND s.fk_user = u.rowid";
@@ -2003,19 +2003,19 @@  discard block
 block discarded – undo
2003 2003
 					$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,";
2004 2004
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
2005 2005
 					$sql .= " FROM";
2006
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2007
-					$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2008
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
2009
-					$sql .= " " . MAIN_DB_PREFIX . "societe as soc";
2010
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON soc.fk_pays = c.rowid,";
2011
-					$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
2012
-					$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2006
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2007
+					$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2008
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
2009
+					$sql .= " ".MAIN_DB_PREFIX."societe as soc";
2010
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
2011
+					$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
2012
+					$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2013 2013
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2014 2014
 					$sql .= " AND p.fk_facture_fourn = f.rowid";
2015 2015
 					$sql .= " AND f.fk_soc = soc.rowid";
2016 2016
 					$sql .= " AND rib.fk_soc = f.fk_soc";
2017 2017
 					if (!empty($thirdpartyBANId)) {
2018
-						$sql .= " AND rib.rowid = " . ((int) $thirdpartyBANId);
2018
+						$sql .= " AND rib.rowid = ".((int) $thirdpartyBANId);
2019 2019
 					} else {
2020 2020
 						$sql .= " AND rib.default_rib = 1";
2021 2021
 					}
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 						$iban = dolDecrypt($obj->iban);
2044 2044
 						$refobj = $obj->reffac;
2045 2045
 						if (empty($refobj) && !empty($forsalary)) {	// If ref of salary not defined, we force a value
2046
-							$refobj = "SAL" . $obj->idfac;
2046
+							$refobj = "SAL".$obj->idfac;
2047 2047
 						}
2048 2048
 
2049 2049
 						$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
 					$nbtotalDrctDbtTxInf = $i;
2055 2055
 				} else {
2056 2056
 					$this->error = $this->db->lasterror();
2057
-					fwrite($this->file, 'ERROR CREDITOR ' . $sql . $CrLf); // CREDITORS = Suppliers
2057
+					fwrite($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
2058 2058
 					$result = -2;
2059 2059
 				}
2060 2060
 				// Define $fileEmetteurSection. Start of block PmtInf. Will contains all $nbtotalDrctDbtTxInf
@@ -2070,26 +2070,26 @@  discard block
 block discarded – undo
2070 2070
 				 * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
2071 2071
 				 */
2072 2072
 				// SEPA File Header
2073
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
2074
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
2075
-				fwrite($this->file, '	<CstmrCdtTrfInitn>' . $CrLf);
2073
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
2074
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
2075
+				fwrite($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
2076 2076
 				// SEPA Group header
2077
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
2078
-				fwrite($this->file, '			<MsgId>' . ('DOL/' . $dateTime_YMD . '/CT' . $this->id) . '</MsgId>' . $CrLf);
2079
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
2080
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
2081
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
2082
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
2083
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
2084
-				fwrite($this->file, '				<Id>' . $CrLf);
2085
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
2086
-				fwrite($this->file, '					<Othr>' . $CrLf);
2087
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
2088
-				fwrite($this->file, '					</Othr>' . $CrLf);
2089
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
2090
-				fwrite($this->file, '				</Id>' . $CrLf);
2091
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
2092
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
2077
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
2078
+				fwrite($this->file, '			<MsgId>'.('DOL/'.$dateTime_YMD.'/CT'.$this->id).'</MsgId>'.$CrLf);
2079
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
2080
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
2081
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
2082
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
2083
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
2084
+				fwrite($this->file, '				<Id>'.$CrLf);
2085
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
2086
+				fwrite($this->file, '					<Othr>'.$CrLf);
2087
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
2088
+				fwrite($this->file, '					</Othr>'.$CrLf);
2089
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
2090
+				fwrite($this->file, '				</Id>'.$CrLf);
2091
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
2092
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
2093 2093
 				// SEPA File Emetteur (mycompany)
2094 2094
 				if ($result != -2) {
2095 2095
 					fwrite($this->file, $fileEmetteurSection);
@@ -2099,9 +2099,9 @@  discard block
 block discarded – undo
2099 2099
 					fwrite($this->file, $fileCrediteurSection);
2100 2100
 				}
2101 2101
 				// SEPA FILE FOOTER
2102
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
2103
-				fwrite($this->file, '	</CstmrCdtTrfInitn>' . $CrLf);
2104
-				fwrite($this->file, '</Document>' . $CrLf);
2102
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
2103
+				fwrite($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
2104
+				fwrite($this->file, '</Document>'.$CrLf);
2105 2105
 			}
2106 2106
 		}
2107 2107
 
@@ -2110,10 +2110,10 @@  discard block
 block discarded – undo
2110 2110
 			if ($type != 'bank-transfer') {
2111 2111
 				$sql = "SELECT pl.amount";
2112 2112
 				$sql .= " FROM";
2113
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2114
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
2115
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2116
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2113
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2114
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
2115
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2116
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2117 2117
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2118 2118
 				$sql .= " AND p.fk_facture = f.rowid";
2119 2119
 
@@ -2136,10 +2136,10 @@  discard block
 block discarded – undo
2136 2136
 			} else {
2137 2137
 				$sql = "SELECT pl.amount";
2138 2138
 				$sql .= " FROM";
2139
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2140
-				$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2141
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2142
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2139
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2140
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2141
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2142
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2143 2143
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2144 2144
 				$sql .= " AND p.fk_facture_fourn = f.rowid";
2145 2145
 				// Lines
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
 		$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
2189 2189
 
2190 2190
 		// 3 char + '-' + 12 + '-' + id + '-' + code 		Must be lower than 32.
2191
-		return $pre . '-' . dol_print_date($row_datec, 'dayhourlogsmall') . '-' . dol_trunc($row_drum . ($row_code_client ? '-' . $row_code_client : ''), 13, 'right', 'UTF-8', 1);
2191
+		return $pre.'-'.dol_print_date($row_datec, 'dayhourlogsmall').'-'.dol_trunc($row_drum.($row_code_client ? '-'.$row_code_client : ''), 13, 'right', 'UTF-8', 1);
2192 2192
 	}
2193 2193
 
2194 2194
 
@@ -2227,11 +2227,11 @@  discard block
 block discarded – undo
2227 2227
 
2228 2228
 		// Raison Sociale Destinataire C2
2229 2229
 
2230
-		fwrite($this->file, substr(strtoupper($client_nom) . "                         ", 0, 24));
2230
+		fwrite($this->file, substr(strtoupper($client_nom)."                         ", 0, 24));
2231 2231
 
2232 2232
 		// Address optional D1
2233 2233
 		$address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => ""));
2234
-		fwrite($this->file, substr($address . "                         ", 0, 24));
2234
+		fwrite($this->file, substr($address."                         ", 0, 24));
2235 2235
 
2236 2236
 		// Zone Reservee D2
2237 2237
 
@@ -2243,17 +2243,17 @@  discard block
 block discarded – undo
2243 2243
 
2244 2244
 		// Numero de compte D4
2245 2245
 
2246
-		fwrite($this->file, substr("000000000000000" . $rib_number, -11));
2246
+		fwrite($this->file, substr("000000000000000".$rib_number, -11));
2247 2247
 
2248 2248
 		// Zone E Montant
2249 2249
 
2250 2250
 		$montant = (round($amount, 2) * 100);
2251 2251
 
2252
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2252
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2253 2253
 
2254 2254
 		// Label F
2255 2255
 
2256
-		fwrite($this->file, substr("*_" . $ref . "_RDVnet" . $rowid . "                               ", 0, 31));
2256
+		fwrite($this->file, substr("*_".$ref."_RDVnet".$rowid."                               ", 0, 31));
2257 2257
 
2258 2258
 		// Code etablissement G1
2259 2259
 
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 			$row_somme = round((float) $row_somme, 2);
2305 2305
 		}
2306 2306
 
2307
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
2307
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2308 2308
 
2309 2309
 		$CrLf = "\n";
2310 2310
 		$Rowing = sprintf("%010d", $row_idfac);
@@ -2319,46 +2319,46 @@  discard block
 block discarded – undo
2319 2319
 		if ($type != 'bank-transfer') {
2320 2320
 			// SEPA Paiement Information of buyer for Direct Debit
2321 2321
 			$XML_DEBITOR = '';
2322
-			$XML_DEBITOR .= '			<DrctDbtTxInf>' . $CrLf;
2323
-			$XML_DEBITOR .= '				<PmtId>' . $CrLf;
2322
+			$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
2323
+			$XML_DEBITOR .= '				<PmtId>'.$CrLf;
2324 2324
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2325
-			$XML_DEBITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2326
-			$XML_DEBITOR .= '				</PmtId>' . $CrLf;
2327
-			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">' . $row_somme . '</InstdAmt>' . $CrLf;
2328
-			$XML_DEBITOR .= '				<DrctDbtTx>' . $CrLf;
2329
-			$XML_DEBITOR .= '					<MndtRltdInf>' . $CrLf;
2330
-			$XML_DEBITOR .= '						<MndtId>' . $Rum . '</MndtId>' . $CrLf;
2331
-			$XML_DEBITOR .= '						<DtOfSgntr>' . $DtOfSgntr . '</DtOfSgntr>' . $CrLf;
2332
-			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>' . $CrLf;
2333
-			$XML_DEBITOR .= '					</MndtRltdInf>' . $CrLf;
2334
-			$XML_DEBITOR .= '				</DrctDbtTx>' . $CrLf;
2335
-			$XML_DEBITOR .= '				<DbtrAgt>' . $CrLf;
2336
-			$XML_DEBITOR .= '					<FinInstnId>' . $CrLf;
2325
+			$XML_DEBITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2326
+			$XML_DEBITOR .= '				</PmtId>'.$CrLf;
2327
+			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.$row_somme.'</InstdAmt>'.$CrLf;
2328
+			$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
2329
+			$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
2330
+			$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
2331
+			$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
2332
+			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
2333
+			$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
2334
+			$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
2335
+			$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
2336
+			$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
2337 2337
 			if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) {
2338
-				$XML_DEBITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2338
+				$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2339 2339
 			}
2340
-			$XML_DEBITOR .= '					</FinInstnId>' . $CrLf;
2341
-			$XML_DEBITOR .= '				</DbtrAgt>' . $CrLf;
2342
-			$XML_DEBITOR .= '				<Dbtr>' . $CrLf;
2343
-			$XML_DEBITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2344
-			$XML_DEBITOR .= '					<PstlAdr>' . $CrLf;
2345
-			$XML_DEBITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2340
+			$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
2341
+			$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
2342
+			$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
2343
+			$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2344
+			$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
2345
+			$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2346 2346
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2347
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2347
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2348 2348
 			if (trim($addressline1)) {
2349
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2349
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2350 2350
 			}
2351 2351
 			if (trim($addressline2)) {
2352
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2352
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2353 2353
 			}
2354
-			$XML_DEBITOR .= '					</PstlAdr>' . $CrLf;
2355
-			$XML_DEBITOR .= '				</Dbtr>' . $CrLf;
2356
-			$XML_DEBITOR .= '				<DbtrAcct>' . $CrLf;
2357
-			$XML_DEBITOR .= '					<Id>' . $CrLf;
2358
-			$XML_DEBITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2359
-			$XML_DEBITOR .= '					</Id>' . $CrLf;
2360
-			$XML_DEBITOR .= '				</DbtrAcct>' . $CrLf;
2361
-			$XML_DEBITOR .= '				<RmtInf>' . $CrLf;
2354
+			$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
2355
+			$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
2356
+			$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
2357
+			$XML_DEBITOR .= '					<Id>'.$CrLf;
2358
+			$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2359
+			$XML_DEBITOR .= '					</Id>'.$CrLf;
2360
+			$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
2361
+			$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
2362 2362
 
2363 2363
 			// Structured data for Belgium
2364 2364
 			if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION') && $mysoc->country_code == 'BE') {
@@ -2368,24 +2368,24 @@  discard block
 block discarded – undo
2368 2368
 				$invoicestatic->fetch($row_idfac);
2369 2369
 
2370 2370
 				$invoicePaymentKey = dolBECalculateStructuredCommunication($invoicestatic->ref, $invoicestatic->type);
2371
-				$XML_DEBITOR .= '					<strd>' . $invoicePaymentKey . '</strd>' . $CrLf;
2371
+				$XML_DEBITOR .= '					<strd>'.$invoicePaymentKey.'</strd>'.$CrLf;
2372 2372
 			} else {
2373 2373
 				// A string with some information on payment - 140 max
2374
-				$XML_DEBITOR .= '					<Ustrd>' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstuctured data - 140 max
2374
+				$XML_DEBITOR .= '					<Ustrd>'.getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstuctured data - 140 max
2375 2375
 			}
2376
-			$XML_DEBITOR .= '				</RmtInf>' . $CrLf;
2377
-			$XML_DEBITOR .= '			</DrctDbtTxInf>' . $CrLf;
2376
+			$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
2377
+			$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
2378 2378
 			return $XML_DEBITOR;
2379 2379
 		} else {
2380 2380
 			// SEPA Payment Information of seller for Credit Transfer
2381 2381
 			$XML_CREDITOR = '';
2382
-			$XML_CREDITOR .= '			<CdtTrfTxInf>' . $CrLf;
2383
-			$XML_CREDITOR .= '				<PmtId>' . $CrLf;
2382
+			$XML_CREDITOR .= '			<CdtTrfTxInf>'.$CrLf;
2383
+			$XML_CREDITOR .= '				<PmtId>'.$CrLf;
2384 2384
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2385
-			$XML_CREDITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2386
-			$XML_CREDITOR .= '				</PmtId>' . $CrLf;
2385
+			$XML_CREDITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2386
+			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
2387 2387
 			if (!empty($this->sepa_xml_pti_in_ctti)) {
2388
-				$XML_CREDITOR .= '				<PmtTpInf>' . $CrLf;
2388
+				$XML_CREDITOR .= '				<PmtTpInf>'.$CrLf;
2389 2389
 
2390 2390
 				// Can be 'NORM' for normal or 'HIGH' for high priority level
2391 2391
 				if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) {
@@ -2397,18 +2397,18 @@  discard block
 block discarded – undo
2397 2397
 				// Set $categoryPurpose: CORE, TREA, SUPP, ...
2398 2398
 				$categoryPurpose = getDolGlobalString('PAYMENTBYBANKTRANSFER_CUSTOM_CATEGORY_PURPOSE', 'CORE');
2399 2399
 
2400
-				$XML_CREDITOR .= '					<InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf;
2401
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2402
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2403
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2404
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2405
-				$XML_CREDITOR .= '						<Cd>' . $categoryPurpose . '</Cd>' . $CrLf;
2406
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2407
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2400
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2401
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2402
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2403
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2404
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2405
+				$XML_CREDITOR .= '						<Cd>'.$categoryPurpose.'</Cd>'.$CrLf;
2406
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2407
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2408 2408
 			}
2409
-			$XML_CREDITOR .= '				<Amt>' . $CrLf;
2409
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2410 2410
 			$XML_CREDITOR .= '				<InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf;
2411
-			$XML_CREDITOR .= '				</Amt>' . $CrLf;
2411
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
2412 2412
 			/*
2413 2413
 			 $XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
2414 2414
 			 $XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
@@ -2419,35 +2419,35 @@  discard block
 block discarded – undo
2419 2419
 			 $XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
2420 2420
 			 */
2421 2421
 			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
2422
-			$XML_CREDITOR .= '				<CdtrAgt>' . $CrLf;
2423
-			$XML_CREDITOR .= '					<FinInstnId>' . $CrLf;
2424
-			$XML_CREDITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2425
-			$XML_CREDITOR .= '					</FinInstnId>' . $CrLf;
2426
-			$XML_CREDITOR .= '				</CdtrAgt>' . $CrLf;
2427
-			$XML_CREDITOR .= '				<Cdtr>' . $CrLf;
2428
-			$XML_CREDITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2429
-			$XML_CREDITOR .= '					<PstlAdr>' . $CrLf;
2430
-			$XML_CREDITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2422
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
2423
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
2424
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2425
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
2426
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
2427
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
2428
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2429
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
2430
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2431 2431
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2432
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2432
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2433 2433
 			if (trim($addressline1)) {
2434
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2434
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2435 2435
 			}
2436 2436
 			if (trim($addressline2)) {
2437
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2437
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2438 2438
 			}
2439
-			$XML_CREDITOR .= '					</PstlAdr>' . $CrLf;
2440
-			$XML_CREDITOR .= '				</Cdtr>' . $CrLf;
2441
-			$XML_CREDITOR .= '				<CdtrAcct>' . $CrLf;
2442
-			$XML_CREDITOR .= '					<Id>' . $CrLf;
2443
-			$XML_CREDITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2444
-			$XML_CREDITOR .= '					</Id>' . $CrLf;
2445
-			$XML_CREDITOR .= '				</CdtrAcct>' . $CrLf;
2446
-			$XML_CREDITOR .= '				<RmtInf>' . $CrLf;
2439
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
2440
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
2441
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
2442
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
2443
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2444
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
2445
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
2446
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
2447 2447
 			// A string with some information on payment - 140 max
2448
-			$XML_CREDITOR .= '					<Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max
2449
-			$XML_CREDITOR .= '				</RmtInf>' . $CrLf;
2450
-			$XML_CREDITOR .= '			</CdtTrfTxInf>' . $CrLf;
2448
+			$XML_CREDITOR .= '					<Ustrd>'.getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstructured data - 140 max
2449
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
2450
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
2451 2451
 			return $XML_CREDITOR;
2452 2452
 		}
2453 2453
 	}
@@ -2480,11 +2480,11 @@  discard block
 block discarded – undo
2480 2480
 
2481 2481
 		// Raison Sociale C2
2482 2482
 
2483
-		fwrite($this->file, substr($this->raison_sociale . "                           ", 0, 24));
2483
+		fwrite($this->file, substr($this->raison_sociale."                           ", 0, 24));
2484 2484
 
2485 2485
 		// Ref of thirdparty on 7 characters
2486 2486
 
2487
-		fwrite($this->file, substr($this->reference_remise . "                           ", 0, 7));
2487
+		fwrite($this->file, substr($this->reference_remise."                           ", 0, 7));
2488 2488
 
2489 2489
 		// Zone Reservee D1-2
2490 2490
 
@@ -2502,7 +2502,7 @@  discard block
 block discarded – undo
2502 2502
 
2503 2503
 		// Numero de compte D4
2504 2504
 
2505
-		fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11));
2505
+		fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11));
2506 2506
 
2507 2507
 		// Zone Reservee E
2508 2508
 
@@ -2564,15 +2564,15 @@  discard block
 block discarded – undo
2564 2564
 			$this->emetteur_iban = $account->iban;
2565 2565
 			$this->emetteur_bic = $account->bic;
2566 2566
 
2567
-			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2567
+			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2568 2568
 
2569 2569
 			$this->raison_sociale = $account->owner_name;
2570 2570
 		}
2571 2571
 
2572 2572
 		// Get pending payments
2573 2573
 		$sql = "SELECT rowid, ref";
2574
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb";
2575
-		$sql .= " WHERE pb.rowid = " . ((int) $this->id);
2574
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb";
2575
+		$sql .= " WHERE pb.rowid = ".((int) $this->id);
2576 2576
 
2577 2577
 		$resql = $this->db->query($sql);
2578 2578
 		if ($resql) {
@@ -2590,45 +2590,45 @@  discard block
 block discarded – undo
2590 2590
 			if ($type != 'bank-transfer') {
2591 2591
 				// SEPA Paiement Information of my company for Direct Debit
2592 2592
 				$XML_SEPA_INFO = '';
2593
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2594
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DOL/' . $dateTime_YMD . '/DD' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2595
-				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>' . $CrLf;
2596
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2597
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2598
-				$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2599
-				$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2600
-				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2601
-				$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2602
-				$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2603
-				$XML_SEPA_INFO .= '					<Cd>' . $localInstrument . '</Cd>' . $CrLf;
2604
-				$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2605
-				$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2606
-				$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2607
-				$XML_SEPA_INFO .= '			<ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
2608
-				$XML_SEPA_INFO .= '			<Cdtr>' . $CrLf;
2609
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2610
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2611
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2593
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2594
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DOL/'.$dateTime_YMD.'/DD'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2595
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
2596
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2597
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2598
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2599
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2600
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2601
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2602
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2603
+				$XML_SEPA_INFO .= '					<Cd>'.$localInstrument.'</Cd>'.$CrLf;
2604
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2605
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2606
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2607
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
2608
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
2609
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2610
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2611
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2612 2612
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2613
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2613
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2614 2614
 				if ($addressline1) {
2615
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2615
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2616 2616
 				}
2617 2617
 				if ($addressline2) {
2618
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2618
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2619 2619
 				}
2620
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2621
-				$XML_SEPA_INFO .= '			</Cdtr>' . $CrLf;
2622
-				$XML_SEPA_INFO .= '			<CdtrAcct>' . $CrLf;
2623
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2624
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2625
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2626
-				$XML_SEPA_INFO .= '			</CdtrAcct>' . $CrLf;
2627
-				$XML_SEPA_INFO .= '			<CdtrAgt>' . $CrLf;
2628
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2629
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2630
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2631
-				$XML_SEPA_INFO .= '			</CdtrAgt>' . $CrLf;
2620
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2621
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
2622
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
2623
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2624
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2625
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2626
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
2627
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
2628
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2629
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2630
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2631
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
2632 2632
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2633 2633
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2634 2634
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2637,64 +2637,64 @@  discard block
 block discarded – undo
2637 2637
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2638 2638
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2639 2639
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2640
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2641
-				$XML_SEPA_INFO .= '			<CdtrSchmeId>' . $CrLf;
2642
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2643
-				$XML_SEPA_INFO .= '					<PrvtId>' . $CrLf;
2644
-				$XML_SEPA_INFO .= '						<Othr>' . $CrLf;
2645
-				$XML_SEPA_INFO .= '							<Id>' . $this->emetteur_ics . '</Id>' . $CrLf;
2646
-				$XML_SEPA_INFO .= '							<SchmeNm>' . $CrLf;
2647
-				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>' . $CrLf;
2648
-				$XML_SEPA_INFO .= '							</SchmeNm>' . $CrLf;
2649
-				$XML_SEPA_INFO .= '						</Othr>' . $CrLf;
2650
-				$XML_SEPA_INFO .= '					</PrvtId>' . $CrLf;
2651
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2652
-				$XML_SEPA_INFO .= '			</CdtrSchmeId>' . $CrLf;
2640
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2641
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2642
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2643
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
2644
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
2645
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
2646
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
2647
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
2648
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
2649
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
2650
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
2651
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2652
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
2653 2653
 			} else {
2654 2654
 				// SEPA Paiement Information of my company for Credit Transfer
2655 2655
 				$XML_SEPA_INFO = '';
2656
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2657
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DOL/' . $dateTime_YMD . '/CT' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2658
-				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>' . $CrLf;
2656
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2657
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DOL/'.$dateTime_YMD.'/CT'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2658
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
2659 2659
 				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
2660
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2661
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2660
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2661
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2662 2662
 				if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) {	// @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange.
2663
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2664
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2665
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2666
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2667
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2668
-					$XML_SEPA_INFO .= '					<Cd>' . $localInstrument . '</Cd>' . $CrLf;
2669
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2670
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2671
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2663
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2664
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2665
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2666
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2667
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2668
+					$XML_SEPA_INFO .= '					<Cd>'.$localInstrument.'</Cd>'.$CrLf;
2669
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2670
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2671
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2672 2672
 				}
2673
-				$XML_SEPA_INFO .= '			<ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf;
2674
-				$XML_SEPA_INFO .= '			<Dbtr>' . $CrLf;
2675
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2676
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2677
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2673
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2674
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
2675
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2676
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2677
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2678 2678
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2679
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2679
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2680 2680
 				if ($addressline1) {
2681
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2681
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2682 2682
 				}
2683 2683
 				if ($addressline2) {
2684
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2684
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2685 2685
 				}
2686
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2687
-				$XML_SEPA_INFO .= '			</Dbtr>' . $CrLf;
2688
-				$XML_SEPA_INFO .= '			<DbtrAcct>' . $CrLf;
2689
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2690
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2691
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2692
-				$XML_SEPA_INFO .= '			</DbtrAcct>' . $CrLf;
2693
-				$XML_SEPA_INFO .= '			<DbtrAgt>' . $CrLf;
2694
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2695
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2696
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2697
-				$XML_SEPA_INFO .= '			</DbtrAgt>' . $CrLf;
2686
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2687
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
2688
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
2689
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2690
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2691
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2692
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
2693
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
2694
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2695
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2696
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2697
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
2698 2698
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2699 2699
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2700 2700
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2704 2704
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2705 2705
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2706
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2706
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2707 2707
 				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2708 2708
 				 $XML_SEPA_INFO .= '				<Id>'.$CrLf;
2709 2709
 				 $XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
 				 $XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
2719 2719
 			}
2720 2720
 		} else {
2721
-			fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf);
2721
+			fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
2722 2722
 			$XML_SEPA_INFO = '';
2723 2723
 		}
2724 2724
 		return $XML_SEPA_INFO;
@@ -2770,7 +2770,7 @@  discard block
 block discarded – undo
2770 2770
 
2771 2771
 		$montant = ($total * 100);
2772 2772
 
2773
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2773
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2774 2774
 
2775 2775
 		// Zone Reservee F
2776 2776
 
@@ -2927,18 +2927,18 @@  discard block
 block discarded – undo
2927 2927
 		$return .= img_picto('', $this->picto);
2928 2928
 		$return .= '</span>';
2929 2929
 		$return .= '<div class="info-box-content">';
2930
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>';
2930
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
2931 2931
 		if ($selected >= 0) {
2932
-			$return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
2932
+			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2933 2933
 		}
2934 2934
 		if (property_exists($this, 'date_echeance')) {
2935
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Date") . '</span> : <span class="info-box-label">' . dol_print_date($this->db->jdate($this->date_echeance), 'day') . '</span>';
2935
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';
2936 2936
 		}
2937 2937
 		if (property_exists($this, 'total')) {
2938
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>';
2938
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
2939 2939
 		}
2940 2940
 		if (method_exists($this, 'LibStatut')) {
2941
-			$return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
2941
+			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2942 2942
 		}
2943 2943
 		$return .= '</div>';
2944 2944
 		$return .= '</div>';
@@ -2959,9 +2959,9 @@  discard block
 block discarded – undo
2959 2959
 			return 0;
2960 2960
 		}
2961 2961
 		if ($id) {
2962
-			$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
2963
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $id);
2964
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2962
+			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2963
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2964
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2965 2965
 			$sql .= " AND fk_user IS NOT NULL";
2966 2966
 
2967 2967
 			$num = 0;
Please login to merge, or discard this patch.