Passed
Branch develop (72ff6f)
by
unknown
83:09
created
htdocs/core/class/conf.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 	public $liste_limit;
95 95
 
96
-	public $tzuserinputkey = 'tzserver';		// Use 'tzuserrel' to always store date in GMT and show date in time zone of user.
96
+	public $tzuserinputkey = 'tzserver'; // Use 'tzuserrel' to always store date in GMT and show date in time zone of user.
97 97
 
98 98
 
99 99
 	/**
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 			}
833 833
 
834 834
 			if (!empty($this->global->MAIN_TZUSERINPUTKEY)) {
835
-				$this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY;	// 'tzserver' or 'tzuserrel'
835
+				$this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY; // 'tzserver' or 'tzuserrel'
836 836
 			}
837 837
 
838 838
 			if (!empty($this->global->PRODUIT_AUTOFILL_DESC)) {
Please login to merge, or discard this patch.
htdocs/core/class/html.formfile.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
 			$maxphptoshow = $maxfilesizearray['maxphptoshow'];
155 155
 			$maxphptoshowparam = $maxfilesizearray['maxphptoshowparam'];
156 156
 			if ($maxmin > 0) {
157
-				$out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
157
+				$out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
158 158
 			}
159 159
 			$out .= '<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
160 160
 			$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple');
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_card.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 		if (empty($error)) {
185 185
 			$line = new StockTransferLine($db);
186
-			$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')'));
186
+			$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'").')'));
187 187
 			if (!empty($records[key($records)])) $line = $records[key($records)];
188 188
 			$line->fk_stocktransfer = $id;
189 189
 			$line->qty += $qty;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 // Affichage alerte date prévue de départ si transfert concerné
369 369
 $date_prevue_depart = $object->date_prevue_depart;
370 370
 $date_prevue_depart_plus_delai = $date_prevue_depart;
371
-if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
371
+if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart).' + '.$object->lead_time_for_warning.' day');
372 372
 if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
373 373
 	print "$('.valuefield.fieldname_date_prevue_depart').append('";
374 374
 	print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
@@ -437,31 +437,31 @@  discard block
 block discarded – undo
437 437
 // Part to edit record
438 438
 if (($id || $ref) && $action == 'edit') {
439 439
 	//if($object->status < 3) {
440
-	print load_fiche_titre($langs->trans("StockTransfer"), '', 'object_' . $object->picto);
440
+	print load_fiche_titre($langs->trans("StockTransfer"), '', 'object_'.$object->picto);
441 441
 
442
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
443
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
442
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
443
+	print '<input type="hidden" name="token" value="'.newToken().'">';
444 444
 	print '<input type="hidden" name="action" value="update">';
445
-	print '<input type="hidden" name="id" value="' . $object->id . '">';
446
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
447
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
445
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
446
+	if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
447
+	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
448 448
 
449 449
 	print dol_get_fiche_head();
450 450
 
451
-	print '<table class="border centpercent tableforfieldedit">' . "\n";
451
+	print '<table class="border centpercent tableforfieldedit">'."\n";
452 452
 
453 453
 	// Common attributes
454
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
454
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
455 455
 
456 456
 	// Other attributes
457
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
457
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
458 458
 
459 459
 	print '</table>';
460 460
 
461 461
 	print dol_get_fiche_end();
462 462
 
463
-	print '<div class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '">';
464
-	print ' &nbsp; <input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
463
+	print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
464
+	print ' &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
465 465
 	print '</div>';
466 466
 
467 467
 	print '</form>';
@@ -492,28 +492,28 @@  discard block
 block discarded – undo
492 492
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
493 493
 	} elseif ($action == 'destock') { // Destock confirmation
494 494
 		// Create an array for form
495
-		$formquestion = array(	'text' => '',
495
+		$formquestion = array('text' => '',
496 496
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestock', $object->ref), 'size'=>40),
497 497
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
498 498
 		);
499 499
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProduct'), '', 'confirm_destock', $formquestion, 'yes', 1);
500 500
 	} elseif ($action == 'destockcancel') { // Destock confirmation cancel
501 501
 		// Create an array for form
502
-		$formquestion = array(	'text' => '',
502
+		$formquestion = array('text' => '',
503 503
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestockCancel', $object->ref), 'size'=>40),
504 504
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
505 505
 		);
506 506
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProductCancel'), '', 'confirm_destockcancel', $formquestion, 'yes', 1);
507 507
 	} elseif ($action == 'addstock') { // Addstock confirmation
508 508
 		// Create an array for form
509
-		$formquestion = array(	'text' => '',
509
+		$formquestion = array('text' => '',
510 510
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStock', $object->ref), 'size'=>40),
511 511
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
512 512
 		);
513 513
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AddStockAllProduct'), '', 'confirm_addstock', $formquestion, 'yes', 1);
514 514
 	} elseif ($action == 'addstockcancel') { // Addstock confirmation cancel
515 515
 		// Create an array for form
516
-		$formquestion = array(	'text' => '',
516
+		$formquestion = array('text' => '',
517 517
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStockCancel', $object->ref), 'size'=>40),
518 518
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
519 519
 		);
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 
539 539
 
540 540
 	if ($action == 'valid' && $permissiontoadd) {
541
-		$nextref=$object->getNextNumRef();
541
+		$nextref = $object->getNextNumRef();
542 542
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $langs->transnoentities('ConfirmValidateStockTransfer', $nextref), 'confirm_validate', $formquestion, 0, 2);
543 543
 	}
544 544
 
@@ -560,25 +560,25 @@  discard block
 block discarded – undo
560 560
 
561 561
 	// Thirdparty
562 562
 	if (isModEnabled('societe')) {
563
-		$morehtmlref .= $langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '').'<br>';
563
+		$morehtmlref .= $langs->trans('ThirdParty').' : '.(is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '').'<br>';
564 564
 	}
565 565
 	// Project
566 566
 	if (!empty($conf->project->enabled)) {
567 567
 		$langs->load("projects");
568
-		$morehtmlref.=$langs->trans('Project') . ' ';
568
+		$morehtmlref .= $langs->trans('Project').' ';
569 569
 		if ($permissiontoadd) {
570 570
 			//if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
571
-			$morehtmlref.=' : ';
571
+			$morehtmlref .= ' : ';
572 572
 			if ($action == 'classify') {
573 573
 				//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
574
-				$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
575
-				$morehtmlref.='<input type="hidden" name="action" value="classin">';
576
-				$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
577
-				$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
578
-				$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
579
-				$morehtmlref.='</form>';
574
+				$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
575
+				$morehtmlref .= '<input type="hidden" name="action" value="classin">';
576
+				$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
577
+				$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
578
+				$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
579
+				$morehtmlref .= '</form>';
580 580
 			} else {
581
-				$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
581
+				$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
582 582
 			}
583 583
 		} else {
584 584
 			if (!empty($object->fk_project)) {
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
607 607
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
608 608
 
609
-	$object->fields['fk_soc']['visible']=0; // Already available in banner
610
-	$object->fields['fk_project']['visible']=0; // Already available in banner
609
+	$object->fields['fk_soc']['visible'] = 0; // Already available in banner
610
+	$object->fields['fk_project']['visible'] = 0; // Already available in banner
611 611
 	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
612 612
 
613 613
 	// Incoterms
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
 	$param = '';
714 714
 
715
-	$conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE=true; // Full display needed to see all column title details
715
+	$conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE = true; // Full display needed to see all column title details
716 716
 
717 717
 	print '<tr class="liste_titre">';
718 718
 	print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone ');
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
 				print '<input type="submit" class="button buttongen marginbottomonly" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
803 803
 			} else {
804 804
 				print '<td class="right">';
805
-				print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $line->id . '#line_' . $line->id . '">';
806
-				print img_edit() . '</a>';
805
+				print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">';
806
+				print img_edit().'</a>';
807 807
 				print '</td>';
808 808
 				print '<td class="right">';
809
-				print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '&action=deleteline&lineid=' . $line->id . '">' . img_delete($langs->trans("Remove")) . '</a>';
809
+				print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=deleteline&lineid='.$line->id.'">'.img_delete($langs->trans("Remove")).'</a>';
810 810
 				print '</td>';
811 811
 			}
812 812
 
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 		$formproduct->loadWarehouses(); // Pour charger la totalité des entrepôts
860 860
 
861 861
 		// On stock ceux qui ne doivent pas être proposés dans la liste
862
-		$TExcludedWarehouseSource=array();
862
+		$TExcludedWarehouseSource = array();
863 863
 		if (!empty($object->fk_warehouse_source)) {
864 864
 			$source_ent = new Entrepot($db);
865 865
 			$source_ent->fetch($object->fk_warehouse_source);
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 		}
870 870
 
871 871
 		// On stock ceux qui ne doivent pas être proposés dans la liste
872
-		$TExcludedWarehouseDestination=array();
872
+		$TExcludedWarehouseDestination = array();
873 873
 		if (!empty($object->fk_warehouse_destination)) {
874 874
 			$dest_ent = new Entrepot($db);
875 875
 			$dest_ent->fetch($object->fk_warehouse_destination);
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 		}
880 880
 
881 881
 		// On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses
882
-		$formproduct->cache_warehouses=array();
882
+		$formproduct->cache_warehouses = array();
883 883
 		// In warehouse
884 884
 		print '<td>';
885 885
 		print $formproduct->selectWarehouses(empty($fk_warehouse_source) ? $object->fk_warehouse_source : $fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
886 886
 		print '</td>';
887 887
 
888 888
 		// On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses
889
-		$formproduct->cache_warehouses=array();
889
+		$formproduct->cache_warehouses = array();
890 890
 		// Out warehouse
891 891
 		print '<td>';
892 892
 		print $formproduct->selectWarehouses(empty($fk_warehouse_destination) ? $object->fk_warehouse_destination : $fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 		// PMP * Qty
904 904
 		print '<td></td>';
905 905
 		// Button to add line
906
-		print '<td class="right" colspan="2"><input type="submit" class="button" name="addline" value="' . dol_escape_htmltag($langs->trans('Add')) . '"></td>';
906
+		print '<td class="right" colspan="2"><input type="submit" class="button" name="addline" value="'.dol_escape_htmltag($langs->trans('Add')).'"></td>';
907 907
 		// Grad and drop lines
908 908
 		print '<td></td>';
909 909
 		print '</tr>';
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
 		// Documents
1014 1014
 		if ($includedocgeneration) {
1015 1015
 			$objref = dol_sanitizeFileName($object->ref);
1016
-			$relativepath = $objref . '/' . $objref . '.pdf';
1016
+			$relativepath = $objref.'/'.$objref.'.pdf';
1017 1017
 			$filedir = $conf->stocktransfer->dir_output.'/'.$object->element.'/'.$objref;
1018
-			$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
1019
-			$genallowed = $user->rights->stocktransfer->stocktransfer->read;	// If you can read, you can build the PDF to read content
1020
-			$delallowed = $user->rights->stocktransfer->stocktransfer->write;	// If you can create/edit, you can remove a file on card
1018
+			$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
1019
+			$genallowed = $user->rights->stocktransfer->stocktransfer->read; // If you can read, you can build the PDF to read content
1020
+			$delallowed = $user->rights->stocktransfer->stocktransfer->write; // If you can create/edit, you can remove a file on card
1021 1021
 			print $formfile->showdocuments('stocktransfer:StockTransfer', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
1022 1022
 		}
1023 1023
 
Please login to merge, or discard this patch.
Braces   +128 added lines, -49 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 // Load translation files required by the page
39 39
 $langs->loadLangs(array("stocks", "other", "productbatch", "companies"));
40
- if (isModEnabled('incoterm')) $langs->load('incoterm');
40
+ if (isModEnabled('incoterm')) {
41
+ 	$langs->load('incoterm');
42
+ }
41 43
 
42 44
 // Get parameters
43 45
 $id = GETPOST('id', 'int');
@@ -72,10 +74,14 @@  discard block
 block discarded – undo
72 74
 $search_all = trim(GETPOST("search_all", 'alpha'));
73 75
 $search = array();
74 76
 foreach ($object->fields as $key => $val) {
75
-	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
76
-}
77
+	if (GETPOST('search_'.$key, 'alpha')) {
78
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
79
+	}
80
+	}
77 81
 
78
-if (empty($action) && empty($id) && empty($ref)) $action = 'view';
82
+if (empty($action) && empty($id) && empty($ref)) {
83
+	$action = 'view';
84
+}
79 85
 
80 86
 // Load object
81 87
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
@@ -94,7 +100,9 @@  discard block
 block discarded – undo
94 100
 //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
95 101
 //$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
96 102
 
97
-if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
103
+if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
104
+	accessforbidden();
105
+}
98 106
 
99 107
 
100 108
 /*
@@ -107,7 +115,9 @@  discard block
 block discarded – undo
107 115
 
108 116
 $parameters = array();
109 117
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
110
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
118
+if ($reshook < 0) {
119
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
120
+}
111 121
 
112 122
 if (empty($reshook)) {
113 123
 	$error = 0;
@@ -116,8 +126,11 @@  discard block
 block discarded – undo
116 126
 
117 127
 	if (empty($backtopage) || ($cancel && empty($id))) {
118 128
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
119
-			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
120
-			else $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
129
+			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
130
+				$backtopage = $backurlforlist;
131
+			} else {
132
+				$backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
133
+			}
121 134
 		}
122 135
 	}
123 136
 	$triggermodname = 'STOCKTRANSFER_STOCKTRANSFER_MODIFY'; // Name of trigger action code to execute when we modify record
@@ -184,7 +197,9 @@  discard block
 block discarded – undo
184 197
 		if (empty($error)) {
185 198
 			$line = new StockTransferLine($db);
186 199
 			$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')'));
187
-			if (!empty($records[key($records)])) $line = $records[key($records)];
200
+			if (!empty($records[key($records)])) {
201
+				$line = $records[key($records)];
202
+			}
188 203
 			$line->fk_stocktransfer = $id;
189 204
 			$line->qty += $qty;
190 205
 			$line->fk_warehouse_source = $fk_warehouse_source;
@@ -193,8 +208,9 @@  discard block
 block discarded – undo
193 208
 			$line->batch = $batch;
194 209
 
195 210
 			$line->pmp = $prod->pmp;
196
-			if ($line->id > 0) $line->update($user);
197
-			else {
211
+			if ($line->id > 0) {
212
+				$line->update($user);
213
+			} else {
198 214
 				$line->rang = count($object->lines) + 1;
199 215
 				$line->create($user);
200 216
 			}
@@ -257,10 +273,15 @@  discard block
 block discarded – undo
257 273
 				$db->begin();
258 274
 				foreach ($lines as $line) {
259 275
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source);
260
-					if ($res <= 0) $error++;
276
+					if ($res <= 0) {
277
+						$error++;
278
+					}
279
+				}
280
+				if (empty($error)) {
281
+					$db->commit();
282
+				} else {
283
+					$db->rollback();
261 284
 				}
262
-				if (empty($error)) $db->commit();
263
-				else $db->rollback();
264 285
 			}
265 286
 			if (empty($error)) {
266 287
 				$object->setStatut($object::STATUS_TRANSFERED, $id);
@@ -278,10 +299,15 @@  discard block
 block discarded – undo
278 299
 				$db->begin();
279 300
 				foreach ($lines as $line) {
280 301
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source, 0);
281
-					if ($res <= 0) $error++;
302
+					if ($res <= 0) {
303
+						$error++;
304
+					}
305
+				}
306
+				if (empty($error)) {
307
+					$db->commit();
308
+				} else {
309
+					$db->rollback();
282 310
 				}
283
-				if (empty($error)) $db->commit();
284
-				else $db->rollback();
285 311
 			}
286 312
 			if (empty($error)) {
287 313
 				$object->setStatut($object::STATUS_VALIDATED, $id);
@@ -299,10 +325,15 @@  discard block
 block discarded – undo
299 325
 				$db->begin();
300 326
 				foreach ($lines as $line) {
301 327
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination, 0);
302
-					if ($res <= 0) $error++;
328
+					if ($res <= 0) {
329
+						$error++;
330
+					}
331
+				}
332
+				if (empty($error)) {
333
+					$db->commit();
334
+				} else {
335
+					$db->rollback();
303 336
 				}
304
-				if (empty($error)) $db->commit();
305
-				else $db->rollback();
306 337
 			}
307 338
 			if (empty($error)) {
308 339
 				$object->setStatut($object::STATUS_CLOSED, $id);
@@ -320,10 +351,15 @@  discard block
 block discarded – undo
320 351
 				$db->begin();
321 352
 				foreach ($lines as $line) {
322 353
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination);
323
-					if ($res <= 0) $error++;
354
+					if ($res <= 0) {
355
+						$error++;
356
+					}
357
+				}
358
+				if (empty($error)) {
359
+					$db->commit();
360
+				} else {
361
+					$db->rollback();
324 362
 				}
325
-				if (empty($error)) $db->commit();
326
-				else $db->rollback();
327 363
 			}
328 364
 			if (empty($error)) {
329 365
 				$object->setStatut($object::STATUS_TRANSFERED, $id);
@@ -368,7 +404,9 @@  discard block
 block discarded – undo
368 404
 // Affichage alerte date prévue de départ si transfert concerné
369 405
 $date_prevue_depart = $object->date_prevue_depart;
370 406
 $date_prevue_depart_plus_delai = $date_prevue_depart;
371
-if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
407
+if ($object->lead_time_for_warning > 0) {
408
+	$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
409
+}
372 410
 if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
373 411
 	print "$('.valuefield.fieldname_date_prevue_depart').append('";
374 412
 	print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
@@ -386,8 +424,12 @@  discard block
 block discarded – undo
386 424
 	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
387 425
 	print '<input type="hidden" name="token" value="'.newToken().'">';
388 426
 	print '<input type="hidden" name="action" value="add">';
389
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
390
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
427
+	if ($backtopage) {
428
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
429
+	}
430
+	if ($backtopageforcancel) {
431
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
432
+	}
391 433
 
392 434
 	print dol_get_fiche_head(array(), '');
393 435
 
@@ -443,8 +485,12 @@  discard block
 block discarded – undo
443 485
 	print '<input type="hidden" name="token" value="' . newToken() . '">';
444 486
 	print '<input type="hidden" name="action" value="update">';
445 487
 	print '<input type="hidden" name="id" value="' . $object->id . '">';
446
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
447
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
488
+	if ($backtopage) {
489
+		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
490
+	}
491
+	if ($backtopageforcancel) {
492
+		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
493
+	}
448 494
 
449 495
 	print dol_get_fiche_head();
450 496
 
@@ -545,8 +591,11 @@  discard block
 block discarded – undo
545 591
 	// Call Hook formConfirm
546 592
 	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
547 593
 	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
548
-	if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
549
-	elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
594
+	if (empty($reshook)) {
595
+		$formconfirm .= $hookmanager->resPrint;
596
+	} elseif ($reshook > 0) {
597
+		$formconfirm = $hookmanager->resPrint;
598
+	}
550 599
 
551 600
 	// Print form confirm
552 601
 	print $formconfirm;
@@ -616,8 +665,11 @@  discard block
 block discarded – undo
616 665
 		print '<table width="100%" class="nobordernopadding"><tr><td>';
617 666
 		print $langs->trans('IncotermLabel');
618 667
 		print '<td><td class="right">';
619
-		if ($permissiontoadd && $action != 'editincoterm') print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
620
-		else print '&nbsp;';
668
+		if ($permissiontoadd && $action != 'editincoterm') {
669
+			print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
670
+		} else {
671
+			print '&nbsp;';
672
+		}
621 673
 		print '</td></tr></table>';
622 674
 		print '</td>';
623 675
 		print '<td>';
@@ -706,7 +758,9 @@  discard block
 block discarded – undo
706 758
 		<input type="hidden" name="mode" value="">
707 759
 		<input type="hidden" name="id" value="' . $object->id.'">
708 760
 		';
709
-	if ($lineid > 0) print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
761
+	if ($lineid > 0) {
762
+		print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
763
+	}
710 764
 	print '<table id="tablelines" class="liste centpercent">';
711 765
 	//print '<div class="tagtable centpercent">';
712 766
 
@@ -753,32 +807,47 @@  discard block
 block discarded – undo
753 807
 
754 808
 		print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.'>';
755 809
 		print '<td class="titlefield">';
756
-		if ($action === 'editline' && $line->id == $lineid) $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
757
-		else print $productstatic->getNomUrl(1).' - '.$productstatic->label;
810
+		if ($action === 'editline' && $line->id == $lineid) {
811
+			$form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
812
+		} else {
813
+			print $productstatic->getNomUrl(1).' - '.$productstatic->label;
814
+		}
758 815
 		print '</td>';
759 816
 		if (isModEnabled('productbatch')) {
760 817
 			print '<td>';
761
-			if ($action === 'editline' && $line->id == $lineid) print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
762
-			else {
818
+			if ($action === 'editline' && $line->id == $lineid) {
819
+				print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
820
+			} else {
763 821
 				$productlot = new Productlot($db);
764 822
 				if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) {
765 823
 					print $productlot->getNomUrl(1);
766
-				} elseif (!empty($line->batch)) print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
824
+				} elseif (!empty($line->batch)) {
825
+					print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
826
+				}
767 827
 			}
768 828
 			print '</td>';
769 829
 		}
770 830
 
771 831
 		print '<td>';
772 832
 
773
-		if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
774
-		else print $warehousestatics->getNomUrl(1);
833
+		if ($action === 'editline' && $line->id == $lineid) {
834
+			print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
835
+		} else {
836
+			print $warehousestatics->getNomUrl(1);
837
+		}
775 838
 		print '</td>';
776 839
 		print '<td>';
777
-		if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
778
-		else print $warehousestatict->getNomUrl(1);
840
+		if ($action === 'editline' && $line->id == $lineid) {
841
+			print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
842
+		} else {
843
+			print $warehousestatict->getNomUrl(1);
844
+		}
779 845
 		print '</td>';
780
-		if ($action === 'editline' && $line->id == $lineid) print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
781
-		else print '<td class="center">'.$line->qty.'</td>';
846
+		if ($action === 'editline' && $line->id == $lineid) {
847
+			print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
848
+		} else {
849
+			print '<td class="center">'.$line->qty.'</td>';
850
+		}
782 851
 
783 852
 		if ($conf->global->PRODUCT_USE_UNITS) {
784 853
 			print '<td class="linecoluseunit nowrap left">';
@@ -840,7 +909,9 @@  discard block
 block discarded – undo
840 909
 		// Product
841 910
 		print '<td class="titlefield">';
842 911
 		$filtertype = 0;
843
-		if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype = '';
912
+		if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
913
+			$filtertype = '';
914
+		}
844 915
 		if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) {
845 916
 			$limit = '';
846 917
 		} else {
@@ -864,7 +935,9 @@  discard block
 block discarded – undo
864 935
 			$source_ent = new Entrepot($db);
865 936
 			$source_ent->fetch($object->fk_warehouse_source);
866 937
 			foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
867
-				if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
938
+				if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) {
939
+					$TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
940
+				}
868 941
 			}
869 942
 		}
870 943
 
@@ -874,7 +947,9 @@  discard block
 block discarded – undo
874 947
 			$dest_ent = new Entrepot($db);
875 948
 			$dest_ent->fetch($object->fk_warehouse_destination);
876 949
 			foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
877
-				if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
950
+				if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) {
951
+					$TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
952
+				}
878 953
 			}
879 954
 		}
880 955
 
@@ -919,7 +994,9 @@  discard block
 block discarded – undo
919 994
 		print '<div class="tabsAction">'."\n";
920 995
 		$parameters = array();
921 996
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
922
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
997
+		if ($reshook < 0) {
998
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
999
+		}
923 1000
 
924 1001
 		if (empty($reshook)) {
925 1002
 			// Send
@@ -1043,7 +1120,9 @@  discard block
 block discarded – undo
1043 1120
 	}
1044 1121
 
1045 1122
 	//Select mail models is same action as presend
1046
-	if (GETPOST('modelselected')) $action = 'presend';
1123
+	if (GETPOST('modelselected')) {
1124
+		$action = 'presend';
1125
+	}
1047 1126
 
1048 1127
 	// Presend form
1049 1128
 	$modelmail = 'stocktransfer';
Please login to merge, or discard this patch.
htdocs/fourn/facture/card-rec.php 1 patch
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 
33 33
 // Load Dolibarr environment
34 34
 require '../../main.inc.php';
35
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39 39
 if (isModEnabled('project')) {
40
-	include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
40
+	include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
41 41
 }
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
44
-require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
45
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
44
+require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
45
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
46 46
 
47 47
 // Load translation files required by the page
48 48
 $langs->loadLangs(array('bills', 'companies', 'compta', 'admin', 'other', 'products', 'banks', 'suppliers'));
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	$page = 0;
81 81
 }     // If $page is not defined, or '' or -1
82 82
 $offset = $limit * $page;
83
-if (! $sortorder) {
83
+if (!$sortorder) {
84 84
 	$sortorder = 'DESC';
85 85
 }
86
-if (! $sortfield) {
86
+if (!$sortfield) {
87 87
 	$sortfield = 'f.titre';
88 88
 }
89 89
 $pageprev = $page - 1;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 $object = new FactureFournisseurRec($db);
93 93
 if (($id > 0 || $title) && $action != 'create' && $action != 'add') {
94 94
 	$ret = $object->fetch($id, $title);
95
-	if (! $ret) {
95
+	if (!$ret) {
96 96
 		setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
97 97
 	}
98 98
 }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	$action = 'list';
136 136
 	$massaction = '';
137 137
 }
138
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
138
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
139 139
 	$massaction = '';
140 140
 }
141 141
 
@@ -151,18 +151,18 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	// Selection of new fields
154
-	include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
154
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
155 155
 
156 156
 	// Set note
157
-	include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once
157
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
158 158
 
159
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be include, not include_once
159
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
160 160
 
161
-	include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be include, not include_once
161
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
162 162
 
163 163
 	// Create predefined invoice
164 164
 	if ($action == 'add') {
165
-		if (! GETPOST('title', 'alphanohtml')) {
165
+		if (!GETPOST('title', 'alphanohtml')) {
166 166
 			setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
167 167
 			$action = "create";
168 168
 			$error++;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			}
186 186
 		}
187 187
 
188
-		if (! $error) {
188
+		if (!$error) {
189 189
 			$object->titre = GETPOST('title', 'alphanohtml'); // deprecated
190 190
 			$object->title = GETPOST('title', 'alphanohtml');
191 191
 			$object->fk_project = GETPOST('projectid', 'int');
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 				$action = "create";
232 232
 			}
233 233
 
234
-			if (! $error) {
234
+			if (!$error) {
235 235
 				$db->commit();
236 236
 
237
-				header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id);
237
+				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id);
238 238
 				exit;
239 239
 			} else {
240 240
 				$db->rollback();
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer)) {
252 252
 		$object->delete($user);
253 253
 
254
-		header('Location: ' . DOL_URL_ROOT . '/fourn/facture/list-rec.php');
254
+		header('Location: '.DOL_URL_ROOT.'/fourn/facture/list-rec.php');
255 255
 		exit;
256 256
 	}
257 257
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			$error++;
329 329
 		}
330 330
 
331
-		if (! $error) {
331
+		if (!$error) {
332 332
 			$db->commit();
333 333
 		} else {
334 334
 			$db->rollback();
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			$error++;
346 346
 		}
347 347
 
348
-		if (! $error) {
348
+		if (!$error) {
349 349
 			$db->commit();
350 350
 		} else {
351 351
 			$db->rollback();
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			$error++;
404 404
 		}
405 405
 
406
-		if (! $error) {
406
+		if (!$error) {
407 407
 			$result = $object->insertExtraFields('BILLREC_MODIFY');
408 408
 			if ($result < 0) {
409 409
 				setEventMessages($object->error, $object->errors, 'errors');
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 			$tva_tx = '';
433 433
 		}
434 434
 
435
-		$qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2);
436
-		$remise_percent = price2num(GETPOST('remise_percent' . $predef), '', 2);
435
+		$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
436
+		$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
437 437
 
438 438
 		// Extrafields
439 439
 		$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 		if (is_array($extralabelsline)) {
443 443
 			// Get extra fields
444 444
 			foreach ($extralabelsline as $key => $value) {
445
-				unset($_POST["options_" . $key . $predef]);
445
+				unset($_POST["options_".$key.$predef]);
446 446
 			}
447 447
 		}
448 448
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
455 455
 			$error++;
456 456
 		}
457
-		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
457
+		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
458 458
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
459 459
 			$error++;
460 460
 		}
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			}
504 504
 		}
505 505
 
506
-		if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
506
+		if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
507 507
 			$ret = $object->fetch($id);
508 508
 			if ($ret < 0) {
509 509
 				dol_print_error($db, $object->error);
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
 			$ret = $object->fetch_thirdparty();
513 513
 
514 514
 			// Clean parameters
515
-			$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'));
516
-			$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'));
515
+			$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'));
516
+			$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'));
517 517
 			$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
518 518
 
519 519
 			// Define special_code for special lines
@@ -610,23 +610,23 @@  discard block
 block discarded – undo
610 610
 							$outputlangs->load('products');
611 611
 						}
612 612
 						if (!empty($prod->customcode)) {
613
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
613
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
614 614
 						}
615 615
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
616 616
 							$tmptxt .= ' - ';
617 617
 						}
618 618
 						if (!empty($prod->country_code)) {
619
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
619
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $outputlangs, 0);
620 620
 						}
621 621
 					} else {
622 622
 						if (!empty($prod->customcode)) {
623
-							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
623
+							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
624 624
 						}
625 625
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
626 626
 							$tmptxt .= ' - ';
627 627
 						}
628 628
 						if (!empty($prod->country_code)) {
629
-							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
629
+							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $langs, 0);
630 630
 						}
631 631
 					}
632 632
 					$tmptxt .= ')';
@@ -652,8 +652,8 @@  discard block
 block discarded – undo
652 652
 			$date_end_fill = !empty(GETPOST('date_end_fill', 'int')) ? GETPOST('date_end_fill', 'int') : null;
653 653
 
654 654
 			// Margin
655
-			$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
656
-			$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
655
+			$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
656
+			$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
657 657
 
658 658
 			// Local Taxes
659 659
 			$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
 				$action = '';
720 720
 			}
721 721
 		}
722
-	} elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha')) {
723
-		if (! $object->fetch($id) > 0) {
722
+	} elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) {
723
+		if (!$object->fetch($id) > 0) {
724 724
 			dol_print_error($db);
725 725
 		}
726 726
 		$object->fetch_thirdparty();
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 			$objectline->array_options = $array_options;
756 756
 			$result = $objectline->insertExtraFields();
757 757
 			if ($result < 0) {
758
-				setEventMessages($langs->trans('Error') . $result, null, 'errors');
758
+				setEventMessages($langs->trans('Error').$result, null, 'errors');
759 759
 			}
760 760
 		}
761 761
 
@@ -765,13 +765,13 @@  discard block
 block discarded – undo
765 765
 		if (is_array($extralabelsline)) {
766 766
 			// Get extra fields
767 767
 			foreach ($extralabelsline as $key => $value) {
768
-				unset($_POST["options_" . $key]);
768
+				unset($_POST["options_".$key]);
769 769
 			}
770 770
 		}
771 771
 
772 772
 		// Define special_code for special lines
773 773
 		$special_code = GETPOST('special_code', 'int');
774
-		if (! GETPOST('qty', 'alpha')) {
774
+		if (!GETPOST('qty', 'alpha')) {
775 775
 			$special_code = 3;
776 776
 		}
777 777
 
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 		$date_end_fill = !empty(GETPOST('date_end_fill', 'int')) ? GETPOST('date_end_fill', 'int') : 'NULL';
818 818
 
819 819
 		// Update line
820
-		if (! $error) {
820
+		if (!$error) {
821 821
 			$result = $object->updateline(GETPOST('lineid', 'int'), GETPOST('productid', 'int'), $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);
822 822
 			if ($result >= 0) {
823 823
 				$object->fetch($object->id); // Reload lines
@@ -891,10 +891,10 @@  discard block
 block discarded – undo
891 891
 	if ($object->fetch($id) > 0) {
892 892
 		$result = $object->fetch_lines();
893 893
 
894
-		print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
895
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
894
+		print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
895
+		print '<input type="hidden" name="token" value="'.newToken().'">';
896 896
 		print '<input type="hidden" name="action" value="add">';
897
-		print '<input type="hidden" name="facid" value="' . $object->id . '">';
897
+		print '<input type="hidden" name="facid" value="'.$object->id.'">';
898 898
 
899 899
 		print dol_get_fiche_head(null, '', '', 0);
900 900
 
@@ -907,17 +907,17 @@  discard block
 block discarded – undo
907 907
 		$object->fetch_thirdparty();
908 908
 
909 909
 		// Title
910
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Title") . '</td><td>';
911
-		print '<input class="flat quatrevingtpercent" type="text" name="title" value="' . dol_escape_htmltag(GETPOST("title", 'alphanohtml')) . '">';
910
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
911
+		print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'">';
912 912
 		print '</td></tr>';
913 913
 
914 914
 		// Ref supplier
915
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("SupplierRef") . '</td><td>';
916
-		print '<input class="flat quatrevingtpercent" type="text" name="ref_supplier" value="' . $object->ref_supplier . '">';
915
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("SupplierRef").'</td><td>';
916
+		print '<input class="flat quatrevingtpercent" type="text" name="ref_supplier" value="'.$object->ref_supplier.'">';
917 917
 		print '</td></tr>';
918 918
 
919 919
 		// Third party
920
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Customer") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'customer') . '</td>';
920
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1, 'customer').'</td>';
921 921
 		print '</tr>';
922 922
 
923 923
 		$note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $object->note_public;
@@ -926,30 +926,30 @@  discard block
 block discarded – undo
926 926
 		// Help of substitution key
927 927
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
928 928
 
929
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')';
930
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%m') . ')';
931
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m') . ')';
932
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B') . ')';
933
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%B') . ')';
934
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B') . ')';
935
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y') . ')';
936
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%Y') . ')';
937
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y') . ')';
929
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m').')';
930
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%m').')';
931
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m').')';
932
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')';
933
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')';
934
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')';
935
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
936
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
937
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')';
938 938
 		// Only on template invoices
939
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date_when, 'dayhour') . ')';
940
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour') . ')';
939
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
940
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')';
941 941
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count");
942 942
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber");
943 943
 
944
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
944
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
945 945
 		foreach ($substitutionarray as $key => $val) {
946
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
946
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
947 947
 		}
948 948
 		$htmltext .= '</i>';
949 949
 
950 950
 		// Libelle
951
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Label") . '</td><td>';
952
-		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label . '">';
951
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td>';
952
+		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="'.$object->label.'">';
953 953
 		print '</td></tr>';
954 954
 
955 955
 		// Public note
@@ -974,38 +974,38 @@  discard block
 block discarded – undo
974 974
 		}
975 975
 
976 976
 		// Author
977
-		print "<tr><td>" . $langs->trans("Author") . "</td><td>" . $user->getFullName($langs) . "</td></tr>";
977
+		print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
978 978
 
979 979
 		// Payment term
980
-		print "<tr><td>" . $langs->trans("PaymentConditions") . "</td><td>";
981
-		$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none');
980
+		print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
981
+		$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
982 982
 		print "</td></tr>";
983 983
 
984 984
 		// Payment mode
985
-		print "<tr><td>" . $langs->trans("PaymentMode") . "</td><td>";
986
-		$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none', '', 1);
985
+		print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
986
+		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', '', 1);
987 987
 		print "</td></tr>";
988 988
 
989 989
 		// Project
990 990
 		if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
991 991
 			$projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project;
992 992
 			$langs->load('projects');
993
-			print '<tr><td>' . $langs->trans('Project') . '</td><td>';
993
+			print '<tr><td>'.$langs->trans('Project').'</td><td>';
994 994
 			$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
995
-			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>';
995
+			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>';
996 996
 			print '</td></tr>';
997 997
 		}
998 998
 
999 999
 		// Bank account
1000 1000
 		if ($object->fk_account > 0) {
1001
-			print "<tr><td>" . $langs->trans('BankAccount') . "</td><td>";
1002
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1001
+			print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
1002
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1003 1003
 			print "</td></tr>";
1004 1004
 		}
1005 1005
 
1006 1006
 		// Model pdf
1007
-		print "<tr><td>" . $langs->trans('Model') . "</td><td>";
1008
-		include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1007
+		print "<tr><td>".$langs->trans('Model')."</td><td>";
1008
+		include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1009 1009
 		$list = ModelePDFSuppliersInvoices::liste_modeles($db);
1010 1010
 		print $form->selectarray('modelpdf', $list, $conf->global->INVOICE_SUPPLIER_ADDON_PDF);
1011 1011
 		print "</td></tr>";
@@ -1016,37 +1016,37 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
 		// Autogeneration
1018 1018
 		$title = $langs->trans("Recurrence");
1019
-		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', '');
1019
+		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
1020 1020
 
1021 1021
 		print dol_get_fiche_head(null, '', '', 0);
1022 1022
 
1023 1023
 		print '<table class="border centpercent">';
1024 1024
 
1025 1025
 		// Frequency + unit
1026
-		print '<tr><td class="titlefieldcreate">' . $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')) . "</td><td>";
1027
-		print "<input type='text' name='frequency' value='" . GETPOST('frequency', 'int') . "' 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'));
1026
+		print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
1027
+		print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' 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'));
1028 1028
 		print "</td></tr>";
1029 1029
 
1030 1030
 		// Date next run
1031
-		print "<tr><td>" . $langs->trans('NextDateToExecution') . "</td><td>";
1031
+		print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
1032 1032
 		$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
1033 1033
 		print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1);
1034 1034
 		print "</td></tr>";
1035 1035
 
1036 1036
 		// Number max of generation
1037
-		print "<tr><td>" . $langs->trans("MaxPeriodNumber") . "</td><td>";
1038
-		print '<input type="text" name="nb_gen_max" value="' . GETPOST('nb_gen_max') . '" size="5" />';
1037
+		print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
1038
+		print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
1039 1039
 		print "</td></tr>";
1040 1040
 
1041 1041
 		// Auto validate the invoice
1042
-		print "<tr><td>" . $langs->trans("StatusOfGeneratedInvoices") . "</td><td>";
1042
+		print "<tr><td>".$langs->trans("StatusOfGeneratedInvoices")."</td><td>";
1043 1043
 		$select = array('0' => $langs->trans('BillStatusDraft'), '1' => $langs->trans('BillStatusValidated'));
1044 1044
 		print $form->selectarray('auto_validate', $select, GETPOST('auto_validate'));
1045 1045
 		print "</td></tr>";
1046 1046
 
1047 1047
 		// Auto generate document
1048 1048
 		if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) {
1049
-			print "<tr><td>" . $langs->trans("StatusOfGeneratedDocuments") . "</td><td>";
1049
+			print "<tr><td>".$langs->trans("StatusOfGeneratedDocuments")."</td><td>";
1050 1050
 			$select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc'));
1051 1051
 			print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
1052 1052
 			print "</td></tr>";
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 
1090 1090
 		print "</form>\n";
1091 1091
 	} else {
1092
-		dol_print_error('', "Error, no invoice " . $object->id);
1092
+		dol_print_error('', "Error, no invoice ".$object->id);
1093 1093
 	}
1094 1094
 } else {
1095 1095
 	/*
@@ -1101,12 +1101,12 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
 		// Confirmation de la suppression d'une ligne produit
1103 1103
 		if ($action == 'ask_deleteline') {
1104
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1104
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1105 1105
 		}
1106 1106
 
1107 1107
 		// Confirm delete of repeatable invoice
1108 1108
 		if ($action == 'ask_deleteinvoice') {
1109
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1109
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1110 1110
 		}
1111 1111
 
1112 1112
 		print $formconfirm;
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 		// Recurring invoice content
1122 1122
 
1123
-		$linkback = '<a href="' . DOL_URL_ROOT . '/fourn/facture/list-rec.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans('BackToList') . '</a>';
1123
+		$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list-rec.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans('BackToList').'</a>';
1124 1124
 
1125 1125
 		$morehtmlref = '';
1126 1126
 		if ($action != 'edittitle') {
@@ -1133,33 +1133,33 @@  discard block
 block discarded – undo
1133 1133
 		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
1134 1134
 		$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
1135 1135
 		// Thirdparty
1136
-		$morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
1136
+		$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
1137 1137
 
1138 1138
 		// Project
1139 1139
 		if (isModEnabled('project')) {
1140 1140
 			$langs->load('projects');
1141
-			$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
1141
+			$morehtmlref .= '<br>'.$langs->trans('Project').' ';
1142 1142
 			if ($usercancreate) {
1143 1143
 				if ($action != 'classify') {
1144
-					$morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
1144
+					$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
1145 1145
 				}
1146 1146
 				if ($action == 'classify') {
1147
-					$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
1147
+					$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
1148 1148
 					$morehtmlref .= '<input type="hidden" name="action" value="classin">';
1149
-					$morehtmlref .= '<input type="hidden" name="token" value="' . newToken() . '">';
1149
+					$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
1150 1150
 					$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
1151
-					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
1151
+					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
1152 1152
 					$morehtmlref .= '</form>';
1153 1153
 				} else {
1154
-					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
1154
+					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
1155 1155
 				}
1156 1156
 			} else {
1157 1157
 				if (!empty($object->fk_project)) {
1158 1158
 					$project = new Project($db);
1159 1159
 					$project->fetch($object->fk_project);
1160
-					$morehtmlref .= ' : ' . $project->getNomUrl(1);
1160
+					$morehtmlref .= ' : '.$project->getNomUrl(1);
1161 1161
 					if ($project->title) {
1162
-						$morehtmlref .= ' - ' . $project->title;
1162
+						$morehtmlref .= ' - '.$project->title;
1163 1163
 					}
1164 1164
 				} else {
1165 1165
 					$morehtmlref .= '';
@@ -1178,34 +1178,34 @@  discard block
 block discarded – undo
1178 1178
 
1179 1179
 		print '<table class="border centpercent tableforfield">';
1180 1180
 
1181
-		print '<tr><td class="titlefield">' . $langs->trans('Author') . '</td><td>';
1181
+		print '<tr><td class="titlefield">'.$langs->trans('Author').'</td><td>';
1182 1182
 		print $author->getNomUrl(-1);
1183 1183
 		print "</td></tr>";
1184 1184
 
1185 1185
 		// Label
1186 1186
 		print '<tr>';
1187
-		print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1188
-		print '<td>' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1187
+		print '<td>'.$form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1188
+		print '<td>'.$form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1189 1189
 		print '</tr>';
1190 1190
 
1191
-		print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
1192
-		print '<td>' . price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1191
+		print '<tr><td>'.$langs->trans('AmountHT').'</td>';
1192
+		print '<td>'.price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1193 1193
 		print '</tr>';
1194 1194
 
1195
-		print '<tr><td>' . $langs->trans("AmountVAT") . '</td><td>' . price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1195
+		print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1196 1196
 		print '</tr>';
1197 1197
 
1198 1198
 		// Amount Local Taxes
1199 1199
 		if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {    // Localtax1
1200
-			print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
1201
-			print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1200
+			print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
1201
+			print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1202 1202
 		}
1203 1203
 		if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {    // Localtax2
1204
-			print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
1205
-			print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1204
+			print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
1205
+			print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1206 1206
 		}
1207 1207
 
1208
-		print '<tr><td>' . $langs->trans("AmountTTC") . '</td><td colspan="3">' . price($object->total_ttc, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1208
+		print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1209 1209
 		print '</tr>';
1210 1210
 
1211 1211
 		// Payment term
@@ -1214,14 +1214,14 @@  discard block
 block discarded – undo
1214 1214
 		print $langs->trans('PaymentConditionsShort');
1215 1215
 		print '</td>';
1216 1216
 		if ($action != 'editconditions' && $usercancreate) {
1217
-			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>';
1217
+			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>';
1218 1218
 		}
1219 1219
 		print '</tr></table>';
1220 1220
 		print '</td><td>';
1221 1221
 		if ($action == 'editconditions') {
1222
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
1222
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
1223 1223
 		} else {
1224
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
1224
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
1225 1225
 		}
1226 1226
 
1227 1227
 		print '</td></tr>';
@@ -1232,14 +1232,14 @@  discard block
 block discarded – undo
1232 1232
 		print $langs->trans('PaymentMode');
1233 1233
 		print '</td>';
1234 1234
 		if ($action != 'editmode' && $usercancreate) {
1235
-			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>';
1235
+			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>';
1236 1236
 		}
1237 1237
 		print '</tr></table>';
1238 1238
 		print '</td><td>';
1239 1239
 		if ($action == 'editmode') {
1240
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1240
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1241 1241
 		} else {
1242
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'none');
1242
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none');
1243 1243
 		}
1244 1244
 		print '</td></tr>';
1245 1245
 
@@ -1252,12 +1252,12 @@  discard block
 block discarded – undo
1252 1252
 			print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
1253 1253
 			print '</td>';
1254 1254
 			if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
1255
-				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>';
1255
+				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>';
1256 1256
 			}
1257 1257
 			print '</tr></table>';
1258 1258
 			print '</td><td>';
1259 1259
 			$htmlname = (($usercancreate && $action == 'editmulticurrencycode') ? 'multicurrency_code' : 'none');
1260
-			$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
1260
+			$form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, $htmlname);
1261 1261
 			print '</td></tr>';
1262 1262
 
1263 1263
 			// Multicurrency rate
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
 				print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
1269 1269
 				print '</td>';
1270 1270
 				if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1271
-					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>';
1271
+					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>';
1272 1272
 				}
1273 1273
 				print '</tr></table>';
1274 1274
 				print '</td><td>';
@@ -1276,12 +1276,12 @@  discard block
 block discarded – undo
1276 1276
 					if ($action == 'actualizemulticurrencyrate') {
1277 1277
 						list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
1278 1278
 					}
1279
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1279
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1280 1280
 				} else {
1281
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1281
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1282 1282
 					if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1283 1283
 						print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
1284
-						print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=actualizemulticurrencyrate">' . $langs->trans("ActualizeCurrency") . '</a>';
1284
+						print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
1285 1285
 						print '</div>';
1286 1286
 					}
1287 1287
 				}
@@ -1297,24 +1297,24 @@  discard block
 block discarded – undo
1297 1297
 
1298 1298
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
1299 1299
 
1300
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m') . ')';
1301
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%m') . ')';
1302
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m') . ')';
1303
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B') . ')';
1304
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%B') . ')';
1305
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B') . ')';
1306
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y') . ')';
1307
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%Y') . ')';
1308
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y') . ')';
1300
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')';
1301
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')';
1302
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')';
1303
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')';
1304
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')';
1305
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')';
1306
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
1307
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
1308
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')';
1309 1309
 		// Only on template invoices
1310
-		$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') . ')';
1311
-		$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') . ')';
1310
+		$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').')';
1311
+		$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').')';
1312 1312
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done;
1313 1313
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max;
1314 1314
 
1315
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
1315
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
1316 1316
 		foreach ($substitutionarray as $key => $val) {
1317
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
1317
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
1318 1318
 		}
1319 1319
 		$htmltext .= '</i>';
1320 1320
 
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
 		print '<tr><td>';
1323 1323
 		print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $usercancreate);
1324 1324
 		print '</td><td class="wordbreak">';
1325
-		print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $usercancreate, 'textarea:' . ROWS_4 . ':90%', '', null, null, '', 1);
1325
+		print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $usercancreate, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
1326 1326
 		print '</td>';
1327 1327
 		print '</tr>';
1328 1328
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 		print '<tr><td>';
1331 1331
 		print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $usercancreate);
1332 1332
 		print '</td><td class="wordbreak">';
1333
-		print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $usercancreate, 'textarea:' . ROWS_4 . ':90%', '', null, null, '', 1);
1333
+		print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $usercancreate, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
1334 1334
 		print '</td>';
1335 1335
 		print '</tr>';
1336 1336
 
@@ -1340,14 +1340,14 @@  discard block
 block discarded – undo
1340 1340
 		print $langs->trans('BankAccount');
1341 1341
 		print '<td>';
1342 1342
 		if ($action != 'editbankaccount' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1343
-			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>';
1343
+			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>';
1344 1344
 		}
1345 1345
 		print '</tr></table>';
1346 1346
 		print '</td><td>';
1347 1347
 		if ($action == 'editbankaccount') {
1348
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'fk_account', 1);
1348
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
1349 1349
 		} else {
1350
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1350
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1351 1351
 		}
1352 1352
 		print "</td>";
1353 1353
 		print '</tr>';
@@ -1358,18 +1358,18 @@  discard block
 block discarded – undo
1358 1358
 		print $langs->trans('Model');
1359 1359
 		print '<td>';
1360 1360
 		if ($action != 'editmodelpdf' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1361
-			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>';
1361
+			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>';
1362 1362
 		}
1363 1363
 		print '</tr></table>';
1364 1364
 		print '</td><td>';
1365 1365
 		if ($action == 'editmodelpdf') {
1366
-			include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1366
+			include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1367 1367
 			$list = array();
1368 1368
 			$models = ModelePDFSuppliersInvoices::liste_modeles($db);
1369 1369
 			foreach ($models as $k => $model) {
1370
-				$list[] = str_replace(':', '|', $k) . ':' . $model;
1370
+				$list[] = str_replace(':', '|', $k).':'.$model;
1371 1371
 			}
1372
-			$select = 'select;' . implode(',', $list);
1372
+			$select = 'select;'.implode(',', $list);
1373 1373
 			//TODO : Droits
1374 1374
 			print $form->editfieldval($langs->trans('Model'), 'modelpdf', $object->model_pdf, $object, $usercancreate, $select);
1375 1375
 		} else {
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
 		// Other attributes
1382 1382
 		$cols = 2;
1383
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
1383
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1384 1384
 
1385 1385
 		print '</table>';
1386 1386
 
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
 
1397 1397
 		print '<table class="border centpercent tableforfield">';
1398 1398
 
1399
-		print '<tr><td colspan="2">' . img_picto('', 'recurring', 'class="pictofixedwidth"') . $title . '</td></tr>';
1399
+		print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>';
1400 1400
 
1401 1401
 		// if "frequency" is empty or = 0, the reccurence is disabled
1402 1402
 		print '<tr><td style="width: 50%">';
@@ -1404,23 +1404,23 @@  discard block
 block discarded – undo
1404 1404
 		print $langs->trans('Frequency');
1405 1405
 		print '</td>';
1406 1406
 		if ($action != 'editfrequency' && $usercancreate) {
1407
-			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>';
1407
+			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>';
1408 1408
 		}
1409 1409
 		print '</tr></table>';
1410 1410
 		print '</td><td>';
1411 1411
 		if ($action == 'editfrequency') {
1412
-			print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '">';
1412
+			print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'">';
1413 1413
 			print '<input type="hidden" name="action" value="setfrequency">';
1414
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
1414
+			print '<input type="hidden" name="token" value="'.newToken().'">';
1415 1415
 			print '<table class="nobordernopadding">';
1416 1416
 			print '<tr><td>';
1417
-			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'));
1417
+			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'));
1418 1418
 			print '</td>';
1419
-			print '<td class="left"><input type="submit" class="button button-edit" value="' . $langs->trans("Modify") . '"></td>';
1419
+			print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
1420 1420
 			print '</tr></table></form>';
1421 1421
 		} else {
1422 1422
 			if ($object->frequency > 0) {
1423
-				print $langs->trans('FrequencyPer_' . $object->unit_frequency, $object->frequency);
1423
+				print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
1424 1424
 			} else {
1425 1425
 				print $langs->trans("NotARecurringInvoiceTemplate");
1426 1426
 			}
@@ -1439,8 +1439,8 @@  discard block
 block discarded – undo
1439 1439
 			print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached');
1440 1440
 		}
1441 1441
 		//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
1442
-		if (! $object->isMaxNbGenReached()) {
1443
-			if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1442
+		if (!$object->isMaxNbGenReached()) {
1443
+			if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1444 1444
 				print img_warning($langs->trans("Late"));
1445 1445
 			}
1446 1446
 		} else {
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 			print $langs->trans("StatusOfGeneratedInvoices");
1474 1474
 		}
1475 1475
 		print '</td><td>';
1476
-		$select = 'select;0:' . $langs->trans('BillStatusDraft') . ',1:' . $langs->trans('BillStatusValidated');
1476
+		$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
1477 1477
 		if ($action == 'auto_validate' || $object->frequency > 0) {
1478 1478
 			print $form->editfieldval($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $usercancreate, $select);
1479 1479
 		}
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 			}
1490 1490
 			print '</td>';
1491 1491
 			print '<td>';
1492
-			$select = 'select;0:' . $langs->trans('DoNotGenerateDoc') . ',1:' . $langs->trans('AutogenerateDoc');
1492
+			$select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc');
1493 1493
 			if ($action == 'generate_pdf' || $object->frequency > 0) {
1494 1494
 				print $form->editfieldval($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $usercancreate, $select);
1495 1495
 			}
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
 			print '<table class="border centpercent tableforfield">';
1514 1514
 
1515 1515
 			// Nb of generation already done
1516
-			print '<tr><td style="width: 50%">' . $langs->trans("NbOfGenerationDone") . '</td>';
1516
+			print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>';
1517 1517
 			print '<td>';
1518 1518
 			print $object->nb_gen_done ? $object->nb_gen_done : '0';
1519 1519
 			print '</td>';
@@ -1538,15 +1538,15 @@  discard block
 block discarded – undo
1538 1538
 		print '<div class="clearboth"></div><br>';
1539 1539
 
1540 1540
 		// Lines
1541
-		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
1542
-        	<input type="hidden" name="token" value="' . newToken() . '">
1543
-        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
1541
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
1542
+        	<input type="hidden" name="token" value="' . newToken().'">
1543
+        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
1544 1544
         	<input type="hidden" name="mode" value="">
1545
-        	<input type="hidden" name="id" value="' . $object->id . '">
1545
+        	<input type="hidden" name="id" value="' . $object->id.'">
1546 1546
         	';
1547 1547
 
1548 1548
 		if (!empty($conf->use_javascript_ajax) && $object->statut == 0) {
1549
-			include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
1549
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
1550 1550
 		}
1551 1551
 
1552 1552
 		print '<div class="div-table-responsive-no-min">';
@@ -1600,24 +1600,24 @@  discard block
 block discarded – undo
1600 1600
 		if (empty($object->suspended)) {
1601 1601
 			if ($usercancreate) {
1602 1602
 				if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
1603
-					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1603
+					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
1604 1604
 				} else {
1605 1605
 					if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
1606
-						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>';
1606
+						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>';
1607 1607
 					} else {
1608
-						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1608
+						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
1609 1609
 					}
1610 1610
 				}
1611 1611
 			} else {
1612
-				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>';
1612
+				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>';
1613 1613
 			}
1614 1614
 		}
1615 1615
 
1616 1616
 		if ($usercancreate) {
1617 1617
 			if (empty($object->suspended)) {
1618
-				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>';
1618
+				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>';
1619 1619
 			} else {
1620
-				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>';
1620
+				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>';
1621 1621
 			}
1622 1622
 		}
1623 1623
 
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
259 259
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
260 260
 					$tmp = explode(':', $typeofdata);
261
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
261
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.(empty($tmp[1]) ? '' : $tmp[1]).'/>';
262 262
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {	// if wysiwyg is enabled $typeofdata = 'ckeditor'
263 263
 					$tmp = explode(':', $typeofdata);
264 264
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 					$ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
324 324
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
325 325
 					$tmp = explode(':', $typeofdata);
326
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($tmp[1] ? $tmp[1] : '') . '/>';
326
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($tmp[1] ? $tmp[1] : '').'/>';
327 327
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
328 328
 					$ret .= dol_htmlentitiesbr($value);
329 329
 				} elseif (preg_match('/^safehtmlstring/', $typeofdata)) {
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 		if (!$htmltext) {
612 612
 			return $text;
613 613
 		}
614
-		$direction = (int) $direction;	// For backward compatibility when $direction was set to '' instead of 0
614
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
615 615
 
616 616
 		$tag = 'td';
617 617
 		if ($notabs == 2) {
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 
925 925
 					$countryArray[$i]['rowid'] = $obj->rowid;
926 926
 					$countryArray[$i]['code_iso'] = $obj->code_iso;
927
-					$countryArray[$i]['code_iso3'] 	= $obj->code_iso3;
927
+					$countryArray[$i]['code_iso3'] = $obj->code_iso3;
928 928
 					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
929 929
 					$countryArray[$i]['favorite'] = $obj->favorite;
930 930
 					$countryArray[$i]['eec'] = $obj->eec;
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 				$ajaxoptions = array();
1287 1287
 			}
1288 1288
 
1289
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1289
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1290 1290
 
1291 1291
 			// No immediate load of all database
1292 1292
 			$placeholder = '';
@@ -1745,11 +1745,11 @@  discard block
 block discarded – undo
1745 1745
 				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1746 1746
 			}
1747 1747
 
1748
-			if ($showempty && ! is_numeric($showempty)) {
1748
+			if ($showempty && !is_numeric($showempty)) {
1749 1749
 				$textforempty = $showempty;
1750 1750
 				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1751 1751
 			} else {
1752
-				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && ! $multiple) {
1752
+				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1753 1753
 					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1754 1754
 				}
1755 1755
 				if ($showempty == 2) {
@@ -2475,15 +2475,15 @@  discard block
 block discarded – undo
2475 2475
 		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2476 2476
 
2477 2477
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2478
-		$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2479
-		$sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
2480
-		if (!empty($status)) $sql.= ' AND status = '. (int) $status;
2481
-		if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
2478
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2479
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2480
+		if (!empty($status)) $sql .= ' AND status = '.(int) $status;
2481
+		if (!empty($type)) $sql .= ' AND bomtype = '.(int) $type;
2482 2482
 		if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2483
-		if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
2483
+		if (!empty($limit)) $sql .= ' LIMIT '.(int) $limit;
2484 2484
 		$resql = $db->query($sql);
2485 2485
 		if ($resql) {
2486
-			if ($showempty)	{
2486
+			if ($showempty) {
2487 2487
 				$out .= '<option value="-1"';
2488 2488
 				if (empty($selected)) $out .= ' selected';
2489 2489
 				$out .= '>&nbsp;</option>';
@@ -2493,7 +2493,7 @@  discard block
 block discarded – undo
2493 2493
 				$res = $product->fetch($obj->fk_product);
2494 2494
 				$out .= '<option value="'.$obj->rowid.'"';
2495 2495
 				if ($obj->rowid == $selected) $out .= 'selected';
2496
-				$out .= '>'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
2496
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2497 2497
 			}
2498 2498
 		} else {
2499 2499
 			$error++;
@@ -2995,7 +2995,7 @@  discard block
 block discarded – undo
2995 2995
 		$opt .= '>';
2996 2996
 		$opt .= $objp->ref;
2997 2997
 		if (!empty($objp->custref)) {
2998
-			$opt.= ' (' . $objp->custref . ')';
2998
+			$opt .= ' ('.$objp->custref.')';
2999 2999
 		}
3000 3000
 		if ($outbarcode) {
3001 3001
 			$opt .= ' ('.$outbarcode.')';
@@ -3007,7 +3007,7 @@  discard block
 block discarded – undo
3007 3007
 
3008 3008
 		$objRef = $objp->ref;
3009 3009
 		if (!empty($objp->custref)) {
3010
-			$objRef .= ' (' . $objp->custref . ')';
3010
+			$objRef .= ' ('.$objp->custref.')';
3011 3011
 		}
3012 3012
 		if (!empty($filterkey) && $filterkey != '') {
3013 3013
 			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
@@ -3055,11 +3055,11 @@  discard block
 block discarded – undo
3055 3055
 					$outprice_ttc = price($objp2->price_ttc);
3056 3056
 					$outpricebasetype = $objp2->price_base_type;
3057 3057
 					if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {  // using this option is a bug. kept for backward compatibility
3058
-						$outtva_tx = $objp2->tva_tx;						// We use the vat rate on line of multiprice
3059
-						$outdefault_vat_code = $objp2->default_vat_code;	// We use the vat code on line of multiprice
3058
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3059
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3060 3060
 					} else {
3061
-						$outtva_tx = $objp->tva_tx;							// We use the vat rate of product, not the one on line of multiprice
3062
-						$outdefault_vat_code = $objp->default_vat_code;		// We use the vat code or product, not the one on line of multiprice
3061
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3062
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3063 3063
 					}
3064 3064
 				}
3065 3065
 			} else {
@@ -3087,8 +3087,8 @@  discard block
 block discarded – undo
3087 3087
 			$outprice_ht = price($objp->unitprice);
3088 3088
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3089 3089
 			$outpricebasetype = $objp->price_base_type;
3090
-			$outtva_tx = $objp->tva_tx;							// This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3091
-			$outdefault_vat_code = $objp->default_vat_code;		// This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3090
+			$outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3091
+			$outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3092 3092
 		}
3093 3093
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3094 3094
 			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
@@ -3594,9 +3594,9 @@  discard block
 block discarded – undo
3594 3594
 					'value' => $outref,
3595 3595
 					'label' => $outvallabel,
3596 3596
 					'qty' => $outqty,
3597
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),	// Keep higher resolution for price for the min qty
3598
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),	// This is used to fill the Unit Price
3599
-					'price_ht' => price2num($objp->unitprice, 'MU'),		// This is used to fill the Unit Price (for compatibility)
3597
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
3598
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
3599
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
3600 3600
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
3601 3601
 					'tva_tx' => price2num($objp->tva_tx),
3602 3602
 					'default_vat_code' => $objp->default_vat_code,
@@ -3621,18 +3621,18 @@  discard block
 block discarded – undo
3621 3621
 				// Add new entry
3622 3622
 				// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
3623 3623
 				// "label" value of json key array is used by jQuery automatically as text for combo box
3624
-				$out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "</option>\n";
3624
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
3625 3625
 				array_push(
3626 3626
 					$outarray,
3627 3627
 					array('key'=>$outkey,
3628 3628
 						'value'=>$outref,
3629 3629
 						'label'=>$outvallabel,
3630 3630
 						'qty'=>$outqty,
3631
-						'price_qty_ht'=>price2num($objp->fprice, 'MU'),		// Keep higher resolution for price for the min qty
3631
+						'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
3632 3632
 						'price_qty_ht_locale'=>price($objp->fprice),
3633
-						'price_unit_ht'=>price2num($objp->unitprice, 'MU'),	// This is used to fill the Unit Price
3633
+						'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
3634 3634
 						'price_unit_ht_locale'=>price($objp->unitprice),
3635
-						'price_ht'=>price2num($objp->unitprice, 'MU'),		// This is used to fill the Unit Price (for compatibility)
3635
+						'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
3636 3636
 						'tva_tx_formated' => price($objp->tva_tx),
3637 3637
 						'tva_tx'=>price2num($objp->tva_tx),
3638 3638
 						'default_vat_code'=>$objp->default_vat_code,
@@ -3889,7 +3889,7 @@  discard block
 block discarded – undo
3889 3889
 		// phpcs:enable
3890 3890
 		global $langs;
3891 3891
 
3892
-		$num = count($this->cache_availability);	// TODO Use $conf->cache['availability'] instead of $this->cache_availability
3892
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
3893 3893
 		if ($num > 0) {
3894 3894
 			return 0; // Cache already loaded
3895 3895
 		}
@@ -3973,7 +3973,7 @@  discard block
 block discarded – undo
3973 3973
 	{
3974 3974
 		global $langs;
3975 3975
 
3976
-		$num = count($this->cache_demand_reason);	// TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
3976
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
3977 3977
 		if ($num > 0) {
3978 3978
 			return 0; // Cache already loaded
3979 3979
 		}
@@ -4069,7 +4069,7 @@  discard block
 block discarded – undo
4069 4069
 		// phpcs:enable
4070 4070
 		global $langs;
4071 4071
 
4072
-		$num = count($this->cache_types_paiements);		// TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4072
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4073 4073
 		if ($num > 0) {
4074 4074
 			return $num; // Cache already loaded
4075 4075
 		}
@@ -4164,9 +4164,9 @@  discard block
 block discarded – undo
4164 4164
 			$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
4165 4165
 		}
4166 4166
 
4167
-		$out.=  '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4167
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4168 4168
 		if ($addempty) {
4169
-			$out.=  '<option value="0">&nbsp;</option>';
4169
+			$out .= '<option value="0">&nbsp;</option>';
4170 4170
 		}
4171 4171
 
4172 4172
 		$selectedDepositPercent = null;
@@ -4178,9 +4178,9 @@  discard block
 block discarded – undo
4178 4178
 
4179 4179
 			if ($selected == $id) {
4180 4180
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4181
-				$out .= '<option value="'.$id.'" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4181
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4182 4182
 			} else {
4183
-				$out .= '<option value="'.$id.'" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4183
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4184 4184
 			}
4185 4185
 			$label = $arrayconditions['label'];
4186 4186
 
@@ -4188,24 +4188,24 @@  discard block
 block discarded – undo
4188 4188
 				$label = str_replace('__DEPOSIT_PERCENT__', $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'], $label);
4189 4189
 			}
4190 4190
 
4191
-			$out.= $label;
4192
-			$out.= '</option>';
4191
+			$out .= $label;
4192
+			$out .= '</option>';
4193 4193
 		}
4194
-		$out.=  '</select>';
4194
+		$out .= '</select>';
4195 4195
 		if ($user->admin && empty($noinfoadmin)) {
4196
-			$out.=  info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4196
+			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4197 4197
 		}
4198
-		$out.=  ajax_combobox($htmlname);
4198
+		$out .= ajax_combobox($htmlname);
4199 4199
 
4200 4200
 		if ($deposit_percent >= 0) {
4201
-			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4202
-			$out .= $langs->trans('DepositPercent') . ' : ';
4203
-			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="' . strval($deposit_percent) . '" />';
4201
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4202
+			$out .= $langs->trans('DepositPercent').' : ';
4203
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.strval($deposit_percent).'" />';
4204 4204
 			$out .= '</span>';
4205 4205
 			$out .= '
4206 4206
 				<script>
4207 4207
 					$(document).ready(function () {
4208
-						$("#' . $htmlname . '").change(function () {
4208
+						$("#' . $htmlname.'").change(function () {
4209 4209
 							let $selected = $(this).find("option:selected");
4210 4210
 							let depositPercent = $selected.attr("data-deposit_percent");
4211 4211
 
@@ -4378,7 +4378,7 @@  discard block
 block discarded – undo
4378 4378
 		// phpcs:enable
4379 4379
 		global $langs;
4380 4380
 
4381
-		$num = count($this->cache_transport_mode);		// TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4381
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4382 4382
 		if ($num > 0) {
4383 4383
 			return $num; // Cache already loaded
4384 4384
 		}
@@ -4536,7 +4536,7 @@  discard block
 block discarded – undo
4536 4536
 					$i++;
4537 4537
 				}
4538 4538
 				print "</select>";
4539
-				if ($user->admin  && empty($noinfoadmin)) {
4539
+				if ($user->admin && empty($noinfoadmin)) {
4540 4540
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4541 4541
 				}
4542 4542
 
@@ -5061,13 +5061,13 @@  discard block
 block discarded – undo
5061 5061
 			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5062 5062
 			foreach ($formquestion as $key => $input) {
5063 5063
 				if (is_array($input) && !empty($input)) {
5064
-					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : '');	// deprecated. Use morecss instead.
5064
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5065 5065
 					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5066 5066
 					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5067 5067
 
5068 5068
 					if ($input['type'] == 'text') {
5069 5069
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
5070
-					} elseif ($input['type'] == 'password')	{
5070
+					} elseif ($input['type'] == 'password') {
5071 5071
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
5072 5072
 					} elseif ($input['type'] == 'textarea') {
5073 5073
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
@@ -7048,7 +7048,7 @@  discard block
 block discarded – undo
7048 7048
 			$retstring .= ' '.$langs->trans('MinuteShort');
7049 7049
 		}
7050 7050
 
7051
-		$retstring.="</span>";
7051
+		$retstring .= "</span>";
7052 7052
 
7053 7053
 		if (!empty($nooutput)) {
7054 7054
 			return $retstring;
@@ -7726,9 +7726,9 @@  discard block
 block discarded – undo
7726 7726
 		$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
7727 7727
 		$reg = array();
7728 7728
 		if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
7729
-			$InfoFieldList[4] = $reg[1];	// take the sort field
7729
+			$InfoFieldList[4] = $reg[1]; // take the sort field
7730 7730
 		}
7731
-		$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);	// take the filter field
7731
+		$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
7732 7732
 
7733 7733
 		$classname = $InfoFieldList[0];
7734 7734
 		$classpath = $InfoFieldList[1];
@@ -7785,7 +7785,7 @@  discard block
 block discarded – undo
7785 7785
 			// Activate the auto complete using ajax call.
7786 7786
 			$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
7787 7787
 			$out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>';
7788
-			$out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '') .' />';
7788
+			$out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' />';
7789 7789
 		} else {
7790 7790
 			// Immediate load of table record.
7791 7791
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8197,7 +8197,7 @@  discard block
 block discarded – undo
8197 8197
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
8198 8198
 	{
8199 8199
 		global $conf, $langs;
8200
-		global $delayedhtmlcontent;	// Will be used later outside of this function
8200
+		global $delayedhtmlcontent; // Will be used later outside of this function
8201 8201
 
8202 8202
 		// TODO Use an internal dolibarr component instead of select2
8203 8203
 		if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
@@ -8301,7 +8301,7 @@  discard block
 block discarded – undo
8301 8301
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
8302 8302
 	{
8303 8303
 		global $conf, $langs;
8304
-		global $delayedhtmlcontent;	// Will be used later outside of this function
8304
+		global $delayedhtmlcontent; // Will be used later outside of this function
8305 8305
 
8306 8306
 		// TODO Use an internal dolibarr component instead of select2
8307 8307
 		if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
@@ -8970,15 +8970,15 @@  discard block
 block discarded – undo
8970 8970
 				print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
8971 8971
 
8972 8972
 				if (!empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) {
8973
-					print '<br><form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
8974
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
8973
+					print '<br><form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
8974
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
8975 8975
 					print '<input type="hidden" name="action" value="addlinkbyref">';
8976 8976
 					print '<input type="hidden" name="token" value="'.newToken().'">';
8977
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
8977
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
8978 8978
 					print '<table class="noborder">';
8979 8979
 					print '<tr>';
8980
-					print '<td>' . $langs->trans("Ref") . '</td>';
8981
-					print '<td><input type="text" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;<input type="submit" class="button valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
8980
+					print '<td>'.$langs->trans("Ref").'</td>';
8981
+					print '<td><input type="text" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;<input type="submit" class="button valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
8982 8982
 					print '</tr>';
8983 8983
 					print '</table>';
8984 8984
 					print '</form>';
@@ -9470,7 +9470,7 @@  discard block
 block discarded – undo
9470 9470
 				}
9471 9471
 			}
9472 9472
 			$email = $object->email;
9473
-		} elseif ($modulepart == 'contact')	{
9473
+		} elseif ($modulepart == 'contact') {
9474 9474
 			$dir = $conf->societe->multidir_output[$entity].'/contact';
9475 9475
 			if (!empty($object->photo)) {
9476 9476
 				if (dolIsAllowedForPreview($object->photo)) {
@@ -9505,7 +9505,7 @@  discard block
 block discarded – undo
9505 9505
 			}
9506 9506
 			$email = $object->email;
9507 9507
 			$capture = 'user';
9508
-		} elseif ($modulepart == 'memberphoto')	{
9508
+		} elseif ($modulepart == 'memberphoto') {
9509 9509
 			$dir = $conf->adherent->dir_output;
9510 9510
 			if (!empty($object->photo)) {
9511 9511
 				if (dolIsAllowedForPreview($object->photo)) {
@@ -9578,7 +9578,7 @@  discard block
 block discarded – undo
9578 9578
 				}
9579 9579
 			} else {
9580 9580
 				$nophoto = '/public/theme/common/nophoto.png';
9581
-				$defaultimg = 'identicon';		// For gravatar
9581
+				$defaultimg = 'identicon'; // For gravatar
9582 9582
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {	// For modules that need a special image when photo not found
9583 9583
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && strpos($object->morphy, 'mor')) !== false) {
9584 9584
 						$nophoto = 'company';
@@ -9619,7 +9619,7 @@  discard block
 block discarded – undo
9619 9619
 				$maxfilesizearray = getMaxFileSizeArray();
9620 9620
 				$maxmin = $maxfilesizearray['maxmin'];
9621 9621
 				if ($maxmin > 0) {
9622
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
9622
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
9623 9623
 				}
9624 9624
 				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
9625 9625
 				$ret .= '</td></tr>';
@@ -10182,22 +10182,22 @@  discard block
 block discarded – undo
10182 10182
 
10183 10183
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
10184 10184
 		//$sql.= ', el.fk_source';
10185
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
10186
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
10185
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
10186
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
10187 10187
 		$sql .= " ORDER BY f.titre ASC";
10188 10188
 
10189 10189
 		$resql = $this->db->query($sql);
10190 10190
 		if ($resql) {
10191 10191
 			// Use select2 selector
10192 10192
 			if (!empty($conf->use_javascript_ajax)) {
10193
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10193
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10194 10194
 				$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
10195 10195
 				$out .= $comboenhancement;
10196 10196
 				$morecss = 'minwidth200imp maxwidth500';
10197 10197
 			}
10198 10198
 
10199 10199
 			if (empty($option_only)) {
10200
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10200
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10201 10201
 			}
10202 10202
 			if (!empty($show_empty)) {
10203 10203
 				$out .= '<option value="0" class="optiongrey">';
@@ -10216,19 +10216,19 @@  discard block
 block discarded – undo
10216 10216
 					$disabled = 0;
10217 10217
 					if (!empty($obj->suspended)) {
10218 10218
 						$disabled = 1;
10219
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
10219
+						$labeltoshow .= ' - '.$langs->trans("Closed");
10220 10220
 					}
10221 10221
 
10222 10222
 
10223 10223
 					if (!empty($selected) && $selected == $obj->rowid) {
10224
-						$out .= '<option value="' . $obj->rowid . '" selected';
10224
+						$out .= '<option value="'.$obj->rowid.'" selected';
10225 10225
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10226
-						$out .= '>' . $labeltoshow . '</option>';
10226
+						$out .= '>'.$labeltoshow.'</option>';
10227 10227
 					} else {
10228 10228
 						if ($disabled && ($selected != $obj->rowid)) {
10229 10229
 							$resultat = '';
10230 10230
 						} else {
10231
-							$resultat = '<option value="' . $obj->rowid . '"';
10231
+							$resultat = '<option value="'.$obj->rowid.'"';
10232 10232
 							if ($disabled) {
10233 10233
 								$resultat .= ' disabled';
10234 10234
 							}
@@ -10249,7 +10249,7 @@  discard block
 block discarded – undo
10249 10249
 			$this->db->free($resql);
10250 10250
 			return $num;
10251 10251
 		} else {
10252
-			$this->errors[]=$this->db->lasterror;
10252
+			$this->errors[] = $this->db->lasterror;
10253 10253
 			return -1;
10254 10254
 		}
10255 10255
 	}
@@ -10411,7 +10411,7 @@  discard block
 block discarded – undo
10411 10411
 			'label_key' => $save_label,
10412 10412
 		);
10413 10413
 
10414
-		if ($save_label == 'Create' || $save_label == 'Add' ) {
10414
+		if ($save_label == 'Create' || $save_label == 'Add') {
10415 10415
 			$save['name'] = 'add';
10416 10416
 		} elseif ($save_label == 'Modify') {
10417 10417
 			$save['name'] = 'edit';
@@ -10430,13 +10430,13 @@  discard block
 block discarded – undo
10430 10430
 
10431 10431
 		!empty($cancel_label) ? $buttons[] = $cancel : '';
10432 10432
 
10433
-		$retstring = $withoutdiv ? '': '<div class="center">';
10433
+		$retstring = $withoutdiv ? '' : '<div class="center">';
10434 10434
 
10435 10435
 		foreach ($buttons as $button) {
10436 10436
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
10437 10437
 			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
10438 10438
 		}
10439
-		$retstring .= $withoutdiv ? '': '</div>';
10439
+		$retstring .= $withoutdiv ? '' : '</div>';
10440 10440
 
10441 10441
 		if ($dol_openinpopup) {
10442 10442
 			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";
Please login to merge, or discard this patch.
Braces   +99 added lines, -37 removed lines patch added patch discarded remove patch
@@ -2477,22 +2477,34 @@  discard block
 block discarded – undo
2477 2477
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2478 2478
 		$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2479 2479
 		$sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
2480
-		if (!empty($status)) $sql.= ' AND status = '. (int) $status;
2481
-		if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
2482
-		if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2483
-		if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
2480
+		if (!empty($status)) {
2481
+			$sql.= ' AND status = '. (int) $status;
2482
+		}
2483
+		if (!empty($type)) {
2484
+			$sql.= ' AND bomtype = '. (int) $type;
2485
+		}
2486
+		if (!empty($TProducts)) {
2487
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2488
+		}
2489
+		if (!empty($limit)) {
2490
+			$sql.= ' LIMIT '. (int) $limit;
2491
+		}
2484 2492
 		$resql = $db->query($sql);
2485 2493
 		if ($resql) {
2486 2494
 			if ($showempty)	{
2487 2495
 				$out .= '<option value="-1"';
2488
-				if (empty($selected)) $out .= ' selected';
2496
+				if (empty($selected)) {
2497
+					$out .= ' selected';
2498
+				}
2489 2499
 				$out .= '>&nbsp;</option>';
2490 2500
 			}
2491 2501
 			while ($obj = $db->fetch_object($resql)) {
2492 2502
 				$product = new Product($db);
2493 2503
 				$res = $product->fetch($obj->fk_product);
2494 2504
 				$out .= '<option value="'.$obj->rowid.'"';
2495
-				if ($obj->rowid == $selected) $out .= 'selected';
2505
+				if ($obj->rowid == $selected) {
2506
+					$out .= 'selected';
2507
+				}
2496 2508
 				$out .= '>'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
2497 2509
 			}
2498 2510
 		} else {
@@ -7084,7 +7096,9 @@  discard block
 block discarded – undo
7084 7096
 		$out = '';
7085 7097
 
7086 7098
 		// check parameters
7087
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7099
+		if (is_null($ajaxoptions)) {
7100
+			$ajaxoptions = array();
7101
+		}
7088 7102
 
7089 7103
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7090 7104
 			$placeholder = '';
@@ -7100,8 +7114,9 @@  discard block
 block discarded – undo
7100 7114
 			$urloption = '';
7101 7115
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7102 7116
 
7103
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7104
-			elseif ($hidelabel > 1) {
7117
+			if (empty($hidelabel)) {
7118
+				$out .= $langs->trans("RefOrLabel").' : ';
7119
+			} elseif ($hidelabel > 1) {
7105 7120
 				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7106 7121
 				if ($hidelabel == 2) {
7107 7122
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7161,14 +7176,20 @@  discard block
 block discarded – undo
7161 7176
 			// For natural search
7162 7177
 			$scrit = explode(' ', $filterkey);
7163 7178
 			$i = 0;
7164
-			if (count($scrit) > 1) $sql .= "(";
7179
+			if (count($scrit) > 1) {
7180
+				$sql .= "(";
7181
+			}
7165 7182
 			foreach ($scrit as $crit) {
7166
-				if ($i > 0) $sql .= " AND ";
7183
+				if ($i > 0) {
7184
+					$sql .= " AND ";
7185
+				}
7167 7186
 				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7168 7187
 				$sql .= ")";
7169 7188
 				$i++;
7170 7189
 			}
7171
-			if (count($scrit) > 1) $sql .= ")";
7190
+			if (count($scrit) > 1) {
7191
+				$sql .= ")";
7192
+			}
7172 7193
 			$sql .= ')';
7173 7194
 		}
7174 7195
 
@@ -7196,12 +7217,19 @@  discard block
 block discarded – undo
7196 7217
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7197 7218
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7198 7219
 			if (!empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7199
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7200
-				else $textifempty .= $langs->trans("All");
7220
+				if ($showempty && !is_numeric($showempty)) {
7221
+					$textifempty = $langs->trans($showempty);
7222
+				} else {
7223
+					$textifempty .= $langs->trans("All");
7224
+				}
7201 7225
 			} else {
7202
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7226
+				if ($showempty && !is_numeric($showempty)) {
7227
+					$textifempty = $langs->trans($showempty);
7228
+				}
7229
+			}
7230
+			if ($showempty) {
7231
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7203 7232
 			}
7204
-			if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
7205 7233
 
7206 7234
 			$i = 0;
7207 7235
 			while ($num && $i < $num) {
@@ -7260,7 +7288,9 @@  discard block
 block discarded – undo
7260 7288
 		$opt .= '>';
7261 7289
 		$opt .= $objp->ref;
7262 7290
 		$objRef = $objp->ref;
7263
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7291
+		if (!empty($filterkey) && $filterkey != '') {
7292
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7293
+		}
7264 7294
 
7265 7295
 		$opt .= "</option>\n";
7266 7296
 		$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
@@ -7292,7 +7322,9 @@  discard block
 block discarded – undo
7292 7322
 		$out = '';
7293 7323
 
7294 7324
 		// check parameters
7295
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7325
+		if (is_null($ajaxoptions)) {
7326
+			$ajaxoptions = array();
7327
+		}
7296 7328
 
7297 7329
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7298 7330
 			$placeholder = '';
@@ -7307,8 +7339,9 @@  discard block
 block discarded – undo
7307 7339
 
7308 7340
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7309 7341
 
7310
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7311
-			elseif ($hidelabel > 1) {
7342
+			if (empty($hidelabel)) {
7343
+				$out .= $langs->trans("RefOrLabel").' : ';
7344
+			} elseif ($hidelabel > 1) {
7312 7345
 				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7313 7346
 				if ($hidelabel == 2) {
7314 7347
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7367,14 +7400,20 @@  discard block
 block discarded – undo
7367 7400
 			// For natural search
7368 7401
 			$scrit = explode(' ', $filterkey);
7369 7402
 			$i = 0;
7370
-			if (count($scrit) > 1) $sql .= "(";
7403
+			if (count($scrit) > 1) {
7404
+				$sql .= "(";
7405
+			}
7371 7406
 			foreach ($scrit as $crit) {
7372
-				if ($i > 0) $sql .= " AND ";
7407
+				if ($i > 0) {
7408
+					$sql .= " AND ";
7409
+				}
7373 7410
 				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
7374 7411
 				$sql .= "";
7375 7412
 				$i++;
7376 7413
 			}
7377
-			if (count($scrit) > 1) $sql .= ")";
7414
+			if (count($scrit) > 1) {
7415
+				$sql .= ")";
7416
+			}
7378 7417
 			$sql .= ')';
7379 7418
 		}
7380 7419
 
@@ -7402,12 +7441,19 @@  discard block
 block discarded – undo
7402 7441
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7403 7442
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7404 7443
 			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
7405
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7406
-				else $textifempty .= $langs->trans("All");
7444
+				if ($showempty && !is_numeric($showempty)) {
7445
+					$textifempty = $langs->trans($showempty);
7446
+				} else {
7447
+					$textifempty .= $langs->trans("All");
7448
+				}
7407 7449
 			} else {
7408
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7450
+				if ($showempty && !is_numeric($showempty)) {
7451
+					$textifempty = $langs->trans($showempty);
7452
+				}
7453
+			}
7454
+			if ($showempty) {
7455
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7409 7456
 			}
7410
-			if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
7411 7457
 
7412 7458
 			$i = 0;
7413 7459
 			while ($num && $i < $num) {
@@ -7469,7 +7515,9 @@  discard block
 block discarded – undo
7469 7515
 		$opt .= '>';
7470 7516
 		$opt .= $objp->ref;
7471 7517
 		$objRef = $objp->ref;
7472
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7518
+		if (!empty($filterkey) && $filterkey != '') {
7519
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7520
+		}
7473 7521
 
7474 7522
 		$opt .= "</option>\n";
7475 7523
 		$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
@@ -7502,7 +7550,9 @@  discard block
 block discarded – undo
7502 7550
 		$out = '';
7503 7551
 
7504 7552
 		// check parameters
7505
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7553
+		if (is_null($ajaxoptions)) {
7554
+			$ajaxoptions = array();
7555
+		}
7506 7556
 
7507 7557
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7508 7558
 			$placeholder = '';
@@ -7520,8 +7570,9 @@  discard block
 block discarded – undo
7520 7570
 
7521 7571
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7522 7572
 
7523
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7524
-			elseif ($hidelabel > 1) {
7573
+			if (empty($hidelabel)) {
7574
+				$out .= $langs->trans("RefOrLabel").' : ';
7575
+			} elseif ($hidelabel > 1) {
7525 7576
 				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7526 7577
 				if ($hidelabel == 2) {
7527 7578
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7582,14 +7633,20 @@  discard block
 block discarded – undo
7582 7633
 			// For natural search
7583 7634
 			$scrit = explode(' ', $filterkey);
7584 7635
 			$i = 0;
7585
-			if (count($scrit) > 1) $sql .= "(";
7636
+			if (count($scrit) > 1) {
7637
+				$sql .= "(";
7638
+			}
7586 7639
 			foreach ($scrit as $crit) {
7587
-				if ($i > 0) $sql .= " AND ";
7640
+				if ($i > 0) {
7641
+					$sql .= " AND ";
7642
+				}
7588 7643
 				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
7589 7644
 				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
7590 7645
 				$i++;
7591 7646
 			}
7592
-			if (count($scrit) > 1) $sql .= ")";
7647
+			if (count($scrit) > 1) {
7648
+				$sql .= ")";
7649
+			}
7593 7650
 			$sql .= ')';
7594 7651
 		}
7595 7652
 		if ($status != -1) {
@@ -7619,10 +7676,15 @@  discard block
 block discarded – undo
7619 7676
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7620 7677
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7621 7678
 			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
7622
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7623
-				else $textifempty .= $langs->trans("All");
7679
+				if ($showempty && !is_numeric($showempty)) {
7680
+					$textifempty = $langs->trans($showempty);
7681
+				} else {
7682
+					$textifempty .= $langs->trans("All");
7683
+				}
7624 7684
 			} else {
7625
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7685
+				if ($showempty && !is_numeric($showempty)) {
7686
+					$textifempty = $langs->trans($showempty);
7687
+				}
7626 7688
 			}
7627 7689
 			if ($showempty) {
7628 7690
 				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
Please login to merge, or discard this patch.
htdocs/core/modules/facture/doc/pdf_crabe.modules.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				// $pdf->GetY() here can't be used. It is bottom of the second addresse box but first one may be higher
449 449
 
450 450
 				// $tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
451
-				$tab_top = 90 + $top_shift;		// top_shift is an addition for linked objects or addons (0 in most cases)
451
+				$tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
452 452
 				$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
453 453
 
454 454
 				// You can add more thing under header here, if you increase $extra_under_address_shift too.
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 					if (!isset($this->tva[$vatrate])) {
775 775
 						$this->tva[$vatrate] = 0;
776 776
 					}
777
-					$this->tva[$vatrate] += $tvaligne;	// ->tva is abandonned, we use now ->tva_array that is more complete
777
+					$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
778 778
 					$vatcode = $object->lines[$i]->vat_src_code;
779 779
 					if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
780 780
 						$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
 			$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
1143 1143
 			$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');
1144 1144
 
1145
-			$posy = $pdf->GetY() + 3;	// We need spaces for 2 lines payment conditions
1145
+			$posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions
1146 1146
 		}
1147 1147
 
1148 1148
 		if ($object->type != 2) {
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 					require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1184 1184
 					$bac = new CompanyBankAccount($this->db);
1185 1185
 					$bac->fetch(0, $object->thirdparty->id);
1186
-					$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
1186
+					$iban = $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
1187 1187
 					$lib_mode_reg .= $outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
1188 1188
 				}
1189 1189
 				$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
 
2037 2037
 			$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
2038 2038
 
2039
-			$mode =  'target';
2039
+			$mode = 'target';
2040 2040
 			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
2041 2041
 
2042 2042
 			// Show recipient
@@ -2079,11 +2079,11 @@  discard block
 block discarded – undo
2079 2079
 				if (!empty($idaddressshipping)) {
2080 2080
 					$contactshipping = $object->fetch_Contact($idaddressshipping[0]);
2081 2081
 					$object->fetch_thirdparty($object->contact->fk_soc);
2082
-					$carac_client_name_shipping=pdfBuildThirdpartyName($object->contact, $outputlangs);
2082
+					$carac_client_name_shipping = pdfBuildThirdpartyName($object->contact, $outputlangs);
2083 2083
 					$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object);
2084 2084
 				} else {
2085
-					$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
2086
-					$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
2085
+					$carac_client_name_shipping = pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
2086
+					$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
2087 2087
 				}
2088 2088
 				if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) {
2089 2089
 					$posy += $hautcadre;
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 					$posy = $pdf->getY();
2103 2103
 
2104 2104
 					// Show shipping information
2105
-					$pdf->SetXY($posx+2, $posy);
2105
+					$pdf->SetXY($posx + 2, $posy);
2106 2106
 					$pdf->SetFont('', '', $default_font_size - 1);
2107 2107
 					$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping, '', 'L');
2108 2108
 					$top_shift += $hautcadre;
Please login to merge, or discard this patch.
htdocs/core/modules/facture/doc/pdf_sponge.modules.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 				// $pdf->GetY() here can't be used. It is bottom of the second addresse box but first one may be higher
489 489
 
490 490
 				// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
491
-				$this->tab_top = 90 + $top_shift + $shipp_shift;		// top_shift is an addition for linked objects or addons (0 in most cases)
491
+				$this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
492 492
 				$this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
493 493
 
494 494
 				// You can add more thing under header here, if you increase $extra_under_address_shift too.
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 					if (!isset($this->tva[$vatrate])) {
960 960
 						$this->tva[$vatrate] = 0;
961 961
 					}
962
-					$this->tva[$vatrate] += $tvaligne;	// ->tva is abandonned, we use now ->tva_array that is more complete
962
+					$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
963 963
 					$vatcode = $object->lines[$i]->vat_src_code;
964 964
 					if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
965 965
 						$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@@ -1248,8 +1248,8 @@  discard block
 block discarded – undo
1248 1248
 			$posy = $pdf->GetY() + 4;
1249 1249
 		}
1250 1250
 
1251
-		$posxval = 52;	// Position of values of properties shown on left side
1252
-		$posxend = 110;	// End of x for text on left side
1251
+		$posxval = 52; // Position of values of properties shown on left side
1252
+		$posxend = 110; // End of x for text on left side
1253 1253
 		if ($this->page_largeur < 210) { // To work with US executive format
1254 1254
 			$posxend -= 10;
1255 1255
 		}
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 
1280 1280
 			$pdf->SetFont('', '', $default_font_size - 2);
1281 1281
 			$pdf->SetXY($posxval, $posy);
1282
-			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
1282
+			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
1283 1283
 			$pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L');
1284 1284
 
1285 1285
 			$posy = $pdf->GetY() + 3; // for 2 lines
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 					require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1325 1325
 					$bac = new CompanyBankAccount($this->db);
1326 1326
 					$bac->fetch(0, $object->thirdparty->id);
1327
-					$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
1327
+					$iban = $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
1328 1328
 					$lib_mode_reg .= $outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
1329 1329
 				}
1330 1330
 
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
 		if (empty($hidetop)) {
2014 2014
 			// Show category of operations
2015 2015
 			if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) {
2016
-				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
2016
+				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
2017 2017
 				$pdf->SetXY($this->marge_gauche, $tab_top - 4);
2018 2018
 				$pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations);
2019 2019
 			}
@@ -2384,11 +2384,11 @@  discard block
 block discarded – undo
2384 2384
 				if (!empty($idaddressshipping)) {
2385 2385
 					$contactshipping = $object->fetch_Contact($idaddressshipping[0]);
2386 2386
 					$object->fetch_thirdparty($object->contact->fk_soc);
2387
-					$carac_client_name_shipping=pdfBuildThirdpartyName($object->contact, $outputlangs);
2387
+					$carac_client_name_shipping = pdfBuildThirdpartyName($object->contact, $outputlangs);
2388 2388
 					$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object);
2389 2389
 				} else {
2390
-					$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
2391
-					$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
2390
+					$carac_client_name_shipping = pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
2391
+					$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
2392 2392
 				}
2393 2393
 				if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) {
2394 2394
 					$posy += $hautcadre;
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
 					$posy = $pdf->getY();
2408 2408
 
2409 2409
 					// Show shipping information
2410
-					$pdf->SetXY($posx+2, $posy);
2410
+					$pdf->SetXY($posx + 2, $posy);
2411 2411
 					$pdf->SetFont('', '', $default_font_size - 1);
2412 2412
 					$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping, '', 'L');
2413 2413
 					$shipp_shift += $hautcadre;
Please login to merge, or discard this patch.
htdocs/core/modules/security/generate/modGeneratePassPerso.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 			return $pass;
195 195
 		}
196 196
 
197
-		return $this->getNewGeneratedPassword();	// warning, may generate infinite loop if conditions are not possible
197
+		return $this->getNewGeneratedPassword(); // warning, may generate infinite loop if conditions are not possible
198 198
 	}
199 199
 
200 200
 	/**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	{
209 209
 		global $langs;
210 210
 
211
-		$this->initAll();	// For the case this method is called alone
211
+		$this->initAll(); // For the case this method is called alone
212 212
 
213 213
 		$password_a = preg_split('//u', $password, null, PREG_SPLIT_NO_EMPTY);
214 214
 		$maj = preg_split('//u', $this->Maj, null, PREG_SPLIT_NO_EMPTY);
Please login to merge, or discard this patch.
htdocs/societe/list.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
 // Get parameters
53
-$action 	= GETPOST('action', 'aZ09');
53
+$action = GETPOST('action', 'aZ09');
54 54
 $massaction = GETPOST('massaction', 'alpha');
55 55
 $show_files = GETPOST('show_files', 'int');
56
-$confirm 	= GETPOST('confirm', 'alpha');
57
-$toselect 	= GETPOST('toselect', 'array');
56
+$confirm = GETPOST('confirm', 'alpha');
57
+$toselect = GETPOST('toselect', 'array');
58 58
 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartylist';
59 59
 $optioncss 	= GETPOST('optioncss', 'alpha');
60 60
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 			if ($searchCategoryCustomerOperator == 0) {
547 547
 				$searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).")";
548 548
 			} else {
549
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
549
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer);
550 550
 			}
551 551
 		}
552 552
 	}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 			if ($searchCategorySupplierOperator == 0) {
577 577
 				$searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")";
578 578
 			} else {
579
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
579
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategorySupplier);
580 580
 			}
581 581
 		}
582 582
 	}
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 		if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1623 1623
 			$typenArray = $formcompany->typent_array(1);
1624 1624
 		}
1625
-		$labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
1625
+		$labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
1626 1626
 
1627 1627
 		print '<td class="center tdoverflowmax125" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
1628 1628
 		print dol_escape_htmltag($labeltypeofcompany);
Please login to merge, or discard this patch.