Completed
Branch develop (77a76a)
by
unknown
22:58
created
htdocs/projet/tasks.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 $confirm = GETPOST('confirm', 'alpha');
52 52
 $cancel = GETPOST('cancel', 'aZ09');
53 53
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'projecttasklist';
54
-$backtopage = GETPOST('backtopage', 'alpha');					// if not set, a default page will be used
54
+$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
55 55
 //$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');	// if not set, $backtopage will be used
56 56
 //$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha');
57 57
 $optioncss  = GETPOST('optioncss', 'aZ');
@@ -94,20 +94,20 @@  discard block
 block discarded – undo
94 94
 $search_date_start_startmonth = GETPOSTINT('search_date_start_startmonth');
95 95
 $search_date_start_startyear = GETPOSTINT('search_date_start_startyear');
96 96
 $search_date_start_startday = GETPOSTINT('search_date_start_startday');
97
-$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear);	// Use tzserver
97
+$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver
98 98
 $search_date_start_endmonth = GETPOSTINT('search_date_start_endmonth');
99 99
 $search_date_start_endyear = GETPOSTINT('search_date_start_endyear');
100 100
 $search_date_start_endday = GETPOSTINT('search_date_start_endday');
101
-$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear);	// Use tzserver
101
+$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver
102 102
 
103 103
 $search_date_end_startmonth = GETPOSTINT('search_date_end_startmonth');
104 104
 $search_date_end_startyear = GETPOSTINT('search_date_end_startyear');
105 105
 $search_date_end_startday = GETPOSTINT('search_date_end_startday');
106
-$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);	// Use tzserver
106
+$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver
107 107
 $search_date_end_endmonth = GETPOSTINT('search_date_end_endmonth');
108 108
 $search_date_end_endyear = GETPOSTINT('search_date_end_endyear');
109 109
 $search_date_end_endday = GETPOSTINT('search_date_end_endday');
110
-$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);	// Use tzserver
110
+$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver
111 111
 
112 112
 //if (! $user->rights->projet->all->lire) $mine=1;	// Special for projects
113 113
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 $progress = GETPOSTINT('progress');
152 152
 $budget_amount = GETPOSTFLOAT('budget_amount');
153
-$billable = (GETPOST('billable', 'aZ') == 'yes'? 1 : 0);
153
+$billable = (GETPOST('billable', 'aZ') == 'yes' ? 1 : 0);
154 154
 $label = GETPOST('label', 'alpha');
155 155
 $description = GETPOST('description', 'restricthtml');
156 156
 $planned_workloadhour = (GETPOSTISSET('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : '');
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
189 189
 
190 190
 $arrayfields = dol_sort_array($arrayfields, 'position');
191
-'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';  // dol_sort_array looses type for Phan
191
+'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
192 192
 
193 193
 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
194 194
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		$param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday));
550 550
 	}
551 551
 	if ($search_date_end_end) {
552
-		$param .= '&search_date_end_end=' . urlencode($search_date_end_end);
552
+		$param .= '&search_date_end_end='.urlencode($search_date_end_end);
553 553
 	}
554 554
 	if ($search_planedworkload) {
555 555
 		$param .= '&search_planedworkload='.urlencode($search_planedworkload);
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) {
593 593
 		$tmpurl = $_SESSION['pageforbacktolist']['project'];
594 594
 		$tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl);
595
-		$linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
595
+		$linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
596 596
 	} else {
597 597
 		$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
598 598
 	}
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
 
758 758
 	$defaultref = '';
759 759
 	$classnamemodtask = getDolGlobalString('PROJECT_TASK_ADDON', 'mod_task_simple');
760
-	if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) {
761
-		require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php';
760
+	if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').".php")) {
761
+		require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').'.php';
762 762
 		$modTask = new $classnamemodtask();
763 763
 		'@phan-var-force ModeleNumRefTask $modTask';
764 764
 		$defaultref = $modTask->getNextValue($object->thirdparty, $object);
Please login to merge, or discard this patch.
htdocs/fourn/facture/card-rec.php 1 patch
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -34,17 +34,17 @@  discard block
 block discarded – undo
34 34
 
35 35
 // Load Dolibarr environment
36 36
 require '../../main.inc.php';
37
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
41 41
 if (isModEnabled('project')) {
42
-	include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
42
+	include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
43 43
 }
44
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
45
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
46
-require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
47
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
44
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
45
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
46
+require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
47
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
48 48
 
49 49
 // Load translation files required by the page
50 50
 $langs->loadLangs(array('bills', 'companies', 'compta', 'admin', 'other', 'products', 'banks', 'suppliers'));
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 	$page = 0;
86 86
 }     // If $page is not defined, or '' or -1
87 87
 $offset = $limit * $page;
88
-if (! $sortorder) {
88
+if (!$sortorder) {
89 89
 	$sortorder = 'DESC';
90 90
 }
91
-if (! $sortfield) {
91
+if (!$sortfield) {
92 92
 	$sortfield = 'f.titre';
93 93
 }
94 94
 $pageprev = $page - 1;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 $object = new FactureFournisseurRec($db);
98 98
 if (($id > 0 || $title) && $action != 'create' && $action != 'add') {
99 99
 	$ret = $object->fetch($id, $title);
100
-	if (! $ret) {
100
+	if (!$ret) {
101 101
 		setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
102 102
 	}
103 103
 }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	$action = 'list';
144 144
 	$massaction = '';
145 145
 }
146
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
146
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
147 147
 	$massaction = '';
148 148
 }
149 149
 
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
 	}
160 160
 
161 161
 	// Selection of new fields
162
-	include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
162
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
163 163
 
164 164
 	// Set note
165
-	include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
165
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
166 166
 
167
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
167
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
168 168
 
169
-	include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once'
169
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once'
170 170
 
171 171
 	// Create predefined invoice
172 172
 	if ($action == 'add' && $permissiontoadd) {
173
-		if (! GETPOST('title', 'alphanohtml')) {
173
+		if (!GETPOST('title', 'alphanohtml')) {
174 174
 			setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
175 175
 			$action = "create";
176 176
 			$error++;
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 			}
194 194
 		}
195 195
 
196
-		if (! $error) {
196
+		if (!$error) {
197 197
 			$object->subtype               = GETPOSTINT('subtype');
198 198
 			$object->title                 = GETPOST('title', 'alphanohtml');
199
-			$object->libelle               = GETPOST('libelle', 'alpha');	// deprecated
199
+			$object->libelle               = GETPOST('libelle', 'alpha'); // deprecated
200 200
 			$object->label                 = GETPOST('libelle', 'alpha');
201 201
 			$object->fk_project            = GETPOSTINT('projectid');
202 202
 			$object->ref_supplier          = GETPOST('ref_supplier', 'alphanohtml');
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 				$action = "create";
243 243
 			}
244 244
 
245
-			if (! $error) {
245
+			if (!$error) {
246 246
 				$db->commit();
247 247
 
248
-				header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id);
248
+				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id);
249 249
 				exit;
250 250
 			} else {
251 251
 				$db->rollback();
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $permissiontodelete) {
263 263
 		$object->delete($user);
264 264
 
265
-		header('Location: ' . DOL_URL_ROOT . '/fourn/facture/list-rec.php');
265
+		header('Location: '.DOL_URL_ROOT.'/fourn/facture/list-rec.php');
266 266
 		exit;
267 267
 	}
268 268
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 		$result = $object->setValueFrom('titre', $title, '', null, 'text', '', $user);
293 293
 
294 294
 		if ($result > 0) {
295
-			$object->titre = $title;	// deprecated
295
+			$object->titre = $title; // deprecated
296 296
 			$object->title = $title;
297 297
 			$object->ref = $object->title;
298 298
 		} else {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			$error++;
340 340
 		}
341 341
 
342
-		if (! $error) {
342
+		if (!$error) {
343 343
 			$db->commit();
344 344
 		} else {
345 345
 			$db->rollback();
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			$error++;
357 357
 		}
358 358
 
359
-		if (! $error) {
359
+		if (!$error) {
360 360
 			$db->commit();
361 361
 		} else {
362 362
 			$db->rollback();
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 			$error++;
416 416
 		}
417 417
 
418
-		if (! $error) {
418
+		if (!$error) {
419 419
 			$result = $object->insertExtraFields('BILLREC_MODIFY');
420 420
 			if ($result < 0) {
421 421
 				setEventMessages($object->error, $object->errors, 'errors');
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 			$tva_tx = '';
445 445
 		}
446 446
 
447
-		$qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2);
448
-		$remise_percent = price2num(GETPOST('remise_percent' . $predef), '', 2);
447
+		$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
448
+		$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
449 449
 
450 450
 		// Extrafields
451 451
 		$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 		if (is_array($extralabelsline)) {
455 455
 			// Get extra fields
456 456
 			foreach ($extralabelsline as $key => $value) {
457
-				unset($_POST["options_" . $key . $predef]);
457
+				unset($_POST["options_".$key.$predef]);
458 458
 			}
459 459
 		}
460 460
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 			setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
467 467
 			$error++;
468 468
 		}
469
-		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
469
+		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
470 470
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
471 471
 			$error++;
472 472
 		}
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 			}
516 516
 		}
517 517
 
518
-		if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
518
+		if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
519 519
 			$ret = $object->fetch($id);
520 520
 			if ($ret < 0) {
521 521
 				dol_print_error($db, $object->error);
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 			$ret = $object->fetch_thirdparty();
525 525
 
526 526
 			// Clean parameters
527
-			$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
528
-			$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
527
+			$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
528
+			$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
529 529
 			$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
530 530
 
531 531
 			// Define special_code for special lines
@@ -622,23 +622,23 @@  discard block
 block discarded – undo
622 622
 							$outputlangs->load('products');
623 623
 						}
624 624
 						if (!empty($prod->customcode)) {
625
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
625
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
626 626
 						}
627 627
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
628 628
 							$tmptxt .= ' - ';
629 629
 						}
630 630
 						if (!empty($prod->country_code)) {
631
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $outputlangs, 0);
631
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $outputlangs, 0);
632 632
 						}
633 633
 					} else {
634 634
 						if (!empty($prod->customcode)) {
635
-							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
635
+							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
636 636
 						}
637 637
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
638 638
 							$tmptxt .= ' - ';
639 639
 						}
640 640
 						if (!empty($prod->country_code)) {
641
-							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $langs, 0);
641
+							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $langs, 0);
642 642
 						}
643 643
 					}
644 644
 					$tmptxt .= ')';
@@ -664,8 +664,8 @@  discard block
 block discarded – undo
664 664
 			$date_end_fill = !empty(GETPOSTINT('date_end_fill')) ? GETPOSTINT('date_end_fill') : null;
665 665
 
666 666
 			// Margin
667
-			$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
668
-			$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
667
+			$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
668
+			$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
669 669
 
670 670
 			// Local Taxes
671 671
 			$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 				$action = '';
732 732
 			}
733 733
 		}
734
-	} elseif ($action == 'updateline' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) {
735
-		if (! $object->fetch($id) > 0) {
734
+	} elseif ($action == 'updateline' && $permissiontoadd && !GETPOST('cancel', 'alpha')) {
735
+		if (!$object->fetch($id) > 0) {
736 736
 			dol_print_error($db);
737 737
 		}
738 738
 		$object->fetch_thirdparty();
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 			$objectline->array_options = $array_options;
768 768
 			$result = $objectline->insertExtraFields();
769 769
 			if ($result < 0) {
770
-				setEventMessages($langs->trans('Error') . $result, null, 'errors');
770
+				setEventMessages($langs->trans('Error').$result, null, 'errors');
771 771
 			}
772 772
 		}
773 773
 
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
 		if (is_array($extralabelsline)) {
778 778
 			// Get extra fields
779 779
 			foreach ($extralabelsline as $key => $value) {
780
-				unset($_POST["options_" . $key]);
780
+				unset($_POST["options_".$key]);
781 781
 			}
782 782
 		}
783 783
 
784 784
 		// Define special_code for special lines
785 785
 		$special_code = GETPOSTINT('special_code');
786
-		if (! GETPOST('qty', 'alpha')) {
786
+		if (!GETPOST('qty', 'alpha')) {
787 787
 			$special_code = 3;
788 788
 		}
789 789
 
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 		$date_end_fill = !empty(GETPOSTINT('date_end_fill')) ? GETPOSTINT('date_end_fill') : 'NULL';
830 830
 
831 831
 		// Update line
832
-		if (! $error) {
832
+		if (!$error) {
833 833
 			$result = $object->updateline(GETPOSTINT('lineid'), GETPOSTINT('productid'), $ref_fourn, $label, $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax1_rate, 'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1);
834 834
 			if ($result >= 0) {
835 835
 				$object->fetch($object->id); // Reload lines
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
 	if ($object->fetch($id) > 0) {
904 904
 		$result = $object->fetch_lines();
905 905
 
906
-		print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
907
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
906
+		print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
907
+		print '<input type="hidden" name="token" value="'.newToken().'">';
908 908
 		print '<input type="hidden" name="action" value="add">';
909
-		print '<input type="hidden" name="facid" value="' . $object->id . '">';
909
+		print '<input type="hidden" name="facid" value="'.$object->id.'">';
910 910
 
911 911
 		print dol_get_fiche_head(null, '', '', 0);
912 912
 
@@ -923,17 +923,17 @@  discard block
 block discarded – undo
923 923
 		$object->fetch_thirdparty();
924 924
 
925 925
 		// Title
926
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Title") . '</td><td>';
927
-		print '<input class="flat quatrevingtpercent" type="text" name="title" value="' . dol_escape_htmltag(GETPOST("title", 'alphanohtml')) . '" autofocus>';
926
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
927
+		print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus>';
928 928
 		print '</td></tr>';
929 929
 
930 930
 		// Ref supplier
931
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("RefSupplier") . '</td><td>';
932
-		print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="' . $object->ref_supplier . '">';
931
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("RefSupplier").'</td><td>';
932
+		print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="'.$object->ref_supplier.'">';
933 933
 		print '</td></tr>';
934 934
 
935 935
 		// Third party
936
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Customer") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'customer') . '</td>';
936
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1, 'customer').'</td>';
937 937
 		print '</tr>';
938 938
 
939 939
 		// Invoice subtype
@@ -949,42 +949,42 @@  discard block
 block discarded – undo
949 949
 		// Help of substitution key
950 950
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
951 951
 
952
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')';
953
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%m') . ')';
954
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m') . ')';
955
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B') . ')';
956
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%B') . ')';
957
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B') . ')';
958
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y') . ')';
959
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%Y') . ')';
960
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y') . ')';
952
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m').')';
953
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%m').')';
954
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m').')';
955
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')';
956
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')';
957
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')';
958
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
959
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
960
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')';
961 961
 		// Only on template invoices
962
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . (isset($object->date_when) ? ' (' . $langs->trans("Example") . ': ' .dol_print_date($object->date_when, 'dayhour') . ')' : '');
963
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . (isset($object->date_when) ? ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour') . ')' : '');
962
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')' : '');
963
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')' : '');
964 964
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count");
965 965
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber");
966 966
 
967
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
967
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
968 968
 		foreach ($substitutionarray as $key => $val) {
969
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
969
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
970 970
 		}
971 971
 		$htmltext .= '</i>';
972 972
 
973 973
 		// Label
974
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Label") . '</td><td>';
975
-		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label . '">';
974
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td>';
975
+		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="'.$object->label.'">';
976 976
 		print '</td></tr>';
977 977
 
978 978
 		// Author
979
-		print "<tr><td>" . $langs->trans("Author") . "</td><td>" . $user->getFullName($langs) . "</td></tr>";
979
+		print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
980 980
 
981 981
 		// Payment term
982
-		print "<tr><td>" . $langs->trans("PaymentConditions") . "</td><td>";
982
+		print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
983 983
 		print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $object->cond_reglement_id, 'cond_reglement_id', -1, 0, 0, '');
984 984
 		print "</td></tr>";
985 985
 
986 986
 		// Payment mode
987
-		print "<tr><td>" . $langs->trans("PaymentMode") . "</td><td>";
987
+		print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
988 988
 		print img_picto('', 'payment', 'class="pictofixedwidth"');
989 989
 		print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1);
990 990
 		print "</td></tr>";
@@ -993,16 +993,16 @@  discard block
 block discarded – undo
993 993
 		if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
994 994
 			$projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project;
995 995
 			$langs->load('projects');
996
-			print '<tr><td>' . $langs->trans('Project') . '</td><td>';
996
+			print '<tr><td>'.$langs->trans('Project').'</td><td>';
997 997
 			$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
998
-			print ' &nbsp; <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $object->thirdparty->id . (!empty($id) ? '&id=' . $id : '')) . '">' . $langs->trans("AddProject") . '</a>';
998
+			print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").'</a>';
999 999
 			print '</td></tr>';
1000 1000
 		}
1001 1001
 
1002 1002
 		// Bank account
1003 1003
 		if ($object->fk_account > 0) {
1004
-			print "<tr><td>" . $langs->trans('BankAccount') . "</td><td>";
1005
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1004
+			print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
1005
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1006 1006
 			print "</td></tr>";
1007 1007
 		}
1008 1008
 
@@ -1019,8 +1019,8 @@  discard block
 block discarded – undo
1019 1019
 		print $object->showOptionals($extrafields, 'create', $parameters);
1020 1020
 
1021 1021
 		// Model pdf
1022
-		print "<tr><td>" . $langs->trans('Model') . "</td><td>";
1023
-		include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1022
+		print "<tr><td>".$langs->trans('Model')."</td><td>";
1023
+		include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1024 1024
 		$list = ModelePDFSuppliersInvoices::liste_modeles($db);
1025 1025
 		print $form->selectarray('modelpdf', $list, $conf->global->INVOICE_SUPPLIER_ADDON_PDF);
1026 1026
 		print "</td></tr>";
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 		// Autogeneration
1054 1054
 		$title = $langs->trans("Recurrence");
1055
-		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', '');
1055
+		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
1056 1056
 
1057 1057
 		print '<span class="opacitymedium">'.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).'</span><br><br>';
1058 1058
 
@@ -1061,30 +1061,30 @@  discard block
 block discarded – undo
1061 1061
 		print '<table class="border centpercent">';
1062 1062
 
1063 1063
 		// Frequency + unit
1064
-		print '<tr><td class="titlefieldcreate">' . $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')) . "</td><td>";
1065
-		print "<input type='text' name='frequency' value='" . GETPOSTINT('frequency') . "' size='4' />&nbsp;" . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm'));
1064
+		print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
1065
+		print "<input type='text' name='frequency' value='".GETPOSTINT('frequency')."' size='4' />&nbsp;".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm'));
1066 1066
 		print "</td></tr>";
1067 1067
 
1068 1068
 		// Date next run
1069
-		print "<tr><td>" . $langs->trans('NextDateToExecution') . "</td><td>";
1069
+		print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
1070 1070
 		$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
1071 1071
 		print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1);
1072 1072
 		print "</td></tr>";
1073 1073
 
1074 1074
 		// Number max of generation
1075
-		print "<tr><td>" . $langs->trans("MaxPeriodNumber") . "</td><td>";
1076
-		print '<input type="text" name="nb_gen_max" value="' . GETPOST('nb_gen_max') . '" size="5" />';
1075
+		print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
1076
+		print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
1077 1077
 		print "</td></tr>";
1078 1078
 
1079 1079
 		// Auto validate the invoice
1080
-		print "<tr><td>" . $langs->trans("StatusOfAutoGeneratedInvoices") . "</td><td>";
1080
+		print "<tr><td>".$langs->trans("StatusOfAutoGeneratedInvoices")."</td><td>";
1081 1081
 		$select = array('0' => $langs->trans('BillStatusDraft'), '1' => $langs->trans('BillStatusValidated'));
1082 1082
 		print $form->selectarray('auto_validate', $select, GETPOST('auto_validate'));
1083 1083
 		print "</td></tr>";
1084 1084
 
1085 1085
 		// Auto generate document
1086 1086
 		if (getDolGlobalString('INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION')) {
1087
-			print "<tr><td>" . $langs->trans("StatusOfGeneratedDocuments") . "</td><td>";
1087
+			print "<tr><td>".$langs->trans("StatusOfGeneratedDocuments")."</td><td>";
1088 1088
 			$select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc'));
1089 1089
 			print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
1090 1090
 			print "</td></tr>";
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 
1128 1128
 		print "</form>\n";
1129 1129
 	} else {
1130
-		dol_print_error(null, "Error, no invoice " . $object->id);
1130
+		dol_print_error(null, "Error, no invoice ".$object->id);
1131 1131
 	}
