Completed
Branch develop (35d0a6)
by
unknown
23:15
created
htdocs/commande/list.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 $search_deliverymonth = '';
150 150
 $search_deliveryyear = '';
151 151
 
152
-$search_import_key  = trim(GETPOST("search_import_key", "alpha"));
152
+$search_import_key = trim(GETPOST("search_import_key", "alpha"));
153 153
 
154 154
 $diroutputmassaction = $conf->order->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
155 155
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	'typent.code' => array('label' => "ThirdPartyType", 'checked' => (string) $checkedtypetiers, 'position' => 55),
217 217
 	'c.date_commande' => array('label' => "OrderDateShort", 'checked' => '1', 'position' => 60, 'csslist' => 'nowraponall'),
218 218
 	'c.delivery_date' => array('label' => "DateDeliveryPlanned", 'checked' => '1', 'enabled' => (string) (int) !getDolGlobalString('ORDER_DISABLE_DELIVERY_DATE'), 'position' => 65, 'csslist' => 'nowraponall'),
219
-	'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => '-1', 'position' => 66 , 'enabled' => (string) (int) isModEnabled("shipping")),
219
+	'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => '-1', 'position' => 66, 'enabled' => (string) (int) isModEnabled("shipping")),
220 220
 	'c.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => '-1', 'position' => 67),
221 221
 	'c.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => '-1', 'position' => 68),
222 222
 	'c.fk_input_reason' => array('label' => "Origin", 'checked' => '-1', 'position' => 69),
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	'c.date_cloture' => array('label' => "DateClosing", 'checked' => '0', 'position' => 130),
240 240
 	'c.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 135, 'searchall' => 1),
241 241
 	'c.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 140),
242
-	'shippable' => array('label' => "Shippable", 'checked' => '1','enabled' => (string) (int) (isModEnabled("shipping")), 'position' => 990),
242
+	'shippable' => array('label' => "Shippable", 'checked' => '1', 'enabled' => (string) (int) (isModEnabled("shipping")), 'position' => 990),
243 243
 	'c.facture' => array('label' => "Billed", 'checked' => '1', 'enabled' => (string) (int) (!getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')), 'position' => 995),
244 244
 	'c.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'visible' => -2, 'position' => 999),
245 245
 	'c.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000)
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 				}
430 430
 
431 431
 				if (empty($objecttmp->note_public)) {
432
-					$objecttmp->note_public =  $langs->transnoentities("Orders");
432
+					$objecttmp->note_public = $langs->transnoentities("Orders");
433 433
 				}
434 434
 
435 435
 				$datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 			$db->rollback();
755 755
 
756 756
 			$action = 'create';
757
-			$_GET["origin"] = $_POST["origin"];		// Keep GET and POST here ?
757
+			$_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ?
758 758
 			$_GET["originid"] = $_POST["originid"]; // Keep GET and POST here ?
759 759
 			if (!empty($errors)) {
760 760
 				setEventMessages(null, $errors, 'errors');
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 			if ($searchCategoryCustomerOperator == 0) {
1130 1130
 				$searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).")";
1131 1131
 			} else {
1132
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
1132
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer);
1133 1133
 			}
1134 1134
 		}
1135 1135
 	}
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 			if ($searchCategoryProductOperator == 0) {
1160 1160
 				$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
1161 1161
 			} else {
1162
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
1162
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct);
1163 1163
 			}
1164 1164
 		}
1165 1165
 	}
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 }
1621 1621
 
1622 1622
 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1623
-$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup
1623
+$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
1624 1624
 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
1625 1625
 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1626 1626
 
@@ -2793,15 +2793,15 @@  discard block
 block discarded – undo
2793 2793
 			if (!empty($show_shippable_command) && isModEnabled('stock')) {
2794 2794
 				$text_icon = '';
2795 2795
 				if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2796
-					$generic_commande->getLinesArray(); 	// Load array ->lines
2797
-					$generic_commande->loadExpeditions();	// Load array ->expeditions
2796
+					$generic_commande->getLinesArray(); // Load array ->lines
2797
+					$generic_commande->loadExpeditions(); // Load array ->expeditions
2798 2798
 
2799 2799
 					$numlines = count($generic_commande->lines); // Loop on each line of order
2800 2800
 					for ($lig = 0; $lig < $numlines; $lig++) {
2801 2801
 						$orderLine = $generic_commande->lines[$lig];
2802 2802
 						'@phan-var-force OrderLine $orderLine';
2803 2803
 						if (isset($generic_commande->expeditions[$orderLine->id])) {
2804
-							$reliquat =  $orderLine->qty - $generic_commande->expeditions[$orderLine->id];
2804
+							$reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id];
2805 2805
 						} else {
2806 2806
 							$reliquat = $orderLine->qty;
2807 2807
 						}
Please login to merge, or discard this patch.
htdocs/commande/card.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -91,18 +91,18 @@  discard block
 block discarded – undo
91 91
 
92 92
 
93 93
 $id        = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('orderid'));
94
-$ref       =  GETPOST('ref', 'alpha');
95
-$socid     =  GETPOSTINT('socid');
96
-$action    =  GETPOST('action', 'aZ09');
97
-$cancel    =  GETPOST('cancel', 'alpha');
98
-$confirm   =  GETPOST('confirm', 'alpha');
94
+$ref       = GETPOST('ref', 'alpha');
95
+$socid     = GETPOSTINT('socid');
96
+$action    = GETPOST('action', 'aZ09');
97
+$cancel    = GETPOST('cancel', 'alpha');
98
+$confirm   = GETPOST('confirm', 'alpha');
99 99
 $backtopage = GETPOST('backtopage', 'alpha');
100 100
 
101
-$lineid    =  GETPOSTINT('lineid');
102
-$contactid =  GETPOSTINT('contactid');
103
-$projectid =  GETPOSTINT('projectid');
104
-$origin    =  GETPOST('origin', 'alpha');
105
-$originid  = (GETPOSTINT('originid') ? GETPOSTINT('originid') : GETPOSTINT('origin_id'));    // For backward compatibility
101
+$lineid    = GETPOSTINT('lineid');
102
+$contactid = GETPOSTINT('contactid');
103
+$projectid = GETPOSTINT('projectid');
104
+$origin    = GETPOST('origin', 'alpha');
105
+$originid  = (GETPOSTINT('originid') ? GETPOSTINT('originid') : GETPOSTINT('origin_id')); // For backward compatibility
106 106
 $rank      = (GETPOSTINT('rank') > 0) ? GETPOSTINT('rank') : -1;
107 107
 
108 108
 // Type Contact default
@@ -145,26 +145,26 @@  discard block
 block discarded – undo
145 145
 $extrafields->fetch_name_optionals_label($object->table_element);
146 146
 
147 147
 // Load object
148
-include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php';     // Must be 'include', not 'include_once'
148
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'
149 149
 
150 150
 // Permissions / Rights
151
-$usercanread    =  $user->hasRight("commande", "lire");
152
-$usercancreate  =  $user->hasRight("commande", "creer");
153
-$usercandelete  =  $user->hasRight("commande", "supprimer");
151
+$usercanread    = $user->hasRight("commande", "lire");
152
+$usercancreate  = $user->hasRight("commande", "creer");
153
+$usercandelete  = $user->hasRight("commande", "supprimer");
154 154
 
155 155
 // Advanced permissions
156
-$usercanclose       =  ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'close')));
157
-$usercanvalidate    =  ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'validate')));
158
-$usercancancel      =  ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'annuler')));
159
-$usercansend        =   (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'send'));
160
-$usercangeneretedoc =   (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'generetedoc'));
156
+$usercanclose       = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'close')));
157
+$usercanvalidate    = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'validate')));
158
+$usercancancel      = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'annuler')));
159
+$usercansend        = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'send'));
160
+$usercangeneretedoc = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'generetedoc'));
161 161
 
162 162
 $usermustrespectpricemin    = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS'));
163 163
 $usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer'));
164 164
 
165
-$permissionnote    = $usercancreate;     //  Used by the include of actions_setnotes.inc.php
166
-$permissiondellink = $usercancreate;     //  Used by the include of actions_dellink.inc.php
167
-$permissiontoadd   = $usercancreate;     //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
165
+$permissionnote    = $usercancreate; //  Used by the include of actions_setnotes.inc.php
166
+$permissiondellink = $usercancreate; //  Used by the include of actions_dellink.inc.php
167
+$permissiontoadd   = $usercancreate; //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
168 168
 
169 169
 
170 170
 $error = 0;
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 		$action = '';
212 212
 	}
213 213
 
214
-	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php';    // Must be 'include', not 'include_once'
214
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
215 215
 
216
-	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';     // Must be 'include', not 'include_once'
216
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
217 217
 
218
-	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';  // Must be 'include', not 'include_once'
218
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once'
219 219
 
220 220
 	// Action clone object
221 221
 	if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate) {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		$pu_ht = '';
748 748
 		$pu_ttc = '';
749 749
 		$pu_ht_devise = '';
750
-		$pu_ttc_devise  = '';
750
+		$pu_ttc_devise = '';
751 751
 
752 752
 		if (GETPOST('price_ht') !== '') {
753 753
 			$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 									$price_base_type = $custprice_line->price_base_type;
889 889
 									$tva_tx = $custprice_line->tva_tx;
890 890
 									if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', (string) $tva_tx)) {
891
-										$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
891
+										$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
892 892
 									}
893 893
 									$tva_npr = $custprice_line->recuperableonly;
894 894
 									if (empty($tva_tx)) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 									$price_base_type = $custprice_line->price_base_type;
955 955
 									$tva_tx = $custprice_line->tva_tx;
956 956
 									if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
957
-										$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
957
+										$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
958 958
 									}
959 959
 									$tva_npr = $custprice_line->recuperableonly;
960 960
 									if (empty($tva_tx)) {
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 					GETPOST('generate_deposit', 'alpha') == 'on' && !empty($deposit_percent_from_payment_terms)
1486 1486
 					&& isModEnabled('invoice') && $user->hasRight('facture', 'creer')
1487 1487
 				) {
1488
-					require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1488
+					require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1489 1489
 
1490 1490
 					$date = dol_mktime(0, 0, 0, GETPOSTINT('datefmonth'), GETPOSTINT('datefday'), GETPOSTINT('datefyear'));
1491 1491
 					$forceFields = array();
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
 					if ($deposit) {
1500 1500
 						setEventMessage('DepositGenerated');
1501
-						$locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id;
1501
+						$locationTarget = DOL_URL_ROOT.'/compta/facture/card.php?id='.$deposit->id;
1502 1502
 					} else {
1503 1503
 						$error++;
1504 1504
 						setEventMessages($object->error, $object->errors, 'errors');
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 				}
1507 1507
 
1508 1508
 				// Define output language
1509
-				if (! $error) {
1509
+				if (!$error) {
1510 1510
 					$db->commit();
1511 1511
 
1512 1512
 					if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 					}
1535 1535
 
1536 1536
 					if ($locationTarget) {
1537
-						header('Location: ' . $locationTarget);
1537
+						header('Location: '.$locationTarget);
1538 1538
 						exit;
1539 1539
 					}
1540 1540
 				} else {
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 	}
1626 1626
 
1627 1627
 	if ($action == 'update_extras' && $usercancreate) {
1628
-		$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
1628
+		$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
1629 1629
 		$attribute_name = GETPOST('attribute', 'restricthtml');
1630 1630
 
1631 1631
 		// Fill array 'array_options' with data from update form
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
 
1863 1863
 			$classname = ucfirst($subelement);
1864 1864
 			$objectsrc = new $classname($db);
1865
-			'@phan-var-force Commande|Propal|Contrat $objectsrc';  // Can possibly be other class but CommonObject is too general
1865
+			'@phan-var-force Commande|Propal|Contrat $objectsrc'; // Can possibly be other class but CommonObject is too general
1866 1866
 			$objectsrc->fetch($originid);
1867 1867
 			if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
1868 1868
 				$objectsrc->fetch_lines();
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
 	print '<form name="crea_commande" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
1960 1960
 	print '<input type="hidden" name="token" value="'.newToken().'">';
1961 1961
 	print '<input type="hidden" name="action" value="add">';
1962
-	print '<input type="hidden" name="changecompany" value="0">';	// will be set to 1 by javascript so we know post is done after a company change
1962
+	print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change
1963 1963
 	print '<input type="hidden" name="remise_percent" value="'.$soc->remise_percent.'">';
1964 1964
 	print '<input type="hidden" name="origin" value="'.$origin.'">';
1965 1965
 	print '<input type="hidden" name="originid" value="'.$originid.'">';
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
 		// Other attributes
2142 2142
 		$parameters = array();
2143 2143
 		if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
2144
-			$parameters['objectsrc'] =  $objectsrc;
2144
+			$parameters['objectsrc'] = $objectsrc;
2145 2145
 		}
2146 2146
 		$parameters['socid'] = $socid;
2147 2147
 
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 			$nbMandated = 0;
2368 2368
 			foreach ($object->lines as $line) {
2369 2369
 				$res = $line->fetch_product();
2370
-				if ($res  > 0) {
2370
+				if ($res > 0) {
2371 2371
 					if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) {
2372 2372
 						$nbMandated++;
2373 2373
 						break;
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
 				$deposit_percent_from_payment_terms = (float) getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
2392 2392
 
2393 2393
 				if (!empty($deposit_percent_from_payment_terms) && isModEnabled('invoice') && $user->hasRight('facture', 'creer')) {
2394
-					require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
2394
+					require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
2395 2395
 
2396 2396
 					$object->fetchObjectLinked();
2397 2397
 
@@ -2604,7 +2604,7 @@  discard block
 block discarded – undo
2604 2604
 		$morehtmlref = '<div class="refidno">';
2605 2605
 		// Ref customer
2606 2606
 		$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, (int) $usercancreate, 'string', '', 0, 1);
2607
-		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, (int) $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
2607
+		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, (int) $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
2608 2608
 		// Thirdparty
2609 2609
 		$morehtmlref .= '<br>'.$soc->getNomUrl(1, 'customer');
2610 2610
 		if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
@@ -2924,36 +2924,36 @@  discard block
 block discarded – undo
2924 2924
 
2925 2925
 			$alert = '';
2926 2926
 			if (getDolGlobalString('ORDER_MANAGE_MIN_AMOUNT') && $object->total_ht < $object->thirdparty->order_min_amount) {
2927
-				$alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->order_min_amount));
2927
+				$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
2928 2928
 			}
2929 2929
 
2930 2930
 			print '<tr>';
2931
-			print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
2932
-			print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2931
+			print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
2932
+			print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2933 2933
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2934 2934
 				// Multicurrency Amount HT
2935
-				print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2935
+				print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2936 2936
 			}
2937 2937
 			print '</tr>';
2938 2938
 
2939 2939
 			print '<tr>';
2940
-			print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>';
2941
-			print '<td class="nowrap amountcard right">' . price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2940
+			print '<td class="titlefieldmiddle">'.$langs->trans('AmountVAT').'</td>';
2941
+			print '<td class="nowrap amountcard right">'.price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2942 2942
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2943 2943
 				// Multicurrency Amount VAT
2944
-				print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2944
+				print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2945 2945
 			}
2946 2946
 			print '</tr>';
2947 2947
 
2948 2948
 			// Amount Local Taxes
2949 2949
 			if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) {
2950 2950
 				print '<tr>';
2951
-				print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
2952
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2951
+				print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
2952
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2953 2953
 				if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2954 2954
 					$object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');
2955 2955
 
2956
-					print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2956
+					print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2957 2957
 				}
2958 2958
 				print '</tr>';
2959 2959
 			}
@@ -2961,22 +2961,22 @@  discard block
 block discarded – undo
2961 2961
 			// Amount Local Taxes
2962 2962
 			if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
2963 2963
 				print '<tr>';
2964
-				print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
2965
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2964
+				print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
2965
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2966 2966
 				if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2967 2967
 					$object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');
2968 2968
 
2969
-					print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2969
+					print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2970 2970
 				}
2971 2971
 				print '</tr>';
2972 2972
 			}
2973 2973
 
2974 2974
 			print '<tr>';
2975
-			print '<td>' . $langs->trans('AmountTTC') . '</td>';
2976
-			print '<td class="valuefield nowrap right amountcard">' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '</td>';
2975
+			print '<td>'.$langs->trans('AmountTTC').'</td>';
2976
+			print '<td class="valuefield nowrap right amountcard">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td>';
2977 2977
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2978 2978
 				// Multicurrency Amount TTC
2979
-				print '<td class="valuefield nowrap right amountcard">' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '</td>';
2979
+				print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code).'</td>';
2980 2980
 			}
2981 2981
 			print '</tr>'."\n";
2982 2982
 
@@ -3093,7 +3093,7 @@  discard block
 block discarded – undo
3093 3093
 						if ($usercansend) {
3094 3094
 							print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
3095 3095
 						} else {
3096
-							print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF']. '#', '', false);
3096
+							print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF'].'#', '', false);
3097 3097
 						}
3098 3098
 					}
3099 3099
 				}
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
 						'enabled' => (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT),
3121 3121
 						'perm' => $usercancreatepurchaseorder,
3122 3122
 						'label' => 'AddPurchaseOrder',
3123
-						'url' => '/fourn/commande/card.php?action=create&amp;origin=' . urlencode($object->element) . '&amp;originid=' . ((int) $object->id)
3123
+						'url' => '/fourn/commande/card.php?action=create&amp;origin='.urlencode($object->element).'&amp;originid='.((int) $object->id)
3124 3124
 					);
3125 3125
 				}
3126 3126
 
@@ -3136,7 +3136,7 @@  discard block
 block discarded – undo
3136 3136
 					'enabled' => (isModEnabled("intervention") && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0),
3137 3137
 					'perm' => ($user->hasRight('ficheinter', 'creer') == 1),
3138 3138
 					'label' => 'AddIntervention',
3139
-					'url' => '/fichinter/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid,
3139
+					'url' => '/fichinter/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
3140 3140
 				);
3141 3141
 				/*if (isModEnabled('ficheinter')) {
3142 3142
 					$langs->load("interventions");
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
 					'enabled' => (isModEnabled("contract") && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)),
3157 3157
 					'perm' => ($user->hasRight('contrat', 'creer') == 1),
3158 3158
 					'label' => 'AddContract',
3159
-					'url' => '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid,
3159
+					'url' => '/contrat/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
3160 3160
 				);
3161 3161
 				/*if (isModEnabled('contrat') && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
3162 3162
 					$langs->load("contracts");
@@ -3179,7 +3179,7 @@  discard block
 block discarded – undo
3179 3179
 							'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))),
3180 3180
 							'perm' => $user->hasRight('expedition', 'creer'),
3181 3181
 							'label' => 'CreateShipment',
3182
-							'url' => '/expedition/shipment.php?id=' . $object->id
3182
+							'url' => '/expedition/shipment.php?id='.$object->id
3183 3183
 						);
3184 3184
 						/*
3185 3185
 						if ($user->hasRight('expedition', 'creer')) {
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
 						}*/
3190 3190
 					} else {
3191 3191
 						$langs->load("errors");
3192
-						print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
3192
+						print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
3193 3193
 					}
3194 3194
 				}
3195 3195
 
@@ -3199,7 +3199,7 @@  discard block
 block discarded – undo
3199 3199
 					'enabled' => (isModEnabled('invoice') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0),
3200 3200
 					'perm' => ($user->hasRight('facture', 'creer') && !getDolGlobalInt('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')),
3201 3201
 					'label' => 'CreateBill',
3202
-					'url' => '/compta/facture/card.php?action=create&amp;token=' . newToken() . '&amp;origin=' . urlencode($object->element) . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid
3202
+					'url' => '/compta/facture/card.php?action=create&amp;token='.newToken().'&amp;origin='.urlencode($object->element).'&amp;originid='.$object->id.'&amp;socid='.$object->socid
3203 3203
 				);
3204 3204
 				/*
3205 3205
 				 if (isModEnabled('facture') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
@@ -3251,7 +3251,7 @@  discard block
 block discarded – undo
3251 3251
 					if ($numshipping == 0) {
3252 3252
 						print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
3253 3253
 					} else {
3254
-						print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
3254
+						print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
3255 3255
 					}
3256 3256
 				}
3257 3257
 			}
Please login to merge, or discard this patch.
htdocs/commande/list_det.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	'typent.code' => array('label' => "ThirdPartyType", 'checked' => (string) $checkedtypetiers, 'position' => 55),
209 209
 	'c.date_commande' => array('label' => "OrderDateShort", 'checked' => '1', 'position' => 60),
210 210
 	'c.delivery_date' => array('label' => "DateDeliveryPlanned", 'checked' => '1', 'enabled' => (string) (int) !getDolGlobalString('ORDER_DISABLE_DELIVERY_DATE'), 'position' => 65),
211
-	'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => '-1', 'position' => 66 , 'enabled' => (string) (int) isModEnabled('shipping')),
211
+	'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => '-1', 'position' => 66, 'enabled' => (string) (int) isModEnabled('shipping')),
212 212
 	'c.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => '-1', 'position' => 67),
213 213
 	'c.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => '-1', 'position' => 68),
214 214
 	'c.fk_input_reason' => array('label' => "Channel", 'checked' => '-1', 'position' => 69),
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	'c.date_cloture' => array('label' => "DateClosing", 'checked' => '0', 'position' => 130),
233 233
 	'c.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_ALLOW_PUBLIC_NOTES')), 'position' => 135),
234 234
 	'c.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_ALLOW_PRIVATE_NOTES')), 'position' => 140),
235
-	'shippable' => array('label' => "Shippable", 'checked' => '1','enabled' => (string) (int) (isModEnabled('shipping')), 'position' => 990),
235
+	'shippable' => array('label' => "Shippable", 'checked' => '1', 'enabled' => (string) (int) (isModEnabled('shipping')), 'position' => 990),
236 236
 	'c.facture' => array('label' => "Billed", 'checked' => '1', 'enabled' => (string) (int) (!getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')), 'position' => 995),
237 237
 	'c.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'visible' => -2, 'position' => 999),
238 238
 	'c.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000)
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	$sql .= natural_search('pr.ref', $search_refProduct);
469 469
 }
470 470
 if ($search_descProduct) {
471
-	$sql .= natural_search(array('pr.label','cdet.description'), $search_descProduct);
471
+	$sql .= natural_search(array('pr.label', 'cdet.description'), $search_descProduct);
472 472
 }
473 473
 if ($search_ref) {
474 474
 	$sql .= natural_search('c.ref', $search_ref);
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 			if ($searchCategoryProductOperator == 0) {
621 621
 				$searchCategoryProjectSqlList[] = " EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as cp WHERE cdet.fk_product = cp.fk_product AND cp.fk_categorie = ".((int) $searchCategoryProject).")";
622 622
 			} else {
623
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProject);
623
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProject);
624 624
 			}
625 625
 		}
626 626
 	}
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	if (!empty($socid)) {
891 891
 		$url .= '&socid='.$socid;
892 892
 	}
893
-	$newcardbutton = '';//dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlistdet' && $permissiontoadd);
893
+	$newcardbutton = ''; //dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlistdet' && $permissiontoadd);
894 894
 
895 895
 	// Lines of title fields
896 896
 	print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 	if (!empty($arrayfields['rowid']['checked'])) {
1310 1310
 		// @phan-suppress-next-line PhanTypeInvalidDimOffset
1311 1311
 		print_liste_field_titre($arrayfields['rowid']['label'], $_SERVER["PHP_SELF"], 'rowid', '', $param, '', $sortfield, $sortorder);
1312
-		'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';  // dol_sort_array looses type for Phan
1312
+		'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
1313 1313
 	}
1314 1314
 	if (!empty($arrayfields['pr.ref']['checked'])) {
1315 1315
 		print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder);
@@ -2105,10 +2105,10 @@  discard block
 block discarded – undo
2105 2105
 			if (!empty($show_shippable_command) && isModEnabled('stock')) {
2106 2106
 				$text_icon = '';
2107 2107
 				if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2108
-					$generic_commande->loadExpeditions();	// Load array ->expeditions
2108
+					$generic_commande->loadExpeditions(); // Load array ->expeditions
2109 2109
 
2110 2110
 					if (isset($generic_commande->expeditions[$obj->rowid])) {
2111
-						$reliquat =  $obj->qty - $generic_commande->expeditions[$obj->rowid];
2111
+						$reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
2112 2112
 					} else {
2113 2113
 						$reliquat = $obj->qty;
2114 2114
 					}
Please login to merge, or discard this patch.
htdocs/website/samples/wrapper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,13 +129,13 @@
 block discarded – undo
129 129
 $original_file = str_replace("../", "/", $original_file);
130 130
 
131 131
 // Cache or not
132
-$cachestring = GETPOST("cache", 'aZ09');	// May be 1, or an int (delay in second of the cache if < 999999, or a timestamp), or a hash
132
+$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int (delay in second of the cache if < 999999, or a timestamp), or a hash
133 133
 $cachedelay = GETPOSTINT('cachedelay') ? GETPOSTINT('cachedelay') : ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600');
134 134
 if ($cachestring || image_format_supported($original_file) >= 0) {
135 135
 	// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
136 136
 	header('Cache-Control: max-age='.$cachedelay.', public, must-revalidate');
137 137
 	header('Pragma: cache'); // This is to avoid having Pragma: no-cache
138
-	header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $cachedelay).' GMT');	// This is to avoid to have Expires set by proxy or web server
138
+	header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $cachedelay).' GMT'); // This is to avoid to have Expires set by proxy or web server
139 139
 }
140 140
 
141 141
 $refname = basename(dirname($original_file)."/");
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * Note: cond_reglement can not be aliased to cond_reglement!!!
478 478
 	 */
479
-	private $cond_reglement;  // Private to call DolDeprecationHandler
479
+	private $cond_reglement; // Private to call DolDeprecationHandler
480 480
 	/**
481 481
 	 * @var int|string Internal to detect deprecated access
482 482
 	 */
483
-	protected $depr_cond_reglement;  // Internal value for deprecation
483
+	protected $depr_cond_reglement; // Internal value for deprecation
484 484
 
485 485
 	/**
486 486
 	 * @var int 		Delivery address ID
@@ -537,12 +537,12 @@  discard block
 block discarded – undo
537 537
 	/**
538 538
 	 * @var float|string Multicurrency total localtax1
539 539
 	 */
540
-	public $multicurrency_total_localtax1;	// not in database
540
+	public $multicurrency_total_localtax1; // not in database
541 541
 
542 542
 	/**
543 543
 	 * @var float|string Multicurrency total localtax2
544 544
 	 */
545
-	public $multicurrency_total_localtax2;	// not in database
545
+	public $multicurrency_total_localtax2; // not in database
546 546
 
547 547
 	/**
548 548
 	 * @var ?string
@@ -1033,17 +1033,17 @@  discard block
 block discarded – undo
1033 1033
 				}
1034 1034
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
1035 1035
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
1036
-					$data[$key] = '<br><b><u>'. $labelextra . '</u></b>';
1036
+					$data[$key] = '<br><b><u>'.$labelextra.'</u></b>';
1037 1037
 				} else {
1038
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
1039
-					$data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
1038
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
1039
+					$data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
1040 1040
 					$count++;
1041 1041
 				}
1042 1042
 			}
1043 1043
 			$data['closedivextra'] = '</div>';
1044 1044
 		}
1045 1045
 
1046
-		$hookmanager->initHooks(array($this->element . 'dao'));
1046
+		$hookmanager->initHooks(array($this->element.'dao'));
1047 1047
 		$parameters = array(
1048 1048
 			'tooltipcontentarray' => &$data,
1049 1049
 			'params' => $params,
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 			$sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")";
1546 1546
 		}
1547 1547
 		if ($status >= 0) {
1548
-			$sql .= " AND t.statut = ".((int) $status);	// t is llx_user or llx_socpeople
1548
+			$sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople
1549 1549
 		}
1550 1550
 		if ($statusoflink >= 0) {
1551 1551
 			$sql .= " AND ec.statut = ".((int) $statusoflink);
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
 		}
1935 1935
 
1936 1936
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
1937
-		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'";	// no escapeforlike here
1937
+		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here
1938 1938
 		$sql .= " LIMIT 1";
1939 1939
 
1940 1940
 		$query = $this->db->query($sql);
@@ -2253,9 +2253,9 @@  discard block
 block discarded – undo
2253 2253
 
2254 2254
 		$oldvalue = null;
2255 2255
 		if ($trigkey) {
2256
-			$sql = "SELECT " . $field;
2257
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2258
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
2256
+			$sql = "SELECT ".$field;
2257
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2258
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2259 2259
 
2260 2260
 			$resql = $this->db->query($sql);
2261 2261
 			if ($resql) {
@@ -2635,7 +2635,7 @@  discard block
 block discarded – undo
2635 2635
 		// Triggers
2636 2636
 		if (!$error && !$notrigger) {
2637 2637
 			// Call triggers
2638
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2638
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2639 2639
 			if ($result < 0) {
2640 2640
 				$error++;
2641 2641
 			} //Do also here what you must do to rollback action if trigger fail
@@ -3014,7 +3014,7 @@  discard block
 block discarded – undo
3014 3014
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
3015 3015
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
3016 3016
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
3017
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3017
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3018 3018
 			}
3019 3019
 			$sql .= ' WHERE rowid='.((int) $this->id);
3020 3020
 
@@ -3362,10 +3362,10 @@  discard block
 block discarded – undo
3362 3362
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3363 3363
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3364 3364
 		if (!$renum) {
3365
-			$sql .= " AND " . $fieldposition . " = 0";
3365
+			$sql .= " AND ".$fieldposition." = 0";
3366 3366
 		}
3367 3367
 		if ($renum) {
3368
-			$sql .= " AND " . $fieldposition . " <> 0";
3368
+			$sql .= " AND ".$fieldposition." <> 0";
3369 3369
 		}
3370 3370
 
3371 3371
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
 			if ($fk_parent_line) {
3387 3387
 				$sql .= ' AND fk_parent_line IS NULL';
3388 3388
 			}
3389
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3389
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3390 3390
 
3391 3391
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3392 3392
 			$resql = $this->db->query($sql);
@@ -3438,7 +3438,7 @@  discard block
 block discarded – undo
3438 3438
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3439 3439
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3440 3440
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3441
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3441
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3442 3442
 
3443 3443
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3444 3444
 
@@ -3562,7 +3562,7 @@  discard block
 block discarded – undo
3562 3562
 
3563 3563
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3564 3564
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3565
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3565
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3566 3566
 			if ($this->db->query($sql)) {
3567 3567
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1));
3568 3568
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3593,7 +3593,7 @@  discard block
 block discarded – undo
3593 3593
 
3594 3594
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3595 3595
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3596
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3596
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3597 3597
 			if ($this->db->query($sql)) {
3598 3598
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1));
3599 3599
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3619,7 +3619,7 @@  discard block
 block discarded – undo
3619 3619
 			$fieldposition = 'position';
3620 3620
 		}
3621 3621
 
3622
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3622
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3623 3623
 		$sql .= " WHERE rowid = ".((int) $rowid);
3624 3624
 
3625 3625
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
 
3648 3648
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3649 3649
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3650
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3650
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3651 3651
 		$resql = $this->db->query($sql);
3652 3652
 		if ($resql) {
3653 3653
 			$row = $this->db->fetch_row($resql);
@@ -3766,7 +3766,7 @@  discard block
 block discarded – undo
3766 3766
 			$newsuffix = '';
3767 3767
 		}
3768 3768
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3769
-			$fieldusermod =  "fk_user_mod";
3769
+			$fieldusermod = "fk_user_mod";
3770 3770
 		} elseif ($this->table_element == 'ecm_files') {
3771 3771
 			$fieldusermod = "fk_user_m";
3772 3772
 		} else {
@@ -3808,7 +3808,7 @@  discard block
 block discarded – undo
3808 3808
 						$trigger_name = 'EXPENSE_REPORT_MODIFY';
3809 3809
 						break;
3810 3810
 					default:
3811
-						$trigger_name = strtoupper($this->element) . '_MODIFY';
3811
+						$trigger_name = strtoupper($this->element).'_MODIFY';
3812 3812
 				}
3813 3813
 				$ret = $this->call_trigger($trigger_name, $user);
3814 3814
 				if ($ret < 0) {
@@ -4106,7 +4106,7 @@  discard block
 block discarded – undo
4106 4106
 			// Situations totals
4107 4107
 			if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {  // @phan-suppress-current-line PhanUndeclaredProperty
4108 4108
 				'@phan-var-force Facture $this';
4109
-				include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';  // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
4109
+				include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
4110 4110
 				if ($this->type != Facture::TYPE_CREDIT_NOTE) {	// @phpstan-ignore-line
4111 4111
 					if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) {
4112 4112
 						$prev_sits = $this->get_prev_sits();
@@ -4232,19 +4232,19 @@  discard block
 block discarded – undo
4232 4232
 		$this->db->begin();
4233 4233
 		$error = 0;
4234 4234
 
4235
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
4235
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
4236 4236
 		$sql .= "fk_source";
4237 4237
 		$sql .= ", sourcetype";
4238 4238
 		$sql .= ", fk_target";
4239 4239
 		$sql .= ", targettype";
4240 4240
 		$sql .= ") VALUES (";
4241 4241
 		$sql .= ((int) $origin_id);
4242
-		$sql .= ", '" . $this->db->escape($origin) . "'";
4243
-		$sql .= ", " . ((int) $this->id);
4244
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
4242
+		$sql .= ", '".$this->db->escape($origin)."'";
4243
+		$sql .= ", ".((int) $this->id);
4244
+		$sql .= ", '".$this->db->escape($targettype)."'";
4245 4245
 		$sql .= ")";
4246 4246
 
4247
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
4247
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
4248 4248
 		if ($this->db->query($sql)) {
4249 4249
 			if (!$notrigger) {
4250 4250
 				// Call trigger
@@ -4499,20 +4499,20 @@  discard block
 block discarded – undo
4499 4499
 		$this->db->begin();
4500 4500
 		$error = 0;
4501 4501
 
4502
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4502
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4503 4503
 		if ($updatesource) {
4504
-			$sql .= "fk_source = " . ((int) $sourceid);
4505
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4506
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4507
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4504
+			$sql .= "fk_source = ".((int) $sourceid);
4505
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4506
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4507
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4508 4508
 		} elseif ($updatetarget) {
4509
-			$sql .= "fk_target = " . ((int) $targetid);
4510
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4511
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4512
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4509
+			$sql .= "fk_target = ".((int) $targetid);
4510
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4511
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4512
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4513 4513
 		}
4514 4514
 
4515
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4515
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4516 4516
 		if ($this->db->query($sql)) {
4517 4517
 			if (!$notrigger) {
4518 4518
 				// Call trigger
@@ -4589,25 +4589,25 @@  discard block
 block discarded – undo
4589 4589
 		}
4590 4590
 
4591 4591
 		if (!$error) {
4592
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4592
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4593 4593
 			$sql .= " WHERE";
4594 4594
 			if ($rowid > 0) {
4595
-				$sql .= " rowid = " . ((int) $rowid);
4595
+				$sql .= " rowid = ".((int) $rowid);
4596 4596
 			} else {
4597 4597
 				if ($deletesource) {
4598
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4599
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'";
4598
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4599
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."'";
4600 4600
 				} elseif ($deletetarget) {
4601
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4602
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'";
4601
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4602
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."'";
4603 4603
 				} else {
4604
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')";
4604
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."')";
4605 4605
 					$sql .= " OR";
4606
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')";
4606
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."')";
4607 4607
 				}
4608 4608
 			}
4609 4609
 
4610
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4610
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4611 4611
 			if (!$this->db->query($sql)) {
4612 4612
 				$this->error = $this->db->lasterror();
4613 4613
 				$this->errors[] = $this->error;
@@ -4772,14 +4772,14 @@  discard block
 block discarded – undo
4772 4772
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4773 4773
 		}
4774 4774
 		$sql .= " WHERE rowid = ".((int) $elementId);
4775
-		$sql .= " AND ".$fieldstatus." <> ".((int) $status);	// We avoid update if status already correct
4775
+		$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
4776 4776
 
4777 4777
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4778 4778
 		$resql = $this->db->query($sql);
4779 4779
 		if ($resql) {
4780 4780
 			$error = 0;
4781 4781
 
4782
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4782
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4783 4783
 
4784 4784
 			if ($nb_rows_affected > 0) {
4785 4785
 				if (empty($trigkey)) {
@@ -4826,7 +4826,7 @@  discard block
 block discarded – undo
4826 4826
 					if ($fieldstatus == 'tosell') {
4827 4827
 						$this->status = $status;
4828 4828
 					} elseif ($fieldstatus == 'tobuy') {
4829
-						$this->status_buy = $status;	// @phpstan-ignore-line
4829
+						$this->status_buy = $status; // @phpstan-ignore-line
4830 4830
 					} else {
4831 4831
 						$this->status = $status;
4832 4832
 					}
@@ -4934,7 +4934,7 @@  discard block
 block discarded – undo
4934 4934
 			return -1;
4935 4935
 		}
4936 4936
 
4937
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4937
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4938 4938
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
4939 4939
 		$tmparray = array_keys($this->childtables);
4940 4940
 		if (is_numeric($tmparray[0])) {
@@ -6051,7 +6051,7 @@  discard block
 block discarded – undo
6051 6051
 			$setsharekey = false;
6052 6052
 			if ($this->element == 'propal' || $this->element == 'proposal') {
6053 6053
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
6054
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
6054
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
6055 6055
 				}
6056 6056
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
6057 6057
 					$setsharekey = true;
@@ -6111,7 +6111,7 @@  discard block
 block discarded – undo
6111 6111
 				$ecmfile->gen_or_uploaded = 'generated';
6112 6112
 				$ecmfile->description = ''; // indexed content
6113 6113
 				$ecmfile->keywords = ''; // keyword content
6114
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
6114
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
6115 6115
 				$ecmfile->src_object_id   = $this->id;
6116 6116
 
6117 6117
 				$result = $ecmfile->create($user);
@@ -6263,8 +6263,8 @@  discard block
 block discarded – undo
6263 6263
 		// phpcs:enable
6264 6264
 		global $langs, $conf;
6265 6265
 
6266
-		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) {
6267
-			dol_print_error(null, 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.');
6266
+		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) {
6267
+			dol_print_error(null, 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.');
6268 6268
 			exit;
6269 6269
 		}
6270 6270
 		if (!is_object($langs)) {	// If lang was not defined, we set it. It is required by run_triggers().
@@ -6456,7 +6456,7 @@  discard block
 block discarded – undo
6456 6456
 		$savDisableCompute = $conf->disable_compute;
6457 6457
 		$conf->disable_compute = 1;
6458 6458
 
6459
-		$ret = $this->fetch($id);	/* @phpstan-ignore-line */
6459
+		$ret = $this->fetch($id); /* @phpstan-ignore-line */
6460 6460
 
6461 6461
 		$conf->disable_compute = $savDisableCompute;
6462 6462
 
@@ -6518,7 +6518,7 @@  discard block
 block discarded – undo
6518 6518
 		if (is_array($optionsArray) && count($optionsArray) > 0) {
6519 6519
 			$sql = "SELECT rowid";
6520 6520
 			foreach ($optionsArray as $name => $label) {
6521
-				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) {
6521
+				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) {
6522 6522
 					$sql .= ", ".$name;
6523 6523
 				}
6524 6524
 				// use geo sql fonction to read as text
@@ -6571,7 +6571,7 @@  discard block
 block discarded – undo
6571 6571
 					 **/
6572 6572
 					if (is_array($extrafields->attributes[$this->table_element]['label'])) {
6573 6573
 						foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
6574
-							$this->array_options['options_' . $key] = null;
6574
+							$this->array_options['options_'.$key] = null;
6575 6575
 						}
6576 6576
 					}
6577 6577
 				}
@@ -6583,9 +6583,9 @@  discard block
 block discarded – undo
6583 6583
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6584 6584
 							//var_dump($conf->disable_compute);
6585 6585
 							if (empty($conf->disable_compute)) {
6586
-								global $objectoffield;        // We set a global variable to $objectoffield so
6587
-								$objectoffield = $this;        // we can use it inside computed formula
6588
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6586
+								global $objectoffield; // We set a global variable to $objectoffield so
6587
+								$objectoffield = $this; // we can use it inside computed formula
6588
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6589 6589
 							}
6590 6590
 						}
6591 6591
 					}
@@ -6770,7 +6770,7 @@  discard block
 block discarded – undo
6770 6770
 										// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
6771 6771
 										if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6772 6772
 											if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6773
-												$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6773
+												$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6774 6774
 											} else {
6775 6775
 												$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6776 6776
 											}
@@ -6781,7 +6781,7 @@  discard block
 block discarded – undo
6781 6781
 										// If value has changed
6782 6782
 										if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6783 6783
 											if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6784
-												$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6784
+												$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6785 6785
 											} else {
6786 6786
 												$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6787 6787
 											}
@@ -6793,7 +6793,7 @@  discard block
 block discarded – undo
6793 6793
 									//var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]);
6794 6794
 									// If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value
6795 6795
 									if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) {	// dolibarr reversible encryption
6796
-										$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6796
+										$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6797 6797
 									} else {
6798 6798
 										$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6799 6799
 									}
@@ -7243,7 +7243,7 @@  discard block
 block discarded – undo
7243 7243
 								if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) {	// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
7244 7244
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
7245 7245
 										if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {
7246
-											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7246
+											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7247 7247
 										} else {
7248 7248
 											$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7249 7249
 										}
@@ -7263,7 +7263,7 @@  discard block
 block discarded – undo
7263 7263
 								}
7264 7264
 							} else {
7265 7265
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {	// dolibarr reversible encryption
7266
-									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7266
+									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7267 7267
 								} else {
7268 7268
 									$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7269 7269
 								}
@@ -7850,7 +7850,7 @@  discard block
 block discarded – undo
7850 7850
 				// 7 : sort field
7851 7851
 
7852 7852
 				// If there is filter
7853
-				if (! empty($InfoFieldList[4])) {
7853
+				if (!empty($InfoFieldList[4])) {
7854 7854
 					$pos = 0;
7855 7855
 					$parenthesisopen = 0;
7856 7856
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -7914,8 +7914,8 @@  discard block
 block discarded – undo
7914 7914
 					}
7915 7915
 
7916 7916
 					$sqlwhere = '';
7917
-					$sql = "SELECT " . $keyList;
7918
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
7917
+					$sql = "SELECT ".$keyList;
7918
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
7919 7919
 
7920 7920
 					if (!empty($InfoFieldList[4])) {
7921 7921
 						// can use SELECT request
@@ -7933,11 +7933,11 @@  discard block
 block discarded – undo
7933 7933
 						// We have to join on extrafield table
7934 7934
 						$errstr = '';
7935 7935
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7936
-							$sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra";
7937
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
7938
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7936
+							$sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra";
7937
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
7938
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7939 7939
 						} else {
7940
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7940
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7941 7941
 						}
7942 7942
 					} else {
7943 7943
 						$sqlwhere .= ' WHERE 1=1';
@@ -7958,7 +7958,7 @@  discard block
 block discarded – undo
7958 7958
 
7959 7959
 					// Some tables may have field, some other not. For the moment we disable it.
7960 7960
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7961
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7961
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7962 7962
 					}
7963 7963
 					$sql .= $sqlwhere;
7964 7964
 
@@ -7968,10 +7968,10 @@  discard block
 block discarded – undo
7968 7968
 					} else {
7969 7969
 						$sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label));
7970 7970
 					}
7971
-					$sql .= ' LIMIT ' . getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
7971
+					$sql .= ' LIMIT '.getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
7972 7972
 					// print $sql;
7973 7973
 
7974
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
7974
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
7975 7975
 					$resql = $this->db->query($sql);
7976 7976
 					if ($resql) {
7977 7977
 						$out .= '<option value="0">&nbsp;</option>';
@@ -7987,7 +7987,7 @@  discard block
 block discarded – undo
7987 7987
 							if (count($fields_label) > 1) {
7988 7988
 								$notrans = true;
7989 7989
 								foreach ($fields_label as $field_toshow) {
7990
-									$labeltoshow .= $obj->$field_toshow . ' ';
7990
+									$labeltoshow .= $obj->$field_toshow.' ';
7991 7991
 								}
7992 7992
 							} else {
7993 7993
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7998,12 +7998,12 @@  discard block
 block discarded – undo
7998 7998
 								foreach ($fields_label as $field_toshow) {
7999 7999
 									$translabel = $langs->trans($obj->$field_toshow);
8000 8000
 									if ($translabel != $obj->$field_toshow) {
8001
-										$labeltoshow = dol_trunc($translabel) . ' ';
8001
+										$labeltoshow = dol_trunc($translabel).' ';
8002 8002
 									} else {
8003
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
8003
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
8004 8004
 									}
8005 8005
 								}
8006
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8006
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8007 8007
 							} else {
8008 8008
 								if (!$notrans) {
8009 8009
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -8017,25 +8017,25 @@  discard block
 block discarded – undo
8017 8017
 									$labeltoshow = '(not defined)';
8018 8018
 								}
8019 8019
 								if ($value == $obj->rowid) {
8020
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8020
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8021 8021
 								}
8022 8022
 
8023 8023
 								if (!empty($InfoFieldList[3]) && $parentField) {
8024
-									$parent = $parentName . ':' . $obj->{$parentField};
8024
+									$parent = $parentName.':'.$obj->{$parentField};
8025 8025
 									$isDependList = 1;
8026 8026
 								}
8027 8027
 
8028
-								$out .= '<option value="' . $obj->rowid . '"';
8028
+								$out .= '<option value="'.$obj->rowid.'"';
8029 8029
 								$out .= ($value == $obj->rowid ? ' selected' : '');
8030
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
8031
-								$out .= '>' . $labeltoshow . '</option>';
8030
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
8031
+								$out .= '>'.$labeltoshow.'</option>';
8032 8032
 							}
8033 8033
 
8034 8034
 							$i++;
8035 8035
 						}
8036 8036
 						$this->db->free($resql);
8037 8037
 					} else {
8038
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8038
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8039 8039
 					}
8040 8040
 				} else {
8041 8041
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8046,9 +8046,9 @@  discard block
 block discarded – undo
8046 8046
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8047 8047
 					$out .= '<option value="0">&nbsp;</option>';
8048 8048
 					foreach ($data as $data_key => $data_value) {
8049
-						$out .= '<option value="' . $data_key . '"';
8049
+						$out .= '<option value="'.$data_key.'"';
8050 8050
 						$out .= ($value == $data_key ? ' selected' : '');
8051
-						$out .= '>' . $data_value . '</option>';
8051
+						$out .= '>'.$data_value.'</option>';
8052 8052
 					}
8053 8053
 				}
8054 8054
 			}
@@ -8088,7 +8088,7 @@  discard block
 block discarded – undo
8088 8088
 				// 7 : sort field
8089 8089
 
8090 8090
 				// If there is a filter
8091
-				if (! empty($InfoFieldList[4])) {
8091
+				if (!empty($InfoFieldList[4])) {
8092 8092
 					$pos = 0;
8093 8093
 					$parenthesisopen = 0;
8094 8094
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -8154,8 +8154,8 @@  discard block
 block discarded – undo
8154 8154
 					}
8155 8155
 
8156 8156
 					$sqlwhere = '';
8157
-					$sql = "SELECT " . $keyList;
8158
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
8157
+					$sql = "SELECT ".$keyList;
8158
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
8159 8159
 
8160 8160
 					if (!empty($InfoFieldList[4])) {
8161 8161
 						// can use SELECT request
@@ -8173,11 +8173,11 @@  discard block
 block discarded – undo
8173 8173
 						// We have to join on extrafield table
8174 8174
 						$errstr = '';
8175 8175
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8176
-							$sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra';
8177
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8178
-							$sqlwhere .= " AND " . $InfoFieldList[4];
8176
+							$sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra';
8177
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8178
+							$sqlwhere .= " AND ".$InfoFieldList[4];
8179 8179
 						} else {
8180
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
8180
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
8181 8181
 						}
8182 8182
 					} else {
8183 8183
 						$sqlwhere .= ' WHERE 1=1';
@@ -8198,14 +8198,14 @@  discard block
 block discarded – undo
8198 8198
 
8199 8199
 					// Some tables may have field, some other not. For the moment we disable it.
8200 8200
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8201
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8201
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8202 8202
 					}
8203 8203
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
8204 8204
 					// print $sql;
8205 8205
 
8206 8206
 					$sql .= $sqlwhere;
8207 8207
 
8208
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
8208
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
8209 8209
 
8210 8210
 					$resql = $this->db->query($sql);
8211 8211
 					if ($resql) {
@@ -8224,7 +8224,7 @@  discard block
 block discarded – undo
8224 8224
 							if (count($fields_label) > 1) {
8225 8225
 								$notrans = true;
8226 8226
 								foreach ($fields_label as $field_toshow) {
8227
-									$labeltoshow .= $obj->$field_toshow . ' ';
8227
+									$labeltoshow .= $obj->$field_toshow.' ';
8228 8228
 								}
8229 8229
 							} else {
8230 8230
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8235,9 +8235,9 @@  discard block
 block discarded – undo
8235 8235
 								foreach ($fields_label as $field_toshow) {
8236 8236
 									$translabel = $langs->trans($obj->$field_toshow);
8237 8237
 									if ($translabel != $obj->$field_toshow) {
8238
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
8238
+										$labeltoshow = dol_trunc($translabel, 18).' ';
8239 8239
 									} else {
8240
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
8240
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
8241 8241
 									}
8242 8242
 								}
8243 8243
 
@@ -8260,7 +8260,7 @@  discard block
 block discarded – undo
8260 8260
 								}
8261 8261
 
8262 8262
 								if (!empty($InfoFieldList[3]) && $parentField) {
8263
-									$parent = $parentName . ':' . $obj->{$parentField};
8263
+									$parent = $parentName.':'.$obj->{$parentField};
8264 8264
 									$isDependList = 1;
8265 8265
 								}
8266 8266
 
@@ -8271,9 +8271,9 @@  discard block
 block discarded – undo
8271 8271
 						}
8272 8272
 						$this->db->free($resql);
8273 8273
 
8274
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8274
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8275 8275
 					} else {
8276
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8276
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8277 8277
 					}
8278 8278
 				} else {
8279 8279
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8282,7 +8282,7 @@  discard block
 block discarded – undo
8282 8282
 						$categcode = Categorie::$MAP_ID_TO_CODE[(int) $InfoFieldList[5]];
8283 8283
 					}
8284 8284
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8285
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8285
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8286 8286
 				}
8287 8287
 			}
8288 8288
 		} elseif ($type == 'link') {
@@ -8317,7 +8317,7 @@  discard block
 block discarded – undo
8317 8317
 			// $val is already the record field found at same place than found by $valparent but already loaded and may have been modified by parent caller.
8318 8318
 
8319 8319
 			//$objectfield = $valparent;
8320
-			$objectfield = $val;			// Is better than using old method $valparent
8320
+			$objectfield = $val; // Is better than using old method $valparent
8321 8321
 
8322 8322
 			// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
8323 8323
 			$out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, (int) $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield);
@@ -8530,7 +8530,7 @@  discard block
 block discarded – undo
8530 8530
 			$value = $this->getLibStatut(3);
8531 8531
 		} elseif ($type == 'date') {
8532 8532
 			if (!empty($value)) {
8533
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
8533
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
8534 8534
 			} else {
8535 8535
 				$value = '';
8536 8536
 			}
@@ -8631,7 +8631,7 @@  discard block
 block discarded – undo
8631 8631
 			$value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : '';
8632 8632
 			if (strpos($value, "|") !== false) {
8633 8633
 				$value = $langs->trans(explode('|', $value)[0]);
8634
-			} elseif (! is_numeric($value)) {
8634
+			} elseif (!is_numeric($value)) {
8635 8635
 				$value = $langs->trans($value);
8636 8636
 			}
8637 8637
 		} elseif ($type == 'sellist') {
@@ -8693,9 +8693,9 @@  discard block
 block discarded – undo
8693 8693
 									$translabel = $langs->trans($obj->$field_toshow);
8694 8694
 								}
8695 8695
 								if ($translabel != $field_toshow) {
8696
-									$value .= dol_trunc($translabel, 18) . ' ';
8696
+									$value .= dol_trunc($translabel, 18).' ';
8697 8697
 								} else {
8698
-									$value .= $obj->$field_toshow . ' ';
8698
+									$value .= $obj->$field_toshow.' ';
8699 8699
 								}
8700 8700
 							}
8701 8701
 						} else {
@@ -8711,7 +8711,7 @@  discard block
 block discarded – undo
8711 8711
 						}
8712 8712
 					}
8713 8713
 				} else {
8714
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8714
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8715 8715
 
8716 8716
 					$toprint = array();
8717 8717
 					$obj = $this->db->fetch_object($resql);
@@ -8719,7 +8719,7 @@  discard block
 block discarded – undo
8719 8719
 					$c->fetch($obj->rowid);
8720 8720
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8721 8721
 					foreach ($ways as $way) {
8722
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8722
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8723 8723
 					}
8724 8724
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8725 8725
 				}
@@ -8735,11 +8735,11 @@  discard block
 block discarded – undo
8735 8735
 				$toprint = array();
8736 8736
 				foreach ($value_arr as $keyval => $valueval) {
8737 8737
 					if (!empty($valueval)) {
8738
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
8738
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
8739 8739
 					}
8740 8740
 				}
8741 8741
 				if (!empty($toprint)) {
8742
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8742
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8743 8743
 				}
8744 8744
 			}
8745 8745
 		} elseif ($type == 'chkbxlst') {
@@ -8794,9 +8794,9 @@  discard block
 block discarded – undo
8794 8794
 										$translabel = $langs->trans($obj->$field_toshow);
8795 8795
 									}
8796 8796
 									if ($translabel != $field_toshow) {
8797
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8797
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8798 8798
 									} else {
8799
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
8799
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
8800 8800
 									}
8801 8801
 								}
8802 8802
 							} else {
@@ -8805,15 +8805,15 @@  discard block
 block discarded – undo
8805 8805
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
8806 8806
 								}
8807 8807
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
8808
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8808
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8809 8809
 								} else {
8810
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
8810
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
8811 8811
 								}
8812 8812
 							}
8813 8813
 						}
8814 8814
 					}
8815 8815
 				} else {
8816
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8816
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8817 8817
 
8818 8818
 					$toprint = array();
8819 8819
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -8822,7 +8822,7 @@  discard block
 block discarded – undo
8822 8822
 							$c->fetch($obj->rowid);
8823 8823
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8824 8824
 							foreach ($ways as $way) {
8825
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8825
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8826 8826
 							}
8827 8827
 						}
8828 8828
 					}
@@ -8992,7 +8992,7 @@  discard block
 block discarded – undo
8992 8992
 		global $langs;
8993 8993
 
8994 8994
 		if (!class_exists('Validate')) {
8995
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
8995
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
8996 8996
 		}
8997 8997
 
8998 8998
 		$this->clearFieldError($fieldKey);
@@ -9231,7 +9231,7 @@  discard block
 block discarded – undo
9231 9231
 				$out .= "\n";
9232 9232
 
9233 9233
 				$nbofextrafieldsshown = 0;
9234
-				$e = 0;	// var to manage the modulo (odd/even)
9234
+				$e = 0; // var to manage the modulo (odd/even)
9235 9235
 
9236 9236
 				$lastseparatorkeyfound = '';
9237 9237
 				$extrafields_collapse_num = '';
@@ -9269,9 +9269,9 @@  discard block
 block discarded – undo
9269 9269
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
9270 9270
 					} elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) {
9271 9271
 						// We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost
9272
-						$ef_name = 'options_' . $key;
9272
+						$ef_name = 'options_'.$key;
9273 9273
 						$ef_value = $this->array_options[$ef_name];
9274
-						$out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n";
9274
+						$out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n";
9275 9275
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation
9276 9276
 					} elseif ($mode == 'view' && empty($visibility)) {
9277 9277
 						continue;
@@ -10349,7 +10349,7 @@  discard block
 block discarded – undo
10349 10349
 						continue;
10350 10350
 					}
10351 10351
 				}
10352
-				$keys_with_alias[] = $alias . '.' . $fieldname;
10352
+				$keys_with_alias[] = $alias.'.'.$fieldname;
10353 10353
 			}
10354 10354
 			return implode(',', $keys_with_alias);
10355 10355
 		} else {
@@ -10490,7 +10490,7 @@  discard block
 block discarded – undo
10490 10490
 		if (!$error) {
10491 10491
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
10492 10492
 			$sql .= " (".implode(", ", $keys).')';
10493
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
10493
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
10494 10494
 
10495 10495
 			$res = $this->db->query($sql);
10496 10496
 			if (!$res) {
@@ -10802,7 +10802,7 @@  discard block
 block discarded – undo
10802 10802
 
10803 10803
 		// Update extrafield
10804 10804
 		if (!$error) {
10805
-			$result = $this->insertExtraFields();	// This delete and reinsert extrafields
10805
+			$result = $this->insertExtraFields(); // This delete and reinsert extrafields
10806 10806
 			if ($result < 0) {
10807 10807
 				$error++;
10808 10808
 			}
@@ -11004,12 +11004,12 @@  discard block
 block discarded – undo
11004 11004
 				$error++;
11005 11005
 			} else {
11006 11006
 				while ($obj = $this->db->fetch_object($resql)) {
11007
-					$result = $this->fetch($obj->rowid);	// @phpstan-ignore-line
11007
+					$result = $this->fetch($obj->rowid); // @phpstan-ignore-line
11008 11008
 					if ($result < 0) {
11009 11009
 						$error++;
11010 11010
 						$this->errors[] = $this->error;
11011 11011
 					} else {
11012
-						$result = $this->delete($user);	// @phpstan-ignore-line
11012
+						$result = $this->delete($user); // @phpstan-ignore-line
11013 11013
 						if ($result < 0) {
11014 11014
 							$error++;
11015 11015
 							$this->errors[] = $this->error;
@@ -11175,7 +11175,7 @@  discard block
 block discarded – undo
11175 11175
 		);
11176 11176
 		foreach ($fields as $key => $value) {
11177 11177
 			if (array_key_exists($key, $this->fields)) {
11178
-				$this->{$key} = $value;		// @phpstan-ignore-line
11178
+				$this->{$key} = $value; // @phpstan-ignore-line
11179 11179
 			}
11180 11180
 		}
11181 11181
 
Please login to merge, or discard this patch.
htdocs/accountancy/class/bookkeeping.class.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 				if (empty($this->piece_num)) {
373 373
 					$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
374 374
 					$sqlnum .= " FROM ".$this->db->prefix().$this->table_element;
375
-					$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
375
+					$sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
376 376
 
377 377
 					$resqlnum = $this->db->query($sqlnum);
378 378
 					if ($resqlnum) {
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		}
469 469
 
470 470
 		// Call triggers
471
-		if (! $error && ! $notrigger) {
471
+		if (!$error && !$notrigger) {
472 472
 			$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
473 473
 			if ($result < 0) {
474 474
 				$error++;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
553 553
 
554 554
 		global $action;
555
-		$hookmanager->initHooks(array($this->element . 'dao'));
555
+		$hookmanager->initHooks(array($this->element.'dao'));
556 556
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
557 557
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
558 558
 		if ($reshook > 0) {
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		if (!$error) {
720 720
 			$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element.$mode);
721 721
 			// Call triggers
722
-			if (! $notrigger) {
722
+			if (!$notrigger) {
723 723
 				$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
724 724
 				if ($result < 0) {
725 725
 					$error++;
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 		$sql .= " t.date_validated as date_validation";
785 785
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.$mode.' as t';
786 786
 		$sql .= ' WHERE 1 = 1';
787
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
787
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
788 788
 		if (null !== $ref) {
789 789
 			$sql .= " AND t.rowid = ".((int) $ref);
790 790
 		} else {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			}
957 957
 		}
958 958
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
959
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
959
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
960 960
 		if (count($sqlwhere) > 0) {
961 961
 			$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
962 962
 		}
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 		$sql .= " t.date_validated as date_validation";
1092 1092
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1093 1093
 
1094
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1094
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1095 1095
 		if ($showAlreadyExportMovements == 0) {
1096 1096
 			$sql .= " AND t.date_export IS NULL";
1097 1097
 		}
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 		$sql .= " SUM(t.debit) as debit,";
1260 1260
 		$sql .= " SUM(t.credit) as credit";
1261 1261
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1262
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1262
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1263 1263
 
1264 1264
 		// Manage filter
1265 1265
 		if (is_array($filter)) {
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 		}
1488 1488
 
1489 1489
 		// Call triggers
1490
-		if (! $error && ! $notrigger) {
1490
+		if (!$error && !$notrigger) {
1491 1491
 			$result = $this->call_trigger('BOOKKEEPING_MODIFY', $user);
1492 1492
 			if ($result < 0) {
1493 1493
 				$error++;
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
 		$this->db->begin();
1581 1581
 
1582 1582
 		// Call triggers
1583
-		if (! $error && ! $notrigger) {
1583
+		if (!$error && !$notrigger) {
1584 1584
 			$result = $this->call_trigger('BOOKKEEPING_DELETE', $user);
1585 1585
 			if ($result < 0) {
1586 1586
 				$error++;
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
 		if (!empty($journal)) {
1684 1684
 			$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
1685 1685
 		}
1686
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1686
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1687 1687
 		// Exclusion of validated entries at the time of deletion
1688 1688
 		$sql .= " AND date_validated IS NULL";
1689 1689
 		$sql .= $sql_filter;
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
 		$this->db->begin();
1730 1730
 
1731 1731
 		// Call triggers
1732
-		if (! $error && ! $notrigger) {
1732
+		if (!$error && !$notrigger) {
1733 1733
 			$result = $this->call_trigger('BOOKKEEPING_DELETE', $user);
1734 1734
 			if ($result < 0) {
1735 1735
 				$error++;
@@ -1741,8 +1741,8 @@  discard block
 block discarded – undo
1741 1741
 			$sql = "DELETE";
1742 1742
 			$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1743 1743
 			$sql .= " WHERE piece_num = ".(int) $piecenum;
1744
-			$sql .= " AND date_validated IS NULL";		// For security, exclusion of validated entries at the time of deletion
1745
-			$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1744
+			$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
1745
+			$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1746 1746
 			$sql .= $sql_filter;
1747 1747
 
1748 1748
 			$resql = $this->db->query($sql);
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 		}
1877 1877
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1878 1878
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
1879
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1879
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1880 1880
 
1881 1881
 		dol_syslog(__METHOD__, LOG_DEBUG);
1882 1882
 		$result = $this->db->query($sql);
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 		global $conf;
1918 1918
 
1919 1919
 		$sql = "SELECT MAX(piece_num)+1 as max FROM ".$this->db->prefix().$this->table_element.$mode;
1920
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1920
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1921 1921
 
1922 1922
 		dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG);
1923 1923
 
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 		}
1962 1962
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1963 1963
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
1964
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1964
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1965 1965
 
1966 1966
 		dol_syslog(__METHOD__, LOG_DEBUG);
1967 1967
 		$result = $this->db->query($sql);
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
 		$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
2027 2027
 		$sql .= " date_validated as date_validation";
2028 2028
 		$sql .= " FROM ".$this->db->prefix().$this->table_element;
2029
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2029
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2030 2030
 
2031 2031
 		dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
2032 2032
 
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 
2105 2105
 			if (!$error) {
2106 2106
 				// Delete if there is an empty line
2107
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
2107
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
2108 2108
 				$resql = $this->db->query($sql);
2109 2109
 				if (!$resql) {
2110 2110
 					$error++;
@@ -2122,7 +2122,7 @@  discard block
 block discarded – undo
2122 2122
 				$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
2123 2123
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2124 2124
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
2125
-				$sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
2125
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = '.((int) $conf->entity);
2126 2126
 				$sql .= $sql_filter;
2127 2127
 				$resql = $this->db->query($sql);
2128 2128
 				if (!$resql) {
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
 			}
2134 2134
 
2135 2135
 			if (!$error) {
2136
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2136
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2137 2137
 				$resql = $this->db->query($sql);
2138 2138
 				if (!$resql) {
2139 2139
 					$error++;
@@ -2143,7 +2143,7 @@  discard block
 block discarded – undo
2143 2143
 			}
2144 2144
 		} elseif ($direction == 1) {
2145 2145
 			if (!$error) {
2146
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2146
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2147 2147
 				$resql = $this->db->query($sql);
2148 2148
 				if (!$resql) {
2149 2149
 					$error++;
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
 				$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
2162 2162
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2163 2163
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
2164
-				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2164
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2165 2165
 				$sql .= $sql_filter;
2166 2166
 				$resql = $this->db->query($sql);
2167 2167
 				if (!$resql) {
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
 			}
2173 2173
 
2174 2174
 			if (!$error) {
2175
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2175
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2176 2176
 				$sql .= $sql_filter;
2177 2177
 				$resql = $this->db->query($sql);
2178 2178
 				if (!$resql) {
@@ -2229,7 +2229,7 @@  discard block
 block discarded – undo
2229 2229
 		$sql .= " AND aa.active = 1";
2230 2230
 		$sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
2231 2231
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2232
-		$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2232
+		$sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2233 2233
 		$sql .= " ORDER BY account_number ASC";
2234 2234
 
2235 2235
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
2294 2294
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
2295 2295
 		$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
2296
-		$sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2296
+		$sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2297 2297
 
2298 2298
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2299 2299
 		$resql = $this->db->query($sql);
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2334 2334
 		$sql .= " AND aa.active = 1";
2335 2335
 		$sql .= " LEFT JOIN ".$this->db->prefix()."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
2336
-		$sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2336
+		$sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2337 2337
 
2338 2338
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2339 2339
 		$resql = $this->db->query($sql);
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 		global $conf;
2367 2367
 
2368 2368
 		$alias = trim($alias);
2369
-		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias . "." : $alias;
2369
+		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias."." : $alias;
2370 2370
 
2371 2371
 		if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) {
2372 2372
 			$result = $this->loadFiscalPeriods($force, 'active');
@@ -2379,10 +2379,10 @@  discard block
 block discarded – undo
2379 2379
 				$i = 0;
2380 2380
 				foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) {
2381 2381
 					$sql_list[$i] = "(";
2382
-					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date";
2382
+					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start'])."' <= ".$this->db->sanitize($alias)."doc_date";
2383 2383
 					if (!empty($fiscal_period['date_end'])) {
2384 2384
 						$sql_list[$i] .= " AND ";
2385
-						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end'])."'";
2385
+						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '".$this->db->idate($fiscal_period['date_end'])."'";
2386 2386
 					}
2387 2387
 					$sql_list[$i] .= ")";
2388 2388
 					$i++;
@@ -2471,17 +2471,17 @@  discard block
 block discarded – undo
2471 2471
 			// Avoid trunc with dot in accountancy for the compatibility with another accounting software
2472 2472
 			$accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1);
2473 2473
 			if (!empty($reference)) {
2474
-				$accountingLabelOperation .= ' - '. $reference;
2474
+				$accountingLabelOperation .= ' - '.$reference;
2475 2475
 			}
2476 2476
 			if (!empty($labelaccount)) {
2477
-				$accountingLabelOperation .= ' - '. $labelaccount;
2477
+				$accountingLabelOperation .= ' - '.$labelaccount;
2478 2478
 			}
2479 2479
 		} elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 1) {
2480 2480
 			$truncThirdpartyName = 32;
2481 2481
 			// Avoid trunc with dot in accountancy for the compatibility with another accounting software
2482 2482
 			$accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1);
2483 2483
 			if (!empty($reference)) {
2484
-				$accountingLabelOperation .= ' - '. $reference;
2484
+				$accountingLabelOperation .= ' - '.$reference;
2485 2485
 			}
2486 2486
 		} elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 2) {
2487 2487
 			$truncThirdpartyName = 64;
@@ -2551,8 +2551,8 @@  discard block
 block discarded – undo
2551 2551
 		if ($mode == 'active') {
2552 2552
 			if (!isset($conf->cache['active_fiscal_period_cached']) || $force) {
2553 2553
 				$sql = "SELECT date_start, date_end";
2554
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2555
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2554
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2555
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2556 2556
 				$sql .= " AND statut = 0";
2557 2557
 
2558 2558
 				$resql = $this->db->query($sql);
@@ -2574,8 +2574,8 @@  discard block
 block discarded – undo
2574 2574
 		if ($mode == 'closed') {
2575 2575
 			if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) {
2576 2576
 				$sql = "SELECT date_start, date_end";
2577
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2578
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2577
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2578
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2579 2579
 				$sql .= " AND statut = 1";
2580 2580
 
2581 2581
 				$resql = $this->db->query($sql);
@@ -2610,10 +2610,10 @@  discard block
 block discarded – undo
2610 2610
 		$list = array();
2611 2611
 
2612 2612
 		$sql = "SELECT rowid, label, date_start, date_end, statut";
2613
-		$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2614
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2613
+		$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2614
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2615 2615
 		if (!empty($filter)) {
2616
-			$sql .= " AND (" . $this->db->sanitize($filter, 1, 1, 1) . ')';
2616
+			$sql .= " AND (".$this->db->sanitize($filter, 1, 1, 1).')';
2617 2617
 		}
2618 2618
 		$sql .= $this->db->order('date_start', 'ASC');
2619 2619
 
@@ -2653,13 +2653,13 @@  discard block
 block discarded – undo
2653 2653
 
2654 2654
 		$sql = "SELECT YEAR(b.doc_date) as year";
2655 2655
 		for ($i = 1; $i <= 12; $i++) {
2656
-			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0") . ") AS month".((int) $i);
2656
+			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0").") AS month".((int) $i);
2657 2657
 		}
2658 2658
 		$sql .= ", COUNT(b.rowid) as total";
2659
-		$sql .= " FROM " . $this->db->prefix() . $this->table_element . " as b";
2660
-		$sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'";
2661
-		$sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'";
2662
-		$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
2659
+		$sql .= " FROM ".$this->db->prefix().$this->table_element." as b";
2660
+		$sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'";
2661
+		$sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'";
2662
+		$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
2663 2663
 
2664 2664
 		// Get count for each month into the fiscal period
2665 2665
 		if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
 			$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.'accounting_fiscalyear as af WHERE b.doc_date >= af.date_start AND b.doc_date <= af.date_end AND af.entity = '.((int) $conf->entity)." AND af.statut = 1)";
2668 2668
 		} else {
2669 2669
 			// Filter on the unitary flag/date lock on each record
2670
-			$sql .= " AND date_validated IS NULL";	// not locked
2670
+			$sql .= " AND date_validated IS NULL"; // not locked
2671 2671
 		}
2672 2672
 
2673 2673
 		$sql .= " GROUP BY YEAR(b.doc_date)";
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
 				'total' => (int) $obj->total,
2689 2689
 			);
2690 2690
 			for ($i = 1; $i <= 12; $i++) {
2691
-				$year_list['count'][$i] = (int) $obj->{'month' . $i};
2691
+				$year_list['count'][$i] = (int) $obj->{'month'.$i};
2692 2692
 			}
2693 2693
 
2694 2694
 			$list[] = $year_list;
@@ -2716,11 +2716,11 @@  discard block
 block discarded – undo
2716 2716
 		$now = dol_now();
2717 2717
 
2718 2718
 		// Specify as export : update field date_validated on selected month/year
2719
-		$sql = " UPDATE " . $this->db->prefix() . $this->table_element;
2720
-		$sql .= " SET date_validated = '" . $this->db->idate($now) . "'";
2721
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2722
-		$sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'";
2723
-		$sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'";
2719
+		$sql = " UPDATE ".$this->db->prefix().$this->table_element;
2720
+		$sql .= " SET date_validated = '".$this->db->idate($now)."'";
2721
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2722
+		$sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'";
2723
+		$sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'";
2724 2724
 		$sql .= " AND date_validated IS NULL";
2725 2725
 
2726 2726
 		dol_syslog(__METHOD__, LOG_DEBUG);
@@ -2753,27 +2753,27 @@  discard block
 block discarded – undo
2753 2753
 
2754 2754
 			$pcg_type_filter = array();
2755 2755
 			foreach ($accounting_groups_used_for_income_statement as $item) {
2756
-				$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
2756
+				$pcg_type_filter[] = "'".$this->db->escape($item)."'";
2757 2757
 			}
2758 2758
 
2759 2759
 			$sql = 'SELECT';
2760 2760
 			$sql .= " t.numero_compte,";
2761 2761
 			$sql .= " aa.pcg_type,";
2762 2762
 			$sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result";
2763
-			$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
2764
-			$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
2765
-			$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
2766
-			$sql .= " AND aa.entity = " . ((int) $conf->entity);
2767
-			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . $this->db->prefix() . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')';
2768
-			$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
2769
-			$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
2770
-			$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
2763
+			$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
2764
+			$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
2765
+			$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
2766
+			$sql .= " AND aa.entity = ".((int) $conf->entity);
2767
+			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
2768
+			$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
2769
+			$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
2770
+			$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
2771 2771
 			$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
2772 2772
 
2773 2773
 			$resql = $this->db->query($sql);
2774 2774
 			if (!$resql) {
2775
-				$this->errors[] = 'Error ' . $this->db->lasterror();
2776
-				dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2775
+				$this->errors[] = 'Error '.$this->db->lasterror();
2776
+				dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2777 2777
 			} else {
2778 2778
 				while ($obj = $this->db->fetch_object($resql)) {
2779 2779
 					$income_statement_amount += $obj->accounting_result;
@@ -2812,7 +2812,7 @@  discard block
 block discarded – undo
2812 2812
 			return -1;
2813 2813
 		} elseif (empty($fiscal_period->id)) {
2814 2814
 			$langs->loadLangs(array('errors', 'compta'));
2815
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
2815
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
2816 2816
 			return -1;
2817 2817
 		}
2818 2818
 
@@ -2831,7 +2831,7 @@  discard block
 block discarded – undo
2831 2831
 			return -1;
2832 2832
 		} elseif (empty($new_fiscal_period->id)) {
2833 2833
 			$langs->loadLangs(array('errors', 'compta'));
2834
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
2834
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
2835 2835
 			return -1;
2836 2836
 		}
2837 2837
 
@@ -2851,7 +2851,7 @@  discard block
 block discarded – undo
2851 2851
 			$journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL'));
2852 2852
 			if (empty($journal_id)) {
2853 2853
 				$langs->loadLangs(array('errors', 'accountancy'));
2854
-				$this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
2854
+				$this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
2855 2855
 				$error++;
2856 2856
 			}
2857 2857
 
@@ -2865,7 +2865,7 @@  discard block
 block discarded – undo
2865 2865
 					$error++;
2866 2866
 				} elseif ($result == 0) {
2867 2867
 					$langs->loadLangs(array('errors', 'accountancy'));
2868
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
2868
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
2869 2869
 					$error++;
2870 2870
 				}
2871 2871
 			} else {
@@ -2879,7 +2879,7 @@  discard block
 block discarded – undo
2879 2879
 				$pcg_type_filter = array();
2880 2880
 				$tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement);
2881 2881
 				foreach ($tmp as $item) {
2882
-					$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
2882
+					$pcg_type_filter[] = "'".$this->db->escape($item)."'";
2883 2883
 				}
2884 2884
 
2885 2885
 				$sql = 'SELECT';
@@ -2889,14 +2889,14 @@  discard block
 block discarded – undo
2889 2889
 				}
2890 2890
 				$sql .= " aa.pcg_type,";
2891 2891
 				$sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance";
2892
-				$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
2893
-				$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
2894
-				$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
2895
-				$sql .= " AND aa.entity = ". ((int) $conf->entity);
2892
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
2893
+				$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
2894
+				$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
2895
+				$sql .= " AND aa.entity = ".((int) $conf->entity);
2896 2896
 				$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
2897
-				$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
2898
-				$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
2899
-				$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
2897
+				$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
2898
+				$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
2899
+				$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
2900 2900
 				$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
2901 2901
 				if ($separate_auxiliary_account) {
2902 2902
 					$sql .= " , NULLIF(t.subledger_account, '')";
@@ -2906,8 +2906,8 @@  discard block
 block discarded – undo
2906 2906
 
2907 2907
 				$resql = $this->db->query($sql);
2908 2908
 				if (!$resql) {
2909
-					$this->errors[] = 'Error ' . $this->db->lasterror();
2910
-					dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2909
+					$this->errors[] = 'Error '.$this->db->lasterror();
2910
+					dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2911 2911
 
2912 2912
 					$error++;
2913 2913
 				} else {
@@ -2936,14 +2936,14 @@  discard block
 block discarded – undo
2936 2936
 								$bookkeeping->subledger_account = $obj->subledger_account;
2937 2937
 								$sql = 'SELECT';
2938 2938
 								$sql .= " subledger_label";
2939
-								$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
2940
-								$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
2939
+								$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
2940
+								$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
2941 2941
 								$sql .= " ORDER BY doc_date DESC";
2942 2942
 								$sql .= " LIMIT 1";
2943 2943
 								$result = $this->db->query($sql);
2944 2944
 								if (!$result) {
2945
-									$this->errors[] = 'Error: ' . $this->db->lasterror();
2946
-									dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2945
+									$this->errors[] = 'Error: '.$this->db->lasterror();
2946
+									dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2947 2947
 									$error++;
2948 2948
 								}
2949 2949
 								$objtmp = $this->db->fetch_object($result);
@@ -2999,14 +2999,14 @@  discard block
 block discarded – undo
2999 2999
 							$bookkeeping->subledger_account = $obj->subledger_account;
3000 3000
 							$sql = 'SELECT';
3001 3001
 							$sql .= " subledger_label";
3002
-							$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
3003
-							$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
3002
+							$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
3003
+							$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
3004 3004
 							$sql .= " ORDER BY doc_date DESC";
3005 3005
 							$sql .= " LIMIT 1";
3006 3006
 							$result = $this->db->query($sql);
3007 3007
 							if (!$result) {
3008
-								$this->errors[] = 'Error: ' . $this->db->lasterror();
3009
-								dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3008
+								$this->errors[] = 'Error: '.$this->db->lasterror();
3009
+								dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3010 3010
 								$error++;
3011 3011
 							}
3012 3012
 							$objtmp = $this->db->fetch_object($result);
@@ -3078,7 +3078,7 @@  discard block
 block discarded – undo
3078 3078
 			return -1;
3079 3079
 		} elseif (empty($fiscal_period->id)) {
3080 3080
 			$langs->loadLangs(array('errors', 'compta'));
3081
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
3081
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
3082 3082
 			return -1;
3083 3083
 		}
3084 3084
 
@@ -3097,7 +3097,7 @@  discard block
 block discarded – undo
3097 3097
 			return -1;
3098 3098
 		} elseif (empty($new_fiscal_period->id)) {
3099 3099
 			$langs->loadLangs(array('errors', 'compta'));
3100
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
3100
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
3101 3101
 			return -1;
3102 3102
 		}
3103 3103
 
@@ -3117,7 +3117,7 @@  discard block
 block discarded – undo
3117 3117
 			return -1;
3118 3118
 		} elseif ($result == 0) {
3119 3119
 			$langs->loadLangs(array('errors', 'accountancy'));
3120
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal');
3120
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal');
3121 3121
 			return -1;
3122 3122
 		}
3123 3123
 
@@ -3125,18 +3125,18 @@  discard block
 block discarded – undo
3125 3125
 		$this->db->begin();
3126 3126
 
3127 3127
 		$sql = 'SELECT t.rowid';
3128
-		$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
3129
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
3130
-		$sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'";
3131
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
3132
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
3133
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
3134
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
3128
+		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
3129
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
3130
+		$sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'";
3131
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
3132
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
3133
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
3134
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
3135 3135
 
3136 3136
 		$resql = $this->db->query($sql);
3137 3137
 		if (!$resql) {
3138
-			$this->errors[] = 'Error ' . $this->db->lasterror();
3139
-			dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3138
+			$this->errors[] = 'Error '.$this->db->lasterror();
3139
+			dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3140 3140
 
3141 3141
 			$error++;
3142 3142
 		} else {
@@ -3151,7 +3151,7 @@  discard block
 block discarded – undo
3151 3151
 					break;
3152 3152
 				} elseif ($result == 0) {
3153 3153
 					$langs->loadLangs(array('errors', 'accountancy'));
3154
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid;
3154
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid;
3155 3155
 					$error++;
3156 3156
 					break;
3157 3157
 				}
Please login to merge, or discard this patch.