Completed
Branch develop (cc6d96)
by
unknown
19:17
created
htdocs/fourn/facture/card-rec.php 1 patch
Spacing   +170 added lines, -170 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'));
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 	$page = 0;
82 82
 }     // If $page is not defined, or '' or -1
83 83
 $offset = $limit * $page;
84
-if (! $sortorder) {
84
+if (!$sortorder) {
85 85
 	$sortorder = 'DESC';
86 86
 }
87
-if (! $sortfield) {
87
+if (!$sortfield) {
88 88
 	$sortfield = 'f.titre';
89 89
 }
90 90
 $pageprev = $page - 1;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 $object = new FactureFournisseurRec($db);
94 94
 if (($id > 0 || $title) && $action != 'create' && $action != 'add') {
95 95
 	$ret = $object->fetch($id, $title);
96
-	if (! $ret) {
96
+	if (!$ret) {
97 97
 		setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
98 98
 	}
99 99
 }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	$action = 'list';
139 139
 	$massaction = '';
140 140
 }
141
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
141
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
142 142
 	$massaction = '';
143 143
 }
144 144
 
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	// Selection of new fields
157
-	include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
157
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
158 158
 
159 159
 	// Set note
160
-	include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once
160
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
161 161
 
162
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be include, not include_once
162
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
163 163
 
164
-	include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be include, not include_once
164
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
165 165
 
166 166
 	// Create predefined invoice
167 167
 	if ($action == 'add') {
168
-		if (! GETPOST('title', 'alphanohtml')) {
168
+		if (!GETPOST('title', 'alphanohtml')) {
169 169
 			setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
170 170
 			$action = "create";
171 171
 			$error++;
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 			}
189 189
 		}
190 190
 
191
-		if (! $error) {
191
+		if (!$error) {
192 192
 			$object->titre = GETPOST('title', 'alphanohtml'); // deprecated
193 193
 			$object->title = GETPOST('title', 'alphanohtml');
194
-			$object->libelle = GETPOST('libelle', 'alpha');	// deprecated
194
+			$object->libelle = GETPOST('libelle', 'alpha'); // deprecated
195 195
 			$object->label = GETPOST('libelle', 'alpha');
196 196
 			$object->fk_project = GETPOST('projectid', 'int');
197 197
 			$object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml');
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
 				$action = "create";
238 238
 			}
239 239
 
240
-			if (! $error) {
240
+			if (!$error) {
241 241
 				$db->commit();
242 242
 
243
-				header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id);
243
+				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id);
244 244
 				exit;
245 245
 			} else {
246 246
 				$db->rollback();
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && ($user->hasRight("fournisseur", "facture", "supprimer") || $user->hasRight("supplier_invoice", "supprimer"))) {
258 258
 		$object->delete($user);
259 259
 
260
-		header('Location: ' . DOL_URL_ROOT . '/fourn/facture/list-rec.php');
260
+		header('Location: '.DOL_URL_ROOT.'/fourn/facture/list-rec.php');
261 261
 		exit;
262 262
 	}
263 263
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$result = $object->setValueFrom('titre', $title, '', null, 'text', '', $user);
288 288
 
289 289
 		if ($result > 0) {
290
-			$object->titre = $title;	// deprecated
290
+			$object->titre = $title; // deprecated
291 291
 			$object->title = $title;
292 292
 			$object->ref = $object->title;
293 293
 		} else {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 			$error++;
335 335
 		}
336 336
 
337
-		if (! $error) {
337
+		if (!$error) {
338 338
 			$db->commit();
339 339
 		} else {
340 340
 			$db->rollback();
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			$error++;
352 352
 		}
353 353
 
354
-		if (! $error) {
354
+		if (!$error) {
355 355
 			$db->commit();
356 356
 		} else {
357 357
 			$db->rollback();
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 			$error++;
411 411
 		}
412 412
 
413
-		if (! $error) {
413
+		if (!$error) {
414 414
 			$result = $object->insertExtraFields('BILLREC_MODIFY');
415 415
 			if ($result < 0) {
416 416
 				setEventMessages($object->error, $object->errors, 'errors');
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 			$tva_tx = '';
440 440
 		}
441 441
 
442
-		$qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2);
443
-		$remise_percent = price2num(GETPOST('remise_percent' . $predef), '', 2);
442
+		$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
443
+		$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
444 444
 
445 445
 		// Extrafields
446 446
 		$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		if (is_array($extralabelsline)) {
450 450
 			// Get extra fields
451 451
 			foreach ($extralabelsline as $key => $value) {
452
-				unset($_POST["options_" . $key . $predef]);
452
+				unset($_POST["options_".$key.$predef]);
453 453
 			}
454 454
 		}
455 455
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
462 462
 			$error++;
463 463
 		}
464
-		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
464
+		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
465 465
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
466 466
 			$error++;
467 467
 		}
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 			}
511 511
 		}
512 512
 
513
-		if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
513
+		if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
514 514
 			$ret = $object->fetch($id);
515 515
 			if ($ret < 0) {
516 516
 				dol_print_error($db, $object->error);
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
 			$ret = $object->fetch_thirdparty();
520 520
 
521 521
 			// Clean parameters
522
-			$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'));
523
-			$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'));
522
+			$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'));
523
+			$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'));
524 524
 			$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
525 525
 
526 526
 			// Define special_code for special lines
@@ -617,23 +617,23 @@  discard block
 block discarded – undo
617 617
 							$outputlangs->load('products');
618 618
 						}
619 619
 						if (!empty($prod->customcode)) {
620
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
620
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
621 621
 						}
622 622
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
623 623
 							$tmptxt .= ' - ';
624 624
 						}
625 625
 						if (!empty($prod->country_code)) {
626
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
626
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $outputlangs, 0);
627 627
 						}
628 628
 					} else {
629 629
 						if (!empty($prod->customcode)) {
630
-							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
630
+							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
631 631
 						}
632 632
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
633 633
 							$tmptxt .= ' - ';
634 634
 						}
635 635
 						if (!empty($prod->country_code)) {
636
-							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
636
+							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $langs, 0);
637 637
 						}
638 638
 					}
639 639
 					$tmptxt .= ')';
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
 			$date_end_fill = !empty(GETPOST('date_end_fill', 'int')) ? GETPOST('date_end_fill', 'int') : null;
660 660
 
661 661
 			// Margin
662
-			$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
663
-			$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
662
+			$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
663
+			$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
664 664
 
665 665
 			// Local Taxes
666 666
 			$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
@@ -726,8 +726,8 @@  discard block
 block discarded – undo
726 726
 				$action = '';
727 727
 			}
728 728
 		}
729
-	} elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha')) {
730
-		if (! $object->fetch($id) > 0) {
729
+	} elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) {
730
+		if (!$object->fetch($id) > 0) {
731 731
 			dol_print_error($db);
732 732
 		}
733 733
 		$object->fetch_thirdparty();
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 			$objectline->array_options = $array_options;
763 763
 			$result = $objectline->insertExtraFields();
764 764
 			if ($result < 0) {
765
-				setEventMessages($langs->trans('Error') . $result, null, 'errors');
765
+				setEventMessages($langs->trans('Error').$result, null, 'errors');
766 766
 			}
767 767
 		}
768 768
 
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
 		if (is_array($extralabelsline)) {
773 773
 			// Get extra fields
774 774
 			foreach ($extralabelsline as $key => $value) {
775
-				unset($_POST["options_" . $key]);
775
+				unset($_POST["options_".$key]);
776 776
 			}
777 777
 		}
778 778
 
779 779
 		// Define special_code for special lines
780 780
 		$special_code = GETPOST('special_code', 'int');
781
-		if (! GETPOST('qty', 'alpha')) {
781
+		if (!GETPOST('qty', 'alpha')) {
782 782
 			$special_code = 3;
783 783
 		}
784 784
 
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 		$date_end_fill = !empty(GETPOST('date_end_fill', 'int')) ? GETPOST('date_end_fill', 'int') : 'NULL';
825 825
 
826 826
 		// Update line
827
-		if (! $error) {
827
+		if (!$error) {
828 828
 			$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);
829 829
 			if ($result >= 0) {
830 830
 				$object->fetch($object->id); // Reload lines
@@ -898,10 +898,10 @@  discard block
 block discarded – undo
898 898
 	if ($object->fetch($id) > 0) {
899 899
 		$result = $object->fetch_lines();
900 900
 
901
-		print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
902
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
901
+		print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
902
+		print '<input type="hidden" name="token" value="'.newToken().'">';
903 903
 		print '<input type="hidden" name="action" value="add">';
904
-		print '<input type="hidden" name="facid" value="' . $object->id . '">';
904
+		print '<input type="hidden" name="facid" value="'.$object->id.'">';
905 905
 
906 906
 		print dol_get_fiche_head(null, '', '', 0);
907 907
 
@@ -914,17 +914,17 @@  discard block
 block discarded – undo
914 914
 		$object->fetch_thirdparty();
915 915
 
916 916
 		// Title
917
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Title") . '</td><td>';
918
-		print '<input class="flat quatrevingtpercent" type="text" name="title" value="' . dol_escape_htmltag(GETPOST("title", 'alphanohtml')) . '" autofocus>';
917
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
918
+		print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus>';
919 919
 		print '</td></tr>';
920 920
 
921 921
 		// Ref supplier
922
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("RefSupplier") . '</td><td>';
923
-		print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="' . $object->ref_supplier . '">';
922
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("RefSupplier").'</td><td>';
923
+		print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="'.$object->ref_supplier.'">';
924 924
 		print '</td></tr>';
925 925
 
926 926
 		// Third party
927
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Customer") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'customer') . '</td>';
927
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1, 'customer').'</td>';
928 928
 		print '</tr>';
929 929
 
930 930
 		$note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $object->note_public;
@@ -933,30 +933,30 @@  discard block
 block discarded – undo
933 933
 		// Help of substitution key
934 934
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
935 935
 
936
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')';
937
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%m') . ')';
938
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m') . ')';
939
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B') . ')';
940
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%B') . ')';
941
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B') . ')';
942
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y') . ')';
943
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%Y') . ')';
944
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y') . ')';
936
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m').')';
937
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%m').')';
938
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m').')';
939
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')';
940
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')';
941
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')';
942
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
943
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
944
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')';
945 945
 		// Only on template invoices
946
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date_when, 'dayhour') . ')';
947
-		$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') . ')';
946
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
947
+		$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').')';
948 948
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count");
949 949
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber");
950 950
 
951
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
951
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
952 952
 		foreach ($substitutionarray as $key => $val) {
953
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
953
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
954 954
 		}
955 955
 		$htmltext .= '</i>';
956 956
 
957 957
 		// Label
958
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Label") . '</td><td>';
959
-		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label . '">';
958
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td>';
959
+		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="'.$object->label.'">';
960 960
 		print '</td></tr>';
961 961
 
962 962
 		// Public note
@@ -981,38 +981,38 @@  discard block
 block discarded – undo
981 981
 		}
982 982
 
983 983
 		// Author