1132 1132
 } else {
1133 1133
 	// View mode
@@ -1139,12 +1139,12 @@  discard block
 block discarded – undo
1139 1139
 
1140 1140
 		// Confirmation de la suppression d'une ligne produit
1141 1141
 		if ($action == 'ask_deleteline') {
1142
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1142
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1143 1143
 		}
1144 1144
 
1145 1145
 		// Confirm delete of repeatable invoice
1146 1146
 		if ($action == 'ask_deleteinvoice') {
1147
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1147
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1148 1148
 		}
1149 1149
 
1150 1150
 		print $formconfirm;
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 
1159 1159
 		// Recurring invoice content
1160 1160
 
1161
-		$linkback = '<a href="' . DOL_URL_ROOT . '/fourn/facture/list-rec.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans('BackToList') . '</a>';
1161
+		$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list-rec.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans('BackToList').'</a>';
1162 1162
 
1163 1163
 		$morehtmlref = '';
1164 1164
 		if ($action != 'edittitle') {
@@ -1171,33 +1171,33 @@  discard block
 block discarded – undo
1171 1171
 		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
1172 1172
 		$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
1173 1173
 		// Thirdparty
1174
-		$morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
1174
+		$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
1175 1175
 
1176 1176
 		// Project
1177 1177
 		if (isModEnabled('project')) {
1178 1178
 			$langs->load('projects');
1179
-			$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
1179
+			$morehtmlref .= '<br>'.$langs->trans('Project').' ';
1180 1180
 			if ($usercancreate) {
1181 1181
 				if ($action != 'classify') {
1182
-					$morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
1182
+					$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
1183 1183
 				}
1184 1184
 				if ($action == 'classify') {
1185
-					$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
1185
+					$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
1186 1186
 					$morehtmlref .= '<input type="hidden" name="action" value="classin">';
1187
-					$morehtmlref .= '<input type="hidden" name="token" value="' . newToken() . '">';
1187
+					$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
1188 1188
 					$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
1189
-					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
1189
+					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
1190 1190
 					$morehtmlref .= '</form>';
1191 1191
 				} else {
1192
-					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
1192
+					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
1193 1193
 				}
1194 1194
 			} else {
1195 1195
 				if (!empty($object->fk_project)) {
1196 1196
 					$project = new Project($db);
1197 1197
 					$project->fetch($object->fk_project);
1198
-					$morehtmlref .= ' : ' . $project->getNomUrl(1);
1198
+					$morehtmlref .= ' : '.$project->getNomUrl(1);
1199 1199
 					if ($project->title) {
1200
-						$morehtmlref .= ' - ' . $project->title;
1200
+						$morehtmlref .= ' - '.$project->title;
1201 1201
 					}
1202 1202
 				} else {
1203 1203
 					$morehtmlref .= '';
@@ -1223,34 +1223,34 @@  discard block
 block discarded – undo
1223 1223
 			print "</td></tr>";
1224 1224
 		}
1225 1225
 
1226
-		print '<tr><td class="titlefield">' . $langs->trans('Author') . '</td><td>';
1226
+		print '<tr><td class="titlefield">'.$langs->trans('Author').'</td><td>';
1227 1227
 		print $author->getNomUrl(-1);
1228 1228
 		print "</td></tr>";
1229 1229
 
1230 1230
 		// Label
1231 1231
 		print '<tr>';
1232
-		print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1233
-		print '<td>' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1232
+		print '<td>'.$form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1233
+		print '<td>'.$form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1234 1234
 		print '</tr>';
1235 1235
 
1236
-		print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
1237
-		print '<td>' . price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td>';
1236
+		print '<tr><td>'.$langs->trans('AmountHT').'</td>';
1237
+		print '<td>'.price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'</td>';
1238 1238
 		print '</tr>';
1239 1239
 
1240
-		print '<tr><td>' . $langs->trans("AmountVAT") . '</td><td>' . price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . '</td>';
1240
+		print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency).'</td>';
1241 1241
 		print '</tr>';
1242 1242
 
1243 1243
 		// Amount Local Taxes
1244 1244
 		if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {    // Localtax1
1245
-			print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
1246
-			print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1245
+			print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
1246
+			print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1247 1247
 		}
1248 1248
 		if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {    // Localtax2
1249
-			print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
1250
-			print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1249
+			print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
1250
+			print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1251 1251
 		}
1252 1252
 
1253
-		print '<tr><td>' . $langs->trans("AmountTTC") . '</td><td colspan="3">' . price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . '</td>';
1253
+		print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</td>';
1254 1254
 		print '</tr>';
1255 1255
 
1256 1256
 		// Payment term
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
 		print $langs->trans('PaymentConditionsShort');
1260 1260
 		print '</td>';
1261 1261
 		if ($action != 'editconditions' && $usercancreate) {
1262
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
1262
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
1263 1263
 		}
1264 1264
 		print '</tr></table>';
1265 1265
 		print '</td><td>';
1266 1266
 		if ($action == 'editconditions') {
1267
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
1267
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
1268 1268
 		} else {
1269
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
1269
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
1270 1270
 		}
1271 1271
 
1272 1272
 		print '</td></tr>';
@@ -1277,14 +1277,14 @@  discard block
 block discarded – undo
1277 1277
 		print $langs->trans('PaymentMode');
1278 1278
 		print '</td>';
1279 1279
 		if ($action != 'editmode' && $usercancreate) {
1280
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmode&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
1280
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
1281 1281
 		}
1282 1282
 		print '</tr></table>';
1283 1283
 		print '</td><td>';
1284 1284
 		if ($action == 'editmode') {
1285
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1285
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1286 1286
 		} else {
1287
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'none');
1287
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none');
1288 1288
 		}
1289 1289
 		print '</td></tr>';
1290 1290
 
@@ -1297,12 +1297,12 @@  discard block
 block discarded – undo
1297 1297
 			print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
1298 1298
 			print '</td>';
1299 1299
 			if ($usercancreate && $action != 'editmulticurrencycode' && $object->suspended == $object::STATUS_SUSPENDED) {
1300
-				print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
1300
+				print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
1301 1301
 			}
1302 1302
 			print '</tr></table>';
1303 1303
 			print '</td><td>';
1304 1304
 			$htmlname = (($usercancreate && $action == 'editmulticurrencycode') ? 'multicurrency_code' : 'none');
1305
-			$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
1305
+			$form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, $htmlname);
1306 1306
 			print '</td></tr>';
1307 1307
 
1308 1308
 			// Multicurrency rate
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 				print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
1314 1314
 				print '</td>';
1315 1315
 				if ($usercancreate && $action != 'editmulticurrencyrate' && $object->suspended == $object::STATUS_SUSPENDED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1316
-					print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
1316
+					print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
1317 1317
 				}
1318 1318
 				print '</tr></table>';
1319 1319
 				print '</td><td>';
@@ -1321,12 +1321,12 @@  discard block
 block discarded – undo
1321 1321
 					if ($action == 'actualizemulticurrencyrate') {
1322 1322
 						list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
1323 1323
 					}
1324
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1324
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1325 1325
 				} else {
1326
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1326
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1327 1327
 					if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1328 1328
 						print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
1329
-						print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=actualizemulticurrencyrate">' . $langs->trans("ActualizeCurrency") . '</a>';
1329
+						print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
1330 1330
 						print '</div>';
1331 1331
 					}
1332 1332
 				}
@@ -1342,24 +1342,24 @@  discard block
 block discarded – undo
1342 1342
 
1343 1343
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
1344 1344
 
1345
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m') . ')';
1346
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%m') . ')';
1347
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m') . ')';
1348
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B') . ')';
1349
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%B') . ')';
1350
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B') . ')';
1351
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y') . ')';
1352
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%Y') . ')';
1353
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y') . ')';
1345
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')';
1346
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')';
1347
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')';
1348
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')';
1349
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')';
1350
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')';
1351
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
1352
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
1353
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')';
1354 1354
 		// Only on template invoices
1355
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour') . ')';
1356
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour') . ')';
1355
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour').')';
1356
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour').')';
1357 1357
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done;
1358 1358
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max;
1359 1359
 
1360
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
1360
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
1361 1361
 		foreach ($substitutionarray as $key => $val) {
1362
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
1362
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
1363 1363
 		}
1364 1364
 		$htmltext .= '</i>';
1365 1365
 
@@ -1369,14 +1369,14 @@  discard block
 block discarded – undo
1369 1369
 		print $langs->trans('BankAccount');
1370 1370
 		print '<td>';
1371 1371
 		if ($action != 'editbankaccount' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1372
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editbankaccount&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetBankAccount'), 1) . '</a></td>';
1372
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
1373 1373
 		}
1374 1374
 		print '</tr></table>';
1375 1375
 		print '</td><td>';
1376 1376
 		if ($action == 'editbankaccount') {
1377
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'fk_account', 1);
1377
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
1378 1378
 		} else {
1379
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1379
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1380 1380
 		}
1381 1381
 		print "</td>";
1382 1382
 		print '</tr>';
@@ -1406,18 +1406,18 @@  discard block
 block discarded – undo
1406 1406
 		print $langs->trans('Model');
1407 1407
 		print '<td>';
1408 1408
 		if ($action != 'editmodelpdf' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1409
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editmodelpdf&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetModel'), 1) . '</a></td>';
1409
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editmodelpdf&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>';
1410 1410
 		}
1411 1411
 		print '</tr></table>';
1412 1412
 		print '</td><td>';
1413 1413
 		if ($action == 'editmodelpdf') {
1414
-			include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1414
+			include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1415 1415
 			$list = array();
1416 1416
 			$models = ModelePDFSuppliersInvoices::liste_modeles($db);
1417 1417
 			foreach ($models as $k => $model) {
1418
-				$list[] = str_replace(':', '|', $k) . ':' . $model;
1418
+				$list[] = str_replace(':', '|', $k).':'.$model;
1419 1419
 			}
1420
-			$select = 'select;' . implode(',', $list);
1420
+			$select = 'select;'.implode(',', $list);
1421 1421
 			//TODO : Droits
1422 1422
 			print $form->editfieldval($langs->trans('Model'), 'modelpdf', $object->model_pdf, $object, $usercancreate, $select);
1423 1423
 		} else {
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 
1444 1444
 		print '<table class="border centpercent tableforfield">';
1445 1445
 
1446
-		print '<tr><td colspan="2">' . img_picto('', 'recurring', 'class="pictofixedwidth"') . $title . '</td></tr>';
1446
+		print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>';
1447 1447
 
1448 1448
 		// if "frequency" is empty or = 0, the recurrence is disabled
1449 1449
 		print '<tr><td style="width: 50%">';
@@ -1451,23 +1451,23 @@  discard block
 block discarded – undo
1451 1451
 		print $langs->trans('Frequency');
1452 1452
 		print '</td>';
1453 1453
 		if ($action != 'editfrequency' && $usercancreate) {
1454
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>';
1454
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>';
1455 1455
 		}
1456 1456
 		print '</tr></table>';
1457 1457
 		print '</td><td>';
1458 1458
 		if ($action == 'editfrequency') {
1459
-			print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '">';
1459
+			print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'">';
1460 1460
 			print '<input type="hidden" name="action" value="setfrequency">';
1461
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
1461
+			print '<input type="hidden" name="token" value="'.newToken().'">';
1462 1462
 			print '<table class="nobordernopadding">';
1463 1463
 			print '<tr><td>';
1464
-			print "<input type='text' name='frequency' value='" . $object->frequency . "' size='5' />&nbsp;" . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
1464
+			print "<input type='text' name='frequency' value='".$object->frequency."' size='5' />&nbsp;".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
1465 1465
 			print '</td>';
1466
-			print '<td class="left"><input type="submit" class="button button-edit" value="' . $langs->trans("Modify") . '"></td>';
1466
+			print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
1467 1467
 			print '</tr></table></form>';
1468 1468
 		} else {
1469 1469
 			if ($object->frequency > 0) {
1470
-				print $langs->trans('FrequencyPer_' . $object->unit_frequency, $object->frequency);
1470
+				print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
1471 1471
 			} else {
1472 1472
 				print $langs->trans("NotARecurringInvoiceTemplate");
1473 1473
 			}
@@ -1486,8 +1486,8 @@  discard block
 block discarded – undo
1486 1486
 			print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached');
1487 1487
 		}
1488 1488
 		//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
1489
-		if (! $object->isMaxNbGenReached()) {
1490
-			if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1489
+		if (!$object->isMaxNbGenReached()) {
1490
+			if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1491 1491
 				print img_warning($langs->trans("Late"));
1492 1492
 			}
1493 1493
 		} else {
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 			print $langs->trans("StatusOfAutoGeneratedInvoices");
1521 1521
 		}
1522 1522
 		print '</td><td>';
1523
-		$select = 'select;0:' . $langs->trans('BillStatusDraft') . ',1:' . $langs->trans('BillStatusValidated');
1523
+		$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
1524 1524
 		if ($action == 'auto_validate' || $object->frequency > 0) {
1525 1525
 			print $form->editfieldval($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $usercancreate, $select);
1526 1526
 		}
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 			}
1537 1537
 			print '</td>';
1538 1538
 			print '<td>';
1539
-			$select = 'select;0:' . $langs->trans('DoNotGenerateDoc') . ',1:' . $langs->trans('AutogenerateDoc');
1539
+			$select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc');
1540 1540
 			if ($action == 'generate_pdf' || $object->frequency > 0) {
1541 1541
 				print $form->editfieldval($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $usercancreate, $select);
1542 1542
 			}
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
 			print '<table class="border centpercent tableforfield">';
1561 1561
 
1562 1562
 			// Nb of generation already done
1563
-			print '<tr><td style="width: 50%">' . $langs->trans("NbOfGenerationDone") . '</td>';
1563
+			print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>';
1564 1564
 			print '<td>';
1565 1565
 			print $object->nb_gen_done ? $object->nb_gen_done : '0';
1566 1566
 			print '</td>';
@@ -1585,15 +1585,15 @@  discard block
 block discarded – undo
1585 1585
 		print '<div class="clearboth"></div><br>';
1586 1586
 
1587 1587
 		// Lines
1588
-		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOSTINT('lineid')) . '" method="POST">
1589
-        	<input type="hidden" name="token" value="' . newToken() . '">
1590
-        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
1588
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOSTINT('lineid')).'" method="POST">
1589
+        	<input type="hidden" name="token" value="' . newToken().'">
1590
+        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
1591 1591
         	<input type="hidden" name="mode" value="">
1592
-        	<input type="hidden" name="id" value="' . $object->id . '">
1592
+        	<input type="hidden" name="id" value="' . $object->id.'">
1593 1593
         	';
1594 1594
 
1595 1595
 		if (!empty($conf->use_javascript_ajax) && $object->statut == 0) {
1596
-			include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
1596
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
1597 1597
 		}
1598 1598
 
1599 1599
 		print '<div class="div-table-responsive-no-min">';
@@ -1650,24 +1650,24 @@  discard block
 block discarded – undo
1650 1650
 		if (empty($object->suspended)) {
1651 1651
 			if ($usercancreate) {
1652 1652
 				if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
1653
-					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1653
+					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
1654 1654
 				} else {
1655 1655
 					if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
1656
-						print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/facture/card.php?action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>';
1656
+						print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
1657 1657
 					} else {
1658
-						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1658
+						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
1659 1659
 					}
1660 1660
 				}
1661 1661
 			} else {
1662
-				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>';
1662
+				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>';
1663 1663
 			}
1664 1664
 		}
1665 1665
 
1666 1666
 		if ($usercancreate) {
1667 1667
 			if (empty($object->suspended)) {
1668
-				print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=disable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Disable") . '</a></div>';
1668
+				print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Disable").'</a></div>';
1669 1669
 			} else {
1670
-				print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=enable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Enable") . '</a></div>';
1670
+				print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=enable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Enable").'</a></div>';
1671 1671
 			}
1672 1672
 		}
1673 1673
 
Please login to merge, or discard this patch.
htdocs/public/eventorganization/attendee_new.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
 	if (getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE')) {
201 201
 		print '<div class="backimagepubliceventorganizationsubscription">';
202
-		print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE').'">';
202
+		print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE').'">';
203 203
 		print '</div>';
204 204
 	}
205 205
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 }
238 238
 
239 239
 // Action called when page is submitted
240
-if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status == 2  || !empty($project->id) && $project->status == Project::STATUS_VALIDATED)) {	// Test on permission not required. Check are done on securitykey and mitigation
240
+if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status == 2 || !empty($project->id) && $project->status == Project::STATUS_VALIDATED)) {	// Test on permission not required. Check are done on securitykey and mitigation
241 241
 	$error = 0;
242 242
 
243 243
 	$urlback = '';
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 
339 339
 		// If the registration has already been paid for this attendee
340 340
 		if (!empty($confattendee->date_subscription) && !empty($confattendee->amount)) {
341
-			$securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, 'master');
341
+			$securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 'master');
342 342
 			$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl);
343 343
 
344 344
 			$mesg = $langs->trans("RegistrationAndPaymentWereAlreadyRecorded", $email);
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 		$resultfetchthirdparty = 0;
354 354
 
355
-		$genericcompanyname = $langs->trans('EventParticipant').' '.($emailcompany ? $emailcompany : $email);	// Keep this label simple so we can retrieve same thirdparty for another event
355
+		$genericcompanyname = $langs->trans('EventParticipant').' '.($emailcompany ? $emailcompany : $email); // Keep this label simple so we can retrieve same thirdparty for another event
356 356
 
357 357
 		// Getting the thirdparty or creating it
358 358
 		$thirdparty = new Societe($db);
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 				$redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.urlencode((string) ($sourcetouse)).'&ref='.urlencode((string) ($reftouse));
608 608
 				if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
609 609
 					if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
610
-						$redirection .= '&securekey='.dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $sourcetouse . $reftouse, '2'); // Use the source in the hash to avoid duplicates if the references are identical
610
+						$redirection .= '&securekey='.dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$sourcetouse.$reftouse, '2'); // Use the source in the hash to avoid duplicates if the references are identical
611 611
 					} else {
612 612
 						$redirection .= '&securekey='.urlencode(getDolGlobalString('PAYMENT_SECURITY_TOKEN'));
613 613
 					}
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 				dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
669 669
 			}
670 670
 
671
-			$securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, '2');
671
+			$securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, '2');
672 672
 			$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl);
673 673
 
674 674
 			header("Location: ".$redirection);
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 print '<span class="opacitymedium">'.$langs->trans("EvntOrgWelcomeMessage").'</span>';
703 703
 print '<br>';
704 704
 // Title
705
-print '<span class="eventlabel large">'.dol_escape_htmltag($project->title . ' '. $conference->label).'</span><br>';
705
+print '<span class="eventlabel large">'.dol_escape_htmltag($project->title.' '.$conference->label).'</span><br>';
706 706
 print '</div>';
707 707
 
708 708
 // Help text
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 	 print ' - ';
761 761
 	 print dol_print_date($project->date_end);
762 762
 	 }*/
763
-	$maxattendees = $project->max_attendees;	// Max attendeed for the project/event
763
+	$maxattendees = $project->max_attendees; // Max attendeed for the project/event
764 764
 }
765 765
 
766 766
 if ($maxattendees && $currentnbofattendees >= $maxattendees) {
@@ -776,14 +776,14 @@  discard block
 block discarded – undo
776 776
 if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS_CONFIRMED) || (!empty($project->id) && $project->status == Project::STATUS_VALIDATED)) {
777 777
 	if (empty($maxattendees) || $currentnbofattendees < $maxattendees) {
778 778
 		// Print form
779
-		print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="newmember">' . "\n";
780
-		print '<input type="hidden" name="token" value="' . newToken() . '" / >';
781
-		print '<input type="hidden" name="entity" value="' . $entity . '" />';
779
+		print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
780
+		print '<input type="hidden" name="token" value="'.newToken().'" / >';
781
+		print '<input type="hidden" name="entity" value="'.$entity.'" />';
782 782
 		print '<input type="hidden" name="action" value="add" />';
783
-		print '<input type="hidden" name="type" value="' . $type . '" />';
784
-		print '<input type="hidden" name="id" value="' . $conference->id . '" />';
785
-		print '<input type="hidden" name="fk_project" value="' . $project->id . '" />';
786
-		print '<input type="hidden" name="securekey" value="' . $securekeyreceived . '" />';
783
+		print '<input type="hidden" name="type" value="'.$type.'" />';
784
+		print '<input type="hidden" name="id" value="'.$conference->id.'" />';
785
+		print '<input type="hidden" name="fk_project" value="'.$project->id.'" />';
786
+		print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />';
787 787
 
788 788
 		print '<br>';
789 789
 		print '<br>';
@@ -803,24 +803,24 @@  discard block
 block discarded – undo
803 803
 		});
804 804
 		</script>';
805 805
 
806
-		print '<table class="border" summary="form to subscribe" id="tablesubscribe">' . "\n";
806
+		print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
807 807
 
808 808
 		// Firstname
809 809
 		print '<tr><td><span class="fieldrequired">';
810
-		print $langs->trans("Firstname") . '</span></td><td>';
810
+		print $langs->trans("Firstname").'</span></td><td>';
811 811
 		print img_picto('', 'user', 'class="pictofixedwidth"');
812
-		print '<input type="text" name="firstname" maxlength="255" class="minwidth200 maxwidth300" value="' . dol_escape_htmltag($firstname) . '" required autofocus></td></tr>' . "\n";
812
+		print '<input type="text" name="firstname" maxlength="255" class="minwidth200 maxwidth300" value="'.dol_escape_htmltag($firstname).'" required autofocus></td></tr>'."\n";
813 813
 
814 814
 		// Lastname
815 815
 		print '<tr><td><span class="fieldrequired">';
816
-		print $langs->trans("Lastname") . '</span></td><td>';
816
+		print $langs->trans("Lastname").'</span></td><td>';
817 817
 		print img_picto('', 'user', 'class="pictofixedwidth"');
818
-		print '<input type="text" name="lastname" maxlength="255" class="minwidth200 maxwidth300" value="' . dol_escape_htmltag($lastname) . '" required></td></tr>' . "\n";
818
+		print '<input type="text" name="lastname" maxlength="255" class="minwidth200 maxwidth300" value="'.dol_escape_htmltag($lastname).'" required></td></tr>'."\n";
819 819
 
820 820
 		// Email
821
-		print '<tr><td><span class="fieldrequired">' . $langs->trans("EmailAttendee") . '</span></td><td>';
821
+		print '<tr><td><span class="fieldrequired">'.$langs->trans("EmailAttendee").'</span></td><td>';
822 822
 		print img_picto('', 'email', 'class="pictofixedwidth"');
823
-		print '<input type="text" name="email" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag(GETPOST('email')) . '" required></td></tr>' . "\n";
823
+		print '<input type="text" name="email" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOST('email')).'" required></td></tr>'."\n";
824 824
 
825 825
 		// Company
826 826
 		print '<tr id="trcompany" class="trcompany"><td>';
@@ -833,21 +833,21 @@  discard block
 block discarded – undo
833 833
 		}
834 834
 		print '</td><td>';
835 835
 		print img_picto('', 'company', 'class="pictofixedwidth"');
836
-		print '<input type="text" name="societe" class="minwidth200 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag(GETPOST('societe')) . '"'.(empty((float) $project->price_registration) ? '' : ' required').'></td></tr>' . "\n";
836
+		print '<input type="text" name="societe" class="minwidth200 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOST('societe')).'"'.(empty((float) $project->price_registration) ? '' : ' required').'></td></tr>'."\n";
837 837
 
838 838
 		// Email company for invoice
839 839
 		if ($project->price_registration) {
840
-			print '<tr><td>' . $form->textwithpicto($langs->trans("EmailCompany"), $langs->trans("EmailCompanyForInvoice")) . '</td><td>';
840
+			print '<tr><td>'.$form->textwithpicto($langs->trans("EmailCompany"), $langs->trans("EmailCompanyForInvoice")).'</td><td>';
841 841
 			print img_picto('', 'email', 'class="pictofixedwidth"');
842
-			print '<input type="text" name="emailcompany" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag(GETPOST('emailcompany')) . '"></td></tr>' . "\n";
842
+			print '<input type="text" name="emailcompany" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOST('emailcompany')).'"></td></tr>'."\n";
843 843
 		}
844 844
 
845 845
 		// Address
846
-		print '<tr><td>' . $langs->trans("Address") . '</td><td>' . "\n";
847
-		print '<textarea name="address" id="address" wrap="soft" class="centpercent" rows="' . ROWS_2 . '">' . dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1) . '</textarea></td></tr>' . "\n";
846
+		print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
847
+		print '<textarea name="address" id="address" wrap="soft" class="centpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
848 848
 
849 849
 		// Zip / Town
850
-		print '<tr><td>' . $langs->trans('Zip') . ' / ' . $langs->trans('Town') . '</td><td>';
850
+		print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
851 851
 		print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
852 852
 		print ' / ';
853 853
 		print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		print '</td></tr>';
877 877
 		// State
878 878
 		if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
879
-			print '<tr><td>' . $langs->trans('State') . '</td><td>';
879
+			print '<tr><td>'.$langs->trans('State').'</td><td>';
880 880
 			if ($country_code) {
881 881
 				print img_picto('', 'state', 'class="pictofixedwidth"');
882 882
 				print $formcompany->select_state(GETPOST("state_id"), $country_code);
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
 		}
888 888
 
889 889
 		if ($project->price_registration) {
890
-			print '<tr><td>' . $langs->trans('Price') . '</td><td>';
890
+			print '<tr><td>'.$langs->trans('Price').'</td><td>';
891 891
 			print '<span class="amount price-registration">'.price($project->price_registration, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
892 892
 			print '</td></tr>';
893 893
 		}
894 894
 
895 895
 		$notetoshow = $note_public;
896
-		print '<tr><td>' . $langs->trans('Note') . '</td><td>';
896
+		print '<tr><td>'.$langs->trans('Note').'</td><td>';
897 897
 		if (getDolGlobalString('EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION')) {
898 898
 			$notetoshow = str_replace('\n', "\n", $conf->global->EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION);
899 899
 		}
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 
907 907
 		// Save
908 908
 		print '<div class="center">';
909
-		print '<input type="submit" value="' . $langs->trans("Submit") . '" id="submitsave" class="button">';
909
+		print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
910 910
 		if (!empty($backtopage)) {
911
-			print ' &nbsp; &nbsp; <input type="submit" value="' . $langs->trans("Cancel") . '" id="submitcancel" class="button button-cancel">';
911
+			print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
912 912
 		}
913 913
 		print '</div>';
914 914
 
Please login to merge, or discard this patch.
htdocs/compta/prelevement/class/bonprelevement.class.php 1 patch
Spacing   +453 added lines, -453 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
 /**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
 	const STATUS_DRAFT = 0;
106 106
 	const STATUS_TRANSFERED = 1;
107
-	const STATUS_CREDITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
108
-	const STATUS_DEBITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
107
+	const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
108
+	const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
109 109
 
110 110
 
111 111
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 		if ($result == 0) {
260 260
 			if ($line_id > 0) {
261
-				$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement (";
261
+				$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
262 262
 				if ($type != 'bank-transfer') {
263 263
 					$sql .= "fk_facture";
264 264
 				} else {
@@ -271,24 +271,24 @@  discard block
 block discarded – undo
271 271
 				$sql .= ",fk_prelevement_lignes";
272 272
 				$sql .= ") VALUES (";
273 273
 				$sql .= ((int) $invoice_id);
274
-				$sql .= ", " . ((int) $line_id);
274
+				$sql .= ", ".((int) $line_id);
275 275
 				$sql .= ")";
276 276
 
277 277
 				if ($this->db->query($sql)) {
278 278
 					$result = 0;
279 279
 				} else {
280 280
 					$result = -1;
281
-					$this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror;
282
-					dol_syslog(get_class($this) . "::AddFacture Error $result");
281
+					$this->errors[] = get_class($this)."::AddFacture ".$this->db->lasterror;
282
+					dol_syslog(get_class($this)."::AddFacture Error $result");
283 283
 				}
284 284
 			} else {
285 285
 				$result = -2;
286
-				$this->errors[] = get_class($this) . "::AddFacture linedid Empty";
287
-				dol_syslog(get_class($this) . "::AddFacture Error $result");
286
+				$this->errors[] = get_class($this)."::AddFacture linedid Empty";
287
+				dol_syslog(get_class($this)."::AddFacture Error $result");
288 288
 			}
289 289
 		} else {
290 290
 			$result = -3;
291
-			dol_syslog(get_class($this) . "::AddFacture Error $result");
291
+			dol_syslog(get_class($this)."::AddFacture Error $result");
292 292
 		}
293 293
 
294 294
 		return $result;
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
 	public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
312 312
 	{
313 313
 		$result = -1;
314
-		$concat = 0;	// ??? what is this for. Seems not used.
314
+		$concat = 0; // ??? what is this for. Seems not used.
315 315
 
316 316
 		if ($concat == 1) {
317 317
 			/*
318 318
 			 * We aggregate the lines
319 319
 			 */
320 320
 			$sql = "SELECT rowid";
321
-			$sql .= " FROM  " . MAIN_DB_PREFIX . "prelevement_lignes";
322
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
321
+			$sql .= " FROM  ".MAIN_DB_PREFIX."prelevement_lignes";
322
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
323 323
 			if ($sourcetype == 'salary') {
324
-				$sql .= " AND fk_soc = " . ((int) $client_id);
324
+				$sql .= " AND fk_soc = ".((int) $client_id);
325 325
 			} else {
326
-				$sql .= " AND fk_user = " . ((int) $client_id);
326
+				$sql .= " AND fk_user = ".((int) $client_id);
327 327
 			}
328
-			$sql .= " AND code_banque = '" . $this->db->escape($code_banque) . "'";
329
-			$sql .= " AND code_guichet = '" . $this->db->escape($code_guichet) . "'";
330
-			$sql .= " AND number = '" . $this->db->escape($number) . "'";
328
+			$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
329
+			$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
330
+			$sql .= " AND number = '".$this->db->escape($number)."'";
331 331
 
332 332
 			$resql = $this->db->query($sql);
333 333
 			if ($resql) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			/*
340 340
 			 * No aggregate
341 341
 			 */
342
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes (";
342
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
343 343
 			$sql .= "fk_prelevement_bons";
344 344
 			$sql .= ", fk_soc";
345 345
 			$sql .= ", client_nom";
@@ -351,21 +351,21 @@  discard block
 block discarded – undo
351 351
 			$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
352 352
 			$sql .= ") VALUES (";
353 353
 			$sql .= $this->id;
354
-			$sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0");	// fk_soc can't be null
355
-			$sql .= ", '" . $this->db->escape($client_nom) . "'";
356
-			$sql .= ", " . ((float) price2num($amount));
357
-			$sql .= ", '" . $this->db->escape($code_banque) . "'";
358
-			$sql .= ", '" . $this->db->escape($code_guichet) . "'";
359
-			$sql .= ", '" . $this->db->escape($number) . "'";
360
-			$sql .= ", '" . $this->db->escape($number_key) . "'";
361
-			$sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : '');
354
+			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
355
+			$sql .= ", '".$this->db->escape($client_nom)."'";
356
+			$sql .= ", ".((float) price2num($amount));
357
+			$sql .= ", '".$this->db->escape($code_banque)."'";
358
+			$sql .= ", '".$this->db->escape($code_guichet)."'";
359
+			$sql .= ", '".$this->db->escape($number)."'";
360
+			$sql .= ", '".$this->db->escape($number_key)."'";
361
+			$sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : '');
362 362
 			$sql .= ")";
363 363
 			if ($this->db->query($sql)) {
364
-				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_lignes");
364
+				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
365 365
 				$result = 0;
366 366
 			} else {
367
-				$this->errors[] = get_class($this) . "::addline Error -2 " . $this->db->lasterror;
368
-				dol_syslog(get_class($this) . "::addline Error -2");
367
+				$this->errors[] = get_class($this)."::addline Error -2 ".$this->db->lasterror;
368
+				dol_syslog(get_class($this)."::addline Error -2");
369 369
 				$result = -2;
370 370
 			}
371 371
 		}
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		$sql .= ", p.type";
409 409
 		$sql .= ", p.fk_bank_account";
410 410
 		$sql .= ", p.statut as status";
411
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
412
-		$sql .= " WHERE p.entity IN (" . getEntity('invoice') . ")";
411
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
412
+		$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
413 413
 		if ($rowid > 0) {
414
-			$sql .= " AND p.rowid = " . ((int) $rowid);
414
+			$sql .= " AND p.rowid = ".((int) $rowid);
415 415
 		} else {
416
-			$sql .= " AND p.ref = '" . $this->db->escape($ref) . "'";
416
+			$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
417 417
 		}
418 418
 
419
-		dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
419
+		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
420 420
 		$result = $this->db->query($sql);
421 421
 		if ($result) {
422 422
 			if ($this->db->num_rows($result)) {
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
 				if (empty($this->status)) {		// Value is sometimes null in database
443 443
 					$this->status = 0;
444 444
 				}
445
-				$this->statut         = $this->status; // For backward compatibility
445
+				$this->statut = $this->status; // For backward compatibility
446 446
 
447 447
 				$this->fetched = 1;
448 448
 
449 449
 				return 1;
450 450
 			} else {
451
-				dol_syslog(get_class($this) . "::Fetch no record found");
451
+				dol_syslog(get_class($this)."::Fetch no record found");
452 452
 				return 0;
453 453
 			}
454 454
 		} else {
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 			if ($date < $this->date_trans) {
490 490
 				$langs->load("errors");
491 491
 				$this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission');
492
-				dol_syslog("bon-prelevment::set_infocredit 1027 " . $this->error);
492
+				dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
493 493
 				return -1027;
494 494
 			}
495 495
 
496 496
 			$this->db->begin();
497 497
 
498
-			$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
499
-			$sql .= " SET fk_user_credit = " . ((int) $user->id);
500
-			$sql .= ", statut = " . self::STATUS_CREDITED;
501
-			$sql .= ", date_credit = '" . $this->db->idate($date) . "'";
502
-			$sql .= " WHERE rowid = " . ((int) $this->id);
503
-			$sql .= " AND entity = " . ((int) $conf->entity);
504
-			$sql .= " AND statut = " . self::STATUS_TRANSFERED;
498
+			$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
499
+			$sql .= " SET fk_user_credit = ".((int) $user->id);
500
+			$sql .= ", statut = ".self::STATUS_CREDITED;
501
+			$sql .= ", date_credit = '".$this->db->idate($date)."'";
502
+			$sql .= " WHERE rowid = ".((int) $this->id);
503
+			$sql .= " AND entity = ".((int) $conf->entity);
504
+			$sql .= " AND statut = ".self::STATUS_TRANSFERED;
505 505
 
506 506
 			$resql = $this->db->query($sql);
507 507
 			if ($resql) {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 						$error++;
616 616
 						$this->error = $paiement->error;
617 617
 						$this->errors = $paiement->errors;
618
-						dol_syslog(get_class($this) . "::set_infocredit AddPayment Error " . $this->error);
618
+						dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
619 619
 					} else {
620 620
 						if ($this->type == 'bank-transfer') {
621 621
 							if ($type == 'salary') {
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 						} else {
631 631
 							$modeforaddpayment = 'payment';
632 632
 							$labelforaddpayment = '(CustomerInvoicePayment)';
633
-							$addbankurl = 'direct-debit';	// = 'directdebit'
633
+							$addbankurl = 'direct-debit'; // = 'directdebit'
634 634
 						}
635 635
 
636 636
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 							$error++;
646 646
 							$this->error = $paiement->error;
647 647
 							$this->errors = $paiement->errors;
648
-							dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error " . $this->error);
648
+							dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
649 649
 						}
650 650
 					}
651 651
 				}
@@ -653,24 +653,24 @@  discard block
 block discarded – undo
653 653
 				// Update withdrawal line
654 654
 				// TODO: Translate to ligneprelevement.class.php
655 655
 				if (!$error) {
656
-					$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes";
656
+					$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
657 657
 					$sql .= " SET statut = 2";
658
-					$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
658
+					$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
659 659
 
660 660
 					if (!$this->db->query($sql)) {
661
-						dol_syslog(get_class($this) . "::set_infocredit Update lines Error");
661
+						dol_syslog(get_class($this)."::set_infocredit Update lines Error");
662 662
 						$error++;
663 663
 					}
664 664
 				}
665 665
 			} else {
666 666
 				$this->error = $this->db->lasterror();
667
-				dol_syslog(get_class($this) . "::set_infocredit Update Bons Error");
667
+				dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
668 668
 				$error++;
669 669
 			}
670 670
 
671 671
 			// End of procedure
672 672
 			if ($error == 0) {
673
-				$this->date_credit = $date;		// date credit or debit
673
+				$this->date_credit = $date; // date credit or debit
674 674
 				$this->statut = self::STATUS_CREDITED;
675 675
 				$this->status = self::STATUS_CREDITED;
676 676
 
@@ -701,17 +701,17 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$error = 0;
703 703
 
704
-		dol_syslog(get_class($this) . "::set_infotrans Start", LOG_INFO);
704
+		dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO);
705 705
 
706 706
 		if ($this->db->begin()) {
707
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons ";
708
-			$sql .= " SET fk_user_trans = " . $user->id;
709
-			$sql .= " , date_trans = '" . $this->db->idate($date) . "'";
710
-			$sql .= " , method_trans = " . ((int) $method);
711
-			$sql .= " , statut = " . self::STATUS_TRANSFERED;
712
-			$sql .= " WHERE rowid = " . ((int) $this->id);
713
-			$sql .= " AND entity = " . ((int) $conf->entity);
714
-			$sql .= " AND statut = " . self::STATUS_DRAFT;
707
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
708
+			$sql .= " SET fk_user_trans = ".$user->id;
709
+			$sql .= " , date_trans = '".$this->db->idate($date)."'";
710
+			$sql .= " , method_trans = ".((int) $method);
711
+			$sql .= " , statut = ".self::STATUS_TRANSFERED;
712
+			$sql .= " WHERE rowid = ".((int) $this->id);
713
+			$sql .= " AND entity = ".((int) $conf->entity);
714
+			$sql .= " AND statut = ".self::STATUS_DRAFT;
715 715
 
716 716
 			if ($this->db->query($sql)) {
717 717
 				$this->method_trans = $method;
@@ -736,12 +736,12 @@  discard block
 block discarded – undo
736 736
 				return 0;
737 737
 			} else {
738 738
 				$this->db->rollback();
739
-				dol_syslog(get_class($this) . "::set_infotrans ROLLBACK", LOG_ERR);
739
+				dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR);
740 740
 
741 741
 				return -1;
742 742
 			}
743 743
 		} else {
744
-			dol_syslog(get_class($this) . "::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
744
+			dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
745 745
 			return -2;
746 746
 		}
747 747
 	}
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 		$arr = array();
762 762
 
763
-		dol_syslog(get_class($this) . "::getListInvoices");
763
+		dol_syslog(get_class($this)."::getListInvoices");
764 764
 
765 765
 		// Returns all invoices presented within same order
766 766
 		$sql = "SELECT ";
@@ -776,13 +776,13 @@  discard block
 block discarded – undo
776 776
 		if ($amounts) {
777 777
 			$sql .= ", SUM(pl.amount)";
778 778
 		}
779
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb,";
780
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
781
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
779
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
780
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
781
+		$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
782 782
 		$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
783 783
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
784
-		$sql .= " AND pb.rowid = " . ((int) $this->id);
785
-		$sql .= " AND pb.entity = " . ((int) $conf->entity);
784
+		$sql .= " AND pb.rowid = ".((int) $this->id);
785
+		$sql .= " AND pb.entity = ".((int) $conf->entity);
786 786
 		if ($amounts) {
787 787
 			if ($this->type == 'bank-transfer') {
788 788
 				if ($type == 'salary') {
@@ -836,17 +836,17 @@  discard block
 block discarded – undo
836 836
 		$sql = "SELECT sum(pd.amount) as nb";
837 837
 		if ($type !== 'salary') {
838 838
 			if ($mode != 'bank-transfer') {
839
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f,";
839
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
840 840
 			} else {
841
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f,";
841
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
842 842
 			}
843 843
 		} else {
844
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s,";
844
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s,";
845 845
 		}
846
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_demande as pd";
847
-		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (" . getEntity('invoice') . ")" : " WHERE s.entity IN (" . getEntity('salary') . ")");
846
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd";
847
+		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")");
848 848
 		if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
849
-			$sql .= ($type !== 'salary' ? " AND f.fk_statut = " . Facture::STATUS_VALIDATED : " AND s.paye = " . Salary::STATUS_UNPAID);
849
+			$sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID);
850 850
 		}
851 851
 		if ($type !== 'salary') {
852 852
 			if ($mode != 'bank-transfer') {
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 			return $obj->nb;
872 872
 		} else {
873 873
 			$error = 1;
874
-			dol_syslog(get_class($this) . "::SommeAPrelever Erreur -1");
874
+			dol_syslog(get_class($this)."::SommeAPrelever Erreur -1");
875 875
 			dol_syslog($this->db->error());
876 876
 
877 877
 			return -1;
@@ -907,26 +907,26 @@  discard block
 block discarded – undo
907 907
 		// phpcs:enable
908 908
 		if ($forsalary == 1) {
909 909
 			$sql = "SELECT count(s.rowid) as nb";
910
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s";
910
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
911 911
 		} else {
912 912
 			$sql = "SELECT count(f.rowid) as nb";
913 913
 
914 914
 			if ($type == 'bank-transfer') {
915
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
915
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
916 916
 			} else {
917
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
917
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
918 918
 			}
919 919
 		}
920
-		$sql .= ", " . MAIN_DB_PREFIX . "prelevement_demande as pd";
920
+		$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pd";
921 921
 		if ($forsalary == 1) {
922
-			$sql .= " WHERE s.entity IN (" . getEntity('invoice') . ")";
922
+			$sql .= " WHERE s.entity IN (".getEntity('invoice').")";
923 923
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
924 924
 				$sql .= " AND s.paye = 0";
925 925
 			}
926 926
 		} else {
927
-			$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
927
+			$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
928 928
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
929
-				$sql .= " AND f.fk_statut = " . Facture::STATUS_VALIDATED;
929
+				$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
930 930
 			}
931 931
 		}
932 932
 		if ($forsalary == 1) {
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 			$sql .= " AND s.paye = 0";
947 947
 		}
948 948
 
949
-		dol_syslog(get_class($this) . "::NbFactureAPrelever");
949
+		dol_syslog(get_class($this)."::NbFactureAPrelever");
950 950
 		$resql = $this->db->query($sql);
951 951
 
952 952
 		if ($resql) {
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 
956 956
 			return $obj->nb;
957 957
 		} else {
958
-			$this->error = get_class($this) . "::NbFactureAPrelever Erreur -1 sql=" . $this->db->error();
958
+			$this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
959 959
 			return -1;
960 960
 		}
961 961
 	}
@@ -987,10 +987,10 @@  discard block
 block discarded – undo
987 987
 		// phpcs:enable
988 988
 		global $conf, $langs, $user;
989 989
 
990
-		dol_syslog(__METHOD__ . " Bank=" . $banque . " Office=" . $agence . " mode=" . $mode . " format=" . $format, LOG_DEBUG);
990
+		dol_syslog(__METHOD__." Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG);
991 991
 
992
-		require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
993
-		require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
992
+		require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
993
+		require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
994 994
 
995 995
 		// Check params
996 996
 		if ($type != 'bank-transfer') {
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 		$factures_prev_id = array();
1027 1027
 		$factures_errors = array();
1028 1028
 		if (!$error) {
1029
-			dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG);
1029
+			dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG);
1030 1030
 
1031 1031
 			$sql = "SELECT f.rowid, pd.rowid as pfdrowid";
1032 1032
 			if ($sourcetype != 'salary') {
@@ -1045,30 +1045,30 @@  discard block
 block discarded – undo
1045 1045
 			}
1046 1046
 			if ($sourcetype != 'salary') {
1047 1047
 				if ($type != 'bank-transfer') {
1048
-					$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
1049
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture";
1048
+					$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
1049
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture";
1050 1050
 				} else {
1051
-					$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
1052
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn";
1051
+					$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
1052
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn";
1053 1053
 				}
1054
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
1055
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1";
1054
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
1055
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1";
1056 1056
 			} else {
1057
-				$sql .= " FROM " . MAIN_DB_PREFIX . "salary as f";
1058
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_salary";
1059
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as s ON s.rowid = f.fk_user";
1060
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user_rib as sr ON s.rowid = sr.fk_user";
1057
+				$sql .= " FROM ".MAIN_DB_PREFIX."salary as f";
1058
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_salary";
1059
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON s.rowid = f.fk_user";
1060
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user";
1061 1061
 				// TODO Add 'AND sr.default_rib = 1' here. Note: the column has been created in v21 in llx_user_rib and default to 0
1062 1062
 				// If we add a test on sr.default_rib = 1, we must also check we have a correct error management to stop if no default BAN is found.
1063 1063
 			}
1064 1064
 			if ($sourcetype != 'salary') {
1065 1065
 				if ($type != 'bank-transfer') {
1066
-					$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ')';
1066
+					$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
1067 1067
 				} else {
1068
-					$sql .= " WHERE f.entity IN (" . getEntity('supplier_invoice') . ')';
1068
+					$sql .= " WHERE f.entity IN (".getEntity('supplier_invoice').')';
1069 1069
 				}
1070 1070
 			} else {
1071
-				$sql .= " WHERE f.entity IN (" . getEntity('salary') . ')';
1071
+				$sql .= " WHERE f.entity IN (".getEntity('salary').')';
1072 1072
 			}
1073 1073
 			if ($sourcetype != 'salary') {
1074 1074
 				$sql .= " AND f.fk_statut = 1"; // Invoice validated
@@ -1082,10 +1082,10 @@  discard block
 block discarded – undo
1082 1082
 			$sql .= " AND pd.traite = 0";
1083 1083
 			$sql .= " AND pd.ext_payment_id IS NULL";
1084 1084
 			if ($sourcetype != 'salary') {
1085
-				$sql .= " AND sr.type = 'ban'";		// TODO Add AND sr.type = 'ban' for users too
1085
+				$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
1086 1086
 			}
1087 1087
 			if ($did > 0) {
1088
-				$sql .= " AND pd.rowid = " . ((int) $did);
1088
+				$sql .= " AND pd.rowid = ".((int) $did);
1089 1089
 			}
1090 1090
 
1091 1091
 			$resql = $this->db->query($sql);
@@ -1094,41 +1094,41 @@  discard block
 block discarded – undo
1094 1094
 				$i = 0;
1095 1095
 
1096 1096
 				while ($i < $num) {
1097
-					$row = $this->db->fetch_row($resql);	// TODO Replace with fetch_object()
1097
+					$row = $this->db->fetch_row($resql); // TODO Replace with fetch_object()
1098 1098
 					$factures[$i] = $row; // All fields
1099 1099
 
1100 1100
 					if ($row[7] == 0) {
1101 1101
 						$error++;
1102
-						dol_syslog(__METHOD__ . " Read invoices/salary error Found a null amount", LOG_ERR);
1103
-						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id " . $row[0] . ", found a null amount";
1102
+						dol_syslog(__METHOD__." Read invoices/salary error Found a null amount", LOG_ERR);
1103
+						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id ".$row[0].", found a null amount";
1104 1104
 						break;
1105 1105
 					}
1106 1106
 					$i++;
1107 1107
 				}
1108 1108
 
1109 1109
 				$this->db->free($resql);
1110
-				dol_syslog(__METHOD__ . " Read invoices/salary, " . $i . " invoices/salary to withdraw", LOG_DEBUG);
1110
+				dol_syslog(__METHOD__." Read invoices/salary, ".$i." invoices/salary to withdraw", LOG_DEBUG);
1111 1111
 			} else {
1112 1112
 				$error++;
1113 1113
 				$this->error = $this->db->lasterror();
1114
-				dol_syslog(__METHOD__ . " Read invoices/salary error " . $this->db->lasterror(), LOG_ERR);
1114
+				dol_syslog(__METHOD__." Read invoices/salary error ".$this->db->lasterror(), LOG_ERR);
1115 1115
 				return -1;
1116 1116
 			}
1117 1117
 		}
1118 1118
 
1119 1119
 		if (!$error) {
1120 1120
 			// Make some checks
1121
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1122
-			require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
1123
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
1124
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
1121
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1122
+			require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1123
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1124
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
1125 1125
 
1126 1126
 			$tmpsoc = new Societe($this->db);
1127 1127
 			$tmpuser = new User($this->db);
1128 1128
 
1129 1129
 			// Check BAN
1130 1130
 			$i = 0;
1131
-			dol_syslog(__METHOD__ . " Check BAN", LOG_DEBUG);
1131
+			dol_syslog(__METHOD__." Check BAN", LOG_DEBUG);
1132 1132
 
1133 1133
 			if (count($factures) > 0) {
1134 1134
 				foreach ($factures as $key => $fac) {
@@ -1168,31 +1168,31 @@  discard block
 block discarded – undo
1168 1168
 							if ($type != 'bank-transfer') {
1169 1169
 								$tmpsoc->id = $fac[2];
1170 1170
 								$tmpsoc->name = $fac[8];
1171
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/compta/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1172
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1173
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1171
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1172
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1173
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1174 1174
 								$error++;
1175 1175
 							}
1176 1176
 							if ($type == 'bank-transfer' && $sourcetype != 'salary') {
1177 1177
 								$tmpsoc->id = $fac[2];
1178 1178
 								$tmpsoc->name = $fac[8];
1179
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1180
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1181
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1179
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1180
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1181
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1182 1182
 								$error++;
1183 1183
 							}
1184 1184
 							if ($type == 'bank-transfer' && $sourcetype == 'salary') {
1185 1185
 								$tmpuser->id = $fac[2];
1186 1186
 								$tmpuser->firstname = $fac[8];
1187
-								$salary_url = "<a href='" . DOL_URL_ROOT . '/salaries/card.php?id=' . $fac[0] . "'>" . $fac[0] . "</a>";
1188
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1189
-								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1187
+								$salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>";
1188
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1189
+								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1190 1190
 								$error++;
1191 1191
 							}
1192
-							dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING);
1192
+							dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING);
1193 1193
 						}
1194 1194
 					} else {
1195
-						dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING);
1195
+						dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING);
1196 1196
 					}
1197 1197
 					/*
1198 1198
 					} else {
@@ -1201,14 +1201,14 @@  discard block
 block discarded – undo
1201 1201
 					*/
1202 1202
 				}
1203 1203
 			} else {
1204
-				dol_syslog(__METHOD__ . " Check BAN No invoice to process", LOG_WARNING);
1204
+				dol_syslog(__METHOD__." Check BAN No invoice to process", LOG_WARNING);
1205 1205
 			}
1206 1206
 		}
1207 1207
 
1208 1208
 		$ok = 0;
1209 1209
 
1210 1210
 		// Withdraw invoices in factures_prev array
1211
-		$out = count($factures_prev) . " invoices will be included.";
1211
+		$out = count($factures_prev)." invoices will be included.";
1212 1212
 		//print $out."\n";
1213 1213
 		dol_syslog($out);
1214 1214
 
@@ -1242,32 +1242,32 @@  discard block
 block discarded – undo
1242 1242
 			 * Process order generation
1243 1243
 			 */
1244 1244
 			if (!$error) {
1245
-				$ref = substr($year, -2) . $month;
1245
+				$ref = substr($year, -2).$month;
1246 1246
 
1247 1247
 				// Get next free number for the ref of bon prelevement
1248
-				$sql = "SELECT substring(ref from char_length(ref) - 1)";	// To extract "YYMMXX" from "TYYMMXX"
1249
-				$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons";
1250
-				$sql .= " WHERE ref LIKE '_" . $this->db->escape($ref) . "%'";
1251
-				$sql .= " AND entity = " . ((int) $conf->entity);
1248
+				$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
1249
+				$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
1250
+				$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
1251
+				$sql .= " AND entity = ".((int) $conf->entity);
1252 1252
 				$sql .= " ORDER BY ref DESC LIMIT 1";
1253 1253
 
1254
-				dol_syslog(get_class($this) . " get next free number", LOG_DEBUG);
1254
+				dol_syslog(get_class($this)." get next free number", LOG_DEBUG);
1255 1255
 				$resql = $this->db->query($sql);
1256 1256
 
1257 1257
 				if ($resql) {
1258 1258
 					$row = $this->db->fetch_row($resql);
1259 1259
 
1260 1260
 					// Build the new ref
1261
-					$ref = "T" . $ref . sprintf("%02d", (intval($row[0]) + 1));
1261
+					$ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1));
1262 1262
 
1263 1263
 					// $conf->abc->dir_output may be:
1264 1264
 					// /home/ldestailleur/git/dolibarr_15.0/documents/abc/
1265 1265
 					// or
1266 1266
 					// /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany.
1267 1267
 					if ($type != 'bank-transfer') {
1268
-						$dir = $conf->prelevement->dir_output . '/receipts';
1268
+						$dir = $conf->prelevement->dir_output.'/receipts';
1269 1269
 					} else {
1270
-						$dir = $conf->paymentbybanktransfer->dir_output . '/receipts';
1270
+						$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
1271 1271
 					}
1272 1272
 					if (!is_dir($dir)) {
1273 1273
 						dol_mkdir($dir);
@@ -1275,41 +1275,41 @@  discard block
 block discarded – undo
1275 1275
 
1276 1276
 					if (isModEnabled('multicompany')) {
1277 1277
 						$labelentity = $conf->entity;
1278
-						$this->filename = $dir . '/' . $ref . '-' . $labelentity . '.xml';
1278
+						$this->filename = $dir.'/'.$ref.'-'.$labelentity.'.xml';
1279 1279
 					} else {
1280
-						$this->filename = $dir . '/' . $ref . '.xml';
1280
+						$this->filename = $dir.'/'.$ref.'.xml';
1281 1281
 					}
1282 1282
 
1283 1283
 					// Create withdraw order in database
1284
-					$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons (";
1284
+					$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
1285 1285
 					$sql .= "ref, entity, datec, type, fk_bank_account";
1286 1286
 					$sql .= ") VALUES (";
1287
-					$sql .= "'" . $this->db->escape($ref) . "'";
1288
-					$sql .= ", " . ((int) $conf->entity);
1289
-					$sql .= ", '" . $this->db->idate($now) . "'";
1290
-					$sql .= ", '" . ($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order') . "'";
1291
-					$sql .= ", " . ((int) $fk_bank_account);
1287
+					$sql .= "'".$this->db->escape($ref)."'";
1288
+					$sql .= ", ".((int) $conf->entity);
1289
+					$sql .= ", '".$this->db->idate($now)."'";
1290
+					$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
1291
+					$sql .= ", ".((int) $fk_bank_account);
1292 1292
 					$sql .= ")";
1293 1293
 
1294 1294
 					$resql = $this->db->query($sql);
1295 1295
 
1296 1296
 
1297 1297
 					if ($resql) {
1298
-						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons");
1298
+						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
1299 1299
 						$this->id = $prev_id;
1300 1300
 						$this->ref = $ref;
1301 1301
 					} else {
1302 1302
 						$error++;
1303
-						dol_syslog(__METHOD__ . " Create withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1303
+						dol_syslog(__METHOD__." Create withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1304 1304
 					}
1305 1305
 				} else {
1306 1306
 					$error++;
1307
-					dol_syslog(__METHOD__ . " Get last withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1307
+					dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1308 1308
 				}
1309 1309
 			}
1310 1310
 
1311 1311
 			if (!$error) {
1312
-				dol_syslog(__METHOD__ . " Now loop on each document to insert them in llx_prelevement_demande");
1312
+				dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
1313 1313
 
1314 1314
 				// Add lines for the bon
1315 1315
 				if (count($factures_prev) > 0) {
@@ -1338,17 +1338,17 @@  discard block
 block discarded – undo
1338 1338
 						}
1339 1339
 
1340 1340
 						// Update invoice requests as done
1341
-						$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande";
1341
+						$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
1342 1342
 						$sql .= " SET traite = 1";
1343
-						$sql .= ", date_traite = '" . $this->db->idate($now) . "'";
1344
-						$sql .= ", fk_prelevement_bons = " . ((int) $this->id);
1345
-						$sql .= " WHERE rowid = " . ((int) $fac[1]);
1343
+						$sql .= ", date_traite = '".$this->db->idate($now)."'";
1344
+						$sql .= ", fk_prelevement_bons = ".((int) $this->id);
1345
+						$sql .= " WHERE rowid = ".((int) $fac[1]);
1346 1346
 
1347 1347
 						$resql = $this->db->query($sql);
1348 1348
 						if (!$resql) {
1349 1349
 							$error++;
1350 1350
 							$this->errors[] = $this->db->lasterror();
1351
-							dol_syslog(__METHOD__ . " Update Error=" . $this->db->lasterror(), LOG_ERR);
1351
+							dol_syslog(__METHOD__." Update Error=".$this->db->lasterror(), LOG_ERR);
1352 1352
 						}
1353 1353
 					}
1354 1354
 				}
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
 				 * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
1360 1360
 				 */
1361 1361
 
1362
-				dol_syslog(__METHOD__ . " Init direct debit or credit transfer file for " . count($factures_prev) . " invoices", LOG_DEBUG);
1362
+				dol_syslog(__METHOD__." Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
1363 1363
 
1364 1364
 				if (count($factures_prev) > 0) {
1365 1365
 					$this->date_echeance = $datetimeprev;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 						$this->emetteur_iban               = $account->iban;
1376 1376
 						$this->emetteur_bic                = $account->bic;
1377 1377
 
1378
-						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);	// Example "FR78ZZZ123456"
1378
+						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456"
1379 1379
 
1380 1380
 						$this->raison_sociale = $account->proprio;
1381 1381
 					}
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 						$error++;
1395 1395
 					}
1396 1396
 				}
1397
-				dol_syslog(__METHOD__ . " Bank order file has been generated under filename " . $this->filename, LOG_DEBUG);
1397
+				dol_syslog(__METHOD__." Bank order file has been generated under filename ".$this->filename, LOG_DEBUG);
1398 1398
 			}
1399 1399
 
1400 1400
 
@@ -1402,15 +1402,15 @@  discard block
 block discarded – undo
1402 1402
 			 * Update total defined after generation of file
1403 1403
 			 */
1404 1404
 			if (!$error) {
1405
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
1406
-				$sql .= " SET amount = " . price2num($this->total);
1407
-				$sql .= " WHERE rowid = " . ((int) $this->id);
1408
-				$sql .= " AND entity = " . ((int) $conf->entity);
1405
+				$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
1406
+				$sql .= " SET amount = ".price2num($this->total);
1407
+				$sql .= " WHERE rowid = ".((int) $this->id);
1408
+				$sql .= " AND entity = ".((int) $conf->entity);
1409 1409
 				$resql = $this->db->query($sql);
1410 1410
 
1411 1411
 				if (!$resql) {
1412 1412
 					$error++;
1413
-					dol_syslog(__METHOD__ . " Error update total: " . $this->db->error(), LOG_ERR);
1413
+					dol_syslog(__METHOD__." Error update total: ".$this->db->error(), LOG_ERR);
1414 1414
 				}
1415 1415
 			}
1416 1416
 
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 
1431 1431
 			if (!$error) {
1432 1432
 				$this->db->commit();
1433
-				return count($factures_prev);	// The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1433
+				return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1434 1434
 			} else {
1435 1435
 				$this->db->rollback();
1436 1436
 				return -1;
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 		}
1470 1470
 
1471 1471
 		if (!$error) {
1472
-			$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) . ")";
1472
+			$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).")";
1473 1473
 			$resql1 = $this->db->query($sql);
1474 1474
 			if (!$resql1) {
1475 1475
 				dol_print_error($this->db);
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 		}
1478 1478
 
1479 1479
 		if (!$error) {
1480
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id);
1480
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id);
1481 1481
 			$resql2 = $this->db->query($sql);
1482 1482
 			if (!$resql2) {
1483 1483
 				dol_print_error($this->db);
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 		}
1486 1486
 
1487 1487
 		if (!$error) {
1488
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_bons WHERE rowid = " . ((int) $this->id);
1488
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".((int) $this->id);
1489 1489
 			$resql3 = $this->db->query($sql);
1490 1490
 			if (!$resql3) {
1491 1491
 				dol_print_error($this->db);
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 		}
1494 1494
 
1495 1495
 		if (!$error) {
1496
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = " . ((int) $this->id);
1496
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
1497 1497
 			$resql4 = $this->db->query($sql);
1498 1498
 			if (!$resql4) {
1499 1499
 				dol_print_error($this->db);
@@ -1535,22 +1535,22 @@  discard block
 block discarded – undo
1535 1535
 			$labeltoshow = 'PaymentByBankTransfer';
1536 1536
 		}
1537 1537
 
1538
-		$label = img_picto('', $this->picto) . ' <u>' . $langs->trans($labeltoshow) . '</u> ' . $this->getLibStatut(5);
1538
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans($labeltoshow).'</u> '.$this->getLibStatut(5);
1539 1539
 		$label .= '<br>';
1540
-		$label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
1540
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
1541 1541
 		if (isset($this->amount)) {
1542
-			$label .= '<br><b>' . $langs->trans("Amount") . ":</b> " . price($this->amount);
1542
+			$label .= '<br><b>'.$langs->trans("Amount").":</b> ".price($this->amount);
1543 1543
 		}
1544 1544
 		if (isset($this->date_trans)) {
1545
-			$label .= '<br><b>' . $langs->trans("TransData") . ":</b> " . dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1545
+			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1546 1546
 		}
1547 1547
 		/*if (isset($this->date_credit)) {
1548 1548
 			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_credit, 'dayhour', 'tzuserrel');
1549 1549
 		}*/
1550 1550
 
1551
-		$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1551
+		$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1552 1552
 		if (!empty($this->type) && $this->type == 'bank-transfer') {
1553
-			$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1553
+			$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1554 1554
 		}
1555 1555
 
1556 1556
 		if ($option != 'nolink') {
@@ -1568,21 +1568,21 @@  discard block
 block discarded – undo
1568 1568
 		if (empty($notooltip)) {
1569 1569
 			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1570 1570
 				$label = $langs->trans("ShowMyObject");
1571
-				$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
1571
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1572 1572
 			}
1573
-			$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
1574
-			$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
1573
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1574
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1575 1575
 		} else {
1576
-			$linkclose = ($morecss ? ' class="' . $morecss . '"' : '');
1576
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1577 1577
 		}
1578 1578
 
1579
-		$linkstart = '<a href="' . $url . '"';
1580
-		$linkstart .= $linkclose . '>';
1579
+		$linkstart = '<a href="'.$url.'"';
1580
+		$linkstart .= $linkclose.'>';
1581 1581
 		$linkend = '</a>';
1582 1582
 
1583 1583
 		$result .= $linkstart;
1584 1584
 		if ($withpicto) {
1585
-			$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);
1585
+			$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);
1586 1586
 		}
1587 1587
 		if ($withpicto != 2) {
1588 1588
 			$result .= $this->ref;
@@ -1611,8 +1611,8 @@  discard block
 block discarded – undo
1611 1611
 	 */
1612 1612
 	public function deleteNotificationById($rowid)
1613 1613
 	{
1614
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1615
-		$sql .= " WHERE rowid = " . ((int) $rowid);
1614
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1615
+		$sql .= " WHERE rowid = ".((int) $rowid);
1616 1616
 
1617 1617
 		if ($this->db->query($sql)) {
1618 1618
 			return 0;
@@ -1636,8 +1636,8 @@  discard block
 block discarded – undo
1636 1636
 			$userid = $user;
1637 1637
 		}
1638 1638
 
1639
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1640
-		$sql .= " WHERE fk_user=" . ((int) $userid) . " AND fk_action='" . $this->db->escape($action) . "'";
1639
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1640
+		$sql .= " WHERE fk_user=".((int) $userid)." AND fk_action='".$this->db->escape($action)."'";
1641 1641
 
1642 1642
 		if ($this->db->query($sql)) {
1643 1643
 			return 0;
@@ -1669,15 +1669,15 @@  discard block
 block discarded – undo
1669 1669
 		if ($this->deleteNotification($user, $action) == 0) {
1670 1670
 			$now = dol_now();
1671 1671
 
1672
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1673
-			$sql .= " VALUES ('" . $this->db->idate($now) . "', " . ((int) $userid) . ", 'NULL', 'NULL', '" . $this->db->escape($action) . "')";
1672
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1673
+			$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')";
1674 1674
 
1675
-			dol_syslog("adnotiff: " . $sql);
1675
+			dol_syslog("adnotiff: ".$sql);
1676 1676
 			if ($this->db->query($sql)) {
1677 1677
 				$result = 0;
1678 1678
 			} else {
1679 1679
 				$result = -1;
1680
-				dol_syslog(get_class($this) . "::addNotification Error $result");
1680
+				dol_syslog(get_class($this)."::addNotification Error $result");
1681 1681
 			}
1682 1682
 		}
1683 1683
 
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 
1713 1713
 		$result = 0;
1714 1714
 
1715
-		dol_syslog(get_class($this) . "::generate build file=" . $this->filename . " type=" . $type);
1715
+		dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type);
1716 1716
 
1717 1717
 		$this->file = fopen($this->filename, "w");
1718 1718
 		if ($this->file == false) {
@@ -1758,13 +1758,13 @@  discard block
 block discarded – undo
1758 1758
 				$sql .= " f.ref as reffac, p.fk_facture as idfac,";
1759 1759
 				$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1760 1760
 				$sql .= " FROM";
1761
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1762
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1763
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1764
-				$sql .= " " . MAIN_DB_PREFIX . "societe as soc,";
1765
-				$sql .= " " . MAIN_DB_PREFIX . "c_country as c,";
1766
-				$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1767
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1761
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1762
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1763
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1764
+				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
1765
+				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
1766
+				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1767
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1768 1768
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1769 1769
 				$sql .= " AND p.fk_facture = f.rowid";
1770 1770
 				$sql .= " AND f.fk_soc = soc.rowid";
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 					$nbtotalDrctDbtTxInf = $i;
1801 1801
 				} else {
1802 1802
 					$this->error = $this->db->lasterror();
1803
-					fwrite($this->file, 'ERROR DEBITOR ' . $sql . $CrLf); // DEBITOR = Customers
1803
+					fwrite($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
1804 1804
 					$result = -2;
1805 1805
 				}
1806 1806
 
@@ -1817,26 +1817,26 @@  discard block
 block discarded – undo
1817 1817
 				 * SECTION CREATION SEPA FILE - ISO200022
1818 1818
 				 */
1819 1819
 				// SEPA File Header
1820
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1821
-				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);
1822
-				fwrite($this->file, '	<CstmrDrctDbtInitn>' . $CrLf);
1820
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1821
+				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);
1822
+				fwrite($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
1823 1823
 				// SEPA Group header
1824
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1825
-				fwrite($this->file, '			<MsgId>' . ('DD/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
1826
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1827
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1828
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1829
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1830
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1831
-				fwrite($this->file, '				<Id>' . $CrLf);
1832
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1833
-				fwrite($this->file, '					<Othr>' . $CrLf);
1834
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1835
-				fwrite($this->file, '					</Othr>' . $CrLf);
1836
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1837
-				fwrite($this->file, '				</Id>' . $CrLf);
1838
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1839
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1824
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1825
+				fwrite($this->file, '			<MsgId>'.('DD/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
1826
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1827
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1828
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1829
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1830
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1831
+				fwrite($this->file, '				<Id>'.$CrLf);
1832
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1833
+				fwrite($this->file, '					<Othr>'.$CrLf);
1834
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1835
+				fwrite($this->file, '					</Othr>'.$CrLf);
1836
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1837
+				fwrite($this->file, '				</Id>'.$CrLf);
1838
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1839
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1840 1840
 				// SEPA File Emetteur
1841 1841
 				if ($result != -2) {
1842 1842
 					fwrite($this->file, $fileEmetteurSection);
@@ -1846,9 +1846,9 @@  discard block
 block discarded – undo
1846 1846
 					fwrite($this->file, $fileDebiteurSection);
1847 1847
 				}
1848 1848
 				// SEPA FILE FOOTER
1849
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1850
-				fwrite($this->file, '	</CstmrDrctDbtInitn>' . $CrLf);
1851
-				fwrite($this->file, '</Document>' . $CrLf);
1849
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1850
+				fwrite($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
1851
+				fwrite($this->file, '</Document>'.$CrLf);
1852 1852
 			} else {
1853 1853
 				/**
1854 1854
 				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
@@ -1880,13 +1880,13 @@  discard block
 block discarded – undo
1880 1880
 					$sql .= " s.ref as reffac, p.fk_salary as idfac,";
1881 1881
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
1882 1882
 					$sql .= " FROM";
1883
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1884
-					$sql .= " " . MAIN_DB_PREFIX . "salary as s,";
1885
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1886
-					$sql .= " " . MAIN_DB_PREFIX . "user as u";
1887
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid,";
1888
-					$sql .= " " . MAIN_DB_PREFIX . "user_rib as rib";
1889
-					$sql .= " WHERE pl.fk_prelevement_bons=" . ((int) $this->id);
1883
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1884
+					$sql .= " ".MAIN_DB_PREFIX."salary as s,";
1885
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1886
+					$sql .= " ".MAIN_DB_PREFIX."user as u";
1887
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
1888
+					$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
1889
+					$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
1890 1890
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1891 1891
 					$sql .= " AND p.fk_salary = s.rowid";
1892 1892
 					$sql .= " AND s.fk_user = u.rowid";
@@ -1897,13 +1897,13 @@  discard block
 block discarded – undo
1897 1897
 					$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,";
1898 1898
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1899 1899
 					$sql .= " FROM";
1900
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1901
-					$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
1902
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1903
-					$sql .= " " . MAIN_DB_PREFIX . "societe as soc";
1904
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON soc.fk_pays = c.rowid,";
1905
-					$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1906
-					$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1900
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1901
+					$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
1902
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1903
+					$sql .= " ".MAIN_DB_PREFIX."societe as soc";
1904
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
1905
+					$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1906
+					$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1907 1907
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1908 1908
 					$sql .= " AND p.fk_facture_fourn = f.rowid";
1909 1909
 					$sql .= " AND f.fk_soc = soc.rowid";
@@ -1930,7 +1930,7 @@  discard block
 block discarded – undo
1930 1930
 						$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
1931 1931
 						$refobj = $obj->reffac;
1932 1932
 						if (empty($refobj) && !empty($forsalary)) {	// If ref of salary not defined, we force a value
1933
-							$refobj = "SAL" . $obj->idfac;
1933
+							$refobj = "SAL".$obj->idfac;
1934 1934
 						}
1935 1935
 
1936 1936
 						$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, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
 					$nbtotalDrctDbtTxInf = $i;
1942 1942
 				} else {
1943 1943
 					$this->error = $this->db->lasterror();
1944
-					fwrite($this->file, 'ERROR CREDITOR ' . $sql . $CrLf); // CREDITORS = Suppliers
1944
+					fwrite($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
1945 1945
 					$result = -2;
1946 1946
 				}
1947 1947
 				// Define $fileEmetteurSection. Start of block PmtInf. Will contains all $nbtotalDrctDbtTxInf
@@ -1957,26 +1957,26 @@  discard block
 block discarded – undo
1957 1957
 				 * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
1958 1958
 				 */
1959 1959
 				// SEPA File Header
1960
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1961
-				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);
1962
-				fwrite($this->file, '	<CstmrCdtTrfInitn>' . $CrLf);
1960
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1961
+				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);
1962
+				fwrite($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
1963 1963
 				// SEPA Group header
1964
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1965
-				fwrite($this->file, '			<MsgId>' . ('TRF/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
1966
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1967
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1968
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1969
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1970
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1971
-				fwrite($this->file, '				<Id>' . $CrLf);
1972
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1973
-				fwrite($this->file, '					<Othr>' . $CrLf);
1974
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1975
-				fwrite($this->file, '					</Othr>' . $CrLf);
1976
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1977
-				fwrite($this->file, '				</Id>' . $CrLf);
1978
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1979
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1964
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1965
+				fwrite($this->file, '			<MsgId>'.('TRF/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
1966
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1967
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1968
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1969
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1970
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1971
+				fwrite($this->file, '				<Id>'.$CrLf);
1972
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1973
+				fwrite($this->file, '					<Othr>'.$CrLf);
1974
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1975
+				fwrite($this->file, '					</Othr>'.$CrLf);
1976
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1977
+				fwrite($this->file, '				</Id>'.$CrLf);
1978
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1979
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1980 1980
 				// SEPA File Emetteur (mycompany)
1981 1981
 				if ($result != -2) {
1982 1982
 					fwrite($this->file, $fileEmetteurSection);
@@ -1986,9 +1986,9 @@  discard block
 block discarded – undo
1986 1986
 					fwrite($this->file, $fileCrediteurSection);
1987 1987
 				}
1988 1988
 				// SEPA FILE FOOTER
1989
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1990
-				fwrite($this->file, '	</CstmrCdtTrfInitn>' . $CrLf);
1991
-				fwrite($this->file, '</Document>' . $CrLf);
1989
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1990
+				fwrite($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
1991
+				fwrite($this->file, '</Document>'.$CrLf);
1992 1992
 			}
1993 1993
 		}
1994 1994
 
@@ -1997,10 +1997,10 @@  discard block
 block discarded – undo
1997 1997
 			if ($type != 'bank-transfer') {
1998 1998
 				$sql = "SELECT pl.amount";
1999 1999
 				$sql .= " FROM";
2000
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2001
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
2002
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2003
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2000
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2001
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
2002
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2003
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2004 2004
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2005 2005
 				$sql .= " AND p.fk_facture = f.rowid";
2006 2006
 
@@ -2023,10 +2023,10 @@  discard block
 block discarded – undo
2023 2023
 			} else {
2024 2024
 				$sql = "SELECT pl.amount";
2025 2025
 				$sql .= " FROM";
2026
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2027
-				$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2028
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2029
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2026
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2027
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2028
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2029
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2030 2030
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2031 2031
 				$sql .= " AND p.fk_facture_fourn = f.rowid";
2032 2032
 				// Lines
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
 		$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)
2076 2076
 
2077 2077
 		// 3 char + '-' + 12 + '-' + id + '-' + code 		Must be lower than 32.
2078
-		return $pre . '-' . dol_print_date($row_datec, 'dayhourlogsmall') . '-' . dol_trunc($row_drum . ($row_code_client ? '-' . $row_code_client : ''), 13, 'right', 'UTF-8', 1);
2078
+		return $pre.'-'.dol_print_date($row_datec, 'dayhourlogsmall').'-'.dol_trunc($row_drum.($row_code_client ? '-'.$row_code_client : ''), 13, 'right', 'UTF-8', 1);
2079 2079
 	}
2080 2080
 
2081 2081
 
@@ -2114,11 +2114,11 @@  discard block
 block discarded – undo
2114 2114
 
2115 2115
 		// Raison Sociale Destinataire C2
2116 2116
 
2117
-		fwrite($this->file, substr(strtoupper($client_nom) . "                         ", 0, 24));
2117
+		fwrite($this->file, substr(strtoupper($client_nom)."                         ", 0, 24));
2118 2118
 
2119 2119
 		// Address optional D1
2120 2120
 		$address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => ""));
2121
-		fwrite($this->file, substr($address . "                         ", 0, 24));
2121
+		fwrite($this->file, substr($address."                         ", 0, 24));
2122 2122
 
2123 2123
 		// Zone Reservee D2
2124 2124
 
@@ -2130,17 +2130,17 @@  discard block
 block discarded – undo
2130 2130
 
2131 2131
 		// Numero de compte D4
2132 2132
 
2133
-		fwrite($this->file, substr("000000000000000" . $rib_number, -11));
2133
+		fwrite($this->file, substr("000000000000000".$rib_number, -11));
2134 2134
 
2135 2135
 		// Zone E Montant
2136 2136
 
2137 2137
 		$montant = (round($amount, 2) * 100);
2138 2138
 
2139
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2139
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2140 2140
 
2141 2141
 		// Label F
2142 2142
 
2143
-		fwrite($this->file, substr("*_" . $ref . "_RDVnet" . $rowid . "                               ", 0, 31));
2143
+		fwrite($this->file, substr("*_".$ref."_RDVnet".$rowid."                               ", 0, 31));
2144 2144
 
2145 2145
 		// Code etablissement G1
2146 2146
 
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
 			$row_somme = round((float) $row_somme, 2);
2192 2192
 		}
2193 2193
 
2194
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
2194
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2195 2195
 
2196 2196
 		$CrLf = "\n";
2197 2197
 		$Rowing = sprintf("%010d", $row_idfac);
@@ -2206,61 +2206,61 @@  discard block
 block discarded – undo
2206 2206
 		if ($type != 'bank-transfer') {
2207 2207
 			// SEPA Paiement Information of buyer for Direct Debit
2208 2208
 			$XML_DEBITOR = '';
2209
-			$XML_DEBITOR .= '			<DrctDbtTxInf>' . $CrLf;
2210
-			$XML_DEBITOR .= '				<PmtId>' . $CrLf;
2209
+			$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
2210
+			$XML_DEBITOR .= '				<PmtId>'.$CrLf;
2211 2211
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2212
-			$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
2213
-			$XML_DEBITOR .= '				</PmtId>' . $CrLf;
2214
-			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">' . $row_somme . '</InstdAmt>' . $CrLf;
2215
-			$XML_DEBITOR .= '				<DrctDbtTx>' . $CrLf;
2216
-			$XML_DEBITOR .= '					<MndtRltdInf>' . $CrLf;
2217
-			$XML_DEBITOR .= '						<MndtId>' . $Rum . '</MndtId>' . $CrLf;
2218
-			$XML_DEBITOR .= '						<DtOfSgntr>' . $DtOfSgntr . '</DtOfSgntr>' . $CrLf;
2219
-			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>' . $CrLf;
2220
-			$XML_DEBITOR .= '					</MndtRltdInf>' . $CrLf;
2221
-			$XML_DEBITOR .= '				</DrctDbtTx>' . $CrLf;
2222
-			$XML_DEBITOR .= '				<DbtrAgt>' . $CrLf;
2223
-			$XML_DEBITOR .= '					<FinInstnId>' . $CrLf;
2212
+			$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
2213
+			$XML_DEBITOR .= '				</PmtId>'.$CrLf;
2214
+			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.$row_somme.'</InstdAmt>'.$CrLf;
2215
+			$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
2216
+			$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
2217
+			$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
2218
+			$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
2219
+			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
2220
+			$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
2221
+			$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
2222
+			$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
2223
+			$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
2224 2224
 			if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) {
2225
-				$XML_DEBITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2225
+				$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2226 2226
 			}
2227
-			$XML_DEBITOR .= '					</FinInstnId>' . $CrLf;
2228
-			$XML_DEBITOR .= '				</DbtrAgt>' . $CrLf;
2229
-			$XML_DEBITOR .= '				<Dbtr>' . $CrLf;
2230
-			$XML_DEBITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2231
-			$XML_DEBITOR .= '					<PstlAdr>' . $CrLf;
2232
-			$XML_DEBITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2227
+			$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
2228
+			$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
2229
+			$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
2230
+			$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2231
+			$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
2232
+			$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2233 2233
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2234
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2234
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2235 2235
 			if (trim($addressline1)) {
2236
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2236
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2237 2237
 			}
2238 2238
 			if (trim($addressline2)) {
2239
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2239
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2240 2240
 			}
2241
-			$XML_DEBITOR .= '					</PstlAdr>' . $CrLf;
2242
-			$XML_DEBITOR .= '				</Dbtr>' . $CrLf;
2243
-			$XML_DEBITOR .= '				<DbtrAcct>' . $CrLf;
2244
-			$XML_DEBITOR .= '					<Id>' . $CrLf;
2245
-			$XML_DEBITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2246
-			$XML_DEBITOR .= '					</Id>' . $CrLf;
2247
-			$XML_DEBITOR .= '				</DbtrAcct>' . $CrLf;
2248
-			$XML_DEBITOR .= '				<RmtInf>' . $CrLf;
2241
+			$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
2242
+			$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
2243
+			$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
2244
+			$XML_DEBITOR .= '					<Id>'.$CrLf;
2245
+			$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2246
+			$XML_DEBITOR .= '					</Id>'.$CrLf;
2247
+			$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
2248
+			$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
2249 2249
 			// A string with some information on payment - 140 max
2250
-			$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
2251
-			$XML_DEBITOR .= '				</RmtInf>' . $CrLf;
2252
-			$XML_DEBITOR .= '			</DrctDbtTxInf>' . $CrLf;
2250
+			$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
2251
+			$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
2252
+			$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
2253 2253
 			return $XML_DEBITOR;
2254 2254
 		} else {
2255 2255
 			// SEPA Payment Information of seller for Credit Transfer
2256 2256
 			$XML_CREDITOR = '';
2257
-			$XML_CREDITOR .= '			<CdtTrfTxInf>' . $CrLf;
2258
-			$XML_CREDITOR .= '				<PmtId>' . $CrLf;
2257
+			$XML_CREDITOR .= '			<CdtTrfTxInf>'.$CrLf;
2258
+			$XML_CREDITOR .= '				<PmtId>'.$CrLf;
2259 2259
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2260
-			$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
2261
-			$XML_CREDITOR .= '				</PmtId>' . $CrLf;
2260
+			$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
2261
+			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
2262 2262
 			if (!empty($this->sepa_xml_pti_in_ctti)) {
2263
-				$XML_CREDITOR .= '				<PmtTpInf>' . $CrLf;
2263
+				$XML_CREDITOR .= '				<PmtTpInf>'.$CrLf;
2264 2264
 
2265 2265
 				// Can be 'NORM' for normal or 'HIGH' for high priority level
2266 2266
 				if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) {
@@ -2268,18 +2268,18 @@  discard block
 block discarded – undo
2268 2268
 				} else {
2269 2269
 					$instrprty = 'NORM';
2270 2270
 				}
2271
-				$XML_CREDITOR .= '					<InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf;
2272
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2273
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2274
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2275
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2276
-				$XML_CREDITOR .= '						<Cd>CORE</Cd>' . $CrLf;
2277
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2278
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2271
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2272
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2273
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2274
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2275
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2276
+				$XML_CREDITOR .= '						<Cd>CORE</Cd>'.$CrLf;
2277
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2278
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2279 2279
 			}
2280
-			$XML_CREDITOR .= '				<Amt>' . $CrLf;
2280
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2281 2281
 			$XML_CREDITOR .= '				<InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf;
2282
-			$XML_CREDITOR .= '				</Amt>' . $CrLf;
2282
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
2283 2283
 			/*
2284 2284
 			 $XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
2285 2285
 			 $XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
@@ -2290,35 +2290,35 @@  discard block
 block discarded – undo
2290 2290
 			 $XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
2291 2291
 			 */
2292 2292
 			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
2293
-			$XML_CREDITOR .= '				<CdtrAgt>' . $CrLf;
2294
-			$XML_CREDITOR .= '					<FinInstnId>' . $CrLf;
2295
-			$XML_CREDITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2296
-			$XML_CREDITOR .= '					</FinInstnId>' . $CrLf;
2297
-			$XML_CREDITOR .= '				</CdtrAgt>' . $CrLf;
2298
-			$XML_CREDITOR .= '				<Cdtr>' . $CrLf;
2299
-			$XML_CREDITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2300
-			$XML_CREDITOR .= '					<PstlAdr>' . $CrLf;
2301
-			$XML_CREDITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2293
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
2294
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
2295
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2296
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
2297
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
2298
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
2299
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2300
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
2301
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2302 2302
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2303
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2303
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2304 2304
 			if (trim($addressline1)) {
2305
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2305
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2306 2306
 			}
2307 2307
 			if (trim($addressline2)) {
2308
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2308
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2309 2309
 			}
2310
-			$XML_CREDITOR .= '					</PstlAdr>' . $CrLf;
2311
-			$XML_CREDITOR .= '				</Cdtr>' . $CrLf;
2312
-			$XML_CREDITOR .= '				<CdtrAcct>' . $CrLf;
2313
-			$XML_CREDITOR .= '					<Id>' . $CrLf;
2314
-			$XML_CREDITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2315
-			$XML_CREDITOR .= '					</Id>' . $CrLf;
2316
-			$XML_CREDITOR .= '				</CdtrAcct>' . $CrLf;
2317
-			$XML_CREDITOR .= '				<RmtInf>' . $CrLf;
2310
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
2311
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
2312
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
2313
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
2314
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2315
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
2316
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
2317
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
2318 2318
 			// A string with some information on payment - 140 max
2319
-			$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
2320
-			$XML_CREDITOR .= '				</RmtInf>' . $CrLf;
2321
-			$XML_CREDITOR .= '			</CdtTrfTxInf>' . $CrLf;
2319
+			$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
2320
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
2321
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
2322 2322
 			return $XML_CREDITOR;
2323 2323
 		}
2324 2324
 	}
@@ -2350,11 +2350,11 @@  discard block
 block discarded – undo
2350 2350
 
2351 2351
 		// Raison Sociale C2
2352 2352
 
2353
-		fwrite($this->file, substr($this->raison_sociale . "                           ", 0, 24));
2353
+		fwrite($this->file, substr($this->raison_sociale."                           ", 0, 24));
2354 2354
 
2355 2355
 		// Ref of thirdparty on 7 characters
2356 2356
 
2357
-		fwrite($this->file, substr($this->reference_remise . "                           ", 0, 7));
2357
+		fwrite($this->file, substr($this->reference_remise."                           ", 0, 7));
2358 2358
 
2359 2359
 		// Zone Reservee D1-2
2360 2360
 
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 
2373 2373
 		// Numero de compte D4
2374 2374
 
2375
-		fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11));
2375
+		fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11));
2376 2376
 
2377 2377
 		// Zone Reservee E
2378 2378
 
@@ -2435,15 +2435,15 @@  discard block
 block discarded – undo
2435 2435
 			$this->emetteur_iban = $account->iban;
2436 2436
 			$this->emetteur_bic = $account->bic;
2437 2437
 
2438
-			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2438
+			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2439 2439
 
2440 2440
 			$this->raison_sociale = $account->proprio;
2441 2441
 		}
2442 2442
 
2443 2443
 		// Get pending payments
2444 2444
 		$sql = "SELECT rowid, ref";
2445
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb";
2446
-		$sql .= " WHERE pb.rowid = " . ((int) $this->id);
2445
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb";
2446
+		$sql .= " WHERE pb.rowid = ".((int) $this->id);
2447 2447
 
2448 2448
 		$resql = $this->db->query($sql);
2449 2449
 		if ($resql) {
@@ -2460,45 +2460,45 @@  discard block
 block discarded – undo
2460 2460
 			if ($type != 'bank-transfer') {
2461 2461
 				// SEPA Paiement Information of my company for Direct Debit
2462 2462
 				$XML_SEPA_INFO = '';
2463
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2464
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DD/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2465
-				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>' . $CrLf;
2466
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2467
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2468
-				$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2469
-				$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2470
-				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2471
-				$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2472
-				$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2473
-				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2474
-				$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2475
-				$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2476
-				$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2477
-				$XML_SEPA_INFO .= '			<ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
2478
-				$XML_SEPA_INFO .= '			<Cdtr>' . $CrLf;
2479
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2480
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2481
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2463
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2464
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2465
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
2466
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2467
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2468
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2469
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2470
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2471
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2472
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2473
+				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2474
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2475
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2476
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2477
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
2478
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
2479
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2480
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2481
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2482 2482
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2483
-				$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) => ""));
2483
+				$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) => ""));
2484 2484
 				if ($addressline1) {
2485
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2485
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2486 2486
 				}
2487 2487
 				if ($addressline2) {
2488
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2488
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2489 2489
 				}
2490
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2491
-				$XML_SEPA_INFO .= '			</Cdtr>' . $CrLf;
2492
-				$XML_SEPA_INFO .= '			<CdtrAcct>' . $CrLf;
2493
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2494
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2495
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2496
-				$XML_SEPA_INFO .= '			</CdtrAcct>' . $CrLf;
2497
-				$XML_SEPA_INFO .= '			<CdtrAgt>' . $CrLf;
2498
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2499
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2500
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2501
-				$XML_SEPA_INFO .= '			</CdtrAgt>' . $CrLf;
2490
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2491
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
2492
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
2493
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2494
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2495
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2496
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
2497
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
2498
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2499
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2500
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2501
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
2502 2502
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2503 2503
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2504 2504
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2507,64 +2507,64 @@  discard block
 block discarded – undo
2507 2507
 				 $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;
2508 2508
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2509 2509
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2510
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2511
-				$XML_SEPA_INFO .= '			<CdtrSchmeId>' . $CrLf;
2512
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2513
-				$XML_SEPA_INFO .= '					<PrvtId>' . $CrLf;
2514
-				$XML_SEPA_INFO .= '						<Othr>' . $CrLf;
2515
-				$XML_SEPA_INFO .= '							<Id>' . $this->emetteur_ics . '</Id>' . $CrLf;
2516
-				$XML_SEPA_INFO .= '							<SchmeNm>' . $CrLf;
2517
-				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>' . $CrLf;
2518
-				$XML_SEPA_INFO .= '							</SchmeNm>' . $CrLf;
2519
-				$XML_SEPA_INFO .= '						</Othr>' . $CrLf;
2520
-				$XML_SEPA_INFO .= '					</PrvtId>' . $CrLf;
2521
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2522
-				$XML_SEPA_INFO .= '			</CdtrSchmeId>' . $CrLf;
2510
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2511
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2512
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2513
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
2514
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
2515
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
2516
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
2517
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
2518
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
2519
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
2520
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
2521
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2522
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
2523 2523
 			} else {
2524 2524
 				// SEPA Paiement Information of my company for Credit Transfer
2525 2525
 				$XML_SEPA_INFO = '';
2526
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2527
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('TRF/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2528
-				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>' . $CrLf;
2526
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2527
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('TRF/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2528
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
2529 2529
 				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
2530
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2531
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2530
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2531
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2532 2532
 				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.
2533
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2534
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2535
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2536
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2537
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2538
-					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2539
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2540
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2541
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2533
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2534
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2535
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2536
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2537
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2538
+					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2539
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2540
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2541
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2542 2542
 				}
2543
-				$XML_SEPA_INFO .= '			<ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf;
2544
-				$XML_SEPA_INFO .= '			<Dbtr>' . $CrLf;
2545
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2546
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2547
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2543
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2544
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
2545
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2546
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2547
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2548 2548
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2549
-				$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) => ""));
2549
+				$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) => ""));
2550 2550
 				if ($addressline1) {
2551
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2551
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2552 2552
 				}
2553 2553
 				if ($addressline2) {
2554
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2554
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2555 2555
 				}
2556
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2557
-				$XML_SEPA_INFO .= '			</Dbtr>' . $CrLf;
2558
-				$XML_SEPA_INFO .= '			<DbtrAcct>' . $CrLf;
2559
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2560
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2561
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2562
-				$XML_SEPA_INFO .= '			</DbtrAcct>' . $CrLf;
2563
-				$XML_SEPA_INFO .= '			<DbtrAgt>' . $CrLf;
2564
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2565
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2566
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2567
-				$XML_SEPA_INFO .= '			</DbtrAgt>' . $CrLf;
2556
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2557
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
2558
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
2559
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2560
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2561
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2562
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
2563
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
2564
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2565
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2566
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2567
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
2568 2568
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2569 2569
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2570 2570
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
 				 $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;
2574 2574
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2575 2575
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2576
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2576
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2577 2577
 				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2578 2578
 				 $XML_SEPA_INFO .= '				<Id>'.$CrLf;
2579 2579
 				 $XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
@@ -2588,7 +2588,7 @@  discard block
 block discarded – undo
2588 2588
 				 $XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
2589 2589
 			}
2590 2590
 		} else {
2591
-			fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf);
2591
+			fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
2592 2592
 			$XML_SEPA_INFO = '';
2593 2593
 		}
2594 2594
 		return $XML_SEPA_INFO;
@@ -2640,7 +2640,7 @@  discard block
 block discarded – undo
2640 2640
 
2641 2641
 		$montant = ($total * 100);
2642 2642
 
2643
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2643
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2644 2644
 
2645 2645
 		// Zone Reservee F
2646 2646
 
@@ -2797,18 +2797,18 @@  discard block
 block discarded – undo
2797 2797
 		$return .= img_picto('', $this->picto);
2798 2798
 		$return .= '</span>';
2799 2799
 		$return .= '<div class="info-box-content">';
2800
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>';
2800
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
2801 2801
 		if ($selected >= 0) {
2802
-			$return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
2802
+			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2803 2803
 		}
2804 2804
 		if (property_exists($this, 'date_echeance')) {
2805
-			$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>';
2805
+			$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>';
2806 2806
 		}
2807 2807
 		if (property_exists($this, 'total')) {
2808
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>';
2808
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
2809 2809
 		}
2810 2810
 		if (method_exists($this, 'LibStatut')) {
2811
-			$return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
2811
+			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2812 2812
 		}
2813 2813
 		$return .= '</div>';
2814 2814
 		$return .= '</div>';
@@ -2829,9 +2829,9 @@  discard block
 block discarded – undo
2829 2829
 			return 0;
2830 2830
 		}
2831 2831
 		if ($id) {
2832
-			$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
2833
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $id);
2834
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2832
+			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2833
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2834
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2835 2835
 			$sql .= " AND fk_user IS NOT NULL";
2836 2836
 
2837 2837
 			$num = 0;
Please login to merge, or discard this patch.
htdocs/compta/facture/class/facture.class.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			$this->mode_reglement_id = 0;
504 504
 		}
505 505
 		$this->status = self::STATUS_DRAFT;
506
-		$this->statut = self::STATUS_DRAFT;	// deprecated
506
+		$this->statut = self::STATUS_DRAFT; // deprecated
507 507
 
508 508
 		if (!empty($this->multicurrency_code)) {
509 509
 			// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 			if (!empty($_facrec->frequency)) {  // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarily when there is no recurrence.
575 575
 				$this->socid = $_facrec->socid;
576 576
 			}
577
-			$this->entity            = $_facrec->entity; // Invoice created in same entity than template
577
+			$this->entity = $_facrec->entity; // Invoice created in same entity than template
578 578
 
579 579
 			// Fields coming from GUI.
580 580
 			// @TODO Value of template should be used as default value on the form on the GUI, and we should here always use the value from GUI
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 				$this->mode_reglement_id = 0;
614 614
 			}
615 615
 			$this->status = self::STATUS_DRAFT;
616
-			$this->statut = self::STATUS_DRAFT;	// deprecated
616
+			$this->statut = self::STATUS_DRAFT; // deprecated
617 617
 
618 618
 			$this->linked_objects = $_facrec->linkedObjectsIds;
619 619
 			// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 						// Complete vat rate with code
861 861
 						$vatrate = $newinvoiceline->tva_tx;
862
-						if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
862
+						if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) {
863 863
 							$vatrate .= ' ('.$newinvoiceline->vat_src_code.')';
864 864
 						}
865 865
 
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 						($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) ? $previousdaynextdatewhen : '',
1080 1080
 						0,
1081 1081
 						$tva_npr,
1082
-						0,  // fk_remise_except
1082
+						0, // fk_remise_except
1083 1083
 						'HT',
1084 1084
 						0,
1085 1085
 						$_facrec->lines[$i]->product_type,
@@ -1092,8 +1092,8 @@  discard block
 block discarded – undo
1092 1092
 						$buyprice,
1093 1093
 						$_facrec->lines[$i]->label,
1094 1094
 						empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options,
1095
-						100,	// situation percent is undefined on recurring invoice lines
1096
-						0,  // fk_prev_id
1095
+						100, // situation percent is undefined on recurring invoice lines
1096
+						0, // fk_prev_id
1097 1097
 						$_facrec->lines[$i]->fk_unit,
1098 1098
 						$_facrec->lines[$i]->multicurrency_subprice,
1099 1099
 						$_facrec->lines[$i]->ref_ext,
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 
1186 1186
 		$facture->fk_facture_source = $this->fk_facture_source;
1187 1187
 		$facture->type 			    = $this->type;
1188
-		$facture->subtype 			= $this->subtype;
1188
+		$facture->subtype = $this->subtype;
1189 1189
 		$facture->socid 		    = $this->socid;
1190 1190
 		$facture->date              = $this->date;
1191 1191
 		$facture->date_pointoftax   = $this->date_pointoftax;
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
 		$facture->origin            = $this->origin;
1204 1204
 		$facture->origin_id         = $this->origin_id;
1205
-		$facture->fk_account         = $this->fk_account;
1205
+		$facture->fk_account = $this->fk_account;
1206 1206
 
1207 1207
 		$facture->lines = $this->lines; // Array of lines of invoice
1208 1208
 		$facture->situation_counter = $this->situation_counter;
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 	{
1677 1677
 		global $conf, $langs, $hookmanager, $action;
1678 1678
 
1679
-		if (! in_array($origin->element, array('propal', 'commande'))) {
1679
+		if (!in_array($origin->element, array('propal', 'commande'))) {
1680 1680
 			$origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder';
1681 1681
 			return null;
1682 1682
 		}
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
 			return null;
1687 1687
 		}
1688 1688
 
1689
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
1689
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
1690 1690
 
1691 1691
 		if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + getDolGlobalInt('INVOICE_MAX_FUTURE_DELAY'))) {
1692 1692
 			$origin->error = 'ErrorDateIsInFuture';
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 		$deposit->pos_source = $origin->pos_source;
1731 1731
 		$deposit->model_pdf = 'crabe';
1732 1732
 
1733
-		$modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type;
1733
+		$modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type;
1734 1734
 
1735 1735
 		if (getDolGlobalString($modelByTypeConfName)) {
1736 1736
 			$deposit->model_pdf = getDolGlobalString($modelByTypeConfName);
@@ -1790,10 +1790,10 @@  discard block
 block discarded – undo
1790 1790
 					$descriptions[$key] = '';
1791 1791
 				}
1792 1792
 				$TTotalByTva[$key] += $line->total_ttc;
1793
-				$descriptions[$key] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : '');
1794
-				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label . ' - ' : '');
1795
-				$descriptions[$key] .= $langs->trans('Qty') . ' : ' . $line->qty;
1796
-				$descriptions[$key] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>';
1793
+				$descriptions[$key] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : '');
1794
+				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label.' - ' : '');
1795
+				$descriptions[$key] .= $langs->trans('Qty').' : '.$line->qty;
1796
+				$descriptions[$key] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>';
1797 1797
 			}
1798 1798
 
1799 1799
 			foreach ($TTotalByTva as $tva => &$total) {
@@ -1817,10 +1817,10 @@  discard block
 block discarded – undo
1817 1817
 				$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
1818 1818
 				$tva_tx = $lines[$i]->tva_tx;
1819 1819
 				$amountdeposit[$tva_tx] += ((float) $lines[$i]->total_ht * (float) $origin->deposit_percent) / 100;
1820
-				$descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : '');
1821
-				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : '');
1822
-				$descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty;
1823
-				$descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>';
1820
+				$descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : '');
1821
+				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : '');
1822
+				$descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty;
1823
+				$descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>';
1824 1824
 			}
1825 1825
 
1826 1826
 			if ($totalamount == 0) {
@@ -1835,11 +1835,11 @@  discard block
 block discarded – undo
1835 1835
 				continue;
1836 1836
 			}
1837 1837
 
1838
-			$descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref;
1838
+			$descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref;
1839 1839
 
1840 1840
 			// Hidden conf
1841 1841
 			if (getDolGlobalString('INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION') && !empty($descriptions[$tva])) {
1842
-				$descline .= '<ul>' . $descriptions[$tva] . '</ul>';
1842
+				$descline .= '<ul>'.$descriptions[$tva].'</ul>';
1843 1843
 			}
1844 1844
 
1845 1845
 			$addlineResult = $deposit->addline(
@@ -2214,9 +2214,9 @@  discard block
 block discarded – undo
2214 2214
 				$this->id = $obj->rowid;
2215 2215
 				$this->entity = $obj->entity;
2216 2216
 
2217
-				$this->ref					= $obj->ref;
2218
-				$this->ref_client			= $obj->ref_client;
2219
-				$this->ref_customer			= $obj->ref_client;
2217
+				$this->ref = $obj->ref;
2218
+				$this->ref_client = $obj->ref_client;
2219
+				$this->ref_customer = $obj->ref_client;
2220 2220
 				$this->ref_ext				= $obj->ref_ext;
2221 2221
 				$this->type					= $obj->type;
2222 2222
 				$this->subtype				= $obj->subtype;
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 				$this->fk_project = $obj->fk_project;
2243 2243
 				$this->project = null; // Clear if another value was already set by fetch_projet
2244 2244
 
2245
-				$this->statut = $obj->status;	// deprecated
2245
+				$this->statut = $obj->status; // deprecated
2246 2246
 				$this->status = $obj->status;
2247 2247
 
2248 2248
 				$this->date_lim_reglement = $this->db->jdate($obj->dlr);
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
 				$this->fk_fac_rec_source	= $obj->fk_fac_rec_source;
2259 2259
 				$this->note = $obj->note_private; // deprecated
2260 2260
 				$this->note_private = $obj->note_private;
2261
-				$this->note_public			= $obj->note_public;
2261
+				$this->note_public = $obj->note_public;
2262 2262
 				$this->user_creation_id     = $obj->fk_user_author;
2263 2263
 				$this->user_validation_id   = $obj->fk_user_valid;
2264 2264
 				$this->user_modification_id = $obj->fk_user_modif;
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 				$line->ref              = $objp->product_ref; // Ref product
2373 2373
 				$line->product_ref      = $objp->product_ref; // Ref product
2374 2374
 				$line->libelle          = $objp->product_label; // deprecated
2375
-				$line->product_label 	= $objp->product_label; // Label product
2375
+				$line->product_label = $objp->product_label; // Label product
2376 2376
 				$line->product_barcode  = $objp->product_barcode; // Barcode number product
2377 2377
 				$line->product_desc     = $objp->product_desc; // Description product
2378 2378
 				$line->fk_product_type  = $objp->fk_product_type; // Type of product
@@ -3246,10 +3246,10 @@  discard block
 block discarded – undo
3246 3246
 		if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'creer'))
3247 3247
 		|| (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'invoice_advance', 'validate'))) {
3248 3248
 			$this->error = 'Permission denied';
3249
-			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3249
+			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3250 3250
 			return -1;
3251 3251
 		}
3252
-		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) &&	// empty should not happened, but when it occurs, the test save life
3252
+		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
3253 3253
 			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')						// If option enabled, we force invoice date
3254 3254
 		) {
3255 3255
 			$this->date = dol_now();
@@ -3418,7 +3418,7 @@  discard block
 block discarded – undo
3418 3418
 					for ($i = 0; $i < $cpt; $i++) {
3419 3419
 						if ($this->lines[$i]->fk_product > 0) {
3420 3420
 							$mouvP = new MouvementStock($this->db);
3421
-							$mouvP->origin = &$this;	// deprecated
3421
+							$mouvP->origin = &$this; // deprecated
3422 3422
 							$mouvP->setOrigin($this->element, $this->id);
3423 3423
 
3424 3424
 							// We decrease stock for product
@@ -3612,7 +3612,7 @@  discard block
 block discarded – undo
3612 3612
 			// Set new ref and define current status
3613 3613
 			if (!$error) {
3614 3614
 				$this->ref = $num;
3615
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
3615
+				$this->statut = self::STATUS_VALIDATED; // deprecated
3616 3616
 				$this->status = self::STATUS_VALIDATED;
3617 3617
 				$this->date_validation = $now;
3618 3618
 				$i = 0;
@@ -3767,7 +3767,7 @@  discard block
 block discarded – undo
3767 3767
 
3768 3768
 			if ($error == 0) {
3769 3769
 				$old_statut = $this->status;
3770
-				$this->statut = self::STATUS_DRAFT;	// deprecated
3770
+				$this->statut = self::STATUS_DRAFT; // deprecated
3771 3771
 				$this->status = self::STATUS_DRAFT;
3772 3772
 
3773 3773
 				// Call trigger
@@ -4671,7 +4671,7 @@  discard block
 block discarded – undo
4671 4671
 		}
4672 4672
 
4673 4673
 		if (!empty($addon)) {
4674
-			dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4674
+			dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4675 4675
 
4676 4676
 			$mybool = false;
4677 4677
 
@@ -5750,14 +5750,14 @@  discard block
 block discarded – undo
5750 5750
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5751 5751
 			$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
5752 5752
 		}
5753
-		$sql .= " WHERE f.paye = 0";	// Only unpaid
5754
-		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;	// Only validated status
5753
+		$sql .= " WHERE f.paye = 0"; // Only unpaid
5754
+		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status
5755 5755
 		if ($datetouse == 'invoicedate') {
5756 5756
 			$sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";
5757 5757
 		} else {
5758 5758
 			$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
5759 5759
 		}
5760
-		$sql .= " AND f.entity IN (".getEntity('facture', 0).")";	// One batch process only one company (no sharing)
5760
+		$sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing)
5761 5761
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5762 5762
 			$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
5763 5763
 		}
@@ -5975,7 +5975,7 @@  discard block
 block discarded – undo
5975 5975
 								$actioncomm->create($user);
5976 5976
 							}
5977 5977
 
5978
-							$this->db->commit();	// We always commit
5978
+							$this->db->commit(); // We always commit
5979 5979
 						}
5980 5980
 
5981 5981
 						if ($errormesg) {
@@ -6017,7 +6017,7 @@  discard block
 block discarded – undo
6017 6017
 		// get date of last validated invoices of same type
6018 6018
 		$sql  = "SELECT datef";
6019 6019
 		$sql .= " FROM ".MAIN_DB_PREFIX."facture";
6020
-		$sql .= " WHERE type = " . (int) $this->type ;
6020
+		$sql .= " WHERE type = ".(int) $this->type;
6021 6021
 		$sql .= " AND date_valid IS NOT NULL";
6022 6022
 		$sql .= " AND entity IN (".getEntity('invoice').")";
6023 6023
 		$sql .= " ORDER BY datef DESC LIMIT 1";
Please login to merge, or discard this patch.
htdocs/compta/facture/class/factureligne.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			$objp = $this->db->fetch_object($result);
221 221
 
222 222
 			if (!$objp) {
223
-				$this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql;
223
+				$this->error = 'InvoiceLine with id '.$rowid.' not found sql='.$sql;
224 224
 				return 0;
225 225
 			}
226 226
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			$this->total_localtax1		= $objp->total_localtax1;
252 252
 			$this->total_localtax2		= $objp->total_localtax2;
253 253
 			$this->total_ttc			= $objp->total_ttc;
254
-			$this->fk_code_ventilation  = $objp->fk_code_ventilation;
254
+			$this->fk_code_ventilation = $objp->fk_code_ventilation;
255 255
 			$this->rang					= $objp->rang;
256 256
 			$this->fk_fournprice = $objp->fk_fournprice;
257 257
 			$marginInfos				= getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 		$sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
646 646
 		$sql .= ", product_type=".$this->product_type;
647 647
 		$sql .= ", info_bits='".$this->db->escape($this->info_bits)."'";
648
-		$sql .= ", special_code=" . (int) $this->special_code;
648
+		$sql .= ", special_code=".(int) $this->special_code;
649 649
 		if (empty($this->skip_update_total)) {
650 650
 			$sql .= ", total_ht=".price2num($this->total_ht);
651 651
 			$sql .= ", total_tva=".price2num($this->total_tva);
Please login to merge, or discard this patch.
htdocs/ticket/card.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -165,31 +165,31 @@  discard block
 block discarded – undo
165 165
 		$search_agenda_label = '';
166 166
 	}
167 167
 
168
-	$backurlforlist = DOL_URL_ROOT . '/ticket/list.php';
168
+	$backurlforlist = DOL_URL_ROOT.'/ticket/list.php';
169 169
 
170 170
 	if (empty($backtopage) || ($cancel && empty($id))) {
171 171
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
172 172
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
173 173
 				$backtopage = $backurlforlist;
174 174
 			} else {
175
-				$backtopage = DOL_URL_ROOT . '/ticket/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__');
175
+				$backtopage = DOL_URL_ROOT.'/ticket/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
176 176
 			}
177 177
 		}
178 178
 	}
179 179
 
180 180
 	if ($cancel) {
181 181
 		if (!empty($backtopageforcancel)) {
182
-			header("Location: " . $backtopageforcancel);
182
+			header("Location: ".$backtopageforcancel);
183 183
 			exit;
184 184
 		} elseif (!empty($backtopage)) {
185
-			header("Location: " . $backtopage);
185
+			header("Location: ".$backtopage);
186 186
 			exit;
187 187
 		}
188 188
 		$action = 'view';
189 189
 	}
190 190
 
191 191
 	if (($action == 'add' || ($action == 'update' && $object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) {
192
-		$ifErrorAction = ($action == 'add' ? 'create' : 'edit');	// Test on permission not required here
192
+		$ifErrorAction = ($action == 'add' ? 'create' : 'edit'); // Test on permission not required here
193 193
 		if ($action == 'add') {		// Test on permission already done
194 194
 			$object->track_id = null;
195 195
 		}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 				if (!$error) {
324 324
 					// File transfer
325
-					$object->copyFilesForTicket('');        // trackid is forced to '' because files were uploaded when no id for ticket exists yet and trackid was ''
325
+					$object->copyFilesForTicket(''); // trackid is forced to '' because files were uploaded when no id for ticket exists yet and trackid was ''
326 326
 				}
327 327
 			}
328 328
 			if (!$error) {
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
 					if (empty($id)) {
333 333
 						$url = $backtopage;
334 334
 					} else {
335
-						$url = 'card.php?track_id=' . urlencode($object->track_id);
335
+						$url = 'card.php?track_id='.urlencode($object->track_id);
336 336
 					}
337 337
 				} else {
338
-					$url = 'card.php?track_id=' . urlencode($object->track_id);
338
+					$url = 'card.php?track_id='.urlencode($object->track_id);
339 339
 				}
340 340
 
341
-				header("Location: " . $url);
341
+				header("Location: ".$url);
342 342
 				exit;
343 343
 			} else {
344 344
 				$db->rollback();
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 		if ($object->markAsRead($user) > 0) {
355 355
 			setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
356 356
 
357
-			header("Location: card.php?track_id=" . $object->track_id);
357
+			header("Location: card.php?track_id=".$object->track_id);
358 358
 			exit;
359 359
 		} else {
360 360
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 			$object->fetch_user($usertoassign);
411 411
 
412 412
 			setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
413
-			header("Location: card.php?track_id=" . $object->track_id);
413
+			header("Location: card.php?track_id=".$object->track_id);
414 414
 			exit;
415 415
 		} else {
416 416
 			array_push($object->errors, $object->error);
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 			if (!empty($backtopage)) {
428 428
 				$url = $backtopage;
429 429
 			} else {
430
-				$url = 'card.php?track_id=' . urlencode($object->track_id);
430
+				$url = 'card.php?track_id='.urlencode($object->track_id);
431 431
 			}
432 432
 
433
-			header("Location: " . $url);
433
+			header("Location: ".$url);
434 434
 			exit;
435 435
 		} else {
436 436
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 		if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) {
445 445
 			setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
446 446
 
447
-			$url = 'card.php?track_id=' . GETPOST('track_id', 'alpha');
448
-			header("Location: " . $url);
447
+			$url = 'card.php?track_id='.GETPOST('track_id', 'alpha');
448
+			header("Location: ".$url);
449 449
 			exit;
450 450
 		} else {
451 451
 			$action = '';
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
 
461 461
 			$object->close($user);
462 462
 
463
-			setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>', null, 'mesgs');
463
+			setEventMessages('<div class="confirm">'.$langs->trans('TicketMarkedAsClosed').'</div>', null, 'mesgs');
464 464
 
465
-			$url = 'card.php?track_id=' . GETPOST('track_id', 'alpha');
466
-			header("Location: " . $url);
465
+			$url = 'card.php?track_id='.GETPOST('track_id', 'alpha');
466
+			header("Location: ".$url);
467 467
 			exit;
468 468
 		} else {
469 469
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
 	if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $permissiontodelete) {
475 475
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
476 476
 			if ($object->delete($user) > 0) {
477
-				setEventMessages('<div class="confirm">' . $langs->trans('TicketDeletedSuccess') . '</div>', null, 'mesgs');
478
-				header("Location: " . DOL_URL_ROOT . "/ticket/list.php");
477
+				setEventMessages('<div class="confirm">'.$langs->trans('TicketDeletedSuccess').'</div>', null, 'mesgs');
478
+				header("Location: ".DOL_URL_ROOT."/ticket/list.php");
479 479
 				exit;
480 480
 			} else {
481 481
 				$langs->load("errors");
482
-				$mesg = '<div class="error">' . $langs->trans($object->error) . '</div>';
482
+				$mesg = '<div class="error">'.$langs->trans($object->error).'</div>';
483 483
 				$action = '';
484 484
 			}
485 485
 		}
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 	if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
490 490
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
491 491
 			$result = $object->setCustomer(GETPOSTINT('editcustomer'));
492
-			$url = $_SERVER["PHP_SELF"] . '?track_id=' . GETPOST('track_id', 'alpha');
493
-			header("Location: " . $url);
492
+			$url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
493
+			header("Location: ".$url);
494 494
 			exit();
495 495
 		}
496 496
 	}
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
501 501
 			$result = $object->setProgression(GETPOST('progress', 'alpha'));
502 502
 
503
-			$url = 'card.php?track_id=' . $object->track_id;
504
-			header("Location: " . $url);
503
+			$url = 'card.php?track_id='.$object->track_id;
504
+			header("Location: ".$url);
505 505
 			exit();
506 506
 		}
507 507
 	}
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
512 512
 			$result = $object->setCategories(GETPOST('categories', 'array'));
513 513
 
514
-			$url = 'card.php?track_id=' . $object->track_id;
515
-			header("Location: " . $url);
514
+			$url = 'card.php?track_id='.$object->track_id;
515
+			header("Location: ".$url);
516 516
 			exit();
517 517
 		}
518 518
 	}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 				}
537 537
 			}
538 538
 
539
-			header("Location: " . $_SERVER['PHP_SELF'] . "?track_id=" . $object->track_id);
539
+			header("Location: ".$_SERVER['PHP_SELF']."?track_id=".$object->track_id);
540 540
 			exit;
541 541
 		}
542 542
 	}
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 					$res = $object->setStatut(Ticket::STATUS_NOT_READ);
552 552
 				}
553 553
 				if ($res) {
554
-					$url = 'card.php?track_id=' . $object->track_id;
555
-					header("Location: " . $url);
554
+					$url = 'card.php?track_id='.$object->track_id;
555
+					header("Location: ".$url);
556 556
 					exit();
557 557
 				} else {
558 558
 					$error++;
@@ -564,16 +564,16 @@  discard block
 block discarded – undo
564 564
 		// Categorisation dans projet
565 565
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
566 566
 			$object->setProject($projectid);
567
-			$url = 'card.php?track_id=' . $object->track_id;
568
-			header("Location: " . $url);
567
+			$url = 'card.php?track_id='.$object->track_id;
568
+			header("Location: ".$url);
569 569
 			exit();
570 570
 		}
571 571
 	} elseif ($action == 'setcontract' && $permissiontoadd) {
572 572
 		// Categorisation dans contrat
573 573
 		if ($object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')) >= 0) {
574 574
 			$object->setContract(GETPOSTINT('contractid'));
575
-			$url = 'card.php?track_id=' . $object->track_id;
576
-			header("Location: " . $url);
575
+			$url = 'card.php?track_id='.$object->track_id;
576
+			header("Location: ".$url);
577 577
 			exit();
578 578
 		}
579 579
 	} elseif ($action == "set_message" && $user->hasRight('ticket', 'manage')) {
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
 			//$old_status = $object->status;
605 605
 			$res = $object->setStatut($new_status);
606 606
 			if ($res) {
607
-				$url = 'card.php?track_id=' . $object->track_id;
608
-				header("Location: " . $url);
607
+				$url = 'card.php?track_id='.$object->track_id;
608
+				header("Location: ".$url);
609 609
 				exit();
610 610
 			} else {
611 611
 				$error++;
@@ -658,17 +658,17 @@  discard block
 block discarded – undo
658 658
 
659 659
 
660 660
 	$permissiondellink = $user->hasRight('ticket', 'write');
661
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
661
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
662 662
 
663 663
 	// Actions to build doc
664
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
664
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
665 665
 
666 666
 	// Actions to send emails
667 667
 	$triggersendname = 'TICKET_SENTBYMAIL';
668 668
 	$paramname = 'id';
669 669
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to add
670
-	$trackid = 'tic' . $object->id;
671
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
670
+	$trackid = 'tic'.$object->id;
671
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
672 672
 
673 673
 	// Set $action to correct value for the case we used presend action to add a message
674 674
 	if (GETPOSTISSET('actionbis') && $action == 'presend') {	// Test on permission not required here
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 
705 705
 	print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket');
706 706
 
707
-	$formticket->trackid = '';		// TODO Use a unique key 'tic' to avoid conflict in upload file feature
707
+	$formticket->trackid = ''; // TODO Use a unique key 'tic' to avoid conflict in upload file feature
708 708
 	$formticket->withfromsocid = $socid ? $socid : $user->socid;
709 709
 	$formticket->withfromcontactid = $contactid ? $contactid : '';
710 710
 	$formticket->withtitletopic = 1;
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 
738 738
 	print dol_get_fiche_head($head, 'tabTicket', $langs->trans('Ticket'), -1, 'ticket');
739 739
 
740
-	$formticket->trackid = $object->track_id;        // TODO Use a unique key 'tic' to avoid conflict in upload file feature
740
+	$formticket->trackid = $object->track_id; // TODO Use a unique key 'tic' to avoid conflict in upload file feature
741 741
 	$formticket->withfromsocid = $object->socid;
742 742
 	$formticket->withtitletopic = 1;
743 743
 	//  $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION') ? 1 : 0));
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 				'-3' => $langs->trans('TicketNotNotifyTiersAtClose')
772 772
 			);
773 773
 			foreach ($thirdparty_contacts as $thirdparty_contact) {
774
-				$contacts_select[$thirdparty_contact['id']] = $thirdparty_contact['civility'] . ' ' . $thirdparty_contact['lastname'] . ' ' . $thirdparty_contact['firstname'];
774
+				$contacts_select[$thirdparty_contact['id']] = $thirdparty_contact['civility'].' '.$thirdparty_contact['lastname'].' '.$thirdparty_contact['firstname'];
775 775
 			}
776 776
 
777 777
 			// Default select all or no contact
@@ -1002,8 +1002,8 @@  discard block
 block discarded – undo
1002 1002
 						$morehtmlref .= $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contract, 'contratid', 0, 1, 1, 1);
1003 1003
 					} else {
1004 1004
 						$morehtmlref .= '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_contrat&token='.newToken().'&id='.$object->id.'">';
1005
-						$morehtmlref .=  img_edit($langs->trans('SetContract'));
1006
-						$morehtmlref .=  '</a>';
1005
+						$morehtmlref .= img_edit($langs->trans('SetContract'));
1006
+						$morehtmlref .= '</a>';
1007 1007
 					}
1008 1008
 				} else {
1009 1009
 					if (!empty($object->fk_contract)) {
@@ -1453,10 +1453,10 @@  discard block
 block discarded – undo
1453 1453
 				// Link to create an intervention
1454 1454
 				// socid is needed otherwise fichinter ask it and forgot origin after form submit :\
1455 1455
 				if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) {
1456
-					print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
1456
+					print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
1457 1457
 				}
1458 1458
 				if ($object->fk_soc > 0 && isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ficheinter', 'creer')) {
1459
-					print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, '');
1459
+					print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, '');
1460 1460
 				}
1461 1461
 
1462 1462
 				// Close ticket if status is read
Please login to merge, or discard this patch.
htdocs/societe/paymentmodes.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 
139 139
 	if ($action == 'update' && $permissiontoaddupdatepaymentinformation) {
140 140
 		// Update the bank account
141
-		if (!GETPOST('label', 'alpha') || !(GETPOST('bank', 'alpha') || (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')!=0))) {
141
+		if (!GETPOST('label', 'alpha') || !(GETPOST('bank', 'alpha') || (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') != 0))) {
142 142
 			if (!GETPOST('label', 'alpha')) {
143 143
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
144 144
 			}
145
-			if (!GETPOST('bank', 'alpha') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
145
+			if (!GETPOST('bank', 'alpha') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
146 146
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors');
147 147
 			}
148 148
 			$action = 'edit';
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 				$action = 'edit';
156 156
 				$error++;
157 157
 			}
158
-			if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
158
+			if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
159 159
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
160 160
 				$action = 'edit';
161 161
 				$error++;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			// Ajout
298 298
 			$companybankaccount = new CompanyBankAccount($db);
299 299
 
300
-			$companybankaccount->socid           = $object->id;
300
+			$companybankaccount->socid = $object->id;
301 301
 
302 302
 			$companybankaccount->fetch_thirdparty();
303 303
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 					$action = 'create';
339 339
 					$error++;
340 340
 				}
341
-				if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
341
+				if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
342 342
 					setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
343 343
 					$action = 'create';
344 344
 					$error++;
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 			'use_companybankid' => GETPOST('companybankid'),
525 525
 			'force_dir_output' => $conf->societe->multidir_output[$object->entity].'/'.dol_sanitizeFileName((string) $object->id)
526 526
 		);
527
-		$_POST['lang_id'] = GETPOST('lang_idrib'.GETPOSTINT('companybankid'), 'alphanohtml');	// This is required by core/action_builddoc.inc.php
528
-		$_POST['model'] = GETPOST('modelrib'.GETPOSTINT('companybankid'), 'alphanohtml'); 		// This is required by core/action_builddoc.inc.php
527
+		$_POST['lang_id'] = GETPOST('lang_idrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php
528
+		$_POST['model'] = GETPOST('modelrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php
529 529
 	}
530 530
 
531 531
 	$id = $socid;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		}
596 596
 		if ($action == 'syncsepatostripe' && $permissiontoaddupdatepaymentinformation) {
597 597
 			// Create the bank account on current Stripe env
598
-			$companypaymentmode = new CompanyPaymentMode($db);	// Get record in llx_societe_rib
598
+			$companypaymentmode = new CompanyPaymentMode($db); // Get record in llx_societe_rib
599 599
 			$companypaymentmode->fetch($id);
600 600
 
601 601
 			if ($companypaymentmode->type != 'ban') {
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 		print '<table class="liste centpercent">'."\n";
1197 1197
 		print '<tr class="liste_titre">';
1198 1198
 		print '<td>'.$langs->trans('Label').'</td>';
1199
-		print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>';	// external system ID
1199
+		print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>'; // external system ID
1200 1200
 		print '<td>'.$langs->trans('Type').'</td>';
1201 1201
 		print '<td>'.$langs->trans('Informations').'</td>';
1202 1202
 		print '<td></td>';
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
 	// List of bank accounts
1538 1538
 	if ($permissiontoaddupdatepaymentinformation) {
1539
-		$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&amp;action=create');
1539
+		$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=create');
1540 1540
 	}
1541 1541
 
1542 1542
 	print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank');
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
 
1554 1554
 		print '<tr class="liste_titre">';
1555 1555
 		print_liste_field_titre("Label");
1556
-		print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")));		// external system ID
1556
+		print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem"))); // external system ID
1557 1557
 		print_liste_field_titre("Bank");
1558 1558
 		print_liste_field_titre("RIB");
1559 1559
 		print_liste_field_titre("IBAN");
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 				print '<td class="width200">';
1735 1735
 				$useonlinesignature = 1;
1736 1736
 				if ($useonlinesignature) {
1737
-					require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php';
1737
+					require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
1738 1738
 					print showOnlineSignatureUrl($companybankaccount->element, (string) $rib->id, $rib, 'short');
1739 1739
 				}
1740 1740
 				print '</td>';
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 	print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Label").'</td>';
1973 1973
 	print '<td><input class="minwidth300" type="text" name="label" value="'.$companybankaccount->label.'"></td></tr>';
1974 1974
 
1975
-	$required = (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0) ? "fieldrequired" : "";
1975
+	$required = (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) ? "fieldrequired" : "";
1976 1976
 	print '<tr><td class="'.$required.'">'.$langs->trans("BankName").'</td>';
1977 1977
 	print '<td><input class="minwidth200" type="text" name="bank" value="'.$companybankaccount->bank.'"></td></tr>';
1978 1978
 
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
 			$name = 'bic';
2011 2011
 			$size = 12;
2012 2012
 			$content = $bankaccount->bic;
2013
-			if ($bankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
2013
+			if ($bankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
2014 2014
 				$require = true;
2015 2015
 			}
2016 2016
 			$tooltip = $langs->trans("Example").': LIABLT2XXXX';
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
 			$name = 'bic';
2183 2183
 			$size = 12;
2184 2184
 			$content = $companybankaccount->bic;
2185
-			if ($companybankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
2185
+			if ($companybankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
2186 2186
 				$require = true;
2187 2187
 			}
2188 2188
 			$tooltip = $langs->trans("Example").': LIABLT2XXXX';
Please login to merge, or discard this patch.
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Put here all includes required by your class file
27
-include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
28
-
29
-require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
30
-require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
31
-require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
32
-
33
-require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';                   // Customer Proposal
34
-require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';                    // Sale Order
35
-require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php';               // Customer Invoice
36
-require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';                      // Contact / Address
37
-require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php';                // Shipping / Delivery
38
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php';           // Purchase Order
39
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php';            // Purchase Invoice
40
-require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php';                       // Project
41
-require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php';                  // Reception
42
-require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php';   // Recruiting
43
-require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';                      // Third-Party
44
-require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php';  // Supplier Proposal
45
-require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';                        // Ticket
27
+include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
28
+
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32
+
33
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // Customer Proposal
34
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Sale Order
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Customer Invoice
36
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Contact / Address
37
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipping / Delivery
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Purchase Order
39
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Purchase Invoice
40
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Project
41
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // Reception
42
+require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
43
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Third-Party
44
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
45
+require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; // Ticket
46 46
 //require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php';        // Expense Report
47 47
 //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php';                    // Holidays (leave request)
48 48
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
785 785
 			$flags .= '';
786 786
 		} else {
787
-			$flags .= '/' . $this->imap_encryption;
787
+			$flags .= '/'.$this->imap_encryption;
788 788
 		}
789 789
 
790 790
 		$flags .= '/novalidate-cert';
@@ -814,8 +814,8 @@  discard block
 block discarded – undo
814 814
 	{
815 815
 		if (function_exists('mb_convert_encoding')) {
816 816
 			// change spaces by entropy because mb_convert fail with spaces
817
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
818
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
817
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
818
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
819 819
 			// if mb_convert work
820 820
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
821 821
 				// change characters
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 				}
1410 1410
 				if ($fromdate > 0) {
1411 1411
 					// $search .= ($search ? ' ' : '').'SINCE '.date('j-M-Y', $fromdate - 1); // SENTSINCE not supported. Date must be X-Abc-9999 (X on 1 digit if < 10)
1412
-					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1)));	// -1 is to add a security to no forgot some email
1412
+					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1))); // -1 is to add a security to no forgot some email
1413 1413
 				}
1414 1414
 				//$search.=($search?' ':'').'SINCE 8-Apr-2022';
1415 1415
 			}
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 				}
1437 1437
 
1438 1438
 				if ($rule['type'] == 'from') {
1439
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1439
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1440 1440
 					if (count($tmprulevaluearray) >= 2) {
1441 1441
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1442 1442
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
 					}
1447 1447
 				}
1448 1448
 				if ($rule['type'] == 'to') {
1449
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1449
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1450 1450
 					if (count($tmprulevaluearray) >= 2) {
1451 1451
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1452 1452
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
 					$tmpsourcedir = $this->getEncodedUtf7($sourcedir);
1575 1575
 				}
1576 1576
 
1577
-				$f = $client->getFolders(false, $tmpsourcedir);	// Note the search of directory do a search on sourcedir*
1577
+				$f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir*
1578 1578
 				if ($f) {
1579 1579
 					$folder = $f[0];
1580 1580
 					if ($folder instanceof Webklex\PHPIMAP\Folder) {
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 			}
1635 1635
 		}
1636 1636
 
1637
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1637
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1638 1638
 
1639 1639
 		// Loop on each email found
1640 1640
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) {
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 				// GET header and overview datas
1667 1667
 				if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
1668 1668
 					'@phan-var-force Webklex\PHPIMAP\Message $imapemail';
1669
-					$header = $imapemail->getHeader()->raw;  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1669
+					$header = $imapemail->getHeader()->raw; // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1670 1670
 					$overview = $imapemail->getAttributes();
1671 1671
 				} else {
1672 1672
 					$header = imap_fetchheader($connection, $imapemail, FT_UID);
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
 						$attachments = [];
1894 1894
 					}
1895 1895
 				} else {
1896
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1896
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1897 1897
 				}
1898 1898
 				'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments';
1899 1899
 
@@ -1990,10 +1990,10 @@  discard block
 block discarded – undo
1990 1990
 					$sendtocc = empty($overview['cc']) ? '' : $overview['cc'];
1991 1991
 					$sendtobcc = empty($overview['bcc']) ? '' : $overview['bcc'];
1992 1992
 
1993
-					$tmpdate = $overview['date']->toDate();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1994
-					$tmptimezone = $tmpdate->getTimezone()->getName();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1993
+					$tmpdate = $overview['date']->toDate(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1994
+					$tmptimezone = $tmpdate->getTimezone()->getName(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1995 1995
 
1996
-					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt');    // if $overview['timezone'] is "+00:00"
1996
+					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00"
1997 1997
 					if (preg_match('/^([+\-])(\d\d):(\d\d)/', $tmptimezone, $reg)) {
1998 1998
 						if ($reg[1] == '+' && ($reg[2] != '00' || $reg[3] != '00')) {
1999 1999
 							$dateemail -= (3600 * (int) $reg[2]);
@@ -2007,7 +2007,7 @@  discard block
 block discarded – undo
2007 2007
 					$subject = $overview['subject'];
2008 2008
 				} else {
2009 2009
 					$fromstring = $overview[0]->from;
2010
-					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")) ;
2010
+					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : ""));
2011 2011
 
2012 2012
 					$sender = !empty($overview[0]->sender) ? $overview[0]->sender : '';
2013 2013
 					$to = $overview[0]->to;
@@ -2078,17 +2078,17 @@  discard block
 block discarded – undo
2078 2078
 				foreach ($arrayofreferences as $reference) {
2079 2079
 					//print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n";
2080 2080
 					if (!empty($trackidfoundintorecipienttype)) {
2081
-						$resultsearchtrackid = -1;		// trackid found
2081
+						$resultsearchtrackid = -1; // trackid found
2082 2082
 						$reg[1] = $trackidfoundintorecipienttype;
2083 2083
 						$reg[2] = $trackidfoundintorecipientid;
2084 2084
 					} elseif (!empty($trackidfoundintomsgidtype)) {
2085
-						$resultsearchtrackid = -1;		// trackid found
2085
+						$resultsearchtrackid = -1; // trackid found
2086 2086
 						$reg[1] = $trackidfoundintomsgidtype;
2087 2087
 						$reg[2] = $trackidfoundintomsgidid;
2088 2088
 					} else {
2089
-						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg);	// trackid found or not
2089
+						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not
2090 2090
 						if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) {
2091
-							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg);	// trackid found
2091
+							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found
2092 2092
 						}
2093 2093
 					}
2094 2094
 
@@ -2255,7 +2255,7 @@  discard block
 block discarded – undo
2255 2255
 									}
2256 2256
 								}
2257 2257
 								if ($changeonticket_references) {
2258
-									$objectemail->update($user, 1);		// We complete the references field, that is a field for technical tracking purpose, not a user field, so no need to execute triggers
2258
+									$objectemail->update($user, 1); // We complete the references field, that is a field for technical tracking purpose, not a user field, so no need to execute triggers
2259 2259
 								}
2260 2260
 							}
2261 2261
 						}
@@ -2384,7 +2384,7 @@  discard block
 block discarded – undo
2384 2384
 
2385 2385
 						// Make Operation
2386 2386
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2387
-						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type);	// If a Dolibarr tracker id is found, we should now the id of object
2387
+						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object
2388 2388
 
2389 2389
 						// Try to guess if this is an email in or out.
2390 2390
 						$actioncode = 'EMAIL_IN';
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
 									$operationslog .= '<br>Ticket not found using trackid='.$trackid.' or msgid='.$msgid;
2440 2440
 									$ticketalreadyexists = 0;
2441 2441
 								} else {
2442
-									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid;	// We change the operation type to do
2442
+									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid; // We change the operation type to do
2443 2443
 									$ticketalreadyexists = 1;
2444 2444
 									$operation['type'] = 'recordevent';
2445 2445
 								}
@@ -2680,11 +2680,11 @@  discard block
 block discarded – undo
2680 2680
 									$result = $contactstatic->fetch(0, null, '', $from);
2681 2681
 									if ($result < 0) {
2682 2682
 										$errorforactions++;
2683
-										$this->error = 'Error when getting contact with email ' . $from;
2683
+										$this->error = 'Error when getting contact with email '.$from;
2684 2684
 										$this->errors[] = $this->error;
2685 2685
 										break;
2686 2686
 									} elseif ($result == 0) {
2687
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2687
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2688 2688
 										$contactstatic = new Contact($this->db);
2689 2689
 
2690 2690
 										// Create contact
@@ -2699,28 +2699,28 @@  discard block
 block discarded – undo
2699 2699
 										} else {
2700 2700
 											// Search country by name or code
2701 2701
 											if (!empty($contactstatic->country)) {
2702
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2702
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2703 2703
 												$result = getCountry('', '3', $this->db, null, 1, $contactstatic->country);
2704 2704
 												if ($result == 'NotDefined') {
2705 2705
 													$errorforactions++;
2706
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2706
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2707 2707
 												} elseif (!($result > 0)) {
2708 2708
 													$errorforactions++;
2709
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2709
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2710 2710
 													$this->errors[] = $this->db->lasterror();
2711 2711
 												} else {
2712 2712
 													$contactstatic->country_id = $result;
2713 2713
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2714 2714
 												}
2715 2715
 											} elseif (!empty($contactstatic->country_code)) {
2716
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2716
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2717 2717
 												$result = getCountry($contactstatic->country_code, '3', $this->db);
2718 2718
 												if ($result == 'NotDefined') {
2719 2719
 													$errorforactions++;
2720
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2720
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2721 2721
 												} elseif (!($result > 0)) {
2722 2722
 													$errorforactions++;
2723
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2723
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2724 2724
 													$this->errors[] = $this->db->lasterror();
2725 2725
 												} else {
2726 2726
 													$contactstatic->country_id = $result;
@@ -2731,28 +2731,28 @@  discard block
 block discarded – undo
2731 2731
 											if (!$errorforactions) {
2732 2732
 												// Search state by name or code (for country if defined)
2733 2733
 												if (!empty($contactstatic->state)) {
2734
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2734
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2735 2735
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2736 2736
 													if (empty($result)) {
2737 2737
 														$errorforactions++;
2738
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2738
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2739 2739
 													} elseif (!($result > 0)) {
2740 2740
 														$errorforactions++;
2741
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2741
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2742 2742
 														$this->errors[] = $this->db->lasterror();
2743 2743
 													} else {
2744 2744
 														$contactstatic->state_id = $result;
2745 2745
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2746 2746
 													}
2747 2747
 												} elseif (!empty($contactstatic->state_code)) {
2748
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2748
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2749 2749
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2750 2750
 													if (empty($result)) {
2751 2751
 														$errorforactions++;
2752
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2752
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2753 2753
 													} elseif (!($result > 0)) {
2754 2754
 														$errorforactions++;
2755
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2755
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2756 2756
 														$this->errors[] = $this->db->lasterror();
2757 2757
 													} else {
2758 2758
 														$contactstatic->state_id = $result;
@@ -2817,8 +2817,8 @@  discard block
 block discarded – undo
2817 2817
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2818 2818
 								$actioncomm->note_private = $descriptionfull;
2819 2819
 								$actioncomm->fk_project  = $projectstatic->id;
2820
-								$actioncomm->datep       = $dateemail;	// date of email
2821
-								$actioncomm->datef       = $dateemail;	// date of email
2820
+								$actioncomm->datep       = $dateemail; // date of email
2821
+								$actioncomm->datef       = $dateemail; // date of email
2822 2822
 								$actioncomm->percentage  = -1; // Not applicable
2823 2823
 								$actioncomm->socid       = $thirdpartystatic->id;
2824 2824
 								$actioncomm->contact_id = $contactstatic->id;
@@ -3017,7 +3017,7 @@  discard block
 block discarded – undo
3017 3017
 								}
3018 3018
 								$hookmanager->initHooks(array('emailcolector'));
3019 3019
 								$parameters = array('arrayobject' => $arrayobject);
3020
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
3020
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
3021 3021
 								if ($reshook > 0) {
3022 3022
 									$arrayobject = $hookmanager->resArray;
3023 3023
 								}
@@ -3026,10 +3026,10 @@  discard block
 block discarded – undo
3026 3026
 
3027 3027
 								foreach ($arrayobject as $key => $objectdesc) {
3028 3028
 									$sql = 'SELECT DISTINCT t.rowid ';
3029
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t';
3029
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t';
3030 3030
 									$sql .= ' WHERE ';
3031 3031
 									foreach ($objectdesc['fields'] as $field) {
3032
-										$sql .= "('" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR ";
3032
+										$sql .= "('".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR ";
3033 3033
 									}
3034 3034
 									$sql = substr($sql, 0, -4);
3035 3035
 
@@ -3050,8 +3050,8 @@  discard block
 block discarded – undo
3050 3050
 									foreach ($ids as $val) {
3051 3051
 										$res = $objectmanaged->fetch($val);
3052 3052
 										if ($res) {
3053
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
3054
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
3053
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
3054
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
3055 3055
 										} else {
3056 3056
 											$this->errors[] = 'object not found';
3057 3057
 										}
@@ -3060,7 +3060,7 @@  discard block
 block discarded – undo
3060 3060
 								foreach ($dirs as $target) {
3061 3061
 									$prefix = $this->actions[$this->id]['actionparam'];
3062 3062
 									foreach ($data as $filename => $content) {
3063
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
3063
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
3064 3064
 										if ($resr == -1) {
3065 3065
 											$this->errors[] = 'Doc not saved';
3066 3066
 										}
@@ -3107,7 +3107,7 @@  discard block
 block discarded – undo
3107 3107
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
3108 3108
 
3109 3109
 								$projecttocreate->title = $subject;
3110
-								$projecttocreate->date_start = $dateemail;	// date of email
3110
+								$projecttocreate->date_start = $dateemail; // date of email
3111 3111
 								$projecttocreate->date_end = 0;
3112 3112
 								$projecttocreate->opp_status = $id_opp_status;
3113 3113
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3393,7 +3393,7 @@  discard block
 block discarded – undo
3393 3393
 								$candidaturetocreate->note_private = $descriptionfull;
3394 3394
 								$candidaturetocreate->entity = $conf->entity;
3395 3395
 								$candidaturetocreate->email_msgid = $msgid;
3396
-								$candidaturetocreate->email_date = $dateemail;		// date of email
3396
+								$candidaturetocreate->email_date = $dateemail; // date of email
3397 3397
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3398 3398
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3399 3399
 
@@ -3579,7 +3579,7 @@  discard block
 block discarded – undo
3579 3579
 			foreach ($arrayofemailtodelete as $imapemailnum => $imapemail) {
3580 3580
 				dol_syslog("EmailCollect::doCollectOneCollector delete email ".$imapemailnum);
3581 3581
 
3582
-				$operationslog .= "<br> move email ".$imapemailnum.($mode> 0 ? ' (test)' : '');
3582
+				$operationslog .= "<br> move email ".$imapemailnum.($mode > 0 ? ' (test)' : '');
3583 3583
 
3584 3584
 				if (empty($mode) && empty($error)) {
3585 3585
 					$tmptargetdir = $targetdir;
@@ -3614,7 +3614,7 @@  discard block
 block discarded – undo
3614 3614
 			foreach ($arrayofemailtodelete as $imapemail => $msgid) {
3615 3615
 				dol_syslog("EmailCollect::doCollectOneCollector delete email ".$imapemail." ".$msgid);
3616 3616
 
3617
-				$operationslog .= "<br> delete email ".$imapemail." ".$msgid.($mode> 0 ? ' (test)' : '');
3617
+				$operationslog .= "<br> delete email ".$imapemail." ".$msgid.($mode > 0 ? ' (test)' : '');
3618 3618
 
3619 3619
 				if (empty($mode) && empty($error)) {
3620 3620
 					$res = imap_mail_move($connection, $imapemail, $targetdir, CP_UID);
@@ -3802,8 +3802,8 @@  discard block
 block discarded – undo
3802 3802
 				 * append increment number to the original filename
3803 3803
 				 */
3804 3804
 				while (file_exists($destdir.$file_name.".".$extension)) {
3805
-					$file_name = $file_name_original . ' (' . $num . ')';
3806
-					$file_name_complete = $file_name . "." . $extension;
3805
+					$file_name = $file_name_original.' ('.$num.')';
3806
+					$file_name_complete = $file_name.".".$extension;
3807 3807
 					$destination = $destdir.$file_name_complete;
3808 3808
 					$num++;
3809 3809
 				}
@@ -3917,7 +3917,7 @@  discard block
 block discarded – undo
3917 3917
 	 */
3918 3918
 	private function saveAttachment($destdir, $filename, $content)
3919 3919
 	{
3920
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
3920
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
3921 3921
 
3922 3922
 		$tmparraysize = getDefaultImageSizes();
3923 3923
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.