Completed
Branch develop (b3ada8)
by
unknown
22:54
created
htdocs/compta/facture/class/facture.class.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 			$this->mode_reglement_id = 0;
503 503
 		}
504 504
 		$this->status = self::STATUS_DRAFT;
505
-		$this->statut = self::STATUS_DRAFT;	// deprecated
505
+		$this->statut = self::STATUS_DRAFT; // deprecated
506 506
 
507 507
 		if (!empty($this->multicurrency_code)) {
508 508
 			// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 			if (!empty($_facrec->frequency)) {  // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarily when there is no recurrence.
589 589
 				$this->socid = $_facrec->socid;
590 590
 			}
591
-			$this->entity            = $_facrec->entity; // Invoice created in same entity than template
591
+			$this->entity = $_facrec->entity; // Invoice created in same entity than template
592 592
 
593 593
 			// Fields coming from GUI.
594 594
 			// @TODO Value of template should be used as default value on the form on the GUI, and we should here always use the value from GUI
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 				$this->mode_reglement_id = 0;
628 628
 			}
629 629
 			$this->status = self::STATUS_DRAFT;
630
-			$this->statut = self::STATUS_DRAFT;	// deprecated
630
+			$this->statut = self::STATUS_DRAFT; // deprecated
631 631
 
632 632
 			$this->linked_objects = $_facrec->linkedObjectsIds;
633 633
 			// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 
878 878
 						// Complete vat rate with code
879 879
 						$vatrate = $newinvoiceline->tva_tx;
880
-						if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
880
+						if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) {
881 881
 							$vatrate .= ' ('.$newinvoiceline->vat_src_code.')';
882 882
 						}
883 883
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 						($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) ? $previousdaynextdatewhen : '',
1086 1086
 						0,
1087 1087
 						$tva_npr,
1088
-						0,  // fk_remise_except
1088
+						0, // fk_remise_except
1089 1089
 						'HT',
1090 1090
 						0,
1091 1091
 						$_facrec->lines[$i]->product_type,
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 						$buyprice,
1099 1099
 						$_facrec->lines[$i]->label,
1100 1100
 						empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options,
1101
-						100,	// situation percent is undefined on recurring invoice lines
1102
-						0,  // fk_prev_id
1101
+						100, // situation percent is undefined on recurring invoice lines
1102
+						0, // fk_prev_id
1103 1103
 						$_facrec->lines[$i]->fk_unit,
1104 1104
 						$_facrec->lines[$i]->multicurrency_subprice,
1105 1105
 						$_facrec->lines[$i]->ref_ext,
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
 		$facture->fk_facture_source = $this->fk_facture_source;
1196 1196
 		$facture->type 			    = $this->type;
1197
-		$facture->subtype 			= $this->subtype;
1197
+		$facture->subtype = $this->subtype;
1198 1198
 		$facture->socid 		    = $this->socid;
1199 1199
 		$facture->date              = $this->date;
1200 1200
 		$facture->date_pointoftax   = $this->date_pointoftax;
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
 		$facture->origin            = $this->origin;
1213 1213
 		$facture->origin_id         = $this->origin_id;
1214
-		$facture->fk_account         = $this->fk_account;
1214
+		$facture->fk_account = $this->fk_account;
1215 1215
 
1216 1216
 		$facture->lines = $this->lines; // Array of lines of invoice
1217 1217
 		$facture->situation_counter = $this->situation_counter;
@@ -1478,8 +1478,8 @@  discard block
 block discarded – undo
1478 1478
 		$this->fk_account = $object->fk_account;
1479 1479
 		$this->cond_reglement_id    = $object->cond_reglement_id;
1480 1480
 		$this->mode_reglement_id    = $object->mode_reglement_id;
1481
-		$this->fk_incoterms    		= $object->fk_incoterms;
1482
-		$this->location_incoterms	= $object->location_incoterms;
1481
+		$this->fk_incoterms = $object->fk_incoterms;
1482
+		$this->location_incoterms = $object->location_incoterms;
1483 1483
 		$this->availability_id      = $object->availability_id;
1484 1484
 		$this->demand_reason_id     = $object->demand_reason_id;
1485 1485
 		$this->delivery_date        = $object->delivery_date;
@@ -1690,7 +1690,7 @@  discard block
 block discarded – undo
1690 1690
 	{
1691 1691
 		global $conf, $langs, $hookmanager, $action;
1692 1692
 
1693
-		if (! in_array($origin->element, array('propal', 'commande'))) {
1693
+		if (!in_array($origin->element, array('propal', 'commande'))) {
1694 1694
 			$origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder';
1695 1695
 			return null;
1696 1696
 		}
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
 			return null;
1701 1701
 		}
1702 1702
 
1703
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
1703
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
1704 1704
 
1705 1705
 		if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + getDolGlobalInt('INVOICE_MAX_FUTURE_DELAY'))) {
1706 1706
 			$origin->error = 'ErrorDateIsInFuture';
@@ -1745,7 +1745,7 @@  discard block
 block discarded – undo
1745 1745
 		$deposit->pos_source = $origin->pos_source;
1746 1746
 		$deposit->model_pdf = 'crabe';
1747 1747
 
1748
-		$modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type;
1748
+		$modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type;
1749 1749
 
1750 1750
 		if (getDolGlobalString($modelByTypeConfName)) {
1751 1751
 			$deposit->model_pdf = getDolGlobalString($modelByTypeConfName);
@@ -1805,10 +1805,10 @@  discard block
 block discarded – undo
1805 1805
 					$descriptions[$key] = '';
1806 1806
 				}
1807 1807
 				$TTotalByTva[$key] += $line->total_ttc;
1808
-				$descriptions[$key] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : '');
1809
-				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label . ' - ' : '');
1810
-				$descriptions[$key] .= $langs->trans('Qty') . ' : ' . $line->qty;
1811
-				$descriptions[$key] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>';
1808
+				$descriptions[$key] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : '');
1809
+				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label.' - ' : '');
1810
+				$descriptions[$key] .= $langs->trans('Qty').' : '.$line->qty;
1811
+				$descriptions[$key] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>';
1812 1812
 			}
1813 1813
 
1814 1814
 			foreach ($TTotalByTva as $tva => &$total) {
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
 				$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
1833 1833
 				$tva_tx = $lines[$i]->tva_tx;
1834 1834
 				$amountdeposit[$tva_tx] += ((float) $lines[$i]->total_ht * (float) $origin->deposit_percent) / 100;
1835
-				$descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : '');
1836
-				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : '');
1837
-				$descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty;
1838
-				$descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>';
1835
+				$descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : '');
1836
+				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : '');
1837
+				$descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty;
1838
+				$descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>';
1839 1839
 			}
1840 1840
 
1841 1841
 			if ($totalamount == 0) {
@@ -1850,11 +1850,11 @@  discard block
 block discarded – undo
1850 1850
 				continue;
1851 1851
 			}
1852 1852
 
1853
-			$descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref;
1853
+			$descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref;
1854 1854
 
1855 1855
 			// Hidden conf
1856 1856
 			if (getDolGlobalString('INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION') && !empty($descriptions[$tva])) {
1857
-				$descline .= '<ul>' . $descriptions[$tva] . '</ul>';
1857
+				$descline .= '<ul>'.$descriptions[$tva].'</ul>';
1858 1858
 			}
1859 1859
 
1860 1860
 			$addlineResult = $deposit->addline(
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
 					: '';
2244 2244
 
2245 2245
 				if ($type !== 'separate') {
2246
-					if (in_array($type, array('point','multipts','linestrg','polygon'))) {
2246
+					if (in_array($type, array('point', 'multipts', 'linestrg', 'polygon'))) {
2247 2247
 						$sql .= ", ST_AsWKT(ef.".$key.") as ".$key;
2248 2248
 					} else {
2249 2249
 						$sql .= ", ef.".$key;
@@ -2286,9 +2286,9 @@  discard block
 block discarded – undo
2286 2286
 				$this->id = $obj->rowid;
2287 2287
 				$this->entity = $obj->entity;
2288 2288
 
2289
-				$this->ref					= $obj->ref;
2290
-				$this->ref_client			= $obj->ref_client;
2291
-				$this->ref_customer			= $obj->ref_client;
2289
+				$this->ref = $obj->ref;
2290
+				$this->ref_client = $obj->ref_client;
2291
+				$this->ref_customer = $obj->ref_client;
2292 2292
 				$this->ref_ext				= $obj->ref_ext;
2293 2293
 				$this->type					= $obj->type;
2294 2294
 				$this->subtype				= $obj->subtype;
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
 				$this->fk_project = $obj->fk_project;
2315 2315
 				$this->project = null; // Clear if another value was already set by fetch_projet
2316 2316
 
2317
-				$this->statut = $obj->status;	// deprecated
2317
+				$this->statut = $obj->status; // deprecated
2318 2318
 				$this->status = $obj->status;
2319 2319
 
2320 2320
 				$this->date_lim_reglement = $this->db->jdate($obj->dlr);
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 				$this->fk_fac_rec_source	= $obj->fk_fac_rec_source;
2331 2331
 				$this->note = $obj->note_private; // deprecated
2332 2332
 				$this->note_private = $obj->note_private;
2333
-				$this->note_public			= $obj->note_public;
2333
+				$this->note_public = $obj->note_public;
2334 2334
 				$this->user_creation_id     = $obj->fk_user_author;
2335 2335
 				$this->user_validation_id   = $obj->fk_user_valid;
2336 2336
 				$this->user_modification_id = $obj->fk_user_modif;
@@ -2379,15 +2379,15 @@  discard block
 block discarded – undo
2379 2379
 
2380 2380
 							// date/datetime
2381 2381
 							if (in_array($type, array('date', 'datetime'))) {
2382
-								$this->array_options['options_' . $key] = $this->db->jdate($rawval);
2382
+								$this->array_options['options_'.$key] = $this->db->jdate($rawval);
2383 2383
 							} elseif ($type == 'password') {
2384 2384
 								if (!empty($rawval) && preg_match('/^dolcrypt:/', $rawval)) {
2385
-									$this->array_options['options_' . $key] = dolDecrypt($rawval);
2385
+									$this->array_options['options_'.$key] = dolDecrypt($rawval);
2386 2386
 								} else {
2387
-									$this->array_options['options_' . $key] = $rawval;
2387
+									$this->array_options['options_'.$key] = $rawval;
2388 2388
 								}
2389 2389
 							} else {
2390
-								$this->array_options['options_' . $key] = $rawval;
2390
+								$this->array_options['options_'.$key] = $rawval;
2391 2391
 							}
2392 2392
 						}
2393 2393
 					}
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 							if (empty($conf->disable_compute)) {
2399 2399
 								global $objectoffield;
2400 2400
 								$objectoffield = $this;
2401
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
2401
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
2402 2402
 							}
2403 2403
 						}
2404 2404
 					}
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
 					: '';
2495 2495
 
2496 2496
 				if ($type !== 'separate') {
2497
-					if (in_array($type, array('point','multipts','linestrg','polygon'))) {
2497
+					if (in_array($type, array('point', 'multipts', 'linestrg', 'polygon'))) {
2498 2498
 						$sql .= ", ST_AsWKT(ef.".$key.") as ".$key;
2499 2499
 					} else {
2500 2500
 						$sql .= ", ef.".$key;
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 				$line->ref              = $objp->product_ref; // Ref product
2535 2535
 				$line->product_ref      = $objp->product_ref; // Ref product
2536 2536
 				$line->libelle          = $objp->product_label; // deprecated
2537
-				$line->product_label 	= $objp->product_label; // Label product
2537
+				$line->product_label = $objp->product_label; // Label product
2538 2538
 				$line->product_barcode  = $objp->product_barcode; // Barcode number product
2539 2539
 				$line->product_desc     = $objp->product_desc; // Description product
2540 2540
 				$line->fk_product_type  = $objp->fk_product_type; // Type of product
@@ -2600,15 +2600,15 @@  discard block
 block discarded – undo
2600 2600
 
2601 2601
 							// date/datetime
2602 2602
 							if (in_array($type, array('date', 'datetime'))) {
2603
-								$line->array_options['options_' . $key] = $this->db->jdate($rawval);
2603
+								$line->array_options['options_'.$key] = $this->db->jdate($rawval);
2604 2604
 							} elseif ($type == 'password') {
2605 2605
 								if (!empty($rawval) && preg_match('/^dolcrypt:/', $rawval)) {
2606
-									$line->array_options['options_' . $key] = dolDecrypt($rawval);
2606
+									$line->array_options['options_'.$key] = dolDecrypt($rawval);
2607 2607
 								} else {
2608
-									$line->array_options['options_' . $key] = $rawval;
2608
+									$line->array_options['options_'.$key] = $rawval;
2609 2609
 								}
2610 2610
 							} else {
2611
-								$line->array_options['options_' . $key] = $rawval;
2611
+								$line->array_options['options_'.$key] = $rawval;
2612 2612
 							}
2613 2613
 						}
2614 2614
 					}
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
 							if (empty($conf->disable_compute)) {
2620 2620
 								global $objectoffield;
2621 2621
 								$objectoffield = $line;
2622
-								$line->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element_line]['computed'][$key], 1, 0, '2');
2622
+								$line->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element_line]['computed'][$key], 1, 0, '2');
2623 2623
 							}
2624 2624
 						}
2625 2625
 					}
@@ -3535,10 +3535,10 @@  discard block
 block discarded – undo
3535 3535
 		if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'creer'))
3536 3536
 		|| (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'invoice_advance', 'validate'))) {
3537 3537
 			$this->error = 'Permission denied';
3538
-			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3538
+			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3539 3539
 			return -1;
3540 3540
 		}
3541
-		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) &&	// empty should not happened, but when it occurs, the test save life
3541
+		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
3542 3542
 			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')						// If option enabled, we force invoice date