984
-		print "<tr><td>" . $langs->trans("Author") . "</td><td>" . $user->getFullName($langs) . "</td></tr>";
984
+		print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
985 985
 
986 986
 		// Payment term
987
-		print "<tr><td>" . $langs->trans("PaymentConditions") . "</td><td>";
988
-		$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none');
987
+		print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
988
+		$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
989 989
 		print "</td></tr>";
990 990
 
991 991
 		// Payment mode
992
-		print "<tr><td>" . $langs->trans("PaymentMode") . "</td><td>";
993
-		$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none', '', 1);
992
+		print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
993
+		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', '', 1);
994 994
 		print "</td></tr>";
995 995
 
996 996
 		// Project
997 997
 		if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
998 998
 			$projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project;
999 999
 			$langs->load('projects');
1000
-			print '<tr><td>' . $langs->trans('Project') . '</td><td>';
1000
+			print '<tr><td>'.$langs->trans('Project').'</td><td>';
1001 1001
 			$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
1002
-			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>';
1002
+			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>';
1003 1003
 			print '</td></tr>';
1004 1004
 		}
1005 1005
 
1006 1006
 		// Bank account
1007 1007
 		if ($object->fk_account > 0) {
1008
-			print "<tr><td>" . $langs->trans('BankAccount') . "</td><td>";
1009
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1008
+			print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
1009
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1010 1010
 			print "</td></tr>";
1011 1011
 		}
1012 1012
 
1013 1013
 		// Model pdf
1014
-		print "<tr><td>" . $langs->trans('Model') . "</td><td>";
1015
-		include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1014
+		print "<tr><td>".$langs->trans('Model')."</td><td>";
1015
+		include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1016 1016
 		$list = ModelePDFSuppliersInvoices::liste_modeles($db);
1017 1017
 		print $form->selectarray('modelpdf', $list, $conf->global->INVOICE_SUPPLIER_ADDON_PDF);
1018 1018
 		print "</td></tr>";
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 
1024 1024
 		// Autogeneration
1025 1025
 		$title = $langs->trans("Recurrence");
1026
-		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', '');
1026
+		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
1027 1027
 
1028 1028
 		print '<span class="opacitymedium">'.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).'</span><br><br>';
1029 1029
 
@@ -1032,30 +1032,30 @@  discard block
 block discarded – undo
1032 1032
 		print '<table class="border centpercent">';
1033 1033
 
1034 1034
 		// Frequency + unit
1035
-		print '<tr><td class="titlefieldcreate">' . $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')) . "</td><td>";
1036
-		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'));
1035
+		print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
1036
+		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'));
1037 1037
 		print "</td></tr>";
1038 1038
 
1039 1039
 		// Date next run
1040
-		print "<tr><td>" . $langs->trans('NextDateToExecution') . "</td><td>";
1040
+		print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
1041 1041
 		$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
1042 1042
 		print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1);
1043 1043
 		print "</td></tr>";
1044 1044
 
1045 1045
 		// Number max of generation
1046
-		print "<tr><td>" . $langs->trans("MaxPeriodNumber") . "</td><td>";
1047
-		print '<input type="text" name="nb_gen_max" value="' . GETPOST('nb_gen_max') . '" size="5" />';
1046
+		print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
1047
+		print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
1048 1048
 		print "</td></tr>";
1049 1049
 
1050 1050
 		// Auto validate the invoice
1051
-		print "<tr><td>" . $langs->trans("StatusOfGeneratedInvoices") . "</td><td>";
1051
+		print "<tr><td>".$langs->trans("StatusOfGeneratedInvoices")."</td><td>";
1052 1052
 		$select = array('0' => $langs->trans('BillStatusDraft'), '1' => $langs->trans('BillStatusValidated'));
1053 1053
 		print $form->selectarray('auto_validate', $select, GETPOST('auto_validate'));
1054 1054
 		print "</td></tr>";
1055 1055
 
1056 1056
 		// Auto generate document
1057 1057
 		if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) {
1058
-			print "<tr><td>" . $langs->trans("StatusOfAutoGeneratedDocuments") . "</td><td>";
1058
+			print "<tr><td>".$langs->trans("StatusOfAutoGeneratedDocuments")."</td><td>";
1059 1059
 			$select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc'));
1060 1060
 			print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
1061 1061
 			print "</td></tr>";
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
 		print "</form>\n";
1100 1100
 	} else {
1101
-		dol_print_error('', "Error, no invoice " . $object->id);
1101
+		dol_print_error('', "Error, no invoice ".$object->id);
1102 1102
 	}
1103 1103
 } else {
1104 1104
 	/*
@@ -1110,12 +1110,12 @@  discard block
 block discarded – undo
1110 1110
 
1111 1111
 		// Confirmation de la suppression d'une ligne produit
1112 1112
 		if ($action == 'ask_deleteline') {
1113
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1113
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1114 1114
 		}
1115 1115
 
1116 1116
 		// Confirm delete of repeatable invoice
1117 1117
 		if ($action == 'ask_deleteinvoice') {
1118
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1118
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1119 1119
 		}
1120 1120
 
1121 1121
 		print $formconfirm;
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
 		// Recurring invoice content
1131 1131
 
1132
-		$linkback = '<a href="' . DOL_URL_ROOT . '/fourn/facture/list-rec.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans('BackToList') . '</a>';
1132
+		$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list-rec.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans('BackToList').'</a>';
1133 1133
 
1134 1134
 		$morehtmlref = '';
1135 1135
 		if ($action != 'edittitle') {
@@ -1142,33 +1142,33 @@  discard block
 block discarded – undo
1142 1142
 		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
1143 1143
 		$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
1144 1144
 		// Thirdparty
1145
-		$morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
1145
+		$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
1146 1146
 
1147 1147
 		// Project
1148 1148
 		if (isModEnabled('project')) {
1149 1149
 			$langs->load('projects');
1150
-			$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
1150
+			$morehtmlref .= '<br>'.$langs->trans('Project').' ';
1151 1151
 			if ($usercancreate) {
1152 1152
 				if ($action != 'classify') {
1153
-					$morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
1153
+					$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
1154 1154
 				}
1155 1155
 				if ($action == 'classify') {
1156
-					$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
1156
+					$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
1157 1157
 					$morehtmlref .= '<input type="hidden" name="action" value="classin">';
1158
-					$morehtmlref .= '<input type="hidden" name="token" value="' . newToken() . '">';
1158
+					$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
1159 1159
 					$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
1160
-					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
1160
+					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
1161 1161
 					$morehtmlref .= '</form>';
1162 1162
 				} else {
1163
-					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
1163
+					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
1164 1164
 				}
1165 1165
 			} else {
1166 1166
 				if (!empty($object->fk_project)) {
1167 1167
 					$project = new Project($db);
1168 1168
 					$project->fetch($object->fk_project);
1169
-					$morehtmlref .= ' : ' . $project->getNomUrl(1);
1169
+					$morehtmlref .= ' : '.$project->getNomUrl(1);
1170 1170
 					if ($project->title) {
1171
-						$morehtmlref .= ' - ' . $project->title;
1171
+						$morehtmlref .= ' - '.$project->title;
1172 1172
 					}
1173 1173
 				} else {
1174 1174
 					$morehtmlref .= '';
@@ -1187,34 +1187,34 @@  discard block
 block discarded – undo
1187 1187
 
1188 1188
 		print '<table class="border centpercent tableforfield">';
1189 1189
 
1190
-		print '<tr><td class="titlefield">' . $langs->trans('Author') . '</td><td>';
1190
+		print '<tr><td class="titlefield">'.$langs->trans('Author').'</td><td>';
1191 1191
 		print $author->getNomUrl(-1);
1192 1192
 		print "</td></tr>";
1193 1193
 
1194 1194
 		// Label
1195 1195
 		print '<tr>';
1196
-		print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1197
-		print '<td>' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1196
+		print '<td>'.$form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1197
+		print '<td>'.$form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1198 1198
 		print '</tr>';
1199 1199
 
1200
-		print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
1201
-		print '<td>' . price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1200
+		print '<tr><td>'.$langs->trans('AmountHT').'</td>';
1201
+		print '<td>'.price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1202 1202
 		print '</tr>';
1203 1203
 
1204
-		print '<tr><td>' . $langs->trans("AmountVAT") . '</td><td>' . price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1204
+		print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1205 1205
 		print '</tr>';
1206 1206
 
1207 1207
 		// Amount Local Taxes
1208 1208
 		if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {    // Localtax1
1209
-			print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
1210
-			print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1209
+			print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
1210
+			print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1211 1211
 		}
1212 1212
 		if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {    // Localtax2
1213
-			print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
1214
-			print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1213
+			print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
1214
+			print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1215 1215
 		}
1216 1216
 
1217
-		print '<tr><td>' . $langs->trans("AmountTTC") . '</td><td colspan="3">' . price($object->total_ttc, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1217
+		print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1218 1218
 		print '</tr>';
1219 1219
 
1220 1220
 		// Payment term
@@ -1223,14 +1223,14 @@  discard block
 block discarded – undo
1223 1223
 		print $langs->trans('PaymentConditionsShort');
1224 1224
 		print '</td>';
1225 1225
 		if ($action != 'editconditions' && $usercancreate) {
1226
-			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>';
1226
+			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>';
1227 1227
 		}
1228 1228
 		print '</tr></table>';
1229 1229
 		print '</td><td>';
1230 1230
 		if ($action == 'editconditions') {
1231
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
1231
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
1232 1232
 		} else {
1233
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
1233
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
1234 1234
 		}
1235 1235
 
1236 1236
 		print '</td></tr>';
@@ -1241,14 +1241,14 @@  discard block
 block discarded – undo
1241 1241
 		print $langs->trans('PaymentMode');
1242 1242
 		print '</td>';
1243 1243
 		if ($action != 'editmode' && $usercancreate) {
1244
-			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>';
1244
+			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>';
1245 1245
 		}
1246 1246
 		print '</tr></table>';
1247 1247
 		print '</td><td>';
1248 1248
 		if ($action == 'editmode') {
1249
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1249
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1250 1250
 		} else {
1251
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'none');
1251
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none');
1252 1252
 		}
1253 1253
 		print '</td></tr>';
1254 1254
 
@@ -1261,12 +1261,12 @@  discard block
 block discarded – undo
1261 1261
 			print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
1262 1262
 			print '</td>';
1263 1263
 			if ($usercancreate && $action != 'editmulticurrencycode' && $object->suspended == $object::STATUS_SUSPENDED) {
1264
-				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>';
1264
+				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>';
1265 1265
 			}
1266 1266
 			print '</tr></table>';
1267 1267
 			print '</td><td>';
1268 1268
 			$htmlname = (($usercancreate && $action == 'editmulticurrencycode') ? 'multicurrency_code' : 'none');
1269
-			$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
1269
+			$form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, $htmlname);
1270 1270
 			print '</td></tr>';
1271 1271
 
1272 1272
 			// Multicurrency rate
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 				print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
1278 1278
 				print '</td>';
1279 1279
 				if ($usercancreate && $action != 'editmulticurrencyrate' && $object->suspended == $object::STATUS_SUSPENDED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1280
-					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>';
1280
+					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>';
1281 1281
 				}
1282 1282
 				print '</tr></table>';
1283 1283
 				print '</td><td>';
@@ -1285,12 +1285,12 @@  discard block
 block discarded – undo
1285 1285
 					if ($action == 'actualizemulticurrencyrate') {
1286 1286
 						list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
1287 1287
 					}
1288
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1288
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1289 1289
 				} else {
1290
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1290
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1291 1291
 					if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1292 1292
 						print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
1293
-						print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=actualizemulticurrencyrate">' . $langs->trans("ActualizeCurrency") . '</a>';
1293
+						print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
1294 1294
 						print '</div>';
1295 1295
 					}
1296 1296
 				}
@@ -1306,24 +1306,24 @@  discard block
 block discarded – undo
1306 1306
 
1307 1307
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
1308 1308
 
1309
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m') . ')';
1310
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%m') . ')';
1311
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m') . ')';
1312
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B') . ')';
1313
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%B') . ')';
1314
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B') . ')';
1315
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y') . ')';
1316
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%Y') . ')';
1317
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y') . ')';
1309
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')';
1310
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')';
1311
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')';
1312
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')';
1313
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')';
1314
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')';
1315
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
1316
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
1317
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')';
1318 1318
 		// Only on template invoices
1319
-		$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') . ')';
1320
-		$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') . ')';
1319
+		$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').')';
1320
+		$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').')';
1321 1321
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done;
1322 1322
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max;
1323 1323
 
1324
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
1324
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
1325 1325
 		foreach ($substitutionarray as $key => $val) {
1326
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
1326
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
1327 1327
 		}
1328 1328
 		$htmltext .= '</i>';
1329 1329
 
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
 		print '<tr><td>';
1332 1332
 		print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $usercancreate);
1333 1333
 		print '</td><td class="wordbreak">';
1334
-		print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $usercancreate, 'textarea:' . ROWS_4 . ':90%', '', null, null, '', 1);
1334
+		print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $usercancreate, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
1335 1335
 		print '</td>';
1336 1336
 		print '</tr>';
1337 1337
 
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
 		print '<tr><td>';
1340 1340
 		print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $usercancreate);
1341 1341
 		print '</td><td class="wordbreak">';
1342
-		print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $usercancreate, 'textarea:' . ROWS_4 . ':90%', '', null, null, '', 1);
1342
+		print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $usercancreate, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
1343 1343
 		print '</td>';
1344 1344
 		print '</tr>';
1345 1345
 
@@ -1349,14 +1349,14 @@  discard block
 block discarded – undo
1349 1349
 		print $langs->trans('BankAccount');
1350 1350
 		print '<td>';
1351 1351
 		if ($action != 'editbankaccount' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1352
-			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>';
1352
+			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>';
1353 1353
 		}
1354 1354
 		print '</tr></table>';
1355 1355
 		print '</td><td>';
1356 1356
 		if ($action == 'editbankaccount') {
1357
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'fk_account', 1);
1357
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
1358 1358
 		} else {
1359
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1359
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1360 1360
 		}
1361 1361
 		print "</td>";
1362 1362
 		print '</tr>';
@@ -1367,18 +1367,18 @@  discard block
 block discarded – undo
1367 1367
 		print $langs->trans('Model');
1368 1368
 		print '<td>';
1369 1369
 		if ($action != 'editmodelpdf' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1370
-			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>';
1370
+			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>';
1371 1371
 		}
1372 1372
 		print '</tr></table>';
1373 1373
 		print '</td><td>';
1374 1374
 		if ($action == 'editmodelpdf') {
1375
-			include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1375
+			include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1376 1376
 			$list = array();
1377 1377
 			$models = ModelePDFSuppliersInvoices::liste_modeles($db);
1378 1378
 			foreach ($models as $k => $model) {
1379
-				$list[] = str_replace(':', '|', $k) . ':' . $model;
1379
+				$list[] = str_replace(':', '|', $k).':'.$model;
1380 1380
 			}
1381
-			$select = 'select;' . implode(',', $list);
1381
+			$select = 'select;'.implode(',', $list);
1382 1382
 			//TODO : Droits
1383 1383
 			print $form->editfieldval($langs->trans('Model'), 'modelpdf', $object->model_pdf, $object, $usercancreate, $select);
1384 1384
 		} else {
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 
1390 1390
 		// Other attributes
1391 1391
 		$cols = 2;
1392
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
1392
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1393 1393
 
1394 1394
 		print '</table>';
1395 1395
 
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 
1406 1406
 		print '<table class="border centpercent tableforfield">';
1407 1407
 
1408
-		print '<tr><td colspan="2">' . img_picto('', 'recurring', 'class="pictofixedwidth"') . $title . '</td></tr>';
1408
+		print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>';
1409 1409
 
1410 1410
 		// if "frequency" is empty or = 0, the reccurence is disabled
1411 1411
 		print '<tr><td style="width: 50%">';
@@ -1413,23 +1413,23 @@  discard block
 block discarded – undo
1413 1413
 		print $langs->trans('Frequency');
1414 1414
 		print '</td>';
1415 1415
 		if ($action != 'editfrequency' && $usercancreate) {
1416
-			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>';
1416
+			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>';
1417 1417
 		}
1418 1418
 		print '</tr></table>';
1419 1419
 		print '</td><td>';
1420 1420
 		if ($action == 'editfrequency') {
1421
-			print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '">';
1421
+			print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'">';
1422 1422
 			print '<input type="hidden" name="action" value="setfrequency">';
1423
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
1423
+			print '<input type="hidden" name="token" value="'.newToken().'">';
1424 1424
 			print '<table class="nobordernopadding">';
1425 1425
 			print '<tr><td>';
1426
-			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'));
1426
+			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'));
1427 1427
 			print '</td>';
1428
-			print '<td class="left"><input type="submit" class="button button-edit" value="' . $langs->trans("Modify") . '"></td>';
1428
+			print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
1429 1429
 			print '</tr></table></form>';
1430 1430
 		} else {
1431 1431
 			if ($object->frequency > 0) {
1432
-				print $langs->trans('FrequencyPer_' . $object->unit_frequency, $object->frequency);
1432
+				print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
1433 1433
 			} else {
1434 1434
 				print $langs->trans("NotARecurringInvoiceTemplate");
1435 1435
 			}
@@ -1448,8 +1448,8 @@  discard block
 block discarded – undo
1448 1448
 			print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached');
1449 1449
 		}
1450 1450
 		//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
1451
-		if (! $object->isMaxNbGenReached()) {
1452
-			if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1451
+		if (!$object->isMaxNbGenReached()) {
1452
+			if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1453 1453
 				print img_warning($langs->trans("Late"));
1454 1454
 			}
1455 1455
 		} else {
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
 			print $langs->trans("StatusOfGeneratedInvoices");
1483 1483
 		}
1484 1484
 		print '</td><td>';
1485
-		$select = 'select;0:' . $langs->trans('BillStatusDraft') . ',1:' . $langs->trans('BillStatusValidated');
1485
+		$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
1486 1486
 		if ($action == 'auto_validate' || $object->frequency > 0) {
1487 1487
 			print $form->editfieldval($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $usercancreate, $select);
1488 1488
 		}
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
 			}
1499 1499
 			print '</td>';
1500 1500
 			print '<td>';
1501
-			$select = 'select;0:' . $langs->trans('DoNotGenerateDoc') . ',1:' . $langs->trans('AutogenerateDoc');
1501
+			$select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc');
1502 1502
 			if ($action == 'generate_pdf' || $object->frequency > 0) {
1503 1503
 				print $form->editfieldval($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $usercancreate, $select);
1504 1504
 			}
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 			print '<table class="border centpercent tableforfield">';
1523 1523
 
1524 1524
 			// Nb of generation already done
1525
-			print '<tr><td style="width: 50%">' . $langs->trans("NbOfGenerationDone") . '</td>';
1525
+			print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>';
1526 1526
 			print '<td>';
1527 1527
 			print $object->nb_gen_done ? $object->nb_gen_done : '0';
1528 1528
 			print '</td>';
@@ -1547,15 +1547,15 @@  discard block
 block discarded – undo
1547 1547
 		print '<div class="clearboth"></div><br>';
1548 1548
 
1549 1549
 		// Lines
1550
-		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
1551
-        	<input type="hidden" name="token" value="' . newToken() . '">
1552
-        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
1550
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
1551
+        	<input type="hidden" name="token" value="' . newToken().'">
1552
+        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
1553 1553
         	<input type="hidden" name="mode" value="">
1554
-        	<input type="hidden" name="id" value="' . $object->id . '">
1554
+        	<input type="hidden" name="id" value="' . $object->id.'">
1555 1555
         	';
1556 1556
 
1557 1557
 		if (!empty($conf->use_javascript_ajax) && $object->statut == 0) {
1558
-			include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
1558
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
1559 1559
 		}
1560 1560
 
1561 1561
 		print '<div class="div-table-responsive-no-min">';
@@ -1609,24 +1609,24 @@  discard block
 block discarded – undo
1609 1609
 		if (empty($object->suspended)) {
1610 1610
 			if ($usercancreate) {
1611 1611
 				if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
1612
-					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1612
+					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
1613 1613
 				} else {
1614 1614
 					if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
1615
-						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>';
1615
+						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>';
1616 1616
 					} else {
1617
-						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1617
+						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
1618 1618
 					}
1619 1619
 				}
1620 1620
 			} else {
1621
-				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>';
1621
+				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>';
1622 1622
 			}
1623 1623
 		}
1624 1624
 
1625 1625
 		if ($usercancreate) {
1626 1626
 			if (empty($object->suspended)) {
1627
-				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>';
1627
+				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>';
1628 1628
 			} else {
1629
-				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>';
1629
+				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>';
1630 1630
 			}
1631 1631
 		}
1632 1632
 
Please login to merge, or discard this patch.
htdocs/fourn/class/fournisseur.facture-rec.class.php 2 patches
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$now = dol_now();
274 274
 
275 275
 		// Clean parameters
276
-		$this->titre = empty($this->titre) ? '' : $this->titre;	// deprecated
276
+		$this->titre = empty($this->titre) ? '' : $this->titre; // deprecated
277 277
 		$this->title = empty($this->title) ? '' : $this->title;
278 278
 		$keyforref = $this->table_ref_field;
279 279
 		$this->ref = $this->$keyforref;
@@ -335,32 +335,32 @@  discard block
 block discarded – undo
335 335
 			$sql .= ", '".$this->db->idate($now)."'";
336 336
 			$sql .= ", ".((int) $this->suspended);
337 337
 			$sql .= ", '".$this->db->escape($this->libelle)."'";
338
-			$sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0');                              // amount
339
-			$sql .= ", " .((int) $user->id);
340
-			$sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');
341
-			$sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');
342
-			$sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
343
-			$sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
344
-			$sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL');      // date_lim_reglement
345
-			$sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');
346
-			$sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');
347
-			$sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');
348
-			$sql .= ", " . (int) $facfourn_src->fk_multicurrency;
338
+			$sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount
339
+			$sql .= ", ".((int) $user->id);
340
+			$sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');
341
+			$sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');
342
+			$sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
343
+			$sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
344
+			$sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement
345
+			$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');
346
+			$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');
347
+			$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');
348
+			$sql .= ", ".(int) $facfourn_src->fk_multicurrency;
349 349
 			$sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'";
350
-			$sql .= ", " . (float) $facfourn_src->multicurrency_tx;
351
-			$sql .= ", " . (int) $this->usenewprice;
352
-			$sql .= ", " . (int) $this->frequency;
350
+			$sql .= ", ".(float) $facfourn_src->multicurrency_tx;
351
+			$sql .= ", ".(int) $this->usenewprice;
352
+			$sql .= ", ".(int) $this->frequency;
353 353
 			$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
354
-			$sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
355
-			$sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
356
-			$sql .= ", " . (int) $this->nb_gen_done;
357
-			$sql .= ", " . (int) $this->nb_gen_max;
358
-			$sql .= ", " . (int) $this->auto_validate;
359
-			$sql .= ", " . (int) $this->generate_pdf;
354
+			$sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
355
+			$sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
356
+			$sql .= ", ".(int) $this->nb_gen_done;
357
+			$sql .= ", ".(int) $this->nb_gen_max;
358
+			$sql .= ", ".(int) $this->auto_validate;
359
+			$sql .= ", ".(int) $this->generate_pdf;
360 360
 			$sql .= ')';
361 361
 
362 362
 			if ($this->db->query($sql)) {
363
-				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec');
363
+				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec');
364 364
 
365 365
 				// Fields used into addline later
366 366
 				$this->fk_multicurrency = $facfourn_src->fk_multicurrency;
@@ -497,42 +497,42 @@  discard block
 block discarded – undo
497 497
 		$error = 0;
498 498
 
499 499
 		$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET";
500
-		$sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ;
501
-		$sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
502
-		$sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ',';
503
-		if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ',';
504
-		$sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ',';
505
-		$sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ",";
506
-		$sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ',';
507
-		$sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ',';
508
-		$sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ',';
509
-		$sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ',';
510
-		$sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ',';
511
-		$sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ',';
512
-		$sql .= " fk_user_modif = ". ((int) $user->id) . ',';
513
-		$sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ',';
514
-		$sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ',';
515
-		$sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ',';
516
-		$sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ',';
517
-		$sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ',';
518
-		$sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',";
519
-		$sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',";
520
-		$sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ",";
521
-		$sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ',';
522
-		$sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ",";
523
-		$sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ',';
524
-		$sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ',';
525
-		$sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ',';
526
-		$sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ',';
527
-		$sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ',';
528
-		$sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ',';
529
-		$sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',";
530
-		$sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ',';
531
-		$sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ',';
532
-		$sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ',';
533
-		$sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ',';
534
-		$sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
535
-		$sql .= " WHERE rowid = ". (int) $this->id;
500
+		$sql .= " titre = '".(!empty($this->title) ? $this->db->escape($this->title) : "")."',";
501
+		$sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
502
+		$sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).',';
503
+		if ($this->fk_soc > 0) $sql .= " fk_soc = ".(int) $this->fk_soc.',';
504
+		$sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).',';
505
+		$sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').",";
506
+		$sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').',';
507
+		$sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).',';
508
+		$sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).',';
509
+		$sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).',';
510
+		$sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).',';
511
+		$sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).',';
512
+		$sql .= " fk_user_modif = ".((int) $user->id).',';
513
+		$sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').',';
514
+		$sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').',';
515
+		$sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').',';
516
+		$sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').',';
517
+		$sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').',';
518
+		$sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',";
519
+		$sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',";
520
+		$sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').",";
521
+		$sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').',';
522
+		$sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').",";
523
+		$sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).',';
524
+		$sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).',';
525
+		$sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).',';
526
+		$sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).',';
527
+		$sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).',';
528
+		$sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).',';
529
+		$sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',";
530
+		$sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').',';
531
+		$sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').',';
532
+		$sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).',';
533
+		$sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).',';
534
+		$sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
535
+		$sql .= " WHERE rowid = ".(int) $this->id;
536 536
 
537 537
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
538 538
 		$resql = $this->db->query($sql);
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
592 592
 		$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')';
593 593
 		if ($rowid) {
594
-			$sql .= ' AND f.rowid='. (int) $rowid;
594
+			$sql .= ' AND f.rowid='.(int) $rowid;
595 595
 		} elseif ($ref) {
596 596
 			$sql .= " AND f.titre='".$this->db->escape($ref)."'";
597 597
 		} else {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 		$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
725 725
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';
726 726
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
727
-		$sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id;
727
+		$sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id;
728 728
 		$sql .= ' ORDER BY l.rang';
729 729
 
730 730
 		dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG);
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 				$line->product_type             = $objp->product_type;
765 765
 				$line->date_start               = $objp->date_start;
766 766
 				$line->date_end                 = $objp->date_end;
767
-				$line->info_bits                = $objp->info_bits	;
767
+				$line->info_bits                = $objp->info_bits;
768 768
 				$line->special_code             = $objp->special_code;
769 769
 				$line->rang                     = $objp->rang;
770 770
 				$line->fk_unit                  = $objp->fk_unit;
@@ -814,11 +814,11 @@  discard block
 block discarded – undo
814 814
 		$main = MAIN_DB_PREFIX.'facture_fourn_det_rec';
815 815
 		$ef = $main."_extrafields";
816 816
 
817
-		$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")";
818
-		$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid;
817
+		$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")";
818
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid;
819 819
 
820 820
 		if ($this->db->query($sqlef) && $this->db->query($sql)) {
821
-			$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid;
821
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid;
822 822
 			dol_syslog($sql);
823 823
 			if ($this->db->query($sql)) {
824 824
 				// Delete linked object
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 			}
848 848
 			// End call triggers
849 849
 		}
850
-		if (! $error) {
850
+		if (!$error) {
851 851
 			$this->db->commit();
852 852
 			return 1;
853 853
 		} else {
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 				}
960 960
 			}
961 961
 
962
-			$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec (';
962
+			$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec (';
963 963
 			$sql .= 'fk_facture_fourn';
964 964
 			$sql .= ', fk_product';
965 965
 			$sql .= ', ref';
@@ -991,46 +991,46 @@  discard block
 block discarded – undo
991 991
 			$sql .= ', fk_user_author';
992 992
 			$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
993 993
 			$sql .= ') VALUES (';
994
-			$sql .= ' ' . (int) $facid;   // source supplier invoie id
995
-			$sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null');
996
-			$sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null');
997
-			$sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null');
998
-			$sql .= ", '" . $this->db->escape($desc) . "'";
999
-			$sql .= ', ' . price2num($pu_ht);
1000
-			$sql .= ', ' . price2num($pu_ttc);
1001
-			$sql .= ', ' . price2num($qty);
1002
-			$sql .= ', ' . price2num($remise_percent);
994
+			$sql .= ' '.(int) $facid; // source supplier invoie id
995
+			$sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : 'null');
996
+			$sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null');
997
+			$sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null');
998
+			$sql .= ", '".$this->db->escape($desc)."'";
999
+			$sql .= ', '.price2num($pu_ht);
1000
+			$sql .= ', '.price2num($pu_ttc);
1001
+			$sql .= ', '.price2num($qty);
1002
+			$sql .= ', '.price2num($remise_percent);
1003 1003
 			$sql .= ', null';
1004
-			$sql .= ", '" . $this->db->escape($vat_src_code) . "'";
1005
-			$sql .= ', ' . price2num($txtva);
1006
-			$sql .= ', ' . price2num($txlocaltax1);
1007
-			$sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'";
1008
-			$sql .= ', ' . price2num($txlocaltax2);
1009
-			$sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'";
1010
-			$sql .= ', ' . price2num($total_ht);
1011
-			$sql .= ', ' . price2num($total_tva);
1012
-			$sql .= ', ' . price2num($total_localtax1);
1013
-			$sql .= ', ' . price2num($total_localtax2);
1014
-			$sql .= ', ' . price2num($total_ttc);
1015
-			$sql .= ', ' . (int) $product_type;
1016
-			$sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL');
1017
-			$sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL');
1018
-			$sql .= ', ' . (int) $info_bits;
1019
-			$sql .= ', ' . (int) $special_code;
1020
-			$sql .= ', ' . (int) $rang;
1021
-			$sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL');
1022
-			$sql .= ', ' . (int) $user;
1023
-			$sql .= ', ' . (int) $this->fk_multicurrency;
1024
-			$sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";
1025
-			$sql .= ', ' . price2num($pu_ht_devise, 'CU');
1026
-			$sql .= ', ' . price2num($multicurrency_total_ht, 'CT');
1027
-			$sql .= ', ' . price2num($multicurrency_total_tva, 'CT');
1028
-			$sql .= ', ' . price2num($multicurrency_total_ttc, 'CT');
1004
+			$sql .= ", '".$this->db->escape($vat_src_code)."'";
1005
+			$sql .= ', '.price2num($txtva);
1006
+			$sql .= ', '.price2num($txlocaltax1);
1007
+			$sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'";
1008
+			$sql .= ', '.price2num($txlocaltax2);
1009
+			$sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'";
1010
+			$sql .= ', '.price2num($total_ht);
1011
+			$sql .= ', '.price2num($total_tva);
1012
+			$sql .= ', '.price2num($total_localtax1);
1013
+			$sql .= ', '.price2num($total_localtax2);
1014
+			$sql .= ', '.price2num($total_ttc);
1015
+			$sql .= ', '.(int) $product_type;
1016
+			$sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL');
1017
+			$sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL');
1018
+			$sql .= ', '.(int) $info_bits;
1019
+			$sql .= ', '.(int) $special_code;
1020
+			$sql .= ', '.(int) $rang;
1021
+			$sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL');
1022
+			$sql .= ', '.(int) $user;
1023
+			$sql .= ', '.(int) $this->fk_multicurrency;
1024
+			$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
1025
+			$sql .= ', '.price2num($pu_ht_devise, 'CU');
1026
+			$sql .= ', '.price2num($multicurrency_total_ht, 'CT');
1027
+			$sql .= ', '.price2num($multicurrency_total_tva, 'CT');
1028
+			$sql .= ', '.price2num($multicurrency_total_ttc, 'CT');
1029 1029
 			$sql .= ')';
1030 1030
 
1031
-			dol_syslog(get_class($this). '::addline', LOG_DEBUG);
1031
+			dol_syslog(get_class($this).'::addline', LOG_DEBUG);
1032 1032
 			if ($this->db->query($sql)) {
1033
-				$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec');
1033
+				$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec');
1034 1034
 				$this->update_price();
1035 1035
 				$this->id = $facid;
1036 1036
 				$this->db->commit();
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 
1082 1082
 		$facid = $this->id;
1083 1083
 
1084
-		dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
1084
+		dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
1085 1085
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
1086 1086
 
1087 1087
 		// Check parameters
@@ -1152,41 +1152,41 @@  discard block
 block discarded – undo
1152 1152
 				$product_type = $product->type;
1153 1153
 			}
1154 1154
 
1155
-			$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
1156
-			$sql .= ' fk_facture_fourn = ' . ((int) $facid);
1157
-			$sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null');
1158
-			$sql .= ", ref = '" . $this->db->escape($ref) . "'";
1159
-			$sql .= ", label = '" . $this->db->escape($label) . "'";
1160
-			$sql .= ", description = '" . $this->db->escape($desc) . "'";
1161
-			$sql .= ', pu_ht = ' . price2num($pu_ht);
1162
-			$sql .= ', qty = ' . price2num($qty);
1163
-			$sql .= ", remise_percent = '" . price2num($remise_percent) . "'";
1164
-			$sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'";
1165
-			$sql .= ', tva_tx = ' . price2num($txtva);
1166
-			$sql .= ', localtax1_tx = ' . (float) $txlocaltax1;
1167
-			$sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'";
1168
-			$sql .= ', localtax2_tx = ' . (float) $txlocaltax2;
1169
-			$sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'";
1170
-			$sql .= ", total_ht = '" . price2num($total_ht) . "'";
1171
-			$sql .= ", total_tva = '" . price2num($total_tva) . "'";
1172
-			$sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'";
1173
-			$sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'";
1174
-			$sql .= ", total_ttc = '" . price2num($total_ttc) . "'";
1175
-			$sql .= ', product_type = ' . (int) $product_type;
1176
-			$sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start);
1177
-			$sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end);
1178
-			$sql .= ', info_bits = ' . (int) $info_bits;
1179
-			$sql .= ', special_code = ' . (int) $special_code;
1180
-			$sql .= ', rang = ' . (int) $rang;
1181
-			$sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null');
1182
-			$sql .= ', fk_user_modif = ' . (int) $user;
1155
+			$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
1156
+			$sql .= ' fk_facture_fourn = '.((int) $facid);
1157
+			$sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null');
1158
+			$sql .= ", ref = '".$this->db->escape($ref)."'";
1159
+			$sql .= ", label = '".$this->db->escape($label)."'";
1160
+			$sql .= ", description = '".$this->db->escape($desc)."'";
1161
+			$sql .= ', pu_ht = '.price2num($pu_ht);
1162
+			$sql .= ', qty = '.price2num($qty);
1163
+			$sql .= ", remise_percent = '".price2num($remise_percent)."'";
1164
+			$sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'";
1165
+			$sql .= ', tva_tx = '.price2num($txtva);
1166
+			$sql .= ', localtax1_tx = '.(float) $txlocaltax1;
1167
+			$sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'";
1168
+			$sql .= ', localtax2_tx = '.(float) $txlocaltax2;
1169
+			$sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'";
1170
+			$sql .= ", total_ht = '".price2num($total_ht)."'";
1171
+			$sql .= ", total_tva = '".price2num($total_tva)."'";
1172
+			$sql .= ", total_localtax1 = '".price2num($total_localtax1)."'";
1173
+			$sql .= ", total_localtax2 = '".price2num($total_localtax2)."'";
1174
+			$sql .= ", total_ttc = '".price2num($total_ttc)."'";
1175
+			$sql .= ', product_type = '.(int) $product_type;
1176
+			$sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start);
1177
+			$sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end);
1178
+			$sql .= ', info_bits = '.(int) $info_bits;
1179
+			$sql .= ', special_code = '.(int) $special_code;
1180
+			$sql .= ', rang = '.(int) $rang;
1181
+			$sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null');
1182
+			$sql .= ', fk_user_modif = '.(int) $user;
1183 1183
 			$sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise);
1184 1184
 			$sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht);
1185 1185
 			$sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva);
1186 1186
 			$sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc);
1187
-			$sql .= ' WHERE rowid = ' . (int) $rowid;
1187
+			$sql .= ' WHERE rowid = '.(int) $rowid;
1188 1188
 
1189
-			dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
1189
+			dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
1190 1190
 			if ($this->db->query($sql)) {
1191 1191
 				$this->id = $facid;
1192 1192
 				$this->update_price();
@@ -1275,16 +1275,16 @@  discard block
 block discarded – undo
1275 1275
 		$tmparray = dol_getdate($now);
1276 1276
 		$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
1277 1277
 
1278
-		dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation);
1278
+		dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation);
1279 1279
 
1280 1280
 		$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec';
1281 1281
 		$sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency
1282 1282
 		$sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')";
1283 1283
 		$sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
1284 1284
 		$sql .= ' AND suspended = 0';
1285
-		$sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here
1285
+		$sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here
1286 1286
 		if ($restrictioninvoiceid > 0) {
1287
-			$sql .= ' AND rowid = '. (int) $restrictioninvoiceid;
1287
+			$sql .= ' AND rowid = '.(int) $restrictioninvoiceid;
1288 1288
 		}
1289 1289
 		$sql .= $this->db->order('entity', 'ASC');
1290 1290
 		//print $sql;exit;
@@ -1322,14 +1322,14 @@  discard block
 block discarded – undo
1322 1322
 					// Set entity context
1323 1323
 					$conf->entity = $facturerec->entity;
1324 1324
 
1325
-					dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity);
1325
+					dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity);
1326 1326
 
1327 1327
 					$new_fac_fourn = new FactureFournisseur($this->db);
1328 1328
 					$new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
1329 1329
 					$new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
1330 1330
 
1331 1331
 					$new_fac_fourn->type = self::TYPE_STANDARD;
1332
-					$new_fac_fourn->statut = self::STATUS_DRAFT;	// deprecated
1332
+					$new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated
1333 1333
 					$new_fac_fourn->status = self::STATUS_DRAFT;
1334 1334
 					$new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
1335 1335
 					$new_fac_fourn->socid = $facturerec->socid;
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
 					$new_fac_fourn->model_pdf = $facturerec->model_pdf;
1339 1339
 					$new_fac_fourn->fk_project = $facturerec->fk_project;
1340 1340
 					$new_fac_fourn->label = $facturerec->label;
1341
-					$new_fac_fourn->libelle = $facturerec->label;	// deprecated
1341
+					$new_fac_fourn->libelle = $facturerec->label; // deprecated
1342 1342
 
1343 1343
 					$invoiceidgenerated = $new_fac_fourn->create($user);
1344 1344
 					if ($invoiceidgenerated <= 0) {
@@ -1367,22 +1367,22 @@  discard block
 block discarded – undo
1367 1367
 					}
1368 1368
 				} else {
1369 1369
 					$error++;
1370
-					$this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n";
1371
-					$this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity;
1372
-					dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity);
1370
+					$this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n";
1371
+					$this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity;
1372
+					dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity);
1373 1373
 				}
1374 1374
 
1375 1375
 				if (!$error && $invoiceidgenerated >= 0) {
1376 1376
 					$facturerec->nb_gen_done++;
1377 1377
 					$facturerec->date_last_gen = dol_now();
1378
-					$facturerec->date_when= $facturerec->getNextDate();
1378
+					$facturerec->date_when = $facturerec->getNextDate();
1379 1379
 					$facturerec->update($user);
1380
-					$this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title);
1381
-					dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->title. ' is finished with a success generation');
1380
+					$this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title);
1381
+					dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->title.' is finished with a success generation');
1382 1382
 					$nb_create++;
1383 1383
 					$this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->title)."\n";
1384 1384
 				} else {
1385
-					$this->db->rollback('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title);
1385
+					$this->db->rollback('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title);
1386 1386
 				}
1387 1387
 
1388 1388
 				$parameters = array(
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 		}
1476 1476
 		$result .= $linkend;
1477 1477
 		global $action;
1478
-		$hookmanager->initHooks(array($this->element . 'dao'));
1478
+		$hookmanager->initHooks(array($this->element.'dao'));
1479 1479
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
1480 1480
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1481 1481
 		if ($reshook > 0) {
@@ -1654,8 +1654,8 @@  discard block
 block discarded – undo
1654 1654
 		$prodids = array();
1655 1655
 
1656 1656
 		$sql = 'SELECT rowid';
1657
-		$sql .= ' FROM ' .MAIN_DB_PREFIX. 'product';
1658
-		$sql .= ' WHERE entity IN (' .getEntity('product'). ')';
1657
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'product';
1658
+		$sql .= ' WHERE entity IN ('.getEntity('product').')';
1659 1659
 		$sql .= $this->db->plimit(100);
1660 1660
 
1661 1661
 		$resql = $this->db->query($sql);
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 			$xnbp = 0;
1695 1695
 			while ($xnbp < $nbp) {
1696 1696
 				$line = new FactureLigne($this->db);
1697
-				$line->desc = $langs->trans('Description'). ' ' .$xnbp;
1697
+				$line->desc = $langs->trans('Description').' '.$xnbp;
1698 1698
 				$line->qty = 1;
1699 1699
 				$line->subprice = 100;
1700 1700
 				$line->tva_tx = 19.6;
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
 
1743 1743
 			// Add a line "offered"
1744 1744
 			$line = new FactureLigne($this->db);
1745
-			$line->desc = $langs->trans('Description'). ' (offered line)';
1745
+			$line->desc = $langs->trans('Description').' (offered line)';
1746 1746
 			$line->qty = 1;
1747 1747
 			$line->subprice = 100;
1748 1748
 			$line->tva_tx = 19.6;
@@ -1789,12 +1789,12 @@  discard block
 block discarded – undo
1789 1789
 	public function setFrequencyAndUnit($frequency, $unit)
1790 1790
 	{
1791 1791
 		if (!$this->table_element) {
1792
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1792
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1793 1793
 			return -1;
1794 1794
 		}
1795 1795
 
1796 1796
 		if (!empty($frequency) && empty($unit)) {
1797
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1797
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1798 1798
 			return -2;
1799 1799
 		}
1800 1800
 
@@ -1833,11 +1833,11 @@  discard block
 block discarded – undo
1833 1833
 			return -1;
1834 1834
 		}
1835 1835
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1836
-		$sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL");
1836
+		$sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL");
1837 1837
 		if ($increment_nb_gen_done > 0) {
1838 1838
 			$sql .= ", nb_gen_done = nb_gen_done + 1";
1839 1839
 		}
1840
-		$sql .= " WHERE rowid = " . (int) $this->id;
1840
+		$sql .= " WHERE rowid = ".(int) $this->id;
1841 1841
 
1842 1842
 		dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG);
1843 1843
 
@@ -1871,8 +1871,8 @@  discard block
 block discarded – undo
1871 1871
 		}
1872 1872
 
1873 1873
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1874
-		$sql .= " SET nb_gen_max = ". (int) $nb;
1875
-		$sql .= " WHERE rowid = " . (int) $this->id;
1874
+		$sql .= " SET nb_gen_max = ".(int) $nb;
1875
+		$sql .= " WHERE rowid = ".(int) $this->id;
1876 1876
 
1877 1877
 		dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG);
1878 1878
 
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
 
1901 1901
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1902 1902
 		$sql .= " SET auto_validate = ".((int) $validate);
1903
-		$sql .= " WHERE rowid = " . (int) $this->id;
1903
+		$sql .= " WHERE rowid = ".(int) $this->id;
1904 1904
 
1905 1905
 		dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG);
1906 1906
 
@@ -1927,8 +1927,8 @@  discard block
 block discarded – undo
1927 1927
 		}
1928 1928
 
1929 1929
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1930
-		$sql .= " SET generate_pdf = ". (int) $validate;
1931
-		$sql .= " WHERE rowid = " . (int) $this->id;
1930
+		$sql .= " SET generate_pdf = ".(int) $validate;
1931
+		$sql .= " WHERE rowid = ".(int) $this->id;
1932 1932
 
1933 1933
 		dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG);
1934 1934
 
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
 
1957 1957
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1958 1958
 		$sql .= " SET modelpdf = '".$this->db->escape($model)."'";
1959
-		$sql .= " WHERE rowid = " . (int) $this->id;
1959
+		$sql .= " WHERE rowid = ".(int) $this->id;
1960 1960
 
1961 1961
 		dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG);
1962 1962
 
@@ -2030,8 +2030,8 @@  discard block
 block discarded – undo
2030 2030
 		$error = 0;
2031 2031
 		$this->db->begin();
2032 2032
 
2033
-		if (! $error) {
2034
-			if (! $notrigger) {
2033
+		if (!$error) {
2034
+			if (!$notrigger) {
2035 2035
 				// Call triggers
2036 2036
 				$result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user);
2037 2037
 				if ($result < 0) {
@@ -2041,15 +2041,15 @@  discard block
 block discarded – undo
2041 2041
 			}
2042 2042
 		}
2043 2043
 
2044
-		if (! $error) {
2044
+		if (!$error) {
2045 2045
 			$result = $this->deleteExtraFields();
2046 2046
 			if ($result < 0) {
2047 2047
 				$error++;
2048 2048
 			}
2049 2049
 		}
2050 2050
 
2051
-		if (! $error) {
2052
-			$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id;
2051
+		if (!$error) {
2052
+			$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id;
2053 2053
 
2054 2054
 			$res = $this->db->query($sql);
2055 2055
 			if ($res === false) {
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
 		$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
2090 2090
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';
2091 2091
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
2092
-		$sql .= ' WHERE l.rowid = '. (int) $rowid;
2092
+		$sql .= ' WHERE l.rowid = '.(int) $rowid;
2093 2093
 		$sql .= ' ORDER BY l.rang';
2094 2094
 
2095 2095
 		dol_syslog('FactureRec::fetch', LOG_DEBUG);
@@ -2161,44 +2161,44 @@  discard block
 block discarded – undo
2161 2161
 
2162 2162
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
2163 2163
 
2164
-		$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
2165
-		$sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn;
2166
-		$sql .= ', fk_parent_line = ' . (int) $this->fk_parent;
2167
-		$sql .= ', fk_product = ' . (int) $this->fk_product;
2168
-		$sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL');
2169
-		$sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL');
2170
-		$sql .= ", description = '" . $this->db->escape($this->description) . "'";
2171
-		$sql .= ', pu_ht = ' . price2num($this->pu_ht);
2172
-		$sql .= ', pu_ttc = ' . price2num($this->pu_ttc);
2173
-		$sql .= ', qty = ' . price2num($this->qty);
2174
-		$sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'";
2175
-		$sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except;
2176
-		$sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'";
2177
-		$sql .= ', tva_tx = ' . price2num($this->tva_tx);
2178
-		$sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx);
2179
-		$sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'";
2180
-		$sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx);
2181
-		$sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'";
2164
+		$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
2165
+		$sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn;
2166
+		$sql .= ', fk_parent_line = '.(int) $this->fk_parent;
2167
+		$sql .= ', fk_product = '.(int) $this->fk_product;
2168
+		$sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL');
2169
+		$sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL');
2170
+		$sql .= ", description = '".$this->db->escape($this->description)."'";
2171
+		$sql .= ', pu_ht = '.price2num($this->pu_ht);
2172
+		$sql .= ', pu_ttc = '.price2num($this->pu_ttc);
2173
+		$sql .= ', qty = '.price2num($this->qty);
2174
+		$sql .= ", remise_percent = '".price2num($this->remise_percent)."'";
2175
+		$sql .= ', fk_remise_except = '.(int) $this->fk_remise_except;
2176
+		$sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'";
2177
+		$sql .= ', tva_tx = '.price2num($this->tva_tx);
2178
+		$sql .= ', localtax1_tx = '.price2num($this->localtax1_tx);
2179
+		$sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'";
2180
+		$sql .= ', localtax2_tx = '.price2num($this->localtax2_tx);
2181
+		$sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'";
2182 2182
 		if (empty($this->skip_update_total)) {
2183
-			$sql .= ', total_ht = ' . price2num($this->total_ht);
2184
-			$sql .= ', total_tva = ' . price2num($this->total_tva);
2185
-			$sql .= ', total_localtax1 = ' . price2num($this->total_localtax1);
2186
-			$sql .= ', total_localtax2 = ' . price2num($this->total_localtax2);
2187
-			$sql .= ', total_ttc = ' . price2num($this->total_ttc);
2183
+			$sql .= ', total_ht = '.price2num($this->total_ht);
2184
+			$sql .= ', total_tva = '.price2num($this->total_tva);
2185
+			$sql .= ', total_localtax1 = '.price2num($this->total_localtax1);
2186
+			$sql .= ', total_localtax2 = '.price2num($this->total_localtax2);
2187
+			$sql .= ', total_ttc = '.price2num($this->total_ttc);
2188 2188
 		}
2189
-		$sql .= ', product_type = ' . (int) $this->product_type;
2190
-		$sql .= ', date_start = ' . (int) $this->date_start;
2191
-		$sql .= ', date_end = ' . (int) $this->date_end;
2192
-		$sql .= ", info_bits = " . ((int) $this->info_bits);
2193
-		$sql .= ', special_code =' . (int) $this->special_code;
2194
-		$sql .= ', rang = ' . (int) $this->rang;
2195
-		$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2196
-		$sql .= ', fk_user_modif = ' . (int) $user;
2197
-		$sql .= ' WHERE rowid = ' . (int) $this->id;
2189
+		$sql .= ', product_type = '.(int) $this->product_type;
2190
+		$sql .= ', date_start = '.(int) $this->date_start;
2191
+		$sql .= ', date_end = '.(int) $this->date_end;
2192
+		$sql .= ", info_bits = ".((int) $this->info_bits);
2193
+		$sql .= ', special_code ='.(int) $this->special_code;
2194
+		$sql .= ', rang = '.(int) $this->rang;
2195
+		$sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2196
+		$sql .= ', fk_user_modif = '.(int) $user;
2197
+		$sql .= ' WHERE rowid = '.(int) $this->id;
2198 2198
 
2199 2199
 		$this->db->begin();
2200 2200
 
2201
-		dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
2201
+		dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
2202 2202
 		$resql = $this->db->query($sql);
2203 2203
 		if ($resql) {
2204 2204
 			if (!$error) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -500,7 +500,9 @@
 block discarded – undo
500 500
 		$sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ;
501 501
 		$sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
502 502
 		$sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ',';
503
-		if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ',';
503
+		if ($this->fk_soc > 0) {
504
+			$sql .= " fk_soc = ". (int) $this->fk_soc. ',';
505
+		}
504 506
 		$sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ',';
505 507
 		$sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ",";
506 508
 		$sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ',';
Please login to merge, or discard this patch.
htdocs/societe/card.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 $backtopage = GETPOST('backtopage', 'alpha');
103 103
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
104 104
 $backtopagejsfields = GETPOST('backtopagejsfields', 'alpha');
105
-$confirm 	= GETPOST('confirm', 'alpha');
105
+$confirm = GETPOST('confirm', 'alpha');
106 106
 
107 107
 $dol_openinpopup = '';
108 108
 if (!empty($backtopagejsfields)) {
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 }
152 152
 
153 153
 // Permissions
154
-$permissiontoread 	= $user->hasRight('societe', 'lire');
155
-$permissiontoadd 	= $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
154
+$permissiontoread = $user->hasRight('societe', 'lire');
155
+$permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
156 156
 $permissiontodelete = $user->hasRight('societe', 'supprimer') || ($permissiontoadd && isset($object->status) && $object->status == 0);
157
-$permissionnote 	= $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
157
+$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
158 158
 $permissiondellink 	= $user->hasRight('societe', 'creer'); // Used by the include of actions_dellink.inc.php
159
-$upload_dir 		= $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
159
+$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
160 160
 
161 161
 // Security check
162 162
 $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
 	if ($action == 'confirm_merge' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) {
201 201
 		$soc_origin_id = GETPOST('soc_origin', 'int');
202
-		$soc_origin = new Societe($db);		// The thirdparty that we will delete
202
+		$soc_origin = new Societe($db); // The thirdparty that we will delete
203 203
 
204 204
 		if ($soc_origin_id <= 0) {
205 205
 			$langs->load('errors');
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 			$error++;
289 289
 		}
290 290
 
291
-		if (isModEnabled('mailing') && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
291
+		if (isModEnabled('mailing') && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 && GETPOST('contact_no_email', 'int') == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
292 292
 			$error++;
293 293
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors');
294 294
 		}
295 295
 
296
-		if (isModEnabled('mailing') && GETPOST("private", 'int') == 1 && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
296
+		if (isModEnabled('mailing') && GETPOST("private", 'int') == 1 && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 && GETPOST('contact_no_email', 'int') == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
297 297
 			$error++;
298 298
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors');
299 299
 		}
@@ -312,19 +312,19 @@  discard block
 block discarded – undo
312 312
 				$object->name = dolGetFirstLastname(GETPOST('firstname', 'alphanohtml'), GETPOST('name', 'alphanohtml'));
313 313
 				$object->civility_id		= GETPOST('civility_id', 'alphanohtml'); // Note: civility id is a code, not an int
314 314
 				// Add non official properties
315
-				$object->name_bis			= GETPOST('name', 'alphanohtml');
316
-				$object->firstname			= GETPOST('firstname', 'alphanohtml');
315
+				$object->name_bis = GETPOST('name', 'alphanohtml');
316
+				$object->firstname = GETPOST('firstname', 'alphanohtml');
317 317
 			} else {
318
-				$object->name				= GETPOST('name', 'alphanohtml');
318
+				$object->name = GETPOST('name', 'alphanohtml');
319 319
 			}
320 320
 			$object->entity					= (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : $conf->entity);
321
-			$object->name_alias				= GETPOST('name_alias', 'alphanohtml');
321
+			$object->name_alias = GETPOST('name_alias', 'alphanohtml');
322 322
 			$object->parent					= GETPOST('parent_company_id', 'int');
323 323
 			$object->address				= GETPOST('address', 'alphanohtml');
324
-			$object->zip					= GETPOST('zipcode', 'alphanohtml');
325
-			$object->town					= GETPOST('town', 'alphanohtml');
326
-			$object->country_id				= GETPOST('country_id', 'int');
327
-			$object->state_id				= GETPOST('state_id', 'int');
324
+			$object->zip = GETPOST('zipcode', 'alphanohtml');
325
+			$object->town = GETPOST('town', 'alphanohtml');
326
+			$object->country_id = GETPOST('country_id', 'int');
327
+			$object->state_id = GETPOST('state_id', 'int');
328 328
 
329 329
 			$object->socialnetworks = array();
330 330
 			if (isModEnabled('socialnetworks')) {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			$object->phone					= GETPOST('phone', 'alpha');
339 339
 			$object->fax					= GETPOST('fax', 'alpha');
340 340
 			$object->email					= trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL));
341
-			$object->no_email 				= GETPOST("no_email", "int");
341
+			$object->no_email = GETPOST("no_email", "int");
342 342
 			$object->url					= trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
343 343
 			$object->idprof1				= trim(GETPOST('idprof1', 'alphanohtml'));
344 344
 			$object->idprof2				= trim(GETPOST('idprof2', 'alphanohtml'));
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 			$object->idprof6				= trim(GETPOST('idprof6', 'alphanohtml'));
349 349
 			$object->prefix_comm			= GETPOST('prefix_comm', 'alphanohtml');
350 350
 			$object->code_client			= GETPOSTISSET('customer_code') ?GETPOST('customer_code', 'alpha') : GETPOST('code_client', 'alpha');
351
-			$object->code_fournisseur		= GETPOSTISSET('supplier_code') ?GETPOST('supplier_code', 'alpha') : GETPOST('code_fournisseur', 'alpha');
351
+			$object->code_fournisseur = GETPOSTISSET('supplier_code') ?GETPOST('supplier_code', 'alpha') : GETPOST('code_fournisseur', 'alpha');
352 352
 			$object->capital				= GETPOST('capital', 'alphanohtml');
353 353
 			$object->barcode				= GETPOST('barcode', 'alphanohtml');
354 354
 
355 355
 			$object->tva_intra				= GETPOST('tva_intra', 'alphanohtml');
356 356
 			$object->tva_assuj				= GETPOST('assujtva_value', 'alpha');
357
-			$object->vat_reverse_charge		= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
357
+			$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
358 358
 			$object->status = GETPOST('status', 'alpha');
359 359
 
360 360
 			// Local Taxes
@@ -364,24 +364,24 @@  discard block
 block discarded – undo
364 364
 			$object->localtax1_value		= GETPOST('lt1', 'alpha');
365 365
 			$object->localtax2_value		= GETPOST('lt2', 'alpha');
366 366
 
367
-			$object->forme_juridique_code	= GETPOST('forme_juridique_code', 'int');
367
+			$object->forme_juridique_code = GETPOST('forme_juridique_code', 'int');
368 368
 			$object->effectif_id			= GETPOST('effectif_id', 'int');
369
-			$object->typent_id				= GETPOST('typent_id', 'int');
369
+			$object->typent_id = GETPOST('typent_id', 'int');
370 370
 
371 371
 			$object->typent_code			= dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type
372 372
 
373
-			$object->client					= GETPOST('client', 'int');
373
+			$object->client = GETPOST('client', 'int');
374 374
 			$object->fournisseur			= GETPOST('fournisseur', 'int');
375 375
 
376
-			$object->commercial_id			= GETPOST('commercial_id', 'int');
377
-			$object->default_lang			= GETPOST('default_lang');
376
+			$object->commercial_id = GETPOST('commercial_id', 'int');
377
+			$object->default_lang = GETPOST('default_lang');
378 378
 
379 379
 			// Webservices url/key
380 380
 			$object->webservices_url		= GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL);
381 381
 			$object->webservices_key		= GETPOST('webservices_key', 'san_alpha');
382 382
 
383 383
 			if (GETPOSTISSET('accountancy_code_sell')) {
384
-				$accountancy_code_sell		= GETPOST('accountancy_code_sell', 'alpha');
384
+				$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
385 385
 
386 386
 				if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
387 387
 					$object->accountancy_code_sell = '';
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 				}
391 391
 			}
392 392
 			if (GETPOSTISSET('accountancy_code_buy')) {
393
-				$accountancy_code_buy		= GETPOST('accountancy_code_buy', 'alpha');
393
+				$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
394 394
 
395 395
 				if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
396 396
 					$object->accountancy_code_buy = '';
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 
838 838
 	// Actions to build doc
839 839
 	$id = $socid;
840
-	$upload_dir = !empty($conf->societe->multidir_output[$object->entity])?$conf->societe->multidir_output[$object->entity]:$conf->societe->dir_output;
840
+	$upload_dir = !empty($conf->societe->multidir_output[$object->entity]) ? $conf->societe->multidir_output[$object->entity] : $conf->societe->dir_output;
841 841
 	$permissiontoadd = $user->hasRight('societe', 'creer');
842 842
 	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
843 843
 }
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 		$object->civility_id		= GETPOST('civility_id', 'alpha');
1004 1004
 
1005 1005
 		$object->tva_assuj = GETPOST('assujtva_value', 'int');
1006
-		$object->vat_reverse_charge	= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
1006
+		$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
1007 1007
 		$object->status = GETPOST('status', 'int');
1008 1008
 
1009 1009
 		//Local Taxes
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 		$object->default_lang = GETPOST('default_lang');
1020 1020
 
1021 1021
 		if (GETPOSTISSET('accountancy_code_sell')) {
1022
-			$accountancy_code_sell  = GETPOST('accountancy_code_sell', 'alpha');
1022
+			$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
1023 1023
 
1024 1024
 			if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
1025 1025
 				$object->accountancy_code_sell = '';
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 			}
1029 1029
 		}
1030 1030
 		if (GETPOSTISSET('accountancy_code_buy')) {
1031
-			$accountancy_code_buy   = GETPOST('accountancy_code_buy', 'alpha');
1031
+			$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
1032 1032
 
1033 1033
 			if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
1034 1034
 				$object->accountancy_code_buy = '';
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 
1154 1154
 			print '<script type="text/javascript">';
1155 1155
 			print '$(document).ready(function () {
1156
-					var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '0' : '1') . ';
1156
+					var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '0' : '1').';
1157 1157
 
1158 1158
 					init_customer_categ();
1159 1159
 			  		$("#customerprospect").change(function() {
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 			print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
1226 1226
 
1227 1227
 			print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus">';
1228
-			print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');	// For some countries that need the company name in 2 languages
1228
+			print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); // For some countries that need the company name in 2 languages
1229 1229
 			// This implementation of the feature to search already existing company has been disabled. It must be implemented by keeping the "input text" and we must call the search ajax societe/ajax/ajaxcompanies.php
1230 1230
 			// on a keydown of the input. We should show data about a duplicate found if we found less than 5 answers into a div under the input.
1231 1231
 			/*
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 				if ($conf->browser->layout == 'phone') {
1484 1484
 					print '</tr><tr>';
1485 1485
 				}
1486
-				print '<td class="individualline noemail">'.$form->editfieldkey($langs->trans('No_Email') .' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).'</td>';
1486
+				print '<td class="individualline noemail">'.$form->editfieldkey($langs->trans('No_Email').' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).'</td>';
1487 1487
 				print '<td class="individualline" '.(($conf->browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).'</td>';
1488 1488
 			}
1489 1489
 			print '</tr>';
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 			$i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2);
1529 1529
 			while ($i <= 6) {
1530 1530
 				$idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
1531
-				if ($idprof != '-')	{
1531
+				if ($idprof != '-') {
1532 1532
 					$key = 'idprof'.$i;
1533 1533
 
1534 1534
 					if (($j % $NBCOLS) == 0) {
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 			// Vat is used
1555 1555
 			print '<tr><td>'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).'</td>';
1556 1556
 			print '<td>';
1557
-			print '<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET('assujtva_value') ? 'checked="checked"': 'checked="checked"') . ' value="1">'; // Assujeti par defaut en creation
1557
+			print '<input id="assujtva_value" name="assujtva_value" type="checkbox" '.(GETPOSTISSET('assujtva_value') ? 'checked="checked"' : 'checked="checked"').' value="1">'; // Assujeti par defaut en creation
1558 1558
 			print '</td>';
1559 1559
 			if ($conf->browser->layout == 'phone') {
1560 1560
 				print '</tr><tr>';
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
 			if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
1567 1567
 				$s .= ' ';
1568 1568
 
1569
-				if (!empty($conf->use_javascript_ajax))	{
1569
+				if (!empty($conf->use_javascript_ajax)) {
1570 1570
 					$widthpopup = 600;
1571 1571
 					if (!empty($conf->dol_use_jmobile)) {
1572 1572
 						$widthpopup = 350;
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 
1596 1596
 			// VAT reverse charge by default
1597 1597
 			if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
1598
-				print '<tr><td>' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . '</td><td colspan="3">';
1598
+				print '<tr><td>'.$form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0).'</td><td colspan="3">';
1599 1599
 				print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').'>';
1600 1600
 				print '</td></tr>';
1601 1601
 			}
@@ -1604,26 +1604,26 @@  discard block
 block discarded – undo
1604 1604
 			//TODO: Place into a function to control showing by country or study better option
1605 1605
 			if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
1606 1606
 				print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
1607
-				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
1607
+				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '').' value="1">';
1608 1608
 				print '</td>';
1609 1609
 				if ($conf->browser->layout == 'phone') {
1610 1610
 					print '</tr><tr>';
1611 1611
 				}
1612 1612
 				print '<td>'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
1613
-				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
1613
+				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '').' value="1">';
1614 1614
 				print '</td></tr>';
1615 1615
 			} elseif ($mysoc->localtax1_assuj == "1") {
1616 1616
 				print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td colspan="3">';
1617
-				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
1617
+				print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '').' value="1">';
1618 1618
 				print '</td></tr>';
1619 1619
 			} elseif ($mysoc->localtax2_assuj == "1") {
1620 1620
 				print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td colspan="3">';
1621
-				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
1621
+				print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '').' value="1">';
1622 1622
 				print '</td></tr>';
1623 1623
 			}
1624 1624
 
1625 1625
 			// Type - Workforce/Staff
1626
-			print '<tr><td>'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'</td><td class="maxwidthonsmartphone"'.( ($conf->browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n";
1626
+			print '<tr><td>'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n";
1627 1627
 			$sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
1628 1628
 			print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
1629 1629
 			if ($user->admin) {
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
 				$object->phone					= GETPOST('phone', 'alpha');
1861 1861
 				$object->fax					= GETPOST('fax', 'alpha');
1862 1862
 				$object->email					= GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
1863
-				$object->no_email				= GETPOST("no_email", "int");
1863
+				$object->no_email = GETPOST("no_email", "int");
1864 1864
 				$object->url					= GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL);
1865 1865
 				$object->capital				= GETPOST('capital', 'alphanohtml');
1866 1866
 				$object->idprof1				= GETPOST('idprof1', 'alphanohtml');
@@ -1876,16 +1876,16 @@  discard block
 block discarded – undo
1876 1876
 				$object->default_lang = GETPOST('default_lang', 'alpha');
1877 1877
 
1878 1878
 				$object->tva_assuj				= GETPOST('assujtva_value', 'int');
1879
-				$object->vat_reverse_charge		= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
1879
+				$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
1880 1880
 				$object->tva_intra				= GETPOST('tva_intra', 'alphanohtml');
1881
-				$object->status =				GETPOST('status', 'int');
1881
+				$object->status = GETPOST('status', 'int');
1882 1882
 
1883 1883
 				// Webservices url/key
1884 1884
 				$object->webservices_url        = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL);
1885 1885
 				$object->webservices_key        = GETPOST('webservices_key', 'san_alpha');
1886 1886
 
1887 1887
 				if (GETPOSTISSET('accountancy_code_sell')) {
1888
-					$accountancy_code_sell  = GETPOST('accountancy_code_sell', 'alpha');
1888
+					$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
1889 1889
 
1890 1890
 					if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
1891 1891
 						$object->accountancy_code_sell = '';
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 					}
1895 1895
 				}
1896 1896
 				if (GETPOSTISSET('accountancy_code_buy')) {
1897
-					$accountancy_code_buy   = GETPOST('accountancy_code_buy', 'alpha');
1897
+					$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
1898 1898
 
1899 1899
 					if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
1900 1900
 						$object->accountancy_code_buy = '';
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
     				}
1977 1977
     			});
1978 1978
 
1979
-				var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '0' : '1') . ';
1979
+				var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '0' : '1').';
1980 1980
 
1981 1981
 				init_customer_categ();
1982 1982
 	  			$("#customerprospect").change(function() {
@@ -2165,13 +2165,13 @@  discard block
 block discarded – undo
2165 2165
 				print '</td></tr>';
2166 2166
 
2167 2167
 				// Zip / Town
2168
-				print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td'.($conf->browser->layout == 'phone' ? ' colspan="3"': '').'>';
2168
+				print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td'.($conf->browser->layout == 'phone' ? ' colspan="3"' : '').'>';
2169 2169
 				print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
2170 2170
 				print '</td>';
2171 2171
 				if ($conf->browser->layout == 'phone') {
2172 2172
 					print '</tr><tr>';
2173 2173
 				}
2174
-				print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td'.($conf->browser->layout == 'phone' ? ' colspan="3"': '').'>';
2174
+				print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td'.($conf->browser->layout == 'phone' ? ' colspan="3"' : '').'>';
2175 2175
 				print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
2176 2176
 				print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
2177 2177
 				print '</td></tr>';
@@ -2200,12 +2200,12 @@  discard block
 block discarded – undo
2200 2200
 
2201 2201
 				// Phone / Fax
2202 2202
 				print '<tr><td>'.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).'</td>';
2203
-				print '<td'.($conf->browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' <input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td>';
2203
+				print '<td'.($conf->browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' <input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td>';
2204 2204
 				if ($conf->browser->layout == 'phone') {
2205 2205
 					print '</tr><tr>';
2206 2206
 				}
2207 2207
 				print '<td>'.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).'</td>';
2208
-				print '<td'.($conf->browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' <input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : $object->fax).'"></td>';
2208
+				print '<td'.($conf->browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' <input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : $object->fax).'"></td>';
2209 2209
 				print '</tr>';
2210 2210
 
2211 2211
 				// Web
@@ -2290,14 +2290,14 @@  discard block
 block discarded – undo
2290 2290
 
2291 2291
 				// VAT is used
2292 2292
 				print '<tr><td>'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).'</td><td colspan="3">';
2293
-				print '<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . ($object->tva_assuj ? 'checked="checked"': '') . ' value="1">';
2293
+				print '<input id="assujtva_value" name="assujtva_value" type="checkbox" '.($object->tva_assuj ? 'checked="checked"' : '').' value="1">';
2294 2294
 				print '</td></tr>';
2295 2295
 
2296 2296
 				// Local Taxes
2297 2297
 				//TODO: Place into a function to control showing by country or study better option
2298 2298
 				if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
2299 2299
 					print '<tr><td>'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).'</td><td>';
2300
-					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . ($object->localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
2300
+					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.($object->localtax1_assuj ? 'checked="checked"' : '').' value="1">';
2301 2301
 					if (!isOnlyOneLocalTax(1)) {
2302 2302
 						print '<span class="cblt1">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2303 2303
 						$formcompany->select_localtax(1, $object->localtax1_value, "lt1");
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
 					print '</td>';
2307 2307
 					print '</tr><tr>';
2308 2308
 					print '<td>'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).'</td><td>';
2309
-					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . ($object->localtax2_assuj ? 'checked="checked"' : '') . ' value="1"></td></tr>';
2309
+					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.($object->localtax2_assuj ? 'checked="checked"' : '').' value="1"></td></tr>';
2310 2310
 					if (!isOnlyOneLocalTax(2)) {
2311 2311
 						print '<span class="cblt2">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2312 2312
 						$formcompany->select_localtax(2, $object->localtax2_value, "lt2");
@@ -2315,7 +2315,7 @@  discard block
 block discarded – undo
2315 2315
 					print '</td></tr>';
2316 2316
 				} elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") {
2317 2317
 					print '<tr><td>'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).'</td><td colspan="3">';
2318
-					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . ($object->localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
2318
+					print '<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" '.($object->localtax1_assuj ? 'checked="checked"' : '').' value="1">';
2319 2319
 					if (!isOnlyOneLocalTax(1)) {
2320 2320
 						print '<span class="cblt1">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2321 2321
 						$formcompany->select_localtax(1, $object->localtax1_value, "lt1");
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 					print '</td></tr>';
2325 2325
 				} elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") {
2326 2326
 					print '<tr><td>'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).'</td><td colspan="3">';
2327
-					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . ($object->localtax2_assuj ? 'checked="checked"' : '') . ' value="1">';
2327
+					print '<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" '.($object->localtax2_assuj ? 'checked="checked"' : '').' value="1">';
2328 2328
 					if (!isOnlyOneLocalTax(2)) {
2329 2329
 						print '<span class="cblt2">     '.$langs->transcountry("Type", $mysoc->country_code).': ';
2330 2330
 						$formcompany->select_localtax(2, $object->localtax2_value, "lt2");
@@ -2335,7 +2335,7 @@  discard block
 block discarded – undo
2335 2335
 
2336 2336
 				// VAT reverse charge by default
2337 2337
 				if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
2338
-					print '<tr><td>' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . '</td><td colspan="3">';
2338
+					print '<tr><td>'.$form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0).'</td><td colspan="3">';
2339 2339
 					print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').'>';
2340 2340
 					print '</td></tr>';
2341 2341
 				}
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
 				print '</tr>';
2377 2377
 
2378 2378
 				// Type - Workforce/Staff
2379
-				print '<tr><td>'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'</td><td class="maxwidthonsmartphone"'.( ($conf->browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>';
2379
+				print '<tr><td>'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>';
2380 2380
 				print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
2381 2381
 				if ($user->admin) {
2382 2382
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
 					$maxfilesizearray = getMaxFileSizeArray();
2513 2513
 					$maxmin = $maxfilesizearray['maxmin'];
2514 2514
 					if ($maxmin > 0) {
2515
-						print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
2515
+						print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
2516 2516
 					}
2517 2517
 					print '<input type="file" class="flat" name="photo" id="photoinput">';
2518 2518
 					print '</td></tr>';
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
 					print '<tr><td>';
2733 2733
 					print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc'));
2734 2734
 					print '</td><td>';
2735
-					print '<input type="checkbox" name="vat_reverse_charge" ' . ($object->vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>';
2735
+					print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').' disabled>';
2736 2736
 					print '</td>';
2737 2737
 					print '</tr>';
2738 2738
 				}
Please login to merge, or discard this patch.
htdocs/compta/tva/class/paymentvat.class.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	public $datepaye;
115 115
 
116 116
 		/**
117
-	 * @var string
118
-	 */
117
+		 * @var string
118
+		 */
119 119
 	public $type_code;
120 120
 
121 121
 	/**
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	}
647 647
 
648 648
 
649
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
649
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
650 650
 	/**
651 651
 	 *  Update link between vat payment and line in llx_bank generated
652 652
 	 *
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	 */
656 656
 	public function update_fk_bank($id_bank)
657 657
 	{
658
-        // phpcs:enable
658
+		// phpcs:enable
659 659
 		$sql = "UPDATE ".MAIN_DB_PREFIX."payment_vat SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
660 660
 
661 661
 		dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		return $this->LibStatut($this->statut, $mode);
681 681
 	}
682 682
 
683
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
683
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
684 684
 	/**
685 685
 	 *  Return the label of a given status
686 686
 	 *
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	 */
691 691
 	public function LibStatut($status, $mode = 0)
692 692
 	{
693
-        // phpcs:enable
693
+		// phpcs:enable
694 694
 		global $langs;
695 695
 
696 696
 		$langs->load('compta');
Please login to merge, or discard this patch.
htdocs/fichinter/class/fichinterrec.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
 
290 290
 				$this->id = $rowid;
291 291
 				$this->title				= $obj->title;
292
-				$this->ref                  = $obj->title;
292
+				$this->ref = $obj->title;
293 293
 				$this->description = $obj->description;
294 294
 				$this->datec				= $obj->datec;
295 295
 				$this->duration = $obj->duree;
296 296
 				$this->socid				= $obj->fk_soc;
297 297
 				$this->status = 0;
298
-				$this->statut = 0;	// deprecated
298
+				$this->statut = 0; // deprecated
299 299
 				$this->fk_project			= $obj->fk_projet;
300 300
 				$this->fk_contrat			= $obj->fk_contrat;
301 301
 				$this->note_private = $obj->note_private;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 			$sql .= ", ".(!empty($fk_product) ? $fk_product : "null");
549 549
 			$sql .= ", ".$product_type;
550 550
 			$sql .= ", ".(!empty($remise_percent) ? $remise_percent : "null");
551
-			$sql.= ", '".price2num($pu_ht)."'";
551
+			$sql .= ", '".price2num($pu_ht)."'";
552 552
 			$sql .= ", '".price2num($total_ht)."'";
553 553
 			$sql .= ", '".price2num($total_tva)."'";
554 554
 			$sql .= ", '".price2num($total_ttc)."'";
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 			$result .= $link.$this->ref.$linkend;
643 643
 		}
644 644
 		global $action;
645
-		$hookmanager->initHooks(array($this->element . 'dao'));
645
+		$hookmanager->initHooks(array($this->element.'dao'));
646 646
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
647 647
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
648 648
 		if ($reshook > 0) {
Please login to merge, or discard this patch.