3543 3543
 		) {
3544 3544
 			$this->date = dol_now();
@@ -3722,7 +3722,7 @@  discard block
 block discarded – undo
3722 3722
 				for ($i = 0; $i < $cpt; $i++) {
3723 3723
 					if ($this->lines[$i]->fk_product > 0) {
3724 3724
 						$mouvP = new MouvementStock($this->db);
3725
-						$mouvP->origin = &$this;	// deprecated
3725
+						$mouvP->origin = &$this; // deprecated
3726 3726
 						$mouvP->setOrigin($this->element, $this->id);
3727 3727
 
3728 3728
 						// We decrease stock for product
@@ -3891,7 +3891,7 @@  discard block
 block discarded – undo
3891 3891
 			// Set new ref and define current status
3892 3892
 			if (!$error) {
3893 3893
 				$this->ref = $num;
3894
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
3894
+				$this->statut = self::STATUS_VALIDATED; // deprecated
3895 3895
 				$this->status = self::STATUS_VALIDATED;
3896 3896
 				$this->date_validation = $now;
3897 3897
 				$i = 0;
@@ -4070,7 +4070,7 @@  discard block
 block discarded – undo
4070 4070
 
4071 4071
 			if ($error == 0) {
4072 4072
 				$old_statut = $this->status;
4073
-				$this->statut = self::STATUS_DRAFT;	// deprecated
4073
+				$this->statut = self::STATUS_DRAFT; // deprecated
4074 4074
 				$this->status = self::STATUS_DRAFT;
4075 4075
 
4076 4076
 				// Call trigger
@@ -4665,8 +4665,8 @@  discard block
 block discarded – undo
4665 4665
 				$rangmax = $this->line_max($fk_parent_line);
4666 4666
 				$this->line->rang = $rangmax + 1;
4667 4667
 			}
4668
-			$apply_abs_price_on_credit_note=false;
4669
-			if ($this->type == self::TYPE_CREDIT_NOTE  && !getDolGlobalInt('FACTURE_ENABLE_NEGATIVE_LINES') && !getDolGlobalInt('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
4668
+			$apply_abs_price_on_credit_note = false;
4669
+			if ($this->type == self::TYPE_CREDIT_NOTE && !getDolGlobalInt('FACTURE_ENABLE_NEGATIVE_LINES') && !getDolGlobalInt('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
4670 4670
 				$apply_abs_price_on_credit_note = true;
4671 4671
 			}
4672 4672
 
@@ -5099,7 +5099,7 @@  discard block
 block discarded – undo
5099 5099
 		}
5100 5100
 
5101 5101
 		if (!empty($addon)) {
5102
-			dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
5102
+			dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
5103 5103
 
5104 5104
 			$mybool = false;
5105 5105
 
@@ -5386,7 +5386,7 @@  discard block
 block discarded – undo
5386 5386
 		if (getDolGlobalInt('LIST_OF_QUALIFIED_INVOICES_LIMIT_DEFINED') > 0) {
5387 5387
 			$sql .= " ORDER BY CASE WHEN f.rowid = ".((int) GETPOST('fac_avoir'))."' THEN 0 ELSE 1 END, f.ref";
5388 5388
 			$sql .= " DESC";
5389
-			$sql .= " LIMIT " . getDolGlobalInt('LIST_OF_QUALIFIED_INVOICES_LIMIT_DEFINED');
5389
+			$sql .= " LIMIT ".getDolGlobalInt('LIST_OF_QUALIFIED_INVOICES_LIMIT_DEFINED');
5390 5390
 		} else {
5391 5391
 			$sql .= " ORDER BY f.ref";
5392 5392
 		}
@@ -5573,7 +5573,7 @@  discard block
 block discarded – undo
5573 5573
 
5574 5574
 		if (empty($option) || $option != 'nolines') {
5575 5575
 			// Lines
5576
-			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5);	// We can force the nb of lines to test from command line (but not more than 1000)
5576
+			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000)
5577 5577
 			$xnbp = 0;
5578 5578
 			while ($xnbp < $nbp) {
5579 5579
 				$line = new FactureLigne($this->db);
@@ -6199,14 +6199,14 @@  discard block
 block discarded – undo
6199 6199
 		if (!empty($paymentmode) && $paymentmode != 'all') {
6200 6200
 			$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
6201 6201
 		}
6202
-		$sql .= " WHERE f.paye = 0";	// Only unpaid
6203
-		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;	// Only validated status
6202
+		$sql .= " WHERE f.paye = 0"; // Only unpaid
6203
+		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status
6204 6204
 		if ($datetouse == 'invoicedate') {
6205 6205
 			$sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";
6206 6206
 		} else {
6207 6207
 			$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
6208 6208
 		}
6209
-		$sql .= " AND f.entity IN (".getEntity('facture', 0).")";	// One batch process only one company (no sharing)
6209
+		$sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing)
6210 6210
 		if (!empty($paymentmode) && $paymentmode != 'all') {
6211 6211
 			$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
6212 6212
 		}
@@ -6425,7 +6425,7 @@  discard block
 block discarded – undo
6425 6425
 								$actioncomm->create($user);
6426 6426
 							}
6427 6427
 
6428
-							$this->db->commit();	// We always commit
6428
+							$this->db->commit(); // We always commit
6429 6429
 						}
6430 6430
 
6431 6431
 						if ($errormesg) {
@@ -6467,7 +6467,7 @@  discard block
 block discarded – undo
6467 6467
 		// get date of last validated invoices of same type
6468 6468
 		$sql  = "SELECT datef";
6469 6469
 		$sql .= " FROM ".MAIN_DB_PREFIX."facture";
6470
-		$sql .= " WHERE type = " . (int) $this->type ;
6470
+		$sql .= " WHERE type = ".(int) $this->type;
6471 6471
 		$sql .= " AND date_valid IS NOT NULL";
6472 6472
 		$sql .= " AND entity IN (".getEntity('invoice').")";
6473 6473
 		$sql .= " ORDER BY datef DESC LIMIT 1";
Please login to merge, or discard this patch.
htdocs/compta/paiement.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 			print '<br>';
640 640
 
641 641
 			$moreHtmlRight = '';
642
-			if ($action=='create') {
643
-				$urlToggleDisplayMod = $_SERVER["PHP_SELF"].'?facid='.$facid.'&action='.$action.'&accountid='.$accountid.'&display-all-invoices=' . (intval(!$displayAllInvoices));
642
+			if ($action == 'create') {
643
+				$urlToggleDisplayMod = $_SERVER["PHP_SELF"].'?facid='.$facid.'&action='.$action.'&accountid='.$accountid.'&display-all-invoices='.(intval(!$displayAllInvoices));
644 644
 
645 645
 				if (empty($displayAllInvoices)) {
646 646
 					$btnTitle = $langs->trans('DisplayOtherInvoicesToo');
@@ -655,19 +655,19 @@  discard block
 block discarded – undo
655 655
 				}
656 656
 
657 657
 				$btnIcon = empty($displayAllInvoices) ? 'fa fa-eye' : 'fa fa-eye-slash';
658
-				$moreHtmlRight.= dolGetButtonTitle($btnTitle, '', $btnIcon, $urlToggleDisplayMod);
658
+				$moreHtmlRight .= dolGetButtonTitle($btnTitle, '', $btnIcon, $urlToggleDisplayMod);
659 659
 			}
660 660
 
661 661
 			print_barre_liste($langs->trans('Invoices'), 0, $_SERVER["PHP_SELF"], '', '', '', '', $num, $totalnboflines, 'bill', 0, $moreHtmlRight, '', 0, 0, 0, 1);
662 662
 
663 663
 			print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
664
-			print '<table id="customer-invoices-paiments-list" class="noborder centpercent" data-display-all-invoices="' . (int) $displayAllInvoices . '" >';
664
+			print '<table id="customer-invoices-paiments-list" class="noborder centpercent" data-display-all-invoices="'.(int) $displayAllInvoices.'" >';
665 665
 			print '<thead>';
666 666
 
667 667
 			print '<tr class="liste_titre">';
668 668
 			print '<td>'.$arraytitle.'</td>';
669 669
 			if ($displayAllInvoices) {
670
-				print '<td>' . $langs->trans('Type') . '</td>';
670
+				print '<td>'.$langs->trans('Type').'</td>';
671 671
 			}
672 672
 			print '<td class="center">'.$langs->trans('Date').'</td>';
673 673
 			print '<td class="center">'.$langs->trans('DateMaxPayment').'</td>';
@@ -728,15 +728,15 @@  discard block
 block discarded – undo
728 728
 					$multicurrency_alreadypayed = price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits, 'MT');
729 729
 					$multicurrency_remaintopay = price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits, 'MT');
730 730
 					// Multicurrency full amount tooltip
731
-					$tooltiponmulticurrencyfullamount = $langs->trans('AmountHT') . ": " . price($objp->multicurrency_total_ht, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "<br>";
732
-					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->multicurrency_total_tva, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "<br>";
733
-					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "<br>";
731
+					$tooltiponmulticurrencyfullamount = $langs->trans('AmountHT').": ".price($objp->multicurrency_total_ht, 0, $langs, 0, -1, -1, $objp->multicurrency_code)."<br>";
732
+					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountVAT').": ".price($objp->multicurrency_total_tva, 0, $langs, 0, -1, -1, $objp->multicurrency_code)."<br>";
733
+					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountTTC').": ".price($objp->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $objp->multicurrency_code)."<br>";
734 734
 				}
735 735
 
736 736
 				// Full amount tooltip
737
-				$tooltiponfullamount = $langs->trans('AmountHT') . ": " . price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . "<br>";
738
-				$tooltiponfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . "<br>";
739
-				$tooltiponfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . "<br>";
737
+				$tooltiponfullamount = $langs->trans('AmountHT').": ".price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency)."<br>";
738
+				$tooltiponfullamount .= $langs->trans('AmountVAT').": ".price($objp->total_tva, 0, $langs, 0, -1, -1, $conf->currency)."<br>";
739
+				$tooltiponfullamount .= $langs->trans('AmountTTC').": ".price($objp->total_ttc, 0, $langs, 0, -1, -1, $conf->currency)."<br>";
740 740
 
741 741
 				print '<tr data-row-type="'.$objp->type.'" class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
742 742
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 						Facture::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"),
757 757
 					];
758 758
 					// Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9
759
-					print '<td class="center nowraponall">' . $typearray[$objp->type] . '</td>';
759
+					print '<td class="center nowraponall">'.$typearray[$objp->type].'</td>';
760 760
 				}
761 761
 
762 762
 				// Date
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 				if (isModEnabled('multicurrency')) {
786 786
 					print '<td class="right">';
787 787
 					if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
788
-						print '<span class="amount classfortooltip" title="'.$tooltiponmulticurrencyfullamount.'">' . price($sign * $objp->multicurrency_total_ttc);
788
+						print '<span class="amount classfortooltip" title="'.$tooltiponmulticurrencyfullamount.'">'.price($sign * $objp->multicurrency_total_ttc);
789 789
 					}
790 790
 					print '</span></td>';
791 791
 
Please login to merge, or discard this patch.
htdocs/website/index.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	$algo .= 'sitefiles';
342 342
 }
343 343
 
344
-$searchkey = GETPOST('searchstring', 'restricthtmlallowunvalid');	// or 'none', must be same as $searchstring
344
+$searchkey = GETPOST('searchstring', 'restricthtmlallowunvalid'); // or 'none', must be same as $searchstring
345 345
 
346 346
 if ($sortfield == '') {
347 347
 	if ($action == 'file_manager') {	// Test on permission not required
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 }
370 370
 
371 371
 $usercanedit = $user->hasRight('website', 'write');
372
-$permissiontoadd = $user->hasRight('website', 'write');	// Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles
372
+$permissiontoadd = $user->hasRight('website', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles
373 373
 $permissiontodelete = $user->hasRight('website', 'delete');
374 374
 
375 375
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 if ($sortorder) {
437 437
 	$backtopage .= '&sortorder='.urlencode($sortorder);
438 438
 }
439
-include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';	// This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file.
439
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file.
440 440
 
441 441
 $backtopage = $savbacktopage;
442 442
 //var_dump($backtopage);
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 // Replacement of string into pages
603 603
 if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha') && $usercanedit) {
604
-	$replacestring = GETPOST('replacestring', 'restricthtmlallowunvalid');	// or 'none', must be same then $searchstring
604
+	$replacestring = GETPOST('replacestring', 'restricthtmlallowunvalid'); // or 'none', must be same then $searchstring
605 605
 
606 606
 	$dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
607 607
 	$allowimportsite = true;
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
 		$objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha');
1176 1176
 		$objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'));
1177 1177
 		$objectpage->allowed_in_frames = GETPOST('WEBSITE_ALLOWED_IN_FRAMES', 'aZ09') ? 1 : 0;
1178
-		$objectpage->htmlheader = GETPOST('htmlheader', 'none');	// Must accept tags like '<script>' and '<link>'
1178
+		$objectpage->htmlheader = GETPOST('htmlheader', 'none'); // Must accept tags like '<script>' and '<link>'
1179 1179
 		$objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml');
1180 1180
 		$objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS');
1181 1181
 		$objectpage->fk_object = GETPOST('WEBSITE_OBJECTID');
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 		$content = '';
1209 1209
 		if (GETPOSTISSET('content')) {
1210 1210
 			//$content = GETPOST('content', 'restricthtmlallowunvalid');	// @TODO Use a restricthtmlallowunvalidwithphp
1211
-			$content = GETPOST('content', 'none');	// @TODO Use a restricthtmlallowunvalidwithphp
1211
+			$content = GETPOST('content', 'none'); // @TODO Use a restricthtmlallowunvalidwithphp
1212 1212
 
1213 1213
 			$objectpage->content = make_substitutions($content, $substitutionarray);
1214 1214
 		} else {
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
 					$error++;
1587 1587
 					setEventMessages($langs->trans('ErrorFaviconMustBeASquaredImage'), array(), 'errors');
1588 1588
 				}
1589
-				if (! $error && ($filesize[0] != 16 && $filesize[0] != 32 && $filesize[0] != 64)) {
1589
+				if (!$error && ($filesize[0] != 16 && $filesize[0] != 32 && $filesize[0] != 64)) {
1590 1590
 					$error++;
1591 1591
 					setEventMessages($langs->trans('ErrorFaviconSize'), array(), 'errors');
1592 1592
 				}
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 				if (!GETPOSTISSET('updateandstay')) {	// If we click on "Save And Stay", we don not make the redirect
1599 1599
 					$action = 'preview';
1600 1600
 					if ($backtopage) {
1601
-						$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage);	// Clean backtopage url
1601
+						$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url
1602 1602
 						header("Location: ".$backtopage);
1603 1603
 						exit;
1604 1604
 					}
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 			}
1623 1623
 
1624 1624
 
1625
-			$dataposted = trim(GETPOST('WEBSITE_HTML_HEADER', 'restricthtmlallowlinkscript'));		// Must accept tags like '<script>' and '<link>'
1625
+			$dataposted = trim(GETPOST('WEBSITE_HTML_HEADER', 'restricthtmlallowlinkscript')); // Must accept tags like '<script>' and '<link>'
1626 1626
 
1627 1627
 			$dataposted = preg_replace(array('/<html>\n*/ims', '/<\/html>\n*/ims'), array('', ''), $dataposted);
1628 1628
 			$dataposted = str_replace('<?=', '<?php', $dataposted);
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1633 1633
 
1634 1634
 			// Security analysis
1635
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1635
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1636 1636
 
1637 1637
 			if (!$errorphpcheck) {
1638 1638
 				$htmlheadercontent = '';
@@ -1670,7 +1670,7 @@  discard block
 block discarded – undo
1670 1670
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1671 1671
 
1672 1672
 			// Security analysis
1673
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1673
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1674 1674
 
1675 1675
 			if (!$errorphpcheck) {
1676 1676
 				$csscontent = '';
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1714 1714
 
1715 1715
 			// Security analysis
1716
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1716
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1717 1717
 
1718 1718
 			if (!$errorphpcheck) {
1719 1719
 				$jscontent = '';
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1752 1752
 
1753 1753
 			// Security analysis
1754
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1754
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1755 1755
 
1756 1756
 			if (!$errorphpcheck) {
1757 1757
 				$robotcontent = '';
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1790 1790
 
1791 1791
 			// Security analysis
1792
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1792
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1793 1793
 
1794 1794
 			if (!$errorphpcheck) {
1795 1795
 				if ($dataposted) {
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1818 1818
 
1819 1819
 			// Security analysis
1820
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1820
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1821 1821
 
1822 1822
 			if (!$errorphpcheck) {
1823 1823
 				$manifestjsoncontent = '';
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1857 1857
 
1858 1858
 			// Security analysis
1859
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1859
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1860 1860
 
1861 1861
 			if (!$errorphpcheck) {
1862 1862
 				$readmecontent = '';
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 			$phpfullcodestring = dolKeepOnlyPhpCode($dataposted);
1896 1896
 
1897 1897
 			// Security analysis
1898
-			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring);	// Contains the setEventMessages
1898
+			$errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages
1899 1899
 
1900 1900
 			if (!$errorphpcheck) {
1901 1901
 				$licensecontent = '';
@@ -1937,7 +1937,7 @@  discard block
 block discarded – undo
1937 1937
 			if (!GETPOSTISSET('updateandstay')) {	// If we click on "Save And Stay", we don not make the redirect
1938 1938
 				$action = 'preview';
1939 1939
 				if ($backtopage) {
1940
-					$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage);	// Clean backtopage url
1940
+					$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url
1941 1941
 					header("Location: ".$backtopage);
1942 1942
 					exit;
1943 1943
 				}
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
 					$sourcestring .= " ".$source;
1999 1999
 				}
2000 2000
 			}
2001
-			$securityspstring .= $directive . $sourcestring;
2001
+			$securityspstring .= $directive.$sourcestring;
2002 2002
 		}
2003 2003
 		$res = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCECSP', $securityspstring, 'chaine', 0, '', $conf->entity);
2004 2004
 		if ($res <= 0) {
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 	if (!GETPOSTISSET('updateandstay')) {	// If we click on "Save And Stay", we don not make the redirect
2044 2044
 		$action = 'preview';
2045 2045
 		if ($backtopage) {
2046
-			$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage);	// Clean backtopage url
2046
+			$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url
2047 2047
 			header("Location: ".$backtopage);
2048 2048
 			exit;
2049 2049
 		}
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
 	$object->fk_default_home = $pageid;
2063 2063
 	$res = $object->update($user);
2064
-	if (! ($res > 0)) {
2064
+	if (!($res > 0)) {
2065 2065
 		$error++;
2066 2066
 		setEventMessages($object->error, $object->errors, 'errors');
2067 2067
 	}
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
 		$objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha');
2177 2177
 		$objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'));
2178 2178
 		$objectpage->allowed_in_frames = GETPOST('WEBSITE_ALLOWED_IN_FRAMES', 'aZ09') ? 1 : 0;
2179
-		$objectpage->htmlheader = trim(GETPOST('htmlheader', 'restricthtmlallowlinkscript'));		// Must accept tags like '<script>' and '<link>'
2179
+		$objectpage->htmlheader = trim(GETPOST('htmlheader', 'restricthtmlallowlinkscript')); // Must accept tags like '<script>' and '<link>'
2180 2180
 		$objectpage->fk_page = (GETPOSTINT('pageidfortranslation') > 0 ? GETPOSTINT('pageidfortranslation') : 0);
2181 2181
 		$objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml'));
2182 2182
 		$objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS', 'alpha');
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
 
2456 2456
 			$phpfullcodestringold = dolKeepOnlyPhpCode($objectpage->content);
2457 2457
 
2458
-			$objectpage->content = GETPOST('PAGE_CONTENT', 'none');	// any HTML content allowed
2458
+			$objectpage->content = GETPOST('PAGE_CONTENT', 'none'); // any HTML content allowed
2459 2459
 
2460 2460
 			$phpfullcodestring = dolKeepOnlyPhpCode($objectpage->content);
2461 2461
 
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
 				$fileofzip = '';
2685 2685
 				if (GETPOSTISSET('templateuserfile')) {
2686 2686
 					// Case we selected one template
2687
-					$fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha');	// $fileofzip will be sanitized later into the importWebSite()
2687
+					$fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha'); // $fileofzip will be sanitized later into the importWebSite()
2688 2688
 				} elseif (!empty($_FILES) && is_array($_FILES['userfile'])) {
2689 2689
 					// Case we upload a new template
2690 2690
 					if (is_array($_FILES['userfile']['tmp_name'])) {
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
 	if ($website->virtualhost) {
2767 2767
 		$domainname = $website->virtualhost;
2768 2768
 	}
2769
-	if (! preg_match('/^http/i', $domainname)) {
2769
+	if (!preg_match('/^http/i', $domainname)) {
2770 2770
 		$domainname = 'https://'.$domainname;
2771 2771
 	}
2772 2772
 
@@ -2832,7 +2832,7 @@  discard block
 block discarded – undo
2832 2832
 				$url->appendChild($lastmod);
2833 2833
 				// Add suggested frequency for refresh
2834 2834
 				if (getDolGlobalString('WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ')) {
2835
-					$changefreq = $domtree->createElement('changefreq', 'weekly');	// TODO Manage other values
2835
+					$changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values
2836 2836
 					$url->appendChild($changefreq);
2837 2837
 				}
2838 2838
 				// Add higher priority for home page
@@ -2937,7 +2937,7 @@  discard block
 block discarded – undo
2937 2937
 				$url->appendChild($lastmod);
2938 2938
 				// Add suggested frequency for refresh
2939 2939
 				if (getDolGlobalString('WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ')) {
2940
-					$changefreq = $domtree->createElement('changefreq', 'weekly');	// TODO Manage other values
2940
+					$changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values
2941 2941
 					$url->appendChild($changefreq);
2942 2942
 				}
2943 2943
 
@@ -3022,7 +3022,7 @@  discard block
 block discarded – undo
3022 3022
 					$sourcestring .= " ".$source;
3023 3023
 				}
3024 3024
 			}
3025
-			$securityspstring .= $directive . $sourcestring;
3025
+			$securityspstring .= $directive.$sourcestring;
3026 3026
 		}
3027 3027
 		$res = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCECSP', $securityspstring, 'chaine', 0, '', $conf->entity);
3028 3028
 		if ($res <= 0) {
@@ -3285,11 +3285,11 @@  discard block
 block discarded – undo
3285 3285
 
3286 3286
 			// // Export web site
3287 3287
 			$extraCssClass = getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE') ? 'hideobject' : '';
3288
-			print '<input type="submit" class="button bordertransp ' . $extraCssClass . '" ' . $disabledexport . ' value="' . dol_escape_htmltag($exportlabel) . '" name="exportsite">';
3288
+			print '<input type="submit" class="button bordertransp '.$extraCssClass.'" '.$disabledexport.' value="'.dol_escape_htmltag($exportlabel).'" name="exportsite">';
3289 3289
 
3290 3290
 			if (getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')) {
3291 3291
 				// Overwrite template in sources
3292
-				$overwriteGitUrl = $_SERVER["PHP_SELF"] . '?action=overwritesite&website=' . urlencode($website->ref);
3292
+				$overwriteGitUrl = $_SERVER["PHP_SELF"].'?action=overwritesite&website='.urlencode($website->ref);
3293 3293
 				print dolButtonToOpenExportDialog('exportpopup', $langs->trans('ExportOptions'), $langs->trans('ExportSite'), 'exportsite', $overwriteGitUrl, $website);
3294 3294
 				//print '<a href="'.$_SERVER["PHP_SELF"].'?action=overwritesite&website='.urlencode($website->ref).'" class="button bordertransp hideobject" title="'.dol_escape_htmltag($langs->trans("ExportIntoGIT").". Directory ".getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')).'">'.dol_escape_htmltag($langs->trans("ExportIntoGIT")).'</a>';
3295 3295
 			}
@@ -3682,7 +3682,7 @@  discard block
 block discarded – undo
3682 3682
 				}
3683 3683
 
3684 3684
 				if ($objectpage->type_container != 'setup') {
3685
-					print '<div class="inline-block marginrightonly">';	// Button includes dynamic content
3685
+					print '<div class="inline-block marginrightonly">'; // Button includes dynamic content
3686 3686
 					print $langs->trans("ShowSubcontainers");
3687 3687
 					if (!getDolGlobalString('WEBSITE_SUBCONTAINERSINLINE')) {
3688 3688
 						print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', 0, 0, 0, '', 'nomarginleft').'</a>';
@@ -3692,7 +3692,7 @@  discard block
 block discarded – undo
3692 3692
 					print '</div>';
3693 3693
 				}
3694 3694
 
3695
-				print '<div class="inline-block marginrightonly">';	// Button edit inline
3695
+				print '<div class="inline-block marginrightonly">'; // Button edit inline
3696 3696
 
3697 3697
 				print '<span id="switchckeditorinline">'."\n";
3698 3698
 				// Enable CKEditor inline with js on section and div with conteneditable=true
@@ -3792,15 +3792,15 @@  discard block
 block discarded – undo
3792 3792
 													// Sending data via AJAX to update section
3793 3793
 													$.ajax({
3794 3794
 														type: \'POST\',
3795
-														url: \'' . DOL_URL_ROOT . '/core/ajax/editinline.php\',
3795
+														url: \'' . DOL_URL_ROOT.'/core/ajax/editinline.php\',
3796 3796
 														data: {
3797 3797
 															website_ref: \''.dol_escape_js($website->ref).'\',
3798
-															page_id: \'' . ((int) $websitepage->id) . '\',
3798
+															page_id: \'' . ((int) $websitepage->id).'\',
3799 3799
 															content: content,
3800 3800
 															element_id: elementId,
3801 3801
 															element_type: elementType,
3802 3802
 															action: \'updatedElementContent\',
3803
-															token: \'' . newToken() . '\'
3803
+															token: \'' . newToken().'\'
3804 3804
 														},
3805 3805
 														success: function(response) {
3806 3806
 															console.log(response);
@@ -3891,7 +3891,7 @@  discard block
 block discarded – undo
3891 3891
 				} else {
3892 3892
 					$disabled = '';
3893 3893
 					$title = '';
3894
-					$url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&pageid='.((int) $websitepage->id).'&website='.urlencode($website->ref);	// action=delete for webpage, deletesite for website
3894
+					$url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&pageid='.((int) $websitepage->id).'&website='.urlencode($website->ref); // action=delete for webpage, deletesite for website
3895 3895
 				}
3896 3896
 				print '<a href="'.$url.'" class="button buttonDelete bordertransp'.($disabled ? ' disabled' : '').'"'.$disabled.' title="'.dol_escape_htmltag($title).'">'.img_picto('', 'delete', 'class=""').'<span class="hideonsmartphone paddingleft">'.$langs->trans("Delete").'</span></a>';
3897 3897
 				print '</span>';
@@ -4084,7 +4084,7 @@  discard block
 block discarded – undo
4084 4084
 		// Clean the php htmlheader file to remove php code and get only html part
4085 4085
 		$htmlheadercontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP( \?>)?\n*/ims', '', $htmlheadercontent);
4086 4086
 	} else {
4087
-		$htmlheadercontent = GETPOST('WEBSITE_HTML_HEADER', 'none');		// Must accept tags like '<script>' and '<link>'
4087
+		$htmlheadercontent = GETPOST('WEBSITE_HTML_HEADER', 'none'); // Must accept tags like '<script>' and '<link>'
4088 4088
 	}
4089 4089
 	if (!trim($htmlheadercontent)) {
4090 4090
 		$htmlheadercontent = "<html>\n";
@@ -4115,7 +4115,7 @@  discard block
 block discarded – undo
4115 4115
 		// Clean the php htaccesscontent file to remove php code and get only html part
4116 4116
 		$htaccesscontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP( \?>)?\n*/ims', '', $htaccesscontent);
4117 4117
 	} else {
4118
-		$htaccesscontent = GETPOST('WEBSITE_HTACCESS', 'nohtml');	// We must use 'nohtml' and not 'alphanohtml' because we must accept "
4118
+		$htaccesscontent = GETPOST('WEBSITE_HTACCESS', 'nohtml'); // We must use 'nohtml' and not 'alphanohtml' because we must accept "
4119 4119
 	}
4120 4120
 
4121 4121
 	if (!GETPOSTISSET('WEBSITE_MANIFEST_JSON')) {
@@ -4215,7 +4215,7 @@  discard block
 block discarded – undo
4215 4215
 	$maxfilesizearray = getMaxFileSizeArray();
4216 4216
 	$maxmin = $maxfilesizearray['maxmin'];
4217 4217
 	if ($maxmin > 0) {
4218
-		print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
4218
+		print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
4219 4219
 	}
4220 4220
 	print '<input type="file" class="flat minwidth300" name="addedfile" id="addedfile"/>';
4221 4221
 
@@ -4257,7 +4257,7 @@  discard block
 block discarded – undo
4257 4257
 	print '<tr><td class="tdtop">';
4258 4258
 	print $langs->trans('WEBSITE_HTML_HEADER');
4259 4259
 	$htmlhelp = $langs->trans("Example").' :<br>';
4260
-	$htmlhelp .= dol_nl2br(dol_htmlentities($htmlheadercontentdefault));	// do not use dol_htmlentitiesbr here, $htmlheadercontentdefault is HTML with content like <link> and <script> that we want to be html encode as they must be show as doc content not executable instruction.
4260
+	$htmlhelp .= dol_nl2br(dol_htmlentities($htmlheadercontentdefault)); // do not use dol_htmlentitiesbr here, $htmlheadercontentdefault is HTML with content like <link> and <script> that we want to be html encode as they must be show as doc content not executable instruction.
4261 4261
 	$textwithhelp = $form->textwithpicto('', $htmlhelp, 1, 'help', '', 0, 2, 'htmlheadertooltip');
4262 4262
 	$htmlhelp2 = $langs->trans("LinkAndScriptsHereAreNotLoadedInEditor").'<br>';
4263 4263
 	print $form->textwithpicto($textwithhelp, $htmlhelp2, 1, 'warning', '', 0, 2, 'htmlheadertooltip2');
@@ -4656,7 +4656,7 @@  discard block
 block discarded – undo
4656 4656
 		$maxfilesizearray = getMaxFileSizeArray();
4657 4657
 		$maxmin = $maxfilesizearray['maxmin'];
4658 4658
 		if ($maxmin > 0) {
4659
-			print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
4659
+			print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
4660 4660
 		}
4661 4661
 		print '<input class="flat minwidth400" type="file" name="userfile[]" accept=".zip">';
4662 4662
 		print '<input type="submit" class="button small" name="buttonsubmitimportfile" value="'.dol_escape_htmltag($langs->trans("Upload")).'">';
@@ -5163,7 +5163,7 @@  discard block
 block discarded – undo
5163 5163
 	$htmlhelp = $langs->trans("EditTheWebSiteForACommonHeader").'<br><br>';
5164 5164
 	$htmlhelp .= $langs->trans("Examples").' :<br>';
5165 5165
 	$htmlhelp .= '<span class="small">';
5166
-	$htmlhelp .= dol_nl2br(dol_htmlentities($htmlheadercontentdefault));	// do not use dol_htmlentitiesbr here, $htmlheadercontentdefault is HTML with content like <link> and <script> that we want to be html encode as they must be show as doc content not executable instruction.
5166
+	$htmlhelp .= dol_nl2br(dol_htmlentities($htmlheadercontentdefault)); // do not use dol_htmlentitiesbr here, $htmlheadercontentdefault is HTML with content like <link> and <script> that we want to be html encode as they must be show as doc content not executable instruction.
5167 5167
 	$htmlhelp .= '</span>';
5168 5168
 	print $form->textwithpicto($langs->transnoentitiesnoconv('HtmlHeaderPage'), $htmlhelp, 1, 'help', '', 0, 2, 'htmlheadertooltip');
5169 5169
 	print '</td><td>';
@@ -5308,7 +5308,7 @@  discard block
 block discarded – undo
5308 5308
 	print '<div class="fiche"><br>';
5309 5309
 
5310 5310
 	$module = 'medias';
5311
-	$formalreadyopen = 2;	// So the form to submit a new file will not be open another time inside the core/tpl/filemanager.tpl.php
5311
+	$formalreadyopen = 2; // So the form to submit a new file will not be open another time inside the core/tpl/filemanager.tpl.php
5312 5312
 	if (empty($url)) {
5313 5313
 		$url = DOL_URL_ROOT.'/website/index.php'; // Must be an url without param
5314 5314
 	}
@@ -5546,8 +5546,8 @@  discard block
 block discarded – undo
5546 5546
 			print getTitleFieldOfList("Categories", 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
5547 5547
 			print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
5548 5548
 			print getTitleFieldOfList("UserCreation", 0, $_SERVER['PHP_SELF'], 'fk_user_creat', '', $param, '', $sortfield, $sortorder, '')."\n";
5549
-			print getTitleFieldOfList("DateCreation", 0, $_SERVER['PHP_SELF'], 'date_creation', '', $param, '', $sortfield, $sortorder, 'center ')."\n";		// Date creation
5550
-			print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";		// Date last modif
5549
+			print getTitleFieldOfList("DateCreation", 0, $_SERVER['PHP_SELF'], 'date_creation', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date creation
5550
+			print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif
5551 5551
 			print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
5552 5552
 			// Action column
5553 5553
 			if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
Please login to merge, or discard this patch.
htdocs/accountancy/class/bookkeeping.class.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			$this->credit = 0.0;
303 303
 		}
304 304
 
305
-		$result = $this->validBookkeepingDate($this->doc_date);	// Check date according to ACCOUNTANCY_FISCAL_PERIOD_MODE.
305
+		$result = $this->validBookkeepingDate($this->doc_date); // Check date according to ACCOUNTANCY_FISCAL_PERIOD_MODE.
306 306
 		if ($result < 0) {
307 307
 			return -1;
308 308
 		} elseif ($result == 0) {
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 				if (empty($this->piece_num)) {
392 392
 					$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
393 393
 					$sqlnum .= " FROM ".$this->db->prefix().$this->table_element;
394
-					$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
394
+					$sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
395 395
 
396 396
 					$resqlnum = $this->db->query($sqlnum);
397 397
 					if ($resqlnum) {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 		}
492 492
 
493 493
 		// Call triggers
494
-		if (! $error && ! $notrigger) {
494
+		if (!$error && !$notrigger) {
495 495
 			$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
496 496
 			if ($result < 0) {
497 497
 				$error++;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
640 640
 
641 641
 		global $action;
642
-		$hookmanager->initHooks(array($this->element . 'dao'));
642
+		$hookmanager->initHooks(array($this->element.'dao'));
643 643
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
644 644
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
645 645
 		if ($reshook > 0) {
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 		if (!$error) {
809 809
 			$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element.$mode);
810 810
 			// Call triggers
811
-			if (! $notrigger) {
811
+			if (!$notrigger) {
812 812
 				$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
813 813
 				if ($result < 0) {
814 814
 					$error++;
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 		$sql .= " t.date_validated as date_validation";
875 875
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.$mode.' as t';
876 876
 		$sql .= ' WHERE 1 = 1';
877
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
877
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
878 878
 		if (null !== $ref) {
879 879
 			$sql .= " AND t.rowid = ".((int) $ref);
880 880
 		} else {
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 			}
1051 1051
 		}
1052 1052
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1053
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1053
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1054 1054
 		if (count($sqlwhere) > 0) {
1055 1055
 			$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
1056 1056
 		}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 		$sql .= " t.date_validated as date_validation";
1187 1187
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1188 1188
 
1189
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1189
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1190 1190
 		if ($showAlreadyExportMovements == 0) {
1191 1191
 			$sql .= " AND t.date_export IS NULL";
1192 1192
 		}
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 		$sql .= " SUM(t.debit) as debit,";
1357 1357
 		$sql .= " SUM(t.credit) as credit";
1358 1358
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1359
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1359
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1360 1360
 
1361 1361
 		// Manage filter
1362 1362
 		if (is_array($filter)) {
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 		}
1585 1585
 
1586 1586
 		// Call triggers
1587
-		if (! $error && ! $notrigger) {
1587
+		if (!$error && !$notrigger) {
1588 1588
 			$result = $this->call_trigger('BOOKKEEPING_MODIFY', $user);
1589 1589
 			if ($result < 0) {
1590 1590
 				$error++;
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element.$mode;
1628 1628
 		$sql .= " SET ".$this->db->sanitize($field)." = ".(is_numeric($value) ? ((float) $value) : "'".$this->db->escape($value)."'");
1629 1629
 		$sql .= " WHERE piece_num = ".((int) $piece_num);
1630
-		$sql .= " AND entity = " . ((int) $conf->entity);
1630
+		$sql .= " AND entity = ".((int) $conf->entity);
1631 1631
 		$sql .= $sql_filter;
1632 1632
 
1633 1633
 		$resql = $this->db->query($sql);
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
 		if (!empty($journal)) {
1783 1783
 			$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
1784 1784
 		}
1785
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1785
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1786 1786
 		// Exclusion of validated entries at the time of deletion
1787 1787
 		$sql .= " AND date_validated IS NULL";
1788 1788
 		$sql .= $sql_filter;
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 		$this->db->begin();
1829 1829
 
1830 1830
 		// Call triggers
1831
-		if (! $error && ! $notrigger) {
1831
+		if (!$error && !$notrigger) {
1832 1832
 			$result = $this->call_trigger('BOOKKEEPING_DELETE', $user);
1833 1833
 			if ($result < 0) {
1834 1834
 				$error++;
@@ -1840,8 +1840,8 @@  discard block
 block discarded – undo
1840 1840
 			$sql = "DELETE";
1841 1841
 			$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1842 1842
 			$sql .= " WHERE piece_num = ".(int) $piecenum;
1843
-			$sql .= " AND date_validated IS NULL";		// For security, exclusion of validated entries at the time of deletion
1844
-			$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1843
+			$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
1844
+			$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1845 1845
 			$sql .= $sql_filter;
1846 1846
 
1847 1847
 			$resql = $this->db->query($sql);
@@ -1975,7 +1975,7 @@  discard block
 block discarded – undo
1975 1975
 		}
1976 1976
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1977 1977
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
1978
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1978
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1979 1979
 
1980 1980
 		dol_syslog(__METHOD__, LOG_DEBUG);
1981 1981
 		$result = $this->db->query($sql);
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 		global $conf;
2018 2018
 
2019 2019
 		$sql = "SELECT MAX(piece_num) + 1 as max FROM ".$this->db->prefix().$this->table_element.$mode;
2020
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2020
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2021 2021
 
2022 2022
 		dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG);
2023 2023
 
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 		if (getDolGlobalString('BOOKKEEPING_ADDON')) {
2054 2054
 			$mybool = false;
2055 2055
 
2056
-			$file = getDolGlobalString('BOOKKEEPING_ADDON') . ".php";
2056
+			$file = getDolGlobalString('BOOKKEEPING_ADDON').".php";
2057 2057
 			$classname = getDolGlobalString('BOOKKEEPING_ADDON');
2058 2058
 
2059 2059
 			// Include file with class
@@ -2113,7 +2113,7 @@  discard block
 block discarded – undo
2113 2113
 		}
2114 2114
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
2115 2115
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
2116
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2116
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2117 2117
 
2118 2118
 		dol_syslog(__METHOD__, LOG_DEBUG);
2119 2119
 		$result = $this->db->query($sql);
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
 		$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
2179 2179
 		$sql .= " date_validated as date_validation";
2180 2180
 		$sql .= " FROM ".$this->db->prefix().$this->table_element;
2181
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2181
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2182 2182
 
2183 2183
 		dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
2184 2184
 
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 
2264 2264
 			if (!$error) {
2265 2265
 				// Delete if there is an empty line
2266
-				$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";
2266
+				$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";
2267 2267
 				$resql = $this->db->query($sql);
2268 2268
 				if (!$resql) {
2269 2269
 					$error++;
@@ -2277,11 +2277,11 @@  discard block
 block discarded – undo
2277 2277
 				$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
2278 2278
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2279 2279
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
2280
-				$sql .= ' SELECT doc_date, doc_type,' . "'{$ref}',";
2280
+				$sql .= ' SELECT doc_date, doc_type,'."'{$ref}',";
2281 2281
 				$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
2282 2282
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2283 2283
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
2284
-				$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);
2284
+				$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);
2285 2285
 				$sql .= $sql_filter;
2286 2286
 				$resql = $this->db->query($sql);
2287 2287
 				if (!$resql) {
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
 			}
2293 2293
 
2294 2294
 			if (!$error) {
2295
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2295
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2296 2296
 				$resql = $this->db->query($sql);
2297 2297
 				if (!$resql) {
2298 2298
 					$error++;
@@ -2302,7 +2302,7 @@  discard block
 block discarded – undo
2302 2302
 			}
2303 2303
 		} elseif ($direction == 1) {
2304 2304
 			if (!$error) {
2305
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2305
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2306 2306
 				$resql = $this->db->query($sql);
2307 2307
 				if (!$resql) {
2308 2308
 					$error++;
@@ -2316,11 +2316,11 @@  discard block
 block discarded – undo
2316 2316
 				$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
2317 2317
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2318 2318
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
2319
-				$sql .= ' SELECT doc_date, doc_type,' . "'{$ref}',";
2319
+				$sql .= ' SELECT doc_date, doc_type,'."'{$ref}',";
2320 2320
 				$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
2321 2321
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2322 2322
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
2323
-				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2323
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2324 2324
 				$sql .= $sql_filter;
2325 2325
 				$resql = $this->db->query($sql);
2326 2326
 				if (!$resql) {
@@ -2331,7 +2331,7 @@  discard block
 block discarded – undo
2331 2331
 			}
2332 2332
 
2333 2333
 			if (!$error) {
2334
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2334
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2335 2335
 				$sql .= $sql_filter;
2336 2336
 				$resql = $this->db->query($sql);
2337 2337
 				if (!$resql) {
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
 		$sql .= " AND aa.active = 1";
2389 2389
 		$sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
2390 2390
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2391
-		$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2391
+		$sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2392 2392
 		$sql .= " ORDER BY account_number ASC";
2393 2393
 
2394 2394
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
2453 2453
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
2454 2454
 		$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
2455
-		$sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2455
+		$sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2456 2456
 
2457 2457
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2458 2458
 		$resql = $this->db->query($sql);
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2493 2493
 		$sql .= " AND aa.active = 1";
2494 2494
 		$sql .= " LEFT JOIN ".$this->db->prefix()."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
2495
-		$sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2495
+		$sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2496 2496
 
2497 2497
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2498 2498
 		$resql = $this->db->query($sql);
@@ -2525,7 +2525,7 @@  discard block
 block discarded – undo
2525 2525
 		global $conf;
2526 2526
 
2527 2527
 		$alias = trim($alias);
2528
-		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias . "." : $alias;
2528
+		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias."." : $alias;
2529 2529
 
2530 2530
 		if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) {
2531 2531
 			$result = $this->loadFiscalPeriods($force, 'active');
@@ -2538,10 +2538,10 @@  discard block
 block discarded – undo
2538 2538
 				$i = 0;
2539 2539
 				foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) {
2540 2540
 					$sql_list[$i] = "(";
2541
-					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date";
2541
+					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start'])."' <= ".$this->db->sanitize($alias)."doc_date";
2542 2542
 					if (!empty($fiscal_period['date_end'])) {
2543 2543
 						$sql_list[$i] .= " AND ";
2544
-						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end'])."'";
2544
+						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '".$this->db->idate($fiscal_period['date_end'])."'";
2545 2545
 					}
2546 2546
 					$sql_list[$i] .= ")";
2547 2547
 					$i++;
@@ -2636,10 +2636,10 @@  discard block
 block discarded – undo
2636 2636
 				$accountingLabelOperation = $thirdpartyname;
2637 2637
 			}
2638 2638
 			if (!empty($reference)) {
2639
-				$accountingLabelOperation .= ' - '. $reference;
2639
+				$accountingLabelOperation .= ' - '.$reference;
2640 2640
 			}
2641 2641
 			if (!empty($labelaccount)) {
2642
-				$accountingLabelOperation .= ' - '. $labelaccount;
2642
+				$accountingLabelOperation .= ' - '.$labelaccount;
2643 2643
 			}
2644 2644
 		} elseif (getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 1) {
2645 2645
 			$truncThirdpartyName = 32;
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
 				$accountingLabelOperation = $thirdpartyname;
2651 2651
 			}
2652 2652
 			if (!empty($reference)) {
2653
-				$accountingLabelOperation .= ' - '. $reference;
2653
+				$accountingLabelOperation .= ' - '.$reference;
2654 2654
 			}
2655 2655
 		} elseif (getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 2) {
2656 2656
 			$truncThirdpartyName = 64;
@@ -2723,8 +2723,8 @@  discard block
 block discarded – undo
2723 2723
 		if ($mode == 'active') {
2724 2724
 			if (!isset($conf->cache['active_fiscal_period_cached']) || $force) {
2725 2725
 				$sql = "SELECT date_start, date_end";
2726
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2727
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2726
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2727
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2728 2728
 				$sql .= " AND statut = 0";
2729 2729
 
2730 2730
 				$resql = $this->db->query($sql);
@@ -2746,8 +2746,8 @@  discard block
 block discarded – undo
2746 2746
 		if ($mode == 'closed') {
2747 2747
 			if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) {
2748 2748
 				$sql = "SELECT date_start, date_end";
2749
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2750
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2749
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2750
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2751 2751
 				$sql .= " AND statut = 1";
2752 2752
 
2753 2753
 				$resql = $this->db->query($sql);
@@ -2781,8 +2781,8 @@  discard block
 block discarded – undo
2781 2781
 		$list = array();
2782 2782
 
2783 2783
 		$sql = "SELECT rowid, label, date_start, date_end, statut";
2784
-		$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2785
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2784
+		$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2785
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2786 2786
 		$sql .= $this->db->order('date_start', 'ASC');
2787 2787
 
2788 2788
 		$resql = $this->db->query($sql);
@@ -2821,13 +2821,13 @@  discard block
 block discarded – undo
2821 2821
 
2822 2822
 		$sql = "SELECT YEAR(b.doc_date) as year";
2823 2823
 		for ($i = 1; $i <= 12; $i++) {
2824
-			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0") . ") AS month".((int) $i);
2824
+			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0").") AS month".((int) $i);
2825 2825
 		}
2826 2826
 		$sql .= ", COUNT(b.rowid) as total";
2827
-		$sql .= " FROM " . $this->db->prefix() . $this->table_element . " as b";
2828
-		$sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'";
2829
-		$sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'";
2830
-		$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
2827
+		$sql .= " FROM ".$this->db->prefix().$this->table_element." as b";
2828
+		$sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'";
2829
+		$sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'";
2830
+		$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
2831 2831
 
2832 2832
 		// Get count for each month into the fiscal period
2833 2833
 		if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
@@ -2835,7 +2835,7 @@  discard block
 block discarded – undo
2835 2835
 			$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)";
2836 2836
 		} else {
2837 2837
 			// Filter on the unitary flag/date lock on each record
2838
-			$sql .= " AND date_validated IS NULL";	// not locked
2838
+			$sql .= " AND date_validated IS NULL"; // not locked
2839 2839
 		}
2840 2840
 
2841 2841
 		$sql .= " GROUP BY YEAR(b.doc_date)";
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
 				'total' => (int) $obj->total,
2857 2857
 			);
2858 2858
 			for ($i = 1; $i <= 12; $i++) {
2859
-				$year_list['count'][$i] = (int) $obj->{'month' . $i};
2859
+				$year_list['count'][$i] = (int) $obj->{'month'.$i};
2860 2860
 			}
2861 2861
 
2862 2862
 			$list[] = $year_list;
@@ -2884,11 +2884,11 @@  discard block
 block discarded – undo
2884 2884
 		$now = dol_now();
2885 2885
 
2886 2886
 		// Specify as export : update field date_validated on selected month/year
2887
-		$sql = " UPDATE " . $this->db->prefix() . $this->table_element;
2888
-		$sql .= " SET date_validated = '" . $this->db->idate($now) . "'";
2889
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2890
-		$sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'";
2891
-		$sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'";
2887
+		$sql = " UPDATE ".$this->db->prefix().$this->table_element;
2888
+		$sql .= " SET date_validated = '".$this->db->idate($now)."'";
2889
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2890
+		$sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'";
2891
+		$sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'";
2892 2892
 		$sql .= " AND date_validated IS NULL";
2893 2893
 
2894 2894
 		dol_syslog(__METHOD__, LOG_DEBUG);
@@ -2921,27 +2921,27 @@  discard block
 block discarded – undo
2921 2921
 
2922 2922
 			$pcg_type_filter = array();
2923 2923
 			foreach ($accounting_groups_used_for_income_statement as $item) {
2924
-				$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
2924
+				$pcg_type_filter[] = "'".$this->db->escape($item)."'";
2925 2925
 			}
2926 2926
 
2927 2927
 			$sql = 'SELECT';
2928 2928
 			$sql .= " t.numero_compte,";
2929 2929
 			$sql .= " aa.pcg_type,";
2930 2930
 			$sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result";
2931
-			$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
2932
-			$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
2933
-			$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
2934
-			$sql .= " AND aa.entity = " . ((int) $conf->entity);
2935
-			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . $this->db->prefix() . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')';
2936
-			$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
2937
-			$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
2938
-			$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
2931
+			$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
2932
+			$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
2933
+			$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
2934
+			$sql .= " AND aa.entity = ".((int) $conf->entity);
2935
+			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
2936
+			$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
2937
+			$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
2938
+			$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
2939 2939
 			$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
2940 2940
 
2941 2941
 			$resql = $this->db->query($sql);
2942 2942
 			if (!$resql) {
2943
-				$this->errors[] = 'Error ' . $this->db->lasterror();
2944
-				dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2943
+				$this->errors[] = 'Error '.$this->db->lasterror();
2944
+				dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2945 2945
 			} else {
2946 2946
 				while ($obj = $this->db->fetch_object($resql)) {
2947 2947
 					$income_statement_amount += $obj->accounting_result;
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
 			return -1;
2981 2981
 		} elseif (empty($fiscal_period->id)) {
2982 2982
 			$langs->loadLangs(array('errors', 'compta'));
2983
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
2983
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
2984 2984
 			return -1;
2985 2985
 		}
2986 2986
 
@@ -2999,7 +2999,7 @@  discard block
 block discarded – undo
2999 2999
 			return -1;
3000 3000
 		} elseif (empty($new_fiscal_period->id)) {
3001 3001
 			$langs->loadLangs(array('errors', 'compta'));
3002
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
3002
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
3003 3003
 			return -1;
3004 3004
 		}
3005 3005
 
@@ -3019,7 +3019,7 @@  discard block
 block discarded – undo
3019 3019
 			$journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL'));
3020 3020
 			if (empty($journal_id)) {
3021 3021
 				$langs->loadLangs(array('errors', 'accountancy'));
3022
-				$this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
3022
+				$this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
3023 3023
 				$error++;
3024 3024
 			}
3025 3025
 
@@ -3033,7 +3033,7 @@  discard block
 block discarded – undo
3033 3033
 					$error++;
3034 3034
 				} elseif ($result == 0) {
3035 3035
 					$langs->loadLangs(array('errors', 'accountancy'));
3036
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
3036
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
3037 3037
 					$error++;
3038 3038
 				}
3039 3039
 			} else {
@@ -3047,7 +3047,7 @@  discard block
 block discarded – undo
3047 3047
 				$pcg_type_filter = array();
3048 3048
 				$tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement);
3049 3049
 				foreach ($tmp as $item) {
3050
-					$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
3050
+					$pcg_type_filter[] = "'".$this->db->escape($item)."'";
3051 3051
 				}
3052 3052
 
3053 3053
 				$sql = 'SELECT';
@@ -3057,14 +3057,14 @@  discard block
 block discarded – undo
3057 3057
 				}
3058 3058
 				$sql .= " aa.pcg_type,";
3059 3059
 				$sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance";
3060
-				$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
3061
-				$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
3062
-				$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
3063
-				$sql .= " AND aa.entity = ". ((int) $conf->entity);
3060
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
3061
+				$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
3062
+				$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
3063
+				$sql .= " AND aa.entity = ".((int) $conf->entity);
3064 3064
 				$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
3065
-				$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
3066
-				$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
3067
-				$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
3065
+				$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
3066
+				$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
3067
+				$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
3068 3068
 				$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
3069 3069
 				if ($separate_auxiliary_account) {
3070 3070
 					$sql .= " , NULLIF(t.subledger_account, '')";
@@ -3074,8 +3074,8 @@  discard block
 block discarded – undo
3074 3074
 
3075 3075
 				$resql = $this->db->query($sql);
3076 3076
 				if (!$resql) {
3077
-					$this->errors[] = 'Error ' . $this->db->lasterror();
3078
-					dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3077
+					$this->errors[] = 'Error '.$this->db->lasterror();
3078
+					dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3079 3079
 
3080 3080
 					$error++;
3081 3081
 				} else {
@@ -3104,14 +3104,14 @@  discard block
 block discarded – undo
3104 3104
 								$bookkeeping->subledger_account = $obj->subledger_account;
3105 3105
 								$sql = 'SELECT';
3106 3106
 								$sql .= " subledger_label";
3107
-								$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
3108
-								$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
3107
+								$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
3108
+								$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
3109 3109
 								$sql .= " ORDER BY doc_date DESC";
3110 3110
 								$sql .= " LIMIT 1";
3111 3111
 								$result = $this->db->query($sql);
3112 3112
 								if (!$result) {
3113
-									$this->errors[] = 'Error: ' . $this->db->lasterror();
3114
-									dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3113
+									$this->errors[] = 'Error: '.$this->db->lasterror();
3114
+									dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3115 3115
 									$error++;
3116 3116
 								}
3117 3117
 								$objtmp = $this->db->fetch_object($result);
@@ -3167,14 +3167,14 @@  discard block
 block discarded – undo
3167 3167
 							$bookkeeping->subledger_account = $obj->subledger_account;
3168 3168
 							$sql = 'SELECT';
3169 3169
 							$sql .= " subledger_label";
3170
-							$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
3171
-							$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
3170
+							$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
3171
+							$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
3172 3172
 							$sql .= " ORDER BY doc_date DESC";
3173 3173
 							$sql .= " LIMIT 1";
3174 3174
 							$result = $this->db->query($sql);
3175 3175
 							if (!$result) {
3176
-								$this->errors[] = 'Error: ' . $this->db->lasterror();
3177
-								dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3176
+								$this->errors[] = 'Error: '.$this->db->lasterror();
3177
+								dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3178 3178
 								$error++;
3179 3179
 							}
3180 3180
 							$objtmp = $this->db->fetch_object($result);
@@ -3246,7 +3246,7 @@  discard block
 block discarded – undo
3246 3246
 			return -1;
3247 3247
 		} elseif (empty($fiscal_period->id)) {
3248 3248
 			$langs->loadLangs(array('errors', 'compta'));
3249
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
3249
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
3250 3250
 			return -1;
3251 3251
 		}
3252 3252
 
@@ -3265,7 +3265,7 @@  discard block
 block discarded – undo
3265 3265
 			return -1;
3266 3266
 		} elseif (empty($new_fiscal_period->id)) {
3267 3267
 			$langs->loadLangs(array('errors', 'compta'));
3268
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
3268
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
3269 3269
 			return -1;
3270 3270
 		}
3271 3271
 
@@ -3285,7 +3285,7 @@  discard block
 block discarded – undo
3285 3285
 			return -1;
3286 3286
 		} elseif ($result == 0) {
3287 3287
 			$langs->loadLangs(array('errors', 'accountancy'));
3288
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal');
3288
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal');
3289 3289
 			return -1;
3290 3290
 		}
3291 3291
 
@@ -3293,18 +3293,18 @@  discard block
 block discarded – undo
3293 3293
 		$this->db->begin();
3294 3294
 
3295 3295
 		$sql = 'SELECT t.rowid';
3296
-		$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
3297
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
3298
-		$sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'";
3299
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
3300
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
3301
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
3302
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
3296
+		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
3297
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
3298
+		$sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'";
3299
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
3300
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
3301
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
3302
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
3303 3303
 
3304 3304
 		$resql = $this->db->query($sql);
3305 3305
 		if (!$resql) {
3306
-			$this->errors[] = 'Error ' . $this->db->lasterror();
3307
-			dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3306
+			$this->errors[] = 'Error '.$this->db->lasterror();
3307
+			dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3308 3308
 
3309 3309
 			$error++;
3310 3310
 		} else {
@@ -3319,7 +3319,7 @@  discard block
 block discarded – undo
3319 3319
 					break;
3320 3320
 				} elseif ($result == 0) {
3321 3321
 					$langs->loadLangs(array('errors', 'accountancy'));
3322
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid;
3322
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid;
3323 3323
 					$error++;
3324 3324
 					break;
3325 3325
 				}
@@ -3385,16 +3385,16 @@  discard block
 block discarded – undo
3385 3385
 			$echecT = [];
3386 3386
 			foreach ($toselect as $id) {
3387 3387
 				if ($bookkeeping->fetch($id)) {
3388
-					if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) {
3388
+					if (!getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) {
3389 3389
 						$accountcustcode = '411';
3390 3390
 					} else $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
3391 3391
 
3392
-					if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) {
3392
+					if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) {
3393 3393
 						$accountsuppcode = '401';
3394 3394
 					} else $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
3395 3395
 
3396 3396
 					if (strpos($bookkeeping->numero_compte, $accountcustcode) === 0 || strpos($bookkeeping->numero_compte, $accountsuppcode) === 0) {
3397
-						$echecT[]=$bookkeeping->numero_compte;
3397
+						$echecT[] = $bookkeeping->numero_compte;
3398 3398
 						continue;
3399 3399
 					}
3400 3400
 
@@ -3421,9 +3421,9 @@  discard block
 block discarded – undo
3421 3421
 		}
3422 3422
 
3423 3423
 		if ($nb > 1) {
3424
-			setEventMessages($nb ." " . $langs->trans('AssignAccountsSuccess'), null, 'mesgs');
3424
+			setEventMessages($nb." ".$langs->trans('AssignAccountsSuccess'), null, 'mesgs');
3425 3425
 		} elseif ($nb > 0) {
3426
-			setEventMessages($nb ." " . $langs->trans('AssignAccountSuccess'), null, 'mesgs');
3426
+			setEventMessages($nb." ".$langs->trans('AssignAccountSuccess'), null, 'mesgs');
3427 3427
 		} else {
3428 3428
 			setEventMessages($langs->trans('AssignAccountError'), null, 'errors');
3429 3429
 			$error++;
@@ -3431,7 +3431,7 @@  discard block
 block discarded – undo
3431 3431
 
3432 3432
 		if (!empty($echecImplode)) {
3433 3433
 			$nbEchec = count(explode(',', $echecImplode));
3434
-			setEventMessages($nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, null, 'errors'
3434
+			setEventMessages($nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber').' '.$echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber').' '.$echecImplode, null, 'errors'
3435 3435
 			);
3436 3436
 		}
3437 3437
 
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 				setEventMessages($langs->trans('ErrorBookkeepingDocDateIsOnAClosedFiscalPeriod'), null, 'errors');
3473 3473
 			} else {
3474 3474
 				setEventMessages($langs->trans('ErrorBookkeepingDocDateNotOnActiveFiscalPeriod'), null, 'errors');
3475
-				header("Location: " . $_SERVER['HTTP_REFERER']);
3475
+				header("Location: ".$_SERVER['HTTP_REFERER']);
3476 3476
 			}
3477 3477
 			$error++;
3478 3478
 			return -1;
@@ -3483,7 +3483,7 @@  discard block
 block discarded – undo
3483 3483
 		$pieceNumNext = $bookKeepingInstance->getNextNumMvt();
3484 3484
 
3485 3485
 		$cloneId = [];
3486
-		$sqlRowidClone = "SELECT rowid FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE piece_num = ".((int) $piecenum);
3486
+		$sqlRowidClone = "SELECT rowid FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE piece_num = ".((int) $piecenum);
3487 3487
 		$resqlRowidClone = $this->db->query($sqlRowidClone);
3488 3488
 
3489 3489
 		if ($resqlRowidClone) {
@@ -3499,27 +3499,27 @@  discard block
 block discarded – undo
3499 3499
 
3500 3500
 					$sql = "SELECT piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, fk_user_author, doc_ref,";
3501 3501
 					$sql .= " fk_doc, fk_docdet, debit, credit, journal_label, sens, montant";
3502
-					$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
3503
-					$sql .= " WHERE rowid = " . ((int) $toselectid);
3502
+					$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
3503
+					$sql .= " WHERE rowid = ".((int) $toselectid);
3504 3504
 					$resql = $this->db->query($sql);
3505 3505
 
3506 3506
 					if ($resql) {
3507 3507
 						while ($obj = $this->db->fetch_object($resql)) {
3508 3508
 							$docRef = $langs->trans('CloneOf', $obj->doc_ref);
3509 3509
 
3510
-							$sql_insert = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping";
3510
+							$sql_insert = "INSERT INTO ".MAIN_DB_PREFIX."accounting_bookkeeping";
3511 3511
 							$sql_insert .= " (piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, doc_date, fk_user_author, doc_ref,";
3512 3512
 							$sql_insert .= " fk_doc, fk_docdet, debit, credit, date_creation, journal_label, sens, montant)";
3513 3513
 							$sql_insert .= " VALUES";
3514
-							$sql_insert .= " (" . ((int) $pieceNumNext) . ", '" . $this->db->escape($obj->label_operation) . "', '" . $this->db->escape($obj->numero_compte) . "', '" . $this->db->escape($obj->label_compte) . "', '" . $this->db->escape($obj->doc_type) . "', '" . $this->db->escape($code_journal) . "', '" . $this->db->idate($docdate) . "', '" . $this->db->escape($obj->fk_user_author) . "', '" . $this->db->escape($docRef) . "', ";
3515
-							$sql_insert .= " ". ((int) $obj->fk_doc) . ", " . ((int) $obj->fk_docdet) . ", " . (float) $obj->debit . ", " . (float) $obj->credit . ", '" . $this->db->idate($docdate) . "', '" . $this->db->escape($journal_label) . "', '" . $this->db->escape($obj->sens) . "', " . (float) $obj->montant . ")";
3514
+							$sql_insert .= " (".((int) $pieceNumNext).", '".$this->db->escape($obj->label_operation)."', '".$this->db->escape($obj->numero_compte)."', '".$this->db->escape($obj->label_compte)."', '".$this->db->escape($obj->doc_type)."', '".$this->db->escape($code_journal)."', '".$this->db->idate($docdate)."', '".$this->db->escape($obj->fk_user_author)."', '".$this->db->escape($docRef)."', ";
3515
+							$sql_insert .= " ".((int) $obj->fk_doc).", ".((int) $obj->fk_docdet).", ".(float) $obj->debit.", ".(float) $obj->credit.", '".$this->db->idate($docdate)."', '".$this->db->escape($journal_label)."', '".$this->db->escape($obj->sens)."', ".(float) $obj->montant.")";
3516 3516
 
3517 3517
 							$resqlInsert = $this->db->query($sql_insert);
3518 3518
 
3519 3519
 							if ($resqlInsert) {
3520 3520
 								setEventMessages($langs->trans('CloningSuccess', $pieceNumNext), null, 'mesgs');
3521 3521
 							} else {
3522
-								setEventMessages($langs->trans('CloningFailed') . $this->db->lasterror(), null, 'errors');
3522
+								setEventMessages($langs->trans('CloningFailed').$this->db->lasterror(), null, 'errors');
3523 3523
 								$error++;
3524 3524
 							}
3525 3525
 						}
@@ -3560,7 +3560,7 @@  discard block
 block discarded – undo
3560 3560
 		$idImplodeSelect = implode(',', $toselect);
3561 3561
 		$pieceNumT = [];
3562 3562
 
3563
-		$sqlPieceNum = "SELECT DISTINCT(piece_num) FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplodeSelect).")";
3563
+		$sqlPieceNum = "SELECT DISTINCT(piece_num) FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplodeSelect).")";
3564 3564
 		$resqlPieceNum = $this->db->query($sqlPieceNum);
3565 3565
 
3566 3566
 		if ($resqlPieceNum) {
@@ -3580,7 +3580,7 @@  discard block
 block discarded – undo
3580 3580
 						setEventMessages($langs->trans('ErrorBookkeepingDocDateIsOnAClosedFiscalPeriod'), null, 'errors');
3581 3581
 					} else {
3582 3582
 						setEventMessages($langs->trans('ErrorBookkeepingDocDateNotOnActiveFiscalPeriod'), null, 'errors');
3583
-						header("Location: " . $_SERVER['HTTP_REFERER']);
3583
+						header("Location: ".$_SERVER['HTTP_REFERER']);
3584 3584
 					}
3585 3585
 					$error++;
3586 3586
 				}
@@ -3588,7 +3588,7 @@  discard block
 block discarded – undo
3588 3588
 				$bookKeepingInstance = new BookKeeping($this->db);
3589 3589
 				$pieceNumNext = $bookKeepingInstance->getNextNumMvt();
3590 3590
 				$cloneId = [];
3591
-				$sqlRowidClone = "SELECT rowid FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE piece_num = $pieceNum";
3591
+				$sqlRowidClone = "SELECT rowid FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE piece_num = $pieceNum";
3592 3592
 				$resqlRowidClone = $this->db->query($sqlRowidClone);
3593 3593
 
3594 3594
 				if ($resqlRowidClone) {
@@ -3602,7 +3602,7 @@  discard block
 block discarded – undo
3602 3602
 							$code_journal = getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL') ? $code_journal : $bookKeeping->code_journal;
3603 3603
 							$journal_label = getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL') ? $accountingJournal->label : $bookKeeping->journal_label;
3604 3604
 							$sql = "SELECT piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, fk_user_author, doc_ref, fk_doc, fk_docdet, debit, credit, journal_label, sens, montant ";
3605
-							$sql .= "FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE rowid = " . ((int) $toselectid);
3605
+							$sql .= "FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE rowid = ".((int) $toselectid);
3606 3606
 
3607 3607
 							$resql = $this->db->query($sql);
3608 3608
 							if ($resql) {
@@ -3613,10 +3613,10 @@  discard block
 block discarded – undo
3613 3613
 									$sql_insert .= " (piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, doc_date,";
3614 3614
 									$sql_insert .= " fk_user_author, doc_ref, fk_doc, fk_docdet, debit, credit, journal_label, sens, montant";
3615 3615
 									$sql_insert .= ")";
3616
-									$sql_insert .= " VALUES (" . ((int) $pieceNumNext) . ", '" . $this->db->escape($obj->label_operation) . "', '" . $this->db->escape($obj->numero_compte) . "',";
3617
-									$sql_insert .= " '" . $this->db->escape($obj->label_compte) . "', '" . $this->db->escape($obj->doc_type) . "', '" . $this->db->escape($code_journal) . "', '" . $this->db->idate($docdate)."',";
3618
-									$sql_insert .= " '" . $this->db->escape($obj->fk_user_author) . "', '" . $this->db->escape($docRef) . "', " . ((int) $obj->fk_doc) . ", " . ((int) $obj->fk_docdet) . ",";
3619
-									$sql_insert .= " " . (float) $obj->debit . ", " . (float) $obj->credit . ", '" . $this->db->escape($journal_label) . "', '" . $this->db->escape($obj->sens) . "', " . (float) $obj->montant;
3616
+									$sql_insert .= " VALUES (".((int) $pieceNumNext).", '".$this->db->escape($obj->label_operation)."', '".$this->db->escape($obj->numero_compte)."',";
3617
+									$sql_insert .= " '".$this->db->escape($obj->label_compte)."', '".$this->db->escape($obj->doc_type)."', '".$this->db->escape($code_journal)."', '".$this->db->idate($docdate)."',";
3618
+									$sql_insert .= " '".$this->db->escape($obj->fk_user_author)."', '".$this->db->escape($docRef)."', ".((int) $obj->fk_doc).", ".((int) $obj->fk_docdet).",";
3619
+									$sql_insert .= " ".(float) $obj->debit.", ".(float) $obj->credit.", '".$this->db->escape($journal_label)."', '".$this->db->escape($obj->sens)."', ".(float) $obj->montant;
3620 3620
 									$sql_insert .= ")";
3621 3621
 
3622 3622
 									$resqlInsert = $this->db->query($sql_insert);
@@ -3668,17 +3668,17 @@  discard block
 block discarded – undo
3668 3668
 		$accountingJournal->fetch(0, $code_journal);
3669 3669
 
3670 3670
 		$this->db->begin();
3671
-		$sqlAlreadyExtourne = "SELECT DISTINCT(piece_num) FROM " .MAIN_DB_PREFIX. "accounting_bookkeeping WHERE label_operation LIKE '%Extourne%'";
3671
+		$sqlAlreadyExtourne = "SELECT DISTINCT(piece_num) FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE label_operation LIKE '%Extourne%'";
3672 3672
 		$resqlAlreadyExtourne = $this->db->query($sqlAlreadyExtourne);
3673 3673
 		$alreadyExtourneT = array();
3674 3674
 		if ($resqlAlreadyExtourne) {
3675 3675
 			while ($obj4 = $this->db->fetch_object($resqlAlreadyExtourne)) {
3676
-				$alreadyExtourneT []= $obj4->piece_num;
3676
+				$alreadyExtourneT [] = $obj4->piece_num;
3677 3677
 			}
3678 3678
 		}
3679 3679
 
3680 3680
 		$idImplode = implode(',', $toselect);
3681
-		$sql1 = "SELECT DISTINCT(piece_num) from " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplode).")";
3681
+		$sql1 = "SELECT DISTINCT(piece_num) from ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplode).")";
3682 3682
 		$resql1 = $this->db->query($sql1);
3683 3683
 		$pieceNumT = [];
3684 3684
 
@@ -3692,7 +3692,7 @@  discard block
 block discarded – undo
3692 3692
 				$newBookKeepingInstance = new BookKeeping($this->db);
3693 3693
 				$pieceNumNext = $newBookKeepingInstance->getNextNumMvt();
3694 3694
 				$extourneIds = [];
3695
-				$sql2 = "SELECT rowid FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE piece_num = ".((int) $pieceNum);
3695
+				$sql2 = "SELECT rowid FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE piece_num = ".((int) $pieceNum);
3696 3696
 				$resql2 = $this->db->query($sql2);
3697 3697
 
3698 3698
 				if ($resql2) {
@@ -3716,7 +3716,7 @@  discard block
 block discarded – undo
3716 3716
 									$newBookKeeping->sens = 'D';
3717 3717
 								}
3718 3718
 
3719
-								$newBookKeeping->label_operation = "Extourne " . $bookKeeping->piece_num . " - " . $bookKeeping->numero_compte . " - " . date('d/m/Y', dol_now()) . " - " . $i;
3719
+								$newBookKeeping->label_operation = "Extourne ".$bookKeeping->piece_num." - ".$bookKeeping->numero_compte." - ".date('d/m/Y', dol_now())." - ".$i;
3720 3720
 
3721 3721
 								$newBookKeeping->numero_compte = $bookKeeping->numero_compte;
3722 3722
 								$newBookKeeping->label_compte = $bookKeeping->label_compte;
Please login to merge, or discard this patch.
htdocs/accountancy/bookkeeping/listbyaccount.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 }
70 70
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
71 71
 
72
-$search_doc_date = GETPOSTDATE('doc_date', 'getpost');	// deprecated. Can use 'search_date_start/end'
72
+$search_doc_date = GETPOSTDATE('doc_date', 'getpost'); // deprecated. Can use 'search_date_start/end'
73 73
 
74 74
 $search_date_startyear = GETPOSTINT('search_date_startyear');
75 75
 $search_date_startmonth = GETPOSTINT('search_date_startmonth');
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	$sql = "SELECT date_start, date_end";
171 171
 	$sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
172 172
 	if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) {
173
-		$sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
173
+		$sql .= " WHERE rowid = ".getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
174 174
 	} else {
175
-		$sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'";
175
+		$sql .= " WHERE date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
176 176
 	}
177 177
 	$sql .= $db->plimit(1);
178 178
 	$res = $db->query($sql);
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		$search_date_due_start = '';
317 317
 		// Due date end
318 318
 		$search_date_due_end_day = '';
319
-		$search_date_due_end_month =  '';
319
+		$search_date_due_end_month = '';
320 320
 		$search_date_due_end_year = '';
321 321
 		$search_date_due_end = '';
322 322
 		$search_lettering_code = '';
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		} else {
369 369
 			$filter['t.numero_compte>='] = $search_accountancy_code_start;
370 370
 		}
371
-		$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
371
+		$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
372 372
 	}
373 373
 	if (!empty($search_accountancy_code_end)) {
374 374
 		if ($type == 'sub') {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		} else {
377 377
 			$filter['t.numero_compte<='] = $search_accountancy_code_end;
378 378
 		}
379
-		$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
379
+		$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
380 380
 	}
381 381
 	if (!empty($search_label_account)) {
382 382
 		$filter['t.label_compte'] = $search_label_account;
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	// Actions
465 465
 	if ($action === 'exporttopdf' && $permissiontoadd) {
466 466
 		$object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
467
-		require_once DOL_DOCUMENT_ROOT . '/core/modules/accountancy/doc/pdf_ledger.modules.php';
467
+		require_once DOL_DOCUMENT_ROOT.'/core/modules/accountancy/doc/pdf_ledger.modules.php';
468 468
 		$pdf = new pdf_ledger($db);
469 469
 		$pdf->fromDate = $search_date_start;
470 470
 		$pdf->toDate = $search_date_end;
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 			}
608 608
 
609 609
 			if (!$error) {
610
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
610
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
611 611
 				exit();
612 612
 			}
613 613
 		} elseif ($massaction == 'letteringmanual' && $permissiontoadd) {
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 				setEventMessages('', $lettering->errors, 'errors');
618 618
 			} else {
619 619
 				setEventMessages($langs->trans($result == 0 ? 'AccountancyNoLetteringModified' : 'AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
620
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
620
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
621 621
 				exit();
622 622
 			}
623 623
 		} elseif ($type == 'sub' && $massaction == 'letteringpartial') {
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 				setEventMessages('', $lettering->errors, 'errors');
628 628
 			} else {
629 629
 				setEventMessages($langs->trans($result == 0 ? 'AccountancyNoLetteringModified' : 'AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
630
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
630
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
631 631
 				exit();
632 632
 			}
633 633
 		} elseif ($action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) {
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 			}
649 649
 
650 650
 			if (!$error) {
651
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
651
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
652 652
 				exit();
653 653
 			}
654 654
 		} elseif ($action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) {
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 				setEventMessages('', $lettering->errors, 'errors');
659 659
 			} else {
660 660
 				setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnletteringModified' : 'AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
661
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
661
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
662 662
 				exit();
663 663
 			}
664 664
 		}
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 				} else {
754 754
 					$subledger_start_account = $subledger_end_account = '';
755 755
 				}
756
-				print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="' . $_SERVER["PHP_SELF"] . '?mode=customer&socid='.$socid.'&type=sub&search_accountancy_code_start='.$subledger_start_account.'&search_accountancy_code_end='.$subledger_end_account.'">';
756
+				print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?mode=customer&socid='.$socid.'&type=sub&search_accountancy_code_start='.$subledger_start_account.'&search_accountancy_code_end='.$subledger_end_account.'">';
757 757
 			} else {
758 758
 				print '<span class="a-mesure marginleftonly marginrightonly">';
759 759
 			}
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 				} else {
774 774
 					$subledger_start_account = $subledger_end_account = '';
775 775
 				}
776
-				print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="' . $_SERVER["PHP_SELF"] . '?mode=supplier&socid='.$socid.'&type=sub&search_accountancy_code_start='.$subledger_start_account.'&search_accountancy_code_end='.$subledger_end_account.'">';
776
+				print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?mode=supplier&socid='.$socid.'&type=sub&search_accountancy_code_start='.$subledger_start_account.'&search_accountancy_code_end='.$subledger_end_account.'">';
777 777
 			} else {
778 778
 				print '<span class="a-mesure marginleftonly marginrightonly">';
779 779
 			}
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0);
819 819
 	}
820 820
 	//$num = count($object->lines);
821
-	$num = $result;						// $result is total nb of lines, or limit + 1, but $object->lines is always limited to $limit
821
+	$num = $result; // $result is total nb of lines, or limit + 1, but $object->lines is always limited to $limit
822 822
 
823 823
 	if ($result < 0) {
824 824
 		setEventMessages($object->error, $object->errors, 'errors');
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
 // List of mass actions available
835 835
 $arrayofmassactions = array();
836 836
 if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
837
-	$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
838
-	$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
839
-	$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
837
+	$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans('LetteringAuto');
838
+	$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans('UnletteringAuto');
839
+	$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans('LetteringManual');
840 840
 	if ($type == 'sub') {
841
-		$arrayofmassactions['letteringpartial'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringPartial');
841
+		$arrayofmassactions['letteringpartial'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans('LetteringPartial');
842 842
 	}
843
-	$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
843
+	$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans('UnletteringManual');
844 844
 }
845 845
 if ($user->hasRight('accounting', 'mouvements', 'creer')) {
846 846
 	$arrayofmassactions['preclonebookkeepingwriting'] = img_picto('', 'clone', 'class="pictofixedwidth"').$langs->trans("Clone");
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
870 870
 print '<input type="hidden" name="type" value="'.$type.'">';
871 871
 if (!empty($socid)) {
872
-	print '<input type="hidden" name="socid" value="' . $socid . '">';
872
+	print '<input type="hidden" name="socid" value="'.$socid.'">';
873 873
 }
874 874
 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
875 875
 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@@ -886,16 +886,16 @@  discard block
 block discarded – undo
886 886
 if (empty($reshook)) {
887 887
 	// Remove navigation buttons if in thirdparty tab mode, except for PDF printing
888 888
 	if (empty($socid)) {
889
-		$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?' . $param);
889
+		$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
890 890
 		if ($type == 'sub') {
891
-			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
892
-			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
891
+			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly'));
892
+			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
893 893
 		} else {
894
-			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
895
-			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
894
+			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
895
+			$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly'));
896 896
 		}
897 897
 	}
898
-	$newcardbutton .= dolGetButtonTitle($langs->trans('ExportToPdf'), '', 'fa fa-file-pdf paddingleft', $_SERVER['PHP_SELF'] . '?action=exporttopdf&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
898
+	$newcardbutton .= dolGetButtonTitle($langs->trans('ExportToPdf'), '', 'fa fa-file-pdf paddingleft', $_SERVER['PHP_SELF'].'?action=exporttopdf&'.$url_param, '', 1, array('morecss' => 'marginleftonly'));
899 899
 
900 900
 	$newcardbutton .= dolGetButtonTitleSeparator();
901 901
 
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 	print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
920 920
 } elseif ($massaction == 'preassignaccountbookkeepingwriting') {
921 921
 	$input = $formaccounting->select_account('', 'account', 1);
922
-	$formquestion = array(array('type' => 'other', 'name' => 'account', 'label' => '<span class="fieldrequired">' . $langs->trans("AccountAccountingShort") . '</span>', 'value' => $input),);
922
+	$formquestion = array(array('type' => 'other', 'name' => 'account', 'label' => '<span class="fieldrequired">'.$langs->trans("AccountAccountingShort").'</span>', 'value' => $input),);
923 923
 	print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("confirmMassAssignAccountBookkeepingWritingConfirm"), $langs->trans("ConfirmMassAssignAccountBookkeepingWritingQuestion", count($toselect)), "assignaccountbookkeepingwriting", $formquestion, '', 0, 200, 500, 1);
924 924
 } elseif ($massaction == 'preclonebookkeepingwriting') {
925 925
 	$input1 = $form->selectDate('', 'massdate', 0, 0, 0, "create_mvt", 1, 1);
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 		array(
929 929
 			'type' => 'other',
930 930
 			'name' => 'massdate',
931
-			'label' => '<span class="fieldrequired">' . $langs->trans("Docdate") . '</span>',
931
+			'label' => '<span class="fieldrequired">'.$langs->trans("Docdate").'</span>',
932 932
 			'value' => $input1
933 933
 		)
934 934
 	);
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 		$formquestion[] = array(
938 938
 			'type' => 'text',
939 939
 			'name' => 'code_journal',
940
-			'label' => '<span class="fieldrequired">' . $langs->trans("Codejournal") . '</span>',
940
+			'label' => '<span class="fieldrequired">'.$langs->trans("Codejournal").'</span>',
941 941
 			'value' => $input2
942 942
 		);
943 943
 	}
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 	);
953 953
 } elseif ($massaction == 'prereturnaccountbookkeepingwriting') {
954 954
 	$input1 = $form->selectDate('', 'massdate', 0, 0, 0, "create_mvt", 1, 1);
955
-	$formquestion = array(array('type' => 'other', 'name' => 'massdate', 'label' => '<span class="fieldrequired">' . $langs->trans("Docdate") . '</span>', 'value' => $input1));
955
+	$formquestion = array(array('type' => 'other', 'name' => 'massdate', 'label' => '<span class="fieldrequired">'.$langs->trans("Docdate").'</span>', 'value' => $input1));
956 956
 	print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassReturnAccountBookkeepingWriting"), $langs->trans("ConfirmMassReturnAccountBookkeepingWritingQuestion", count($toselect)), "returnaccountbookkeepingwriting", $formquestion, '', 0, 200, 500, 1);
957 957
 }
958 958
 
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
 	} else {
1005 1005
 		$stringforfirstkey .= ' CTL +';
1006 1006
 	}
1007
-	$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
1008
-	$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
1007
+	$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="'.$stringforfirstkey.' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
1008
+	$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="'.$stringforfirstkey.' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
1009 1009
 	$moreforfilter .= <<<SCRIPT
1010 1010
 <script type="text/javascript">
1011 1011
 	jQuery(document).ready(function() {
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 if (empty($socid)) {
1038 1038
 	$moreforfilter .= '<div class="divsearchfield">';
1039
-	$moreforfilter .= $langs->trans('AccountingCategory') . ': ';
1039
+	$moreforfilter .= $langs->trans('AccountingCategory').': ';
1040 1040
 	$moreforfilter .= '<div class="nowrap inline-block">';
1041 1041
 	$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
1042 1042
 	$moreforfilter .= '</div>';
@@ -1223,9 +1223,9 @@  discard block
 block discarded – undo
1223 1223
 
1224 1224
 $displayed_account_number = null; // Start with undefined to be able to distinguish with empty
1225 1225
 
1226
-$objectstatic = null;  // Init for static analysis
1227
-$objectlink = '';  // Init for static analysis
1228
-$result = -1;  // Init for static analysis
1226
+$objectstatic = null; // Init for static analysis
1227
+$objectlink = ''; // Init for static analysis
1228
+$result = -1; // Init for static analysis
1229 1229
 
1230 1230
 // Loop on record
1231 1231
 // --------------------------------------------------------------------
@@ -1241,8 +1241,8 @@  discard block
 block discarded – undo
1241 1241
 $totalarray['val']['totalbalance'] = 0;
1242 1242
 
1243 1243
 // Init for static analysis
1244
-$colspan = 0;			// colspan before field 'label of operation'
1245
-$colspanend = 0;		// colspan after debit/credit
1244
+$colspan = 0; // colspan before field 'label of operation'
1245
+$colspanend = 0; // colspan after debit/credit
1246 1246
 $accountg = '-';
1247 1247
 
1248 1248
 while ($i < min($num, $limit)) {
@@ -1255,8 +1255,8 @@  discard block
 block discarded – undo
1255 1255
 	}
1256 1256
 	//if (empty($accountg)) $accountg = '-';
1257 1257
 
1258
-	$colspan = 0;			// colspan before field 'label of operation'
1259
-	$colspanend = 0;		// colspan after debit/credit
1258
+	$colspan = 0; // colspan before field 'label of operation'
1259
+	$colspanend = 0; // colspan after debit/credit
1260 1260
 	if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1261 1261
 		$colspan++;
1262 1262
 	}
@@ -1309,9 +1309,9 @@  discard block
 block discarded – undo
1309 1309
 		if (isset($displayed_account_number)) {
1310 1310
 			print '<tr class="liste_total">';
1311 1311
 			if ($type == 'sub') {
1312
-				print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accounta($displayed_account_number) . ':</td>';
1312
+				print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.length_accounta($displayed_account_number).':</td>';
1313 1313
 			} else {
1314
-				print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>';
1314
+				print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.length_accountg($displayed_account_number).':</td>';
1315 1315
 			}
1316 1316
 			print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
1317 1317
 			print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
@@ -1350,9 +1350,9 @@  discard block
 block discarded – undo
1350 1350
 				print length_accounta($line->subledger_account);
1351 1351
 			} else {
1352 1352
 				// Should not happen: subledger account must be null or a non empty value
1353
-				print '<span class="error">' . $langs->trans("Unknown");
1353
+				print '<span class="error">'.$langs->trans("Unknown");
1354 1354
 				if ($line->subledger_label) {
1355
-					print ' (' . $line->subledger_label . ')';
1355
+					print ' ('.$line->subledger_label.')';
1356 1356
 					$htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
1357 1357
 				} else {
1358 1358
 					$htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
@@ -1362,9 +1362,9 @@  discard block
 block discarded – undo
1362 1362
 			}
1363 1363
 		} else {
1364 1364
 			if ($line->numero_compte != "" && $line->numero_compte != '-1') {
1365
-				print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
1365
+				print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
1366 1366
 			} else {
1367
-				print '<span class="error">' . $langs->trans("Unknown") . '</span>';
1367
+				print '<span class="error">'.$langs->trans("Unknown").'</span>';
1368 1368
 			}
1369 1369
 		}
1370 1370
 		print '</td>';
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 			if (in_array($line->id, $arrayofselected)) {
1388 1388
 				$selected = 1;
1389 1389
 			}
1390
-			print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
1390
+			print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1391 1391
 		}
1392 1392
 		print '</td>';
1393 1393
 		if (!$i) {
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
 		} elseif ($line->doc_type == 'bank') {
1483 1483
 			print $objectstatic->getNomUrl(1);
1484 1484
 			$bank_ref = strstr($line->doc_ref, '-');
1485
-			print " " . $bank_ref;
1485
+			print " ".$bank_ref;
1486 1486
 		} else {
1487 1487
 			print $line->doc_ref;
1488 1488
 		}
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 			if (in_array($line->id, $arrayofselected)) {
1596 1596
 				$selected = 1;
1597 1597
 			}
1598
-			print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
1598
+			print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1599 1599
 		}
1600 1600
 		print '</td>';
1601 1601
 		if (!$i) {
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 }
1657 1657
 
1658 1658
 // Show total line
1659
-$trforbreaknobg = 1;	// used in list_print_total.tpl.php
1659
+$trforbreaknobg = 1; // used in list_print_total.tpl.php
1660 1660
 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1661 1661
 
1662 1662
 // If no record found
Please login to merge, or discard this patch.
htdocs/accountancy/bookkeeping/list.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 $search_doc_type = GETPOST("search_doc_type", 'alpha');
72 72
 $search_doc_ref = GETPOST("search_doc_ref", 'alpha');
73 73
 
74
-$search_doc_date = GETPOSTDATE('doc_date', 'getpost');	// deprecated. Can use 'search_date_start/end'
74
+$search_doc_date = GETPOSTDATE('doc_date', 'getpost'); // deprecated. Can use 'search_date_start/end'
75 75
 
76 76
 $search_date_start = GETPOSTDATE('search_date_start', 'getpost', 'auto', 'search_date_start_accountancy');
77 77
 $search_date_end = GETPOSTDATE('search_date_end', 'getpostend', 'auto', 'search_date_end_accountancy');
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 		$sql = "SELECT date_start, date_end";
164 164
 		$sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
165 165
 		if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) {
166
-			$sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
166
+			$sql .= " WHERE rowid = ".getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
167 167
 		} else {
168
-			$sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'";
168
+			$sql .= " WHERE date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
169 169
 		}
170 170
 		$sql .= $db->plimit(1);
171 171
 		$res = $db->query($sql);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$search_date_due_start = '';
288 288
 		// Due date end
289 289
 		$search_date_due_end_day = '';
290
-		$search_date_due_end_month =  '';
290
+		$search_date_due_end_month = '';
291 291
 		$search_date_due_end_year = '';
292 292
 		$search_date_due_end = '';
293 293
 		$search_debit = '';
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	// Actions
464 464
 	if ($action === 'exporttopdf' && $permissiontoadd) {
465 465
 		$object->fetchAll('ASC,ASC,ASC', 'code_journal,doc_date,piece_num', 0, 0, $filter);
466
-		require_once DOL_DOCUMENT_ROOT . '/core/modules/accountancy/doc/pdf_bookkeeping.modules.php';
466
+		require_once DOL_DOCUMENT_ROOT.'/core/modules/accountancy/doc/pdf_bookkeeping.modules.php';
467 467
 		$pdf = new pdf_bookkeeping($db);
468 468
 		$pdf->fromDate = $search_date_start;
469 469
 		$pdf->toDate = $search_date_end;
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 			}
609 609
 
610 610
 			if (!$error) {
611
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
611
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
612 612
 				exit();
613 613
 			}
614 614
 		} elseif ($massaction == 'letteringmanual' && $permissiontoadd) {
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 				setEventMessages('', $lettering->errors, 'errors');
619 619
 			} else {
620 620
 				setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
621
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
621
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
622 622
 				exit();
623 623
 			}
624 624
 		} elseif ($action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) {
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 			}
640 640
 
641 641
 			if (!$error) {
642
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
642
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
643 643
 				exit();
644 644
 			}
645 645
 		} elseif ($action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) {
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 				setEventMessages('', $lettering->errors, 'errors');
650 650
 			} else {
651 651
 				setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
652
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
652
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
653 653
 				exit();
654 654
 			}
655 655
 		}
@@ -830,10 +830,10 @@  discard block
 block discarded – undo
830 830
 // List of mass actions available
831 831
 $arrayofmassactions = array();
832 832
 if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
833
-	$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
834
-	$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
835
-	$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
836
-	$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
833
+	$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans('LetteringAuto');
834
+	$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans('UnletteringAuto');
835
+	$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans('LetteringManual');
836
+	$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans('UnletteringManual');
837 837
 }
838 838
 if ($user->hasRight('accounting', 'mouvements', 'creer')) {
839 839
 	$arrayofmassactions['preclonebookkeepingwriting'] = img_picto('', 'clone', 'class="pictofixedwidth"').$langs->trans("Clone");
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 	$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
883 883
 	$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
884 884
 	$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub'.$param, '', 1, array('morecss' => 'marginleftonly'));
885
-	$newcardbutton .= dolGetButtonTitle($langs->trans('ExportToPdf'), '', 'fa fa-file-pdf paddingleft', $_SERVER['PHP_SELF'] . '?action=exporttopdf&' . $param, '', 1, array('morecss' => 'marginleftonly'));
885
+	$newcardbutton .= dolGetButtonTitle($langs->trans('ExportToPdf'), '', 'fa fa-file-pdf paddingleft', $_SERVER['PHP_SELF'].'?action=exporttopdf&'.$param, '', 1, array('morecss' => 'marginleftonly'));
886 886
 
887 887
 	$url = './card.php?action=create'.(!empty($type) ? '&type=sub' : '').'&backtopage='.urlencode($_SERVER['PHP_SELF']);
888 888
 	if (!empty($socid)) {
@@ -902,16 +902,16 @@  discard block
 block discarded – undo
902 902
 	print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
903 903
 } elseif ($massaction == 'preassignaccountbookkeepingwriting') {
904 904
 	$input = $formaccounting->select_account('', 'account', 1);
905
-	$formquestion = array(array('type' => 'other', 'name' => 'account', 'label' => '<span class="fieldrequired">' . $langs->trans("AccountAccountingShort") . '</span>', 'value' => $input),);
905
+	$formquestion = array(array('type' => 'other', 'name' => 'account', 'label' => '<span class="fieldrequired">'.$langs->trans("AccountAccountingShort").'</span>', 'value' => $input),);
906 906
 	print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("confirmMassAssignAccountBookkeepingWritingConfirm"), $langs->trans("ConfirmMassAssignAccountBookkeepingWritingQuestion", count($toselect)), "assignaccountbookkeepingwriting", $formquestion, '', 0, 200, 500, 1);
907 907
 } elseif ($massaction == 'preclonebookkeepingwriting') {
908 908
 	$input1 = $form->selectDate('', 'massdate', 0, 0, 0, "create_mvt", 1, 1);
909
-	$input2 = $formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1) . '</td>';
909
+	$input2 = $formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).'</td>';
910 910
 	$formquestion = array(
911 911
 		array(
912 912
 			'type' => 'other',
913 913
 			'name' => 'massdate',
914
-			'label' => '<span class="fieldrequired">' . $langs->trans("Docdate") . '</span>',
914
+			'label' => '<span class="fieldrequired">'.$langs->trans("Docdate").'</span>',
915 915
 			'value' => $input1
916 916
 		)
917 917
 	);
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 		$formquestion[] = array(
921 921
 			'type' => 'text',
922 922
 			'name' => 'code_journal',
923
-			'label' => '<span class="fieldrequired">' . $langs->trans("Codejournal") . '</span>',
923
+			'label' => '<span class="fieldrequired">'.$langs->trans("Codejournal").'</span>',
924 924
 			'value' => $input2
925 925
 		);
926 926
 	}
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 	);
936 936
 } elseif ($massaction == 'prereturnaccountbookkeepingwriting') {
937 937
 	$input1 = $form->selectDate('', 'massdate', 0, 0, 0, "create_mvt", 1, 1);
938
-	$formquestion = array(array('type' => 'other', 'name' => 'massdate', 'label' => '<span class="fieldrequired">' . $langs->trans("Docdate") . '</span>', 'value' => $input1));
938
+	$formquestion = array(array('type' => 'other', 'name' => 'massdate', 'label' => '<span class="fieldrequired">'.$langs->trans("Docdate").'</span>', 'value' => $input1));
939 939
 	print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassReturnAccountBookkeepingWriting"), $langs->trans("ConfirmMassReturnAccountBookkeepingWritingQuestion", count($toselect)), "returnaccountbookkeepingwriting", $formquestion, '', 0, 200, 500, 1);
940 940
 }
941 941
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 	}
1305 1305
 
1306 1306
 	// Document ref
1307
-	$modulepart = '';	// may be used by include*.tpl.php
1307
+	$modulepart = ''; // may be used by include*.tpl.php
1308 1308
 	if (!empty($arrayfields['t.doc_ref']['checked'])) {
1309 1309
 		$objectstatic = null;
1310 1310
 
@@ -1372,8 +1372,8 @@  discard block
 block discarded – undo
1372 1372
 			$labeltoshow .= $objectstatic->getNomUrl(1);
1373 1373
 			$labeltoshowalt .= $objectstatic->ref;
1374 1374
 			$bank_ref = strstr($line->doc_ref, '-');
1375
-			$labeltoshow .= " " . $bank_ref;
1376
-			$labeltoshowalt .= " " . $bank_ref;
1375
+			$labeltoshow .= " ".$bank_ref;
1376
+			$labeltoshowalt .= " ".$bank_ref;
1377 1377
 		} else {
1378 1378
 			$labeltoshow .= $line->doc_ref;
1379 1379
 			$labeltoshowalt .= $line->doc_ref;
Please login to merge, or discard this patch.