Browse Source

add missing rule

Frédéric FRANCE 4 years ago
parent
commit
a4e25359e7
100 changed files with 810 additions and 543 deletions
  1. 1 1
      dev/setup/codesniffer/ruleset.xml
  2. 63 63
      htdocs/comm/propal/card.php
  3. 6 3
      htdocs/comm/propal/class/propal.class.php
  4. 2 1
      htdocs/comm/propal/list.php
  5. 6 3
      htdocs/comm/propal/stats/index.php
  6. 2 1
      htdocs/compta/bank/account_statement_document.php
  7. 4 3
      htdocs/compta/bank/bankentries_list.php
  8. 3 1
      htdocs/compta/bank/budget.php
  9. 2 1
      htdocs/compta/bank/categ.php
  10. 10 5
      htdocs/compta/bank/graph.php
  11. 2 1
      htdocs/compta/bank/line.php
  12. 6 2
      htdocs/compta/bank/list.php
  13. 4 2
      htdocs/compta/cashcontrol/cashcontrol_card.php
  14. 2 1
      htdocs/compta/cashcontrol/cashcontrol_list.php
  15. 3 4
      htdocs/compta/cashcontrol/report.php
  16. 6 6
      htdocs/compta/deplacement/card.php
  17. 6 3
      htdocs/compta/deplacement/stats/index.php
  18. 33 32
      htdocs/compta/facture/card-rec.php
  19. 8 8
      htdocs/compta/facture/card.php
  20. 4 2
      htdocs/compta/facture/class/facture.class.php
  21. 6 3
      htdocs/compta/facture/class/paymentterm.class.php
  22. 2 1
      htdocs/compta/facture/invoicetemplate_list.php
  23. 2 1
      htdocs/compta/facture/list.php
  24. 3 1
      htdocs/compta/facture/prelevement.php
  25. 6 3
      htdocs/compta/facture/stats/index.php
  26. 2 1
      htdocs/compta/journal/sellsjournal.php
  27. 14 7
      htdocs/compta/localtax/clients.php
  28. 21 9
      htdocs/compta/localtax/index.php
  29. 10 5
      htdocs/compta/localtax/quadri_detail.php
  30. 4 2
      htdocs/compta/paiement.php
  31. 2 2
      htdocs/compta/paiement/cheque/card.php
  32. 2 3
      htdocs/compta/paiement/class/paiement.class.php
  33. 10 5
      htdocs/compta/resultat/clientfourn.php
  34. 10 5
      htdocs/compta/resultat/index.php
  35. 10 5
      htdocs/compta/resultat/result.php
  36. 2 1
      htdocs/compta/sociales/card.php
  37. 2 1
      htdocs/compta/sociales/class/chargesociales.class.php
  38. 4 2
      htdocs/compta/sociales/class/paymentsocialcontribution.class.php
  39. 18 9
      htdocs/compta/stats/byratecountry.php
  40. 10 5
      htdocs/compta/stats/cabyprodserv.php
  41. 10 5
      htdocs/compta/stats/cabyuser.php
  42. 10 5
      htdocs/compta/stats/casoc.php
  43. 10 5
      htdocs/compta/stats/index.php
  44. 10 5
      htdocs/compta/stats/supplier_turnover.php
  45. 10 5
      htdocs/compta/stats/supplier_turnover_by_prodserv.php
  46. 10 5
      htdocs/compta/stats/supplier_turnover_by_thirdparty.php
  47. 2 1
      htdocs/compta/tva/card.php
  48. 4 2
      htdocs/compta/tva/class/paymentvat.class.php
  49. 10 5
      htdocs/compta/tva/clients.php
  50. 21 9
      htdocs/compta/tva/index.php
  51. 12 6
      htdocs/compta/tva/quadri_detail.php
  52. 3 1
      htdocs/core/actions_sendmails.inc.php
  53. 2 1
      htdocs/core/actions_setmoduleoptions.inc.php
  54. 2 3
      htdocs/core/ajax/ajaxdirpreview.php
  55. 6 9
      htdocs/core/ajax/ajaxdirtree.php
  56. 2 3
      htdocs/core/ajax/pingresult.php
  57. 6 3
      htdocs/core/boxes/box_graph_invoices_permonth.php
  58. 4 2
      htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
  59. 4 2
      htdocs/core/boxes/box_graph_orders_permonth.php
  60. 4 2
      htdocs/core/boxes/box_graph_orders_supplier_permonth.php
  61. 15 7
      htdocs/core/boxes/box_graph_product_distribution.php
  62. 6 3
      htdocs/core/boxes/box_graph_propales_permonth.php
  63. 6 3
      htdocs/core/class/CMailFile.class.php
  64. 2 1
      htdocs/core/class/CSMSFile.class.php
  65. 6 3
      htdocs/core/class/ccountry.class.php
  66. 6 3
      htdocs/core/class/comment.class.php
  67. 4 6
      htdocs/core/class/commoninvoice.class.php
  68. 44 22
      htdocs/core/class/commonobject.class.php
  69. 9 10
      htdocs/core/class/conf.class.php
  70. 6 3
      htdocs/core/class/cstate.class.php
  71. 6 3
      htdocs/core/class/ctypent.class.php
  72. 6 3
      htdocs/core/class/cunits.class.php
  73. 2 1
      htdocs/core/class/dolgeoip.class.php
  74. 4 6
      htdocs/core/class/dolgraph.class.php
  75. 2 1
      htdocs/core/class/events.class.php
  76. 2 1
      htdocs/core/class/extrafields.class.php
  77. 10 5
      htdocs/core/class/fileupload.class.php
  78. 13 8
      htdocs/core/class/hookmanager.class.php
  79. 37 20
      htdocs/core/class/html.form.class.php
  80. 2 1
      htdocs/core/class/html.formactions.class.php
  81. 6 3
      htdocs/core/class/html.formcompany.class.php
  82. 26 15
      htdocs/core/class/html.formfile.class.php
  83. 2 1
      htdocs/core/class/html.formmail.class.php
  84. 4 2
      htdocs/core/class/html.formother.class.php
  85. 2 1
      htdocs/core/class/html.formprojet.class.php
  86. 2 1
      htdocs/core/class/html.formsms.class.php
  87. 2 1
      htdocs/core/class/html.formwebsite.class.php
  88. 17 17
      htdocs/core/class/lessc.class.php
  89. 4 1
      htdocs/core/class/menubase.class.php
  90. 17 26
      htdocs/core/class/rssparser.class.php
  91. 21 32
      htdocs/core/class/smtps.class.php
  92. 6 3
      htdocs/core/class/stats.class.php
  93. 6 7
      htdocs/core/class/translate.class.php
  94. 6 3
      htdocs/core/class/utils.class.php
  95. 2 1
      htdocs/core/class/vcard.class.php
  96. 7 7
      htdocs/core/customreports.php
  97. 3 1
      htdocs/core/datepicker.php
  98. 2 3
      htdocs/core/extrafieldsinexport.inc.php
  99. 27 13
      htdocs/core/lib/admin.lib.php
  100. 5 2
      htdocs/core/lib/barcode.lib.php

+ 1 - 1
dev/setup/codesniffer/ruleset.xml

@@ -215,7 +215,7 @@
     <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
 
     <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" />
-    <!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> -->
+    <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
     <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
 
     <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />

+ 63 - 63
htdocs/comm/propal/card.php

@@ -215,8 +215,8 @@ if (empty($reshook)) {
 				}
 			}
 		}
-	} // Delete proposal
-	elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) {
+	} elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) {
+		// Delete proposal
 		$result = $object->delete($user);
 		if ($result > 0) {
 			header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1');
@@ -225,8 +225,8 @@ if (empty($reshook)) {
 			$langs->load("errors");
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
-	} // Remove line
-	elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
+	} elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
+		// Remove line
 		$result = $object->deleteline($lineid);
 		// reorder lines
 		if ($result) {
@@ -250,8 +250,8 @@ if (empty($reshook)) {
 
 		header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
 		exit();
-	} // Validation
-	elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) {
+	} elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) {
+		// Validation
 		$idwarehouse = GETPOST('idwarehouse', 'int');
 		$result = $object->valid($user);
 		if ($result >= 0) {
@@ -308,17 +308,17 @@ if (empty($reshook)) {
 		if ($result < 0) {
 			dol_print_error($db, $object->error);
 		}
-	} // Positionne ref client
-	elseif ($action == 'setref_client' && $usercancreate) {
+	} elseif ($action == 'setref_client' && $usercancreate) {
+		// Positionne ref client
 		$result = $object->set_ref_client($user, GETPOST('ref_client'));
 		if ($result < 0) {
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
-	} // Set incoterm
-	elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) {
+	} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) {
+		// Set incoterm
 		$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
-	} // Create proposal
-	elseif ($action == 'add' && $usercancreate) {
+	} elseif ($action == 'add' && $usercancreate) {
+		// Create proposal
 		$object->socid = $socid;
 		$object->fetch_thirdparty();
 
@@ -554,8 +554,8 @@ if (empty($reshook)) {
 						setEventMessages($object->error, $object->errors, 'errors');
 						$error++;
 					}
-				} // Standard creation
-				else {
+				} else {
+					// Standard creation
 					$id = $object->create($user);
 				}
 
@@ -616,8 +616,8 @@ if (empty($reshook)) {
 				}
 			}
 		}
-	} // Classify billed
-	elseif ($action == 'classifybilled' && $usercanclose) {
+	} elseif ($action == 'classifybilled' && $usercanclose) {
+		// Classify billed
 		$db->begin();
 
 		$result = $object->cloture($user, $object::STATUS_BILLED, '');
@@ -631,8 +631,8 @@ if (empty($reshook)) {
 		} else {
 			$db->rollback();
 		}
-	} // Close proposal
-	elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) {
+	} elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) {
+		// Close proposal
 		if (!(GETPOST('statut', 'int') > 0)) {
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
 			$action = 'closeas';
@@ -654,8 +654,8 @@ if (empty($reshook)) {
 				}
 			}
 		}
-	} // Reopen proposal
-	elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) {
+	} elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) {
+		// Reopen proposal
 		// prevent browser refresh from reopening proposal several times
 		if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
 			$db->begin();
@@ -672,11 +672,11 @@ if (empty($reshook)) {
 				$db->rollback();
 			}
 		}
-	} // add lines from objectlinked
-	elseif ($action == 'import_lines_from_object'
+	} elseif ($action == 'import_lines_from_object'
 		&& $user->rights->propal->creer
 		&& $object->statut == Propal::STATUS_DRAFT
 		) {
+		// add lines from objectlinked
 		$fromElement = GETPOST('fromelement');
 		$fromElementid = GETPOST('fromelementid');
 		$importLines = GETPOST('line_checkbox');
@@ -898,8 +898,8 @@ if (empty($reshook)) {
 							$tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
 						}
 					}
-				} // If price per customer
-				elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
+				} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
+					// If price per customer
 					require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
 
 					$prodcustprice = new Productcustomerprice($db);
@@ -924,8 +924,8 @@ if (empty($reshook)) {
 							}
 						}
 					}
-				} // If price per quantity
-				elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
+				} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
+					// If price per quantity
 					if ($prod->prices_by_qty[0]) {	// yes, this product has some prices per quantity
 						// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
 						$pqp = GETPOST('pbq', 'int');
@@ -945,8 +945,8 @@ if (empty($reshook)) {
 							break;
 						}
 					}
-				} // If price per quantity and customer
-				elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
+				} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
+					// If price per quantity and customer
 					if ($prod->prices_by_qty[$object->thirdparty->price_level]) { // yes, this product has some prices per quantity
 						// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
 						$pqp = GETPOST('pbq', 'int');
@@ -975,9 +975,9 @@ if (empty($reshook)) {
 				if (!empty($price_ht) || $price_ht === '0') {
 					$pu_ht = price2num($price_ht, 'MU');
 					$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
-				} // On reevalue prix selon taux tva car taux tva transaction peut etre different
-				// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
-				elseif ($tmpvat != $tmpprodvat) {
+				} elseif ($tmpvat != $tmpprodvat) {
+					// On reevalue prix selon taux tva car taux tva transaction peut etre different
+					// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
 					if ($price_base_type != 'HT') {
 						$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
 					} else {
@@ -1167,8 +1167,8 @@ if (empty($reshook)) {
 				}
 			}
 		}
-	} // Update a line within proposal
-	elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) {
+	} elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) {
+		// Update a line within proposal
 		// Define info_bits
 		$info_bits = 0;
 		if (preg_match('/\*/', GETPOST('tva_tx'))) {
@@ -1313,36 +1313,36 @@ if (empty($reshook)) {
 	} elseif ($action == 'classin' && $usercancreate) {
 		// Set project
 		$object->setProject(GETPOST('projectid', 'int'));
-	} // Delivery time
-	elseif ($action == 'setavailability' && $usercancreate) {
+	} elseif ($action == 'setavailability' && $usercancreate) {
+		// Delivery time
 		$result = $object->set_availability($user, GETPOST('availability_id', 'int'));
-	} // Origin of the commercial proposal
-	elseif ($action == 'setdemandreason' && $usercancreate) {
+	} elseif ($action == 'setdemandreason' && $usercancreate) {
+		// Origin of the commercial proposal
 		$result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int'));
-	} // Terms of payment
-	elseif ($action == 'setconditions' && $usercancreate) {
+	} elseif ($action == 'setconditions' && $usercancreate) {
+		// Terms of payment
 		$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
 	} elseif ($action == 'setremisepercent' && $usercancreate) {
 		$result = $object->set_remise_percent($user, $_POST['remise_percent']);
 	} elseif ($action == 'setremiseabsolue' && $usercancreate) {
 		$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
-	} // Payment choice
-	elseif ($action == 'setmode' && $usercancreate) {
+	} elseif ($action == 'setmode' && $usercancreate) {
+		// Payment choice
 		$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
-	} // Multicurrency Code
-	elseif ($action == 'setmulticurrencycode' && $usercancreate) {
+	} elseif ($action == 'setmulticurrencycode' && $usercancreate) {
+		// Multicurrency Code
 		$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
-	} // Multicurrency rate
-	elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
+	} elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
+		// Multicurrency rate
 		$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
-	} // bank account
-	elseif ($action == 'setbankaccount' && $usercancreate) {
+	} elseif ($action == 'setbankaccount' && $usercancreate) {
+		// bank account
 		$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
-	} // shipping method
-	elseif ($action == 'setshippingmethod' && $usercancreate) {
+	} elseif ($action == 'setshippingmethod' && $usercancreate) {
+		// shipping method
 		$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
-	}// warehouse
-	elseif ($action == 'setwarehouse' && $usercancreate) {
+	} elseif ($action == 'setwarehouse' && $usercancreate) {
+		// warehouse
 		$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
 	} elseif ($action == 'update_extras') {
 		$object->oldcopy = dol_clone($object);
@@ -1383,15 +1383,15 @@ if (empty($reshook)) {
 					setEventMessages($object->error, $object->errors, 'errors');
 				}
 			}
-		} // Toggle the status of a contact
-		elseif ($action == 'swapstatut') {
+		} elseif ($action == 'swapstatut') {
+			// Toggle the status of a contact
 			if ($object->fetch($id) > 0) {
 				$result = $object->swapContactStatus(GETPOST('ligne'));
 			} else {
 				dol_print_error($db);
 			}
-		} // Delete a contact
-		elseif ($action == 'deletecontact') {
+		} elseif ($action == 'deletecontact') {
+			// Delete a contact
 			$object->fetch($id);
 			$result = $object->delete_contact($lineid);
 
@@ -1907,17 +1907,17 @@ if ($action == 'create') {
 		}
 
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250);
-	} // Confirm delete
-	elseif ($action == 'delete') {
+	} elseif ($action == 'delete') {
+		// Confirm delete
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
-	} // Confirm reopen
-	elseif ($action == 'reopen') {
+	} elseif ($action == 'reopen') {
+		// Confirm reopen
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1);
-	} // Confirmation delete product/service line
-	elseif ($action == 'ask_deleteline') {
+	} elseif ($action == 'ask_deleteline') {
+		// Confirmation delete product/service line
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
-	} // Confirm validate proposal
-	elseif ($action == 'validate') {
+	} elseif ($action == 'validate') {
+		// Confirm validate proposal
 		$error = 0;
 
 		// We verify whether the object is provisionally numbering

+ 6 - 3
htdocs/comm/propal/class/propal.class.php

@@ -1651,7 +1651,8 @@ class Propal extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -1891,7 +1892,8 @@ class Propal extends CommonObject
 				$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'propale/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
 				$resql = $this->db->query($sql);
 				if (!$resql) {
-					$error++; $this->error = $this->db->lasterror();
+					$error++;
+					$this->error = $this->db->lasterror();
 				}
 
 				// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@@ -2457,7 +2459,8 @@ class Propal extends CommonObject
 		dol_syslog(get_class($this)."::reopen", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 		if (!$error) {
 			if (!$notrigger) {

+ 2 - 1
htdocs/comm/propal/list.php

@@ -222,7 +222,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';

+ 6 - 3
htdocs/comm/propal/stats/index.php

@@ -123,7 +123,8 @@ $px1 = new DolGraph();
 $mesg = $px1->isGraphKo();
 if (!$mesg) {
 	$px1->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;
@@ -158,7 +159,8 @@ $px2 = new DolGraph();
 $mesg = $px2->isGraphKo();
 if (!$mesg) {
 	$px2->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;
@@ -202,7 +204,8 @@ $px3 = new DolGraph();
 $mesg = $px3->isGraphKo();
 if (!$mesg) {
 	$px3->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;

+ 2 - 1
htdocs/compta/bank/account_statement_document.php

@@ -186,7 +186,8 @@ if ($id > 0 || !empty($ref)) {
 		$permission = $user->rights->banque->modifier;
 		$permtoedit = $user->rights->banque->modifier;
 		$param = '&id='.$object->id.'&num='.urlencode($numref);
-		$moreparam = '&num='.urlencode($numref); ;
+		$moreparam = '&num='.urlencode($numref);
+		;
 		$relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/";
 		include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
 	} else {

+ 4 - 3
htdocs/compta/bank/bankentries_list.php

@@ -182,7 +182,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';
@@ -1188,8 +1189,8 @@ if ($resql) {
 					// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
 					if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
 						$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
-					} // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
-					else {
+					} else {
+						// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
 						$balance = $objforbalance->previoustotal;
 					}
 				}

+ 3 - 1
htdocs/compta/bank/budget.php

@@ -72,7 +72,9 @@ $sql .= " ORDER BY c.label";
 $result = $db->query($sql);
 if ($result) {
 	$num = $db->num_rows($result);
-	$i = 0; $total = 0; $totalnb = 0;
+	$i = 0;
+	$total = 0;
+	$totalnb = 0;
 
 	while ($i < $num) {
 		$objp = $db->fetch_object($result);

+ 2 - 1
htdocs/compta/bank/categ.php

@@ -126,7 +126,8 @@ $sql .= " ORDER BY rowid";
 $result = $db->query($sql);
 if ($result) {
 	$num = $db->num_rows($result);
-	$i = 0; $total = 0;
+	$i = 0;
+	$total = 0;
 
 	while ($i < $num) {
 		$objp = $db->fetch_object($result);

+ 10 - 5
htdocs/compta/bank/graph.php

@@ -795,13 +795,17 @@ print '</table>';
 
 // Graphs
 if ($mode == 'standard') {
-	$prevyear = $year; $nextyear = $year;
-	$prevmonth = $month - 1; $nextmonth = $month + 1;
+	$prevyear = $year;
+	$nextyear = $year;
+	$prevmonth = $month - 1;
+	$nextmonth = $month + 1;
 	if ($prevmonth < 1) {
-		$prevmonth = 12; $prevyear--;
+		$prevmonth = 12;
+		$prevyear--;
 	}
 	if ($nextmonth > 12) {
-		$nextmonth = 1; $nextyear++;
+		$nextmonth = 1;
+		$nextyear++;
 	}
 
 	// For month
@@ -818,7 +822,8 @@ if ($mode == 'standard') {
 	print '</div>';
 
 	// For year
-	$prevyear = $year - 1; $nextyear = $year + 1;
+	$prevyear = $year - 1;
+	$nextyear = $year + 1;
 	$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
 
 	print '<div class="right clearboth margintoponly">'.$link.'</div>';

+ 2 - 1
htdocs/compta/bank/line.php

@@ -272,7 +272,8 @@ $sql .= " WHERE rowid=".$rowid;
 $sql .= " ORDER BY dateo ASC";
 $result = $db->query($sql);
 if ($result) {
-	$i = 0; $total = 0;
+	$i = 0;
+	$total = 0;
 	if ($db->num_rows($result)) {
 		$objp = $db->fetch_object($result);
 

+ 6 - 2
htdocs/compta/bank/list.php

@@ -134,7 +134,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';
@@ -490,7 +491,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $
 print "</tr>\n";
 
 
-$totalarray = array(); $found = 0; $i = 0; $lastcurrencycode = '';
+$totalarray = array();
+$found = 0;
+$i = 0;
+$lastcurrencycode = '';
 
 foreach ($accounts as $key => $type) {
 	if ($i >= $limit) {

+ 4 - 2
htdocs/compta/cashcontrol/cashcontrol_card.php

@@ -413,9 +413,11 @@ if ($action == "create" || $action == "start" || $action == 'close') {
 		for ($i = 1; $i <= $numterminals; $i++) {
 			$array[$i] = $i;
 		}
-		$selectedposnumber = 0; $showempty = 1;
+		$selectedposnumber = 0;
+		$showempty = 1;
 		if ($conf->global->TAKEPOS_NUM_TERMINALS == '1') {
-			$selectedposnumber = 1; $showempty = 0;
+			$selectedposnumber = 1;
+			$showempty = 0;
 		}
 		print $form->selectarray('posnumber', $array, GETPOSTISSET('posnumber') ?GETPOST('posnumber', 'int') : $selectedposnumber, $showempty);
 		//print '<input name="posnumber" type="text" class="maxwidth50" value="'.(GETPOSTISSET('posnumber')?GETPOST('posnumber', 'alpha'):'0').'">';

+ 2 - 1
htdocs/compta/cashcontrol/cashcontrol_list.php

@@ -140,7 +140,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';

+ 3 - 4
htdocs/compta/cashcontrol/report.php

@@ -233,10 +233,9 @@ if ($resql) {
 		} else {
 			if ($conf->global->$var1 == $bankaccount->id) {
 				$cash += $objp->amount;
-			}
-			//elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
-			//elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
-			else {
+				// } elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
+				//elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
+			} else {
 				$other += $objp->amount;
 			}
 		}

+ 6 - 6
htdocs/compta/deplacement/card.php

@@ -134,8 +134,8 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
 		header("Location: index.php");
 		exit;
 	}
-} // Update record
-elseif ($action == 'update' && $user->rights->deplacement->creer) {
+} elseif ($action == 'update' && $user->rights->deplacement->creer) {
+	// Update record
 	if (!GETPOST('cancel', 'alpha')) {
 		$result = $object->fetch($id);
 
@@ -159,15 +159,15 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) {
 		header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
 		exit;
 	}
-} // Set into a project
-elseif ($action == 'classin' && $user->rights->deplacement->creer) {
+} elseif ($action == 'classin' && $user->rights->deplacement->creer) {
+	// Set into a project
 	$object->fetch($id);
 	$result = $object->setProject(GETPOST('projectid', 'int'));
 	if ($result < 0) {
 		dol_print_error($db, $object->error);
 	}
-} // Set fields
-elseif ($action == 'setdated' && $user->rights->deplacement->creer) {
+} elseif ($action == 'setdated' && $user->rights->deplacement->creer) {
+	// Set fields
 	$dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int'));
 	$object->fetch($id);
 	$result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY');

+ 6 - 3
htdocs/compta/deplacement/stats/index.php

@@ -110,7 +110,8 @@ $px1 = new DolGraph();
 $mesg = $px1->isGraphKo();
 if (!$mesg) {
 	$px1->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;
@@ -140,7 +141,8 @@ $px2 = new DolGraph();
 $mesg = $px2->isGraphKo();
 if (!$mesg) {
 	$px2->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;
@@ -184,7 +186,8 @@ $px3 = new DolGraph();
 $mesg = $px3->isGraphKo();
 if (!$mesg) {
 	$px3->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;

+ 33 - 32
htdocs/compta/facture/card-rec.php

@@ -133,7 +133,8 @@ $error = 0;
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';
@@ -279,14 +280,14 @@ if (empty($reshook)) {
 	// Set condition
 	if ($action == 'setconditions' && $user->rights->facture->creer) {
 		$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
-	} // Set mode
-	elseif ($action == 'setmode' && $user->rights->facture->creer) {
+	} elseif ($action == 'setmode' && $user->rights->facture->creer) {
+		// Set mode
 		$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
-	} // Set project
-	elseif ($action == 'classin' && $user->rights->facture->creer) {
+	} elseif ($action == 'classin' && $user->rights->facture->creer) {
+		// Set project
 		$object->setProject(GETPOST('projectid', 'int'));
-	} // Set bank account
-	elseif ($action == 'setref' && $user->rights->facture->creer) {
+	} elseif ($action == 'setref' && $user->rights->facture->creer) {
+		// Set bank account
 		//var_dump(GETPOST('ref', 'alpha'));exit;
 		$result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
 		if ($result > 0) {
@@ -302,32 +303,32 @@ if (empty($reshook)) {
 				setEventMessages($object->error, $object->errors, 'errors');
 			}
 		}
-	} // Set bank account
-	elseif ($action == 'setbankaccount' && $user->rights->facture->creer) {
+	} elseif ($action == 'setbankaccount' && $user->rights->facture->creer) {
+		// Set bank account
 		$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
-	} // Set frequency and unit frequency
-	elseif ($action == 'setfrequency' && $user->rights->facture->creer) {
+	} elseif ($action == 'setfrequency' && $user->rights->facture->creer) {
+		// Set frequency and unit frequency
 		$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
-	} // Set next date of execution
-	elseif ($action == 'setdate_when' && $user->rights->facture->creer) {
+	} elseif ($action == 'setdate_when' && $user->rights->facture->creer) {
+		// Set next date of execution
 		$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
 		if (!empty($date)) {
 			$object->setNextDate($date);
 		}
-	} // Set max period
-	elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) {
+	} elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) {
+		// Set max period
 		$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
-	} // Set auto validate
-	elseif ($action == 'setauto_validate' && $user->rights->facture->creer) {
+	} elseif ($action == 'setauto_validate' && $user->rights->facture->creer) {
+		// Set auto validate
 		$object->setAutoValidate(GETPOST('auto_validate', 'int'));
-	} // Set generate pdf
-	elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) {
+	} elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) {
+		// Set generate pdf
 		$object->setGeneratepdf(GETPOST('generate_pdf', 'int'));
-	} // Set model pdf
-	elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) {
+	} elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) {
+		// Set model pdf
 		$object->setModelpdf(GETPOST('modelpdf', 'alpha'));
-	} // Set status disabled
-	elseif ($action == 'disable' && $user->rights->facture->creer) {
+	} elseif ($action == 'disable' && $user->rights->facture->creer) {
+		// Set status disabled
 		$db->begin();
 
 		$object->fetch($id);
@@ -343,8 +344,8 @@ if (empty($reshook)) {
 			$db->rollback();
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
-	} // Set status enabled
-	elseif ($action == 'enable' && $user->rights->facture->creer) {
+	} elseif ($action == 'enable' && $user->rights->facture->creer) {
+		// Set status enabled
 		$db->begin();
 
 		$object->fetch($id);
@@ -360,11 +361,11 @@ if (empty($reshook)) {
 			$db->rollback();
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
-	} // Multicurrency Code
-	elseif ($action == 'setmulticurrencycode' && $usercancreate) {
+	} elseif ($action == 'setmulticurrencycode' && $usercancreate) {
+		// Multicurrency Code
 		$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
-	} // Multicurrency rate
-	elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
+	} elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
+		// Multicurrency rate
 		$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
 	}
 
@@ -525,9 +526,9 @@ if (empty($reshook)) {
 				if (!empty($price_ht)) {
 					$pu_ht = price2num($price_ht, 'MU');
 					$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
-				} // On reevalue prix selon taux tva car taux tva transaction peut etre different
-				// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
-				elseif ($tmpvat != $tmpprodvat) {
+				} elseif ($tmpvat != $tmpprodvat) {
+					// On reevalue prix selon taux tva car taux tva transaction peut etre different
+					// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
 					if ($price_base_type != 'HT') {
 						$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
 					} else {

+ 8 - 8
htdocs/compta/facture/card.php

@@ -233,8 +233,8 @@ if (empty($reshook)) {
 				$action = '';
 			}
 		}
-	} // Delete line
-	elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
+	} elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
+		// Delete line
 		$object->fetch($id);
 		$object->fetch_thirdparty();
 
@@ -563,8 +563,8 @@ if (empty($reshook)) {
 	} elseif ($action == 'setref_client' && $usercancreate) {
 		$object->fetch($id);
 		$object->set_ref_client(GETPOST('ref_client'));
-	} // Classify to validated
-	elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) {
+	} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) {
+		// Classify to validated
 		$idwarehouse = GETPOST('idwarehouse', 'int');
 
 		$object->fetch($id);
@@ -2770,15 +2770,15 @@ if (empty($reshook)) {
 					setEventMessages($object->error, $object->errors, 'errors');
 				}
 			}
-		} // bascule du statut d'un contact
-		elseif ($action == 'swapstatut') {
+		} elseif ($action == 'swapstatut') {
+			// bascule du statut d'un contact
 			if ($object->fetch($id)) {
 				$result = $object->swapContactStatus(GETPOST('ligne'));
 			} else {
 				dol_print_error($db);
 			}
-		} // Efface un contact
-		elseif ($action == 'deletecontact') {
+		} elseif ($action == 'deletecontact') {
+			// Efface un contact
 			$object->fetch($id);
 			$result = $object->delete_contact($lineid);
 

+ 4 - 2
htdocs/compta/facture/class/facture.class.php

@@ -1972,7 +1972,8 @@ class Facture extends CommonInvoice
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -2807,7 +2808,8 @@ class Facture extends CommonInvoice
 					$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'facture/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
 					$resql = $this->db->query($sql);
 					if (!$resql) {
-						$error++; $this->error = $this->db->lasterror();
+						$error++;
+						$this->error = $this->db->lasterror();
 					}
 
 					// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments

+ 6 - 3
htdocs/compta/facture/class/paymentterm.class.php

@@ -145,7 +145,8 @@ class PaymentTerm // extends CommonObject
 		dol_syslog(get_class($this)."::create", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -317,7 +318,8 @@ class PaymentTerm // extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback
@@ -355,7 +357,8 @@ class PaymentTerm // extends CommonObject
 		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback

+ 2 - 1
htdocs/compta/facture/invoicetemplate_list.php

@@ -170,7 +170,8 @@ if ($socid > 0) {
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';

+ 2 - 1
htdocs/compta/facture/list.php

@@ -248,7 +248,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';

+ 3 - 1
htdocs/compta/facture/prelevement.php

@@ -576,7 +576,9 @@ if ($object->id > 0) {
 	print dol_get_fiche_end();
 
 
-	$numopen = 0; $pending = 0; $numclosed = 0;
+	$numopen = 0;
+	$pending = 0;
+	$numclosed = 0;
 
 
 	// How many Direct debit opened requests ?

+ 6 - 3
htdocs/compta/facture/stats/index.php

@@ -133,7 +133,8 @@ $px1 = new DolGraph();
 $mesg = $px1->isGraphKo();
 if (!$mesg) {
 	$px1->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;
@@ -168,7 +169,8 @@ $px2 = new DolGraph();
 $mesg = $px2->isGraphKo();
 if (!$mesg) {
 	$px2->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;
@@ -212,7 +214,8 @@ $px3 = new DolGraph();
 $mesg = $px3->isGraphKo();
 if (!$mesg) {
 	$px3->SetData($data);
-	$i = $startyear; $legend = array();
+	$i = $startyear;
+	$legend = array();
 	while ($i <= $endyear) {
 		$legend[] = $i;
 		$i++;

+ 2 - 1
htdocs/compta/journal/sellsjournal.php

@@ -88,7 +88,8 @@ $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_starty
 $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
 
 if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
-	$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
+	$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
+	$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
 }
 
 $name = $langs->trans("SellsJournal");

+ 14 - 7
htdocs/compta/localtax/clients.php

@@ -51,7 +51,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 	$q = GETPOST("q");
 	if (empty($q)) {
 		if (GETPOST("month")) {
-			$date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false);
+			$date_start = dol_get_first_day($year_start, GETPOST("month"), false);
+			$date_end = dol_get_last_day($year_start, GETPOST("month"), false);
 		} else {
 			$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) {
@@ -64,16 +65,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		}
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 }
@@ -206,7 +211,8 @@ if ($calc == 0 || $calc == 2) {
 	$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
 
 	if (is_array($coll_list)) {
-		$total = 0; $totalamount = 0;
+		$total = 0;
+		$totalamount = 0;
 		$i = 1;
 		foreach ($coll_list as $coll) {
 			if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) {
@@ -270,7 +276,8 @@ if ($calc == 0 || $calc == 1) {
 
 	$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
 	if (is_array($coll_list)) {
-		$total = 0; $totalamount = 0;
+		$total = 0;
+		$totalamount = 0;
 		$i = 1;
 		foreach ($coll_list as $coll) {
 			if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) {

+ 21 - 9
htdocs/compta/localtax/index.php

@@ -50,23 +50,28 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 	$q = GETPOST("q", "int");
 	if (empty($q)) {
 		if (GETPOST("month", "int")) {
-			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
+			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
+			$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
 		} else {
 			$date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false);
 			$date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
 		}
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 }
@@ -286,8 +291,12 @@ $tmp = dol_getdate($date_end);
 $yend = $tmp['year'];
 $mend = $tmp['mon'];
 
-$total = 0; $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
-$i = 0; $mcursor = 0;
+$total = 0;
+$subtotalcoll = 0;
+$subtotalpaye = 0;
+$subtotal = 0;
+$i = 0;
+$mcursor = 0;
 while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) {	// $mcursor is to avoid too large loop
 	//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
 	if ($m == 13) {
@@ -537,7 +546,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) {	// $
 	print "<td>&nbsp;</td>\n";
 	print "</tr>\n";
 
-	$i++; $m++;
+	$i++;
+	$m++;
 	if ($i > 2) {
 		print '<tr class="liste_total">';
 		print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
@@ -546,7 +556,9 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) {	// $
 		print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
 		print '<td>&nbsp;</td></tr>';
 		$i = 0;
-		$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
+		$subtotalcoll = 0;
+		$subtotalpaye = 0;
+		$subtotal = 0;
 	}
 }
 print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';

+ 10 - 5
htdocs/compta/localtax/quadri_detail.php

@@ -61,7 +61,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 	$q = GETPOST("q", "int");
 	if (empty($q)) {
 		if (GETPOST("month", "int")) {
-			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
+			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
+			$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
 		} else {
 			$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) {
@@ -74,16 +75,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		}
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 }

+ 4 - 2
htdocs/compta/paiement.php

@@ -559,12 +559,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
 				$alreadypayedlabel = $langs->trans('Received');
 				$multicurrencyalreadypayedlabel = $langs->trans('MulticurrencyReceived');
 				if ($facture->type == 2) {
-					$alreadypayedlabel = $langs->trans("PaidBack"); $multicurrencyalreadypayedlabel = $langs->trans("MulticurrencyPaidBack");
+					$alreadypayedlabel = $langs->trans("PaidBack");
+					$multicurrencyalreadypayedlabel = $langs->trans("MulticurrencyPaidBack");
 				}
 				$remaindertopay = $langs->trans('RemainderToTake');
 				$multicurrencyremaindertopay = $langs->trans('MulticurrencyRemainderToTake');
 				if ($facture->type == 2) {
-					$remaindertopay = $langs->trans("RemainderToPayBack"); $multicurrencyremaindertopay = $langs->trans("MulticurrencyRemainderToPayBack");
+					$remaindertopay = $langs->trans("RemainderToPayBack");
+					$multicurrencyremaindertopay = $langs->trans("MulticurrencyRemainderToPayBack");
 				}
 
 				$i = 0;

+ 2 - 2
htdocs/compta/paiement/cheque/card.php

@@ -235,8 +235,8 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) {
 		header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
 		exit;
 	}
-} // Remove file in doc form
-elseif ($action == 'remove_file' && $user->rights->banque->cheque) {
+} elseif ($action == 'remove_file' && $user->rights->banque->cheque) {
+	// Remove file in doc form
 	if ($object->fetch($id) > 0) {
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
 

+ 2 - 3
htdocs/compta/paiement/class/paiement.class.php

@@ -335,9 +335,8 @@ class Paiement extends CommonObject
 								dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice, nor situation invoice. We do nothing more.");
 							} elseif ($remaintopay) {
 								dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
-							}
-							//else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
-							else {
+								// } else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
+							} else {
 								// If invoice is a down payment, we also convert down payment to discount
 								if ($invoice->type == Facture::TYPE_DEPOSIT) {
 									$amount_ht = $amount_tva = $amount_ttc = array();

+ 10 - 5
htdocs/compta/resultat/clientfourn.php

@@ -111,19 +111,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		} else {
 			$month_end = $month_start;
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 }
 

+ 10 - 5
htdocs/compta/resultat/index.php

@@ -79,19 +79,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		} else {
 			$month_end = $month_start;
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 }
 

+ 10 - 5
htdocs/compta/resultat/result.php

@@ -91,19 +91,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		} else {
 			$month_end = $month_start;
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 }
 

+ 2 - 1
htdocs/compta/sociales/card.php

@@ -612,7 +612,8 @@ if ($id > 0) {
 			$totalpaye = 0;
 
 			$num = $db->num_rows($resql);
-			$i = 0; $total = 0;
+			$i = 0;
+			$total = 0;
 
 			print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
 			print '<table class="noborder paymenttable">';

+ 2 - 1
htdocs/compta/sociales/class/chargesociales.class.php

@@ -356,7 +356,8 @@ class ChargeSociales extends CommonObject
 		$resql = $this->db->query($sql);
 
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {

+ 4 - 2
htdocs/compta/sociales/class/paymentsocialcontribution.class.php

@@ -369,7 +369,8 @@ class PaymentSocialContribution extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback
@@ -420,7 +421,8 @@ class PaymentSocialContribution extends CommonObject
 			dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 			$resql = $this->db->query($sql);
 			if (!$resql) {
-				$error++; $this->errors[] = "Error ".$this->db->lasterror();
+				$error++;
+				$this->errors[] = "Error ".$this->db->lasterror();
 			}
 		}
 

+ 18 - 9
htdocs/compta/stats/byratecountry.php

@@ -74,19 +74,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 				$year_end++;
 			}
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 }
@@ -175,17 +180,21 @@ if ($modetax == 2) {
 $calcmode .= '<br>('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')';
 // Set period
 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
-$prevyear = $year_start; $prevquarter = $q;
+$prevyear = $year_start;
+$prevquarter = $q;
 if ($prevquarter > 1) {
 	$prevquarter--;
 } else {
-	$prevquarter = 4; $prevyear--;
+	$prevquarter = 4;
+	$prevyear--;
 }
-$nextyear = $year_start; $nextquarter = $q;
+$nextyear = $year_start;
+$nextquarter = $q;
 if ($nextquarter < 4) {
 	$nextquarter++;
 } else {
-	$nextquarter = 1; $nextyear++;
+	$nextquarter = 1;
+	$nextyear++;
 }
 $description .= $fsearch;
 $builddate = dol_now();

+ 10 - 5
htdocs/compta/stats/cabyprodserv.php

@@ -119,19 +119,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 				$year_end++;
 			}
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 } else {

+ 10 - 5
htdocs/compta/stats/cabyuser.php

@@ -100,19 +100,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 				$year_end++;
 			}
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 } else {
 	// TODO We define q

+ 10 - 5
htdocs/compta/stats/casoc.php

@@ -120,19 +120,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 				$year_end++;
 			}
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 } else {
 	// TODO We define q

+ 10 - 5
htdocs/compta/stats/index.php

@@ -73,19 +73,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		} else {
 			$month_end = $month_start;
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 }
 

+ 10 - 5
htdocs/compta/stats/supplier_turnover.php

@@ -69,19 +69,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		} else {
 			$month_end = $month_start;
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 }
 

+ 10 - 5
htdocs/compta/stats/supplier_turnover_by_prodserv.php

@@ -114,19 +114,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 				$year_end++;
 			}
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 } else {

+ 10 - 5
htdocs/compta/stats/supplier_turnover_by_thirdparty.php

@@ -114,19 +114,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 				$year_end++;
 			}
 		}
-		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
+		$date_start = dol_get_first_day($year_start, $month_start, false);
+		$date_end = dol_get_last_day($year_end, $month_end, false);
 	}
 	if ($q == 1) {
-		$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+		$date_start = dol_get_first_day($year_start, 1, false);
+		$date_end = dol_get_last_day($year_start, 3, false);
 	}
 	if ($q == 2) {
-		$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+		$date_start = dol_get_first_day($year_start, 4, false);
+		$date_end = dol_get_last_day($year_start, 6, false);
 	}
 	if ($q == 3) {
-		$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+		$date_start = dol_get_first_day($year_start, 7, false);
+		$date_end = dol_get_last_day($year_start, 9, false);
 	}
 	if ($q == 4) {
-		$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+		$date_start = dol_get_first_day($year_start, 10, false);
+		$date_end = dol_get_last_day($year_start, 12, false);
 	}
 } else {
 	// TODO We define q

+ 2 - 1
htdocs/compta/tva/card.php

@@ -630,7 +630,8 @@ if ($id) {
 		$totalpaye = 0;
 
 		$num = $db->num_rows($resql);
-		$i = 0; $total = 0;
+		$i = 0;
+		$total = 0;
 
 		print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
 		print '<table class="noborder paymenttable">';

+ 4 - 2
htdocs/compta/tva/class/paymentvat.class.php

@@ -372,7 +372,8 @@ class PaymentVAT extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback
@@ -423,7 +424,8 @@ class PaymentVAT extends CommonObject
 			dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 			$resql = $this->db->query($sql);
 			if (!$resql) {
-				$error++; $this->errors[] = "Error ".$this->db->lasterror();
+				$error++;
+				$this->errors[] = "Error ".$this->db->lasterror();
 			}
 		}
 

+ 10 - 5
htdocs/compta/tva/clients.php

@@ -66,7 +66,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 	$q = GETPOST("q", "int");
 	if (empty($q)) {
 		if (GETPOST("month", 'int')) {
-			$date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false);
+			$date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false);
+			$date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false);
 		} else {
 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter
 				$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm');
@@ -90,16 +91,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		}
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 }

+ 21 - 9
htdocs/compta/tva/index.php

@@ -59,7 +59,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 	$q = GETPOST("q", "int");
 	if (empty($q)) {
 		if (GETPOST("month", "int")) {
-			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
+			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
+			$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
 		} else {
 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter
 				$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm');
@@ -83,16 +84,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		}
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 }
@@ -301,8 +306,12 @@ $tmp = dol_getdate($date_end);
 $yend = $tmp['year'];
 $mend = $tmp['mon'];
 //var_dump($m);
-$total = 0; $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
-$i = 0; $mcursor = 0;
+$total = 0;
+$subtotalcoll = 0;
+$subtotalpaye = 0;
+$subtotal = 0;
+$i = 0;
+$mcursor = 0;
 
 while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) {	// $mcursor is to avoid too large loop
 	//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
@@ -535,7 +544,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) {	// $
 	print "<td>&nbsp;</td>\n";
 	print "</tr>\n";
 
-	$i++; $m++;
+	$i++;
+	$m++;
 	if ($i > 2) {
 		print '<tr class="liste_total">';
 		print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
@@ -544,7 +554,9 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) {	// $
 		print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
 		print '<td>&nbsp;</td></tr>';
 		$i = 0;
-		$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
+		$subtotalcoll = 0;
+		$subtotalpaye = 0;
+		$subtotal = 0;
 	}
 }
 print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';

+ 12 - 6
htdocs/compta/tva/quadri_detail.php

@@ -66,7 +66,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 	$q = GETPOST("q", "int");
 	if (empty($q)) {
 		if (GETPOST("month", "int")) {
-			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
+			$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
+			$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
 		} else {
 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter
 				$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm');
@@ -90,16 +91,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
 		}
 	} else {
 		if ($q == 1) {
-			$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
+			$date_start = dol_get_first_day($year_start, 1, false);
+			$date_end = dol_get_last_day($year_start, 3, false);
 		}
 		if ($q == 2) {
-			$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
+			$date_start = dol_get_first_day($year_start, 4, false);
+			$date_end = dol_get_last_day($year_start, 6, false);
 		}
 		if ($q == 3) {
-			$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
+			$date_start = dol_get_first_day($year_start, 7, false);
+			$date_end = dol_get_last_day($year_start, 9, false);
 		}
 		if ($q == 4) {
-			$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
+			$date_start = dol_get_first_day($year_start, 10, false);
+			$date_end = dol_get_last_day($year_start, 12, false);
 		}
 	}
 }
@@ -179,7 +184,8 @@ if ($modetax == 2) {
 $calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')</span>';
 // Set period
 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
-$prevyear = $year_start; $prevquarter = $q;
+$prevyear = $year_start;
+$prevquarter = $q;
 if ($prevquarter > 1) {
 	$prevquarter--;
 } else {

+ 3 - 1
htdocs/core/actions_sendmails.inc.php

@@ -108,7 +108,9 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
 		$trackid = GETPOST('trackid', 'aZ09');
 	}
 
-	$subject = ''; $actionmsg = ''; $actionmsg2 = '';
+	$subject = '';
+	$actionmsg = '';
+	$actionmsg2 = '';
 
 	$langs->load('mails');
 

+ 2 - 1
htdocs/core/actions_setmoduleoptions.inc.php

@@ -84,7 +84,8 @@ if ($action == 'setModuleOptions') {
 			$tmpdir = trim($tmpdir);
 			$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
 			if (!$tmpdir) {
-				unset($listofdir[$key]); continue;
+				unset($listofdir[$key]);
+				continue;
 			}
 			if (!is_dir($tmpdir)) {
 				if (empty($nomessageinsetmoduleoptions)) {

+ 2 - 3
htdocs/core/ajax/ajaxdirpreview.php

@@ -284,9 +284,8 @@ if ($type == 'directory') {
 		$perm = $user->rights->ecm->upload;
 
 		$formfile->list_of_autoecmfiles($upload_dir, $filearray, $module, $param, 1, '', $perm, 1, $textifempty, $maxlengthname, $url, 1);
-	}
-	// Manual list
-	else {
+	} else {
+		// Manual list
 		if ($module == 'medias') {
 			/*
 			   $_POST is array like

+ 6 - 9
htdocs/core/ajax/ajaxdirtree.php

@@ -237,17 +237,14 @@ if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_
 		// If directory is son of expanded directory, we show line
 		if (in_array($val['id_mere'], $expandedsectionarray)) {
 			$showline = 4;
-		}
-		// If directory is brother of selected directory, we show line
-		elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) {
+		} elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) {
+			// If directory is brother of selected directory, we show line
 			$showline = 3;
-		}
-		// If directory is parent of selected directory or is selected directory, we show line
-		elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) {
+		} elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) {
+			// If directory is parent of selected directory or is selected directory, we show line
 			$showline = 2;
-		}
-		// If we are level one we show line
-		elseif ($val['level'] < 2) {
+		} elseif ($val['level'] < 2) {
+			// If we are level one we show line
 			$showline = 1;
 		}
 

+ 2 - 3
htdocs/core/ajax/pingresult.php

@@ -71,9 +71,8 @@ if ($action == 'firstpingok') {
 	dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);
 
 	print 'First ping OK saved for entity '.$conf->entity;
-}
-// If ko
-elseif ($action == 'firstpingko') {
+} elseif ($action == 'firstpingko') {
+	// If ko
 	// Note: pings are by installation, done on entity 1.
 	dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt'); // erase last value
 	print 'First ping KO saved for entity '.$conf->entity;

+ 6 - 3
htdocs/core/boxes/box_graph_invoices_permonth.php

@@ -122,7 +122,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
 				$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
 			}
 			if (empty($shownb) && empty($showtot)) {
-				$shownb = 1; $showtot = 1;
+				$shownb = 1;
+				$showtot = 1;
 			}
 			$nowarray = dol_getdate(dol_now(), true);
 			if (empty($endyear)) {
@@ -154,7 +155,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
 
 					$px1->SetData($data1);
 					unset($data1);
-					$i = $startyear; $legend = array();
+					$i = $startyear;
+					$legend = array();
 					while ($i <= $endyear) {
 						if ($startmonth != 1) {
 							$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
@@ -197,7 +199,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
 
 					$px2->SetData($data2);
 					unset($data2);
-					$i = $startyear; $legend = array();
+					$i = $startyear;
+					$legend = array();
 					while ($i <= $endyear) {
 						if ($startmonth != 1) {
 							$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

+ 4 - 2
htdocs/core/boxes/box_graph_invoices_supplier_permonth.php

@@ -119,7 +119,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
 				$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
 			}
 			if (empty($shownb) && empty($showtot)) {
-				$shownb = 1; $showtot = 1;
+				$shownb = 1;
+				$showtot = 1;
 			}
 			$nowarray = dol_getdate(dol_now(), true);
 			if (empty($year)) {
@@ -197,7 +198,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
 
 					$px2->SetData($data2);
 					unset($data2);
-					$i = $startyear; $legend = array();
+					$i = $startyear;
+					$legend = array();
 					while ($i <= $endyear) {
 						if ($startmonth != 1) {
 							$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

+ 4 - 2
htdocs/core/boxes/box_graph_orders_permonth.php

@@ -122,7 +122,8 @@ class box_graph_orders_permonth extends ModeleBoxes
 				$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
 			}
 			if (empty($shownb) && empty($showtot)) {
-				$shownb = 1; $showtot = 1;
+				$shownb = 1;
+				$showtot = 1;
 			}
 			$nowarray = dol_getdate(dol_now(), true);
 			if (empty($endyear)) {
@@ -193,7 +194,8 @@ class box_graph_orders_permonth extends ModeleBoxes
 				if (!$mesg) {
 					$px2->SetData($data2);
 					unset($data2);
-					$i = $startyear; $legend = array();
+					$i = $startyear;
+					$legend = array();
 					while ($i <= $endyear) {
 						if ($startmonth != 1) {
 							$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

+ 4 - 2
htdocs/core/boxes/box_graph_orders_supplier_permonth.php

@@ -121,7 +121,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
 				$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
 			}
 			if (empty($shownb) && empty($showtot)) {
-				$shownb = 1; $showtot = 1;
+				$shownb = 1;
+				$showtot = 1;
 			}
 			$nowarray = dol_getdate(dol_now(), true);
 			if (empty($endyear)) {
@@ -192,7 +193,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
 				if (!$mesg) {
 					$px2->SetData($data2);
 					unset($data2);
-					$i = $startyear; $legend = array();
+					$i = $startyear;
+					$legend = array();
 					while ($i <= $endyear) {
 						if ($startmonth != 1) {
 							$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

+ 15 - 7
htdocs/core/boxes/box_graph_product_distribution.php

@@ -101,7 +101,9 @@ class box_graph_product_distribution extends ModeleBoxes
 			$showordernb = (!empty($tmparray['showordernb']) ? $tmparray['showordernb'] : '');
 		}
 		if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) {
-			$showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1;
+			$showpropalnb = 1;
+			$showinvoicenb = 1;
+			$showordernb = 1;
 		}
 		if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
 			$showinvoicenb = 0;
@@ -154,7 +156,8 @@ class box_graph_product_distribution extends ModeleBoxes
 				$langs->load("propal");
 				include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
 
-				$showpointvalue = 1; $nocolor = 0;
+				$showpointvalue = 1;
+				$nocolor = 0;
 				$stats_proposal = new PropaleStats($this->db, $socid, ($userid > 0 ? $userid : 0));
 				$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
 				if (empty($data2)) {
@@ -169,7 +172,8 @@ class box_graph_product_distribution extends ModeleBoxes
 				$px2 = new DolGraph();
 				$mesg = $px2->isGraphKo();
 				if (!$mesg) {
-					$i = 0; $legend = array();
+					$i = 0;
+					$legend = array();
 
 					foreach ($data2 as $key => $val) {
 						$data2[$key][0] = dol_trunc($data2[$key][0], 32);
@@ -210,7 +214,8 @@ class box_graph_product_distribution extends ModeleBoxes
 				$langs->load("orders");
 				include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
 
-				$showpointvalue = 1; $nocolor = 0;
+				$showpointvalue = 1;
+				$nocolor = 0;
 				$mode = 'customer';
 				$stats_order = new CommandeStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
 				$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
@@ -226,7 +231,8 @@ class box_graph_product_distribution extends ModeleBoxes
 				$px3 = new DolGraph();
 				$mesg = $px3->isGraphKo();
 				if (!$mesg) {
-					$i = 0; $legend = array();
+					$i = 0;
+					$legend = array();
 
 					foreach ($data3 as $key => $val) {
 						$data3[$key][0] = dol_trunc($data3[$key][0], 32);
@@ -268,7 +274,8 @@ class box_graph_product_distribution extends ModeleBoxes
 				$langs->load("bills");
 				include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
 
-				$showpointvalue = 1; $nocolor = 0;
+				$showpointvalue = 1;
+				$nocolor = 0;
 				$mode = 'customer';
 				$stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
 				$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
@@ -284,7 +291,8 @@ class box_graph_product_distribution extends ModeleBoxes
 				$px1 = new DolGraph();
 				$mesg = $px1->isGraphKo();
 				if (!$mesg) {
-					$i = 0; $legend = array();
+					$i = 0;
+					$legend = array();
 
 					foreach ($data1 as $key => $val) {
 						$data1[$key][0] = dol_trunc($data1[$key][0], 32);

+ 6 - 3
htdocs/core/boxes/box_graph_propales_permonth.php

@@ -122,7 +122,8 @@ class box_graph_propales_permonth extends ModeleBoxes
 				$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
 			}
 			if (empty($shownb) && empty($showtot)) {
-				$shownb = 1; $showtot = 1;
+				$shownb = 1;
+				$showtot = 1;
 			}
 			$nowarray = dol_getdate(dol_now(), true);
 			if (empty($endyear)) {
@@ -149,7 +150,8 @@ class box_graph_propales_permonth extends ModeleBoxes
 					$px1->SetType($datatype1);
 					$px1->SetData($data1);
 					unset($data1);
-					$i = $startyear; $legend = array();
+					$i = $startyear;
+					$legend = array();
 					while ($i <= $endyear) {
 						if ($startmonth != 1) {
 							$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
@@ -195,7 +197,8 @@ class box_graph_propales_permonth extends ModeleBoxes
 					$px2->SetType($datatype2);
 					$px2->SetData($data2);
 					unset($data2);
-					$i = $startyear; $legend = array();
+					$i = $startyear;
+					$legend = array();
 					while ($i <= $endyear) {
 						if ($startmonth != 1) {
 							$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

+ 6 - 3
htdocs/core/class/CMailFile.class.php

@@ -578,7 +578,8 @@ class CMailFile
 			$hookmanager = new HookManager($db);
 			$hookmanager->initHooks(array('mail'));
 
-			$parameters = array(); $action = '';
+			$parameters = array();
+			$action = '';
 			$reshook = $hookmanager->executeHooks('sendMail', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
 			if ($reshook < 0) {
 				$this->error = "Error in hook maildao sendMail ".$reshook;
@@ -815,7 +816,8 @@ class CMailFile
 				$this->smtps->setHost($server);
 				$this->smtps->setPort($port); // 25, 465...;
 
-				$loginid = ''; $loginpass = '';
+				$loginid = '';
+				$loginpass = '';
 				if (!empty($conf->global->$keyforsmtpid)) {
 					$loginid = $conf->global->$keyforsmtpid;
 					$this->smtps->setID($loginid);
@@ -946,7 +948,8 @@ class CMailFile
 				return 'Bad value for sendmode';
 			}
 
-			$parameters = array(); $action = '';
+			$parameters = array();
+			$action = '';
 			$reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
 			if ($reshook < 0) {
 				$this->error = "Error in hook maildao sendMailAfter ".$reshook;

+ 2 - 1
htdocs/core/class/CSMSFile.class.php

@@ -151,7 +151,8 @@ class CSMSFile
 				}
 			} elseif (!empty($conf->global->MAIN_SMS_SENDMODE)) {    // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module'
 				$tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE);
-				$classfile = $tmp[0]; $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
+				$classfile = $tmp[0];
+				$module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
 				dol_include_once('/'.$module.'/class/'.$classfile.'.class.php');
 				try {
 					$classname = ucfirst($classfile);

+ 6 - 3
htdocs/core/class/ccountry.class.php

@@ -130,7 +130,8 @@ class Ccountry // extends CommonObject
 		dol_syslog(get_class($this)."::create", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -246,7 +247,8 @@ class Ccountry // extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback
@@ -284,7 +286,8 @@ class Ccountry // extends CommonObject
 		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback

+ 6 - 3
htdocs/core/class/comment.class.php

@@ -141,7 +141,8 @@ class Comment extends CommonObject
 		dol_syslog(get_class($this)."::create", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -268,7 +269,8 @@ class Comment extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -318,7 +320,8 @@ class Comment extends CommonObject
 
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {

+ 4 - 6
htdocs/core/class/commoninvoice.class.php

@@ -632,9 +632,8 @@ abstract class CommonInvoice extends CommonObject
 			$datelim = $this->date + ($cdr_nbjour * 3600 * 24);
 
 			$datelim += ($cdr_decalage * 3600 * 24);
-		}
-		// 1 : application of the "end of the month" rule
-		elseif ($cdr_type == 1) {
+		} elseif ($cdr_type == 1) {
+			// 1 : application of the "end of the month" rule
 			$datelim = $this->date + ($cdr_nbjour * 3600 * 24);
 
 			$mois = date('m', $datelim);
@@ -650,9 +649,8 @@ abstract class CommonInvoice extends CommonObject
 			$datelim -= (3600 * 24);
 
 			$datelim += ($cdr_decalage * 3600 * 24);
-		}
-		// 2 : application of the rule, the N of the current or next month
-		elseif ($cdr_type == 2 && !empty($cdr_decalage)) {
+		} elseif ($cdr_type == 2 && !empty($cdr_decalage)) {
+			// 2 : application of the rule, the N of the current or next month
 			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
 			$datelim = $this->date + ($cdr_nbjour * 3600 * 24);
 

+ 44 - 22
htdocs/core/class/commonobject.class.php

@@ -762,7 +762,8 @@ abstract class CommonObject
 				$out .= img_picto($langs->trans("Address"), 'map-marker-alt');
 				$out .= '</a> ';
 			}
-			$out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++;
+			$out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
+			$outdone++;
 			$outdone++;
 
 			// List of extra languages
@@ -1181,7 +1182,8 @@ abstract class CommonObject
 			if (!$notrigger) {
 				$result = $this->call_trigger(strtoupper($this->element).'_DELETE_CONTACT', $user);
 				if ($result < 0) {
-					$this->db->rollback(); return -1;
+					$this->db->rollback();
+					return -1;
 				}
 			}
 
@@ -3154,9 +3156,8 @@ abstract class CommonObject
 					return $this->getRangOfLine($fk_parent_line);
 				}
 			}
-		}
-		// If not, search the last rang of element
-		else {
+		} else {
+			// If not, search the last rang of element
 			$sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
 			$sql .= ' WHERE '.$this->fk_element.' = '.$this->id;
 
@@ -3745,42 +3746,60 @@ abstract class CommonObject
 					if ($objecttype == 'facture') {
 						$classpath = 'compta/facture/class';
 					} elseif ($objecttype == 'facturerec') {
-						$classpath = 'compta/facture/class'; $module = 'facture';
+						$classpath = 'compta/facture/class';
+						$module = 'facture';
 					} elseif ($objecttype == 'propal') {
 						$classpath = 'comm/propal/class';
 					} elseif ($objecttype == 'supplier_proposal') {
 						$classpath = 'supplier_proposal/class';
 					} elseif ($objecttype == 'shipping') {
-						$classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon';
+						$classpath = 'expedition/class';
+						$subelement = 'expedition';
+						$module = 'expedition_bon';
 					} elseif ($objecttype == 'delivery') {
-						$classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'delivery_note';
+						$classpath = 'delivery/class';
+						$subelement = 'delivery';
+						$module = 'delivery_note';
 					} elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') {
-						$classpath = 'fourn/class'; $module = 'fournisseur';
+						$classpath = 'fourn/class';
+						$module = 'fournisseur';
 					} elseif ($objecttype == 'fichinter') {
-						$classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter';
+						$classpath = 'fichinter/class';
+						$subelement = 'fichinter';
+						$module = 'ficheinter';
 					} elseif ($objecttype == 'subscription') {
-						$classpath = 'adherents/class'; $module = 'adherent';
+						$classpath = 'adherents/class';
+						$module = 'adherent';
 					} elseif ($objecttype == 'contact') {
 						 $module = 'societe';
 					}
 
 					// Set classfile
-					$classfile = strtolower($subelement); $classname = ucfirst($subelement);
+					$classfile = strtolower($subelement);
+					$classname = ucfirst($subelement);
 
 					if ($objecttype == 'order') {
-						$classfile = 'commande'; $classname = 'Commande';
+						$classfile = 'commande';
+						$classname = 'Commande';
 					} elseif ($objecttype == 'invoice_supplier') {
-						$classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur';
+						$classfile = 'fournisseur.facture';
+						$classname = 'FactureFournisseur';
 					} elseif ($objecttype == 'order_supplier') {
-						$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
+						$classfile = 'fournisseur.commande';
+						$classname = 'CommandeFournisseur';
 					} elseif ($objecttype == 'supplier_proposal') {
-						$classfile = 'supplier_proposal'; $classname = 'SupplierProposal';
+						$classfile = 'supplier_proposal';
+						$classname = 'SupplierProposal';
 					} elseif ($objecttype == 'facturerec') {
-						$classfile = 'facture-rec'; $classname = 'FactureRec';
+						$classfile = 'facture-rec';
+						$classname = 'FactureRec';
 					} elseif ($objecttype == 'subscription') {
-						$classfile = 'subscription'; $classname = 'Subscription';
+						$classfile = 'subscription';
+						$classname = 'Subscription';
 					} elseif ($objecttype == 'project' || $objecttype == 'projet') {
-						$classpath = 'projet/class'; $classfile = 'project'; $classname = 'Project';
+						$classpath = 'projet/class';
+						$classfile = 'project';
+						$classname = 'Project';
 					}
 
 					// Here $module, $classfile and $classname are set
@@ -4618,7 +4637,8 @@ abstract class CommonObject
 
 		$element = $this->element;
 
-		$text = ''; $description = '';
+		$text = '';
+		$description = '';
 
 		// Line in view mode
 		if ($action != 'editline' || $selected != $line->id) {
@@ -4985,7 +5005,8 @@ abstract class CommonObject
 			if (!$notrigger) {
 				$result = $this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
 				if ($result < 0) {
-					$this->db->rollback(); return -1;
+					$this->db->rollback();
+					return -1;
 				}
 			}
 			$this->db->commit();
@@ -5106,7 +5127,8 @@ abstract class CommonObject
 							$tmpdir = trim($tmpdir);
 							$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
 							if (!$tmpdir) {
-								unset($listofdir[$key]); continue;
+								unset($listofdir[$key]);
+								continue;
 							}
 							if (is_dir($tmpdir)) {
 								$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0);

+ 9 - 10
htdocs/core/class/conf.class.php

@@ -196,13 +196,13 @@ class Conf
 								$this->modules_parts[$partname] = array();
 							}
 							$this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array
-						}
-						// If this is constant for all generic part activated by a module. It initializes
-						// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
-						// modules_parts['models'], modules_parts['theme']
-						// modules_parts['sms'],
-						// modules_parts['css'], ...
-						elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
+						} elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
+							// If this is constant for all generic part activated by a module. It initializes
+							// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
+							// modules_parts['models'], modules_parts['theme']
+							// modules_parts['sms'],
+							// modules_parts['css'], ...
+
 							$modulename = strtolower($reg[1]);
 							$partname = strtolower($reg[2]);
 							if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
@@ -221,9 +221,8 @@ class Conf
 								$value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
 							}
 							$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array
-						}
-						// If this is a module constant (must be at end)
-						elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
+						} elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
+							// If this is a module constant (must be at end)
 							$modulename = strtolower($reg[1]);
 							if ($modulename == 'propale') {
 								$modulename = 'propal';

+ 6 - 3
htdocs/core/class/cstate.class.php

@@ -123,7 +123,8 @@ class Cstate // extends CommonObject
 		dol_syslog(get_class($this)."::create", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -229,7 +230,8 @@ class Cstate // extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback
@@ -266,7 +268,8 @@ class Cstate // extends CommonObject
 		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback

+ 6 - 3
htdocs/core/class/ctypent.class.php

@@ -130,7 +130,8 @@ class Ctypent // extends CommonObject
 		dol_syslog(get_class($this)."::create", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -244,7 +245,8 @@ class Ctypent // extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback
@@ -282,7 +284,8 @@ class Ctypent // extends CommonObject
 		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback

+ 6 - 3
htdocs/core/class/cunits.class.php

@@ -133,7 +133,8 @@ class CUnits // extends CommonObject
 		dol_syslog(get_class($this)."::create", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		if (!$error) {
@@ -351,7 +352,8 @@ class CUnits // extends CommonObject
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback
@@ -389,7 +391,8 @@ class CUnits // extends CommonObject
 		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 		$resql = $this->db->query($sql);
 		if (!$resql) {
-			$error++; $this->errors[] = "Error ".$this->db->lasterror();
+			$error++;
+			$this->errors[] = "Error ".$this->db->lasterror();
 		}
 
 		// Commit or rollback

+ 2 - 1
htdocs/core/class/dolgeoip.class.php

@@ -61,7 +61,8 @@ class DolGeoIP
 				require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
 			}
 		} else {
-			print 'ErrorBadParameterInConstructor'; return 0;
+			print 'ErrorBadParameterInConstructor';
+			return 0;
 		}
 
 		// Here, function exists (embedded into PHP or exists because we made include)

+ 4 - 6
htdocs/core/class/dolgraph.class.php

@@ -908,9 +908,8 @@ class DolGraph
 			$this->stringtoshow .= 'legend: {show: ' . ($showlegend ? 'true' : 'false') . ', position: \'ne\' }
 		});
 		}' . "\n";
-		}
-		// Other cases, graph of type 'bars', 'lines'
-		else {
+		} else {
+			// Other cases, graph of type 'bars', 'lines'
 			// Add code to support tooltips
 			// TODO: remove js css and use graph-tooltip-inner class instead by adding css in each themes
 			$this->stringtoshow .= '
@@ -1262,9 +1261,8 @@ class DolGraph
 			$this->stringtoshow .= ']' . "\n";
 			$this->stringtoshow .= '}' . "\n";
 			$this->stringtoshow .= '});' . "\n";
-		}
-		// Other cases, graph of type 'bars', 'lines', 'linesnopoint'
-		else {
+		} else {
+			// Other cases, graph of type 'bars', 'lines', 'linesnopoint'
 			$type = 'bar';
 
 			if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') {

+ 2 - 1
htdocs/core/class/events.class.php

@@ -147,7 +147,8 @@ class Events // extends CommonObject
 
 		// Check parameters
 		if (empty($this->description)) {
-			$this->error = 'ErrorBadValueForParameterCreateEventDesc'; return -1;
+			$this->error = 'ErrorBadValueForParameterCreateEventDesc';
+			return -1;
 		}
 
 		// Insert request

+ 2 - 1
htdocs/core/class/extrafields.class.php

@@ -251,7 +251,8 @@ class ExtraFields
 		}
 
 		if ($type == 'separate') {
-			$unique = 0; $required = 0;
+			$unique = 0;
+			$required = 0;
 		}	// Force unique and not required if this is a separator field to avoid troubles.
 		if ($elementtype == 'thirdparty') {
 			$elementtype = 'societe';

+ 10 - 5
htdocs/core/class/fileupload.class.php

@@ -70,7 +70,8 @@ class FileUpload
 			$element = $pathname = 'projet';
 			$dir_output = $conf->$element->dir_output;
 		} elseif ($element == 'project_task') {
-			$pathname = 'projet'; $filename = 'task';
+			$pathname = 'projet';
+			$filename = 'task';
 			$dir_output = $conf->projet->dir_output;
 			$parentForeignKey = 'fk_project';
 			$parentClass = 'Project';
@@ -80,20 +81,24 @@ class FileUpload
 			$element = 'ficheinter';
 			$dir_output = $conf->$element->dir_output;
 		} elseif ($element == 'order_supplier') {
-			$pathname = 'fourn'; $filename = 'fournisseur.commande';
+			$pathname = 'fourn';
+			$filename = 'fournisseur.commande';
 			$dir_output = $conf->fournisseur->commande->dir_output;
 		} elseif ($element == 'invoice_supplier') {
-			$pathname = 'fourn'; $filename = 'fournisseur.facture';
+			$pathname = 'fourn';
+			$filename = 'fournisseur.facture';
 			$dir_output = $conf->fournisseur->facture->dir_output;
 		} elseif ($element == 'product') {
 			$dir_output = $conf->product->multidir_output[$conf->entity];
 		} elseif ($element == 'productbatch') {
 			$dir_output = $conf->productbatch->multidir_output[$conf->entity];
 		} elseif ($element == 'action') {
-			$pathname = 'comm/action'; $filename = 'actioncomm';
+			$pathname = 'comm/action';
+			$filename = 'actioncomm';
 			$dir_output = $conf->agenda->dir_output;
 		} elseif ($element == 'chargesociales') {
-			$pathname = 'compta/sociales'; $filename = 'chargesociales';
+			$pathname = 'compta/sociales';
+			$filename = 'chargesociales';
 			$dir_output = $conf->tax->dir_output;
 		} else {
 			$dir_output = $conf->$element->dir_output;

+ 13 - 8
htdocs/core/class/hookmanager.class.php

@@ -228,11 +228,14 @@ class HookManager
 		}
 
 		// Init return properties
-		$this->resPrint = ''; $this->resArray = array(); $this->resNbOfHooks = 0;
+		$this->resPrint = '';
+		$this->resArray = array();
+		$this->resNbOfHooks = 0;
 
 		// Loop on each hook to qualify modules that have declared context
 		$modulealreadyexecuted = array();
-		$resaction = 0; $error = 0;
+		$resaction = 0;
+		$error = 0;
 		foreach ($this->hooks as $context => $modules) {    // $this->hooks is an array with context as key and value is an array of modules that handle this context
 			if (!empty($modules)) {
 				foreach ($modules as $module => $actionclassinstance) {
@@ -265,7 +268,8 @@ class HookManager
 						$resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
 						if ($resaction < 0 || !empty($actionclassinstance->error) || (!empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) {
 							$error++;
-							$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
+							$this->error = $actionclassinstance->error;
+							$this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
 							dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
 						}
 
@@ -275,9 +279,8 @@ class HookManager
 						if (!empty($actionclassinstance->resprints)) {
 							$this->resPrint .= $actionclassinstance->resprints;
 						}
-					}
-					// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
-					else {
+					} else {
+						// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
 						// TODO. this test should be done into the method of hook by returning nothing
 						if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) {
 							continue;
@@ -294,14 +297,16 @@ class HookManager
 						}
 						if (is_numeric($resaction) && $resaction < 0) {
 							$error++;
-							$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
+							$this->error = $actionclassinstance->error;
+							$this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
 							dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
 						}
 						// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
 						if (!is_array($resaction) && !is_numeric($resaction)) {
 							dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
 							if (empty($actionclassinstance->resprints)) {
-								$this->resPrint .= $resaction; $resaction = 0;
+								$this->resPrint .= $resaction;
+								$resaction = 0;
 							}
 						}
 					}

+ 37 - 20
htdocs/core/class/html.form.class.php

@@ -488,7 +488,8 @@ class Form
 				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
 				$tmp = explode(':', $inputType);
-				$inputType = $tmp[0]; $loadmethod = $tmp[1];
+				$inputType = $tmp[0];
+				$loadmethod = $tmp[1];
 				if (!empty($tmp[2])) {
 					$savemethod = $tmp[2];
 				}
@@ -502,7 +503,8 @@ class Form
 				$cols = (empty($tmp[2]) ? '80' : $tmp[2]);
 			} elseif (preg_match('/^ckeditor/', $inputType)) {
 				$tmp = explode(':', $inputType);
-				$inputType = $tmp[0]; $toolbar = $tmp[1];
+				$inputType = $tmp[0];
+				$toolbar = $tmp[1];
 				if (!empty($tmp[2])) {
 					$width = $tmp[2];
 				}
@@ -594,15 +596,18 @@ class Form
 
 		$extrastyle = '';
 		if ($direction < 0) {
-			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-left: 3px !important;';
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
+			$extrastyle = 'padding: 0px; padding-left: 3px !important;';
 		}
 		if ($direction > 0) {
-			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-right: 3px !important;';
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
+			$extrastyle = 'padding: 0px; padding-right: 3px !important;';
 		}
 
 		$classfortooltip = 'classfortooltip';
 
-		$s = ''; $textfordialog = '';
+		$s = '';
+		$textfordialog = '';
 
 		if ($tooltiptrigger == '') {
 			$htmltext = str_replace('"', '&quot;', $htmltext);
@@ -2084,7 +2089,8 @@ class Form
 		if ($nbassignetouser) {
 			$out .= '<ul class="attendees">';
 		}
-		$i = 0; $ownerid = 0;
+		$i = 0;
+		$ownerid = 0;
 		foreach ($assignedtouser as $key => $value) {
 			if ($value['id'] == $ownerid) {
 				continue;
@@ -2094,7 +2100,8 @@ class Form
 			$userstatic->fetch($value['id']);
 			$out .= $userstatic->getNomUrl(-1);
 			if ($i == 0) {
-				$ownerid = $value['id']; $out .= ' ('.$langs->trans("Owner").')';
+				$ownerid = $value['id'];
+				$out .= ' ('.$langs->trans("Owner").')';
 			}
 			if ($nbassignetouser > 1 && $action != 'view') {
 				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
@@ -5811,7 +5818,8 @@ class Form
 			}
 
 			// Disabled if seller is not subject to VAT
-			$disabled = false; $title = '';
+			$disabled = false;
+			$title = '';
 			if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") {
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
 				// of using supplier invoices (this is a very bad idea !)
@@ -5991,10 +5999,12 @@ class Form
 			$stepminutes = 1;
 		}
 		if ($empty == 1) {
-			$emptydate = 1; $emptyhours = 1;
+			$emptydate = 1;
+			$emptyhours = 1;
 		}
 		if ($empty == 2) {
-			$emptydate = 0; $emptyhours = 1;
+			$emptydate = 0;
+			$emptyhours = 1;
 		}
 		$orig_set_time = $set_time;
 
@@ -6149,9 +6159,8 @@ class Form
 				} else {
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
 				}
-			}
-			// Show date with combo selects
-			else {
+			} else {
+				// Show date with combo selects
 				// Day
 				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
 
@@ -6448,7 +6457,8 @@ class Form
 
 		$retstring = '';
 
-		$hourSelected = 0; $minSelected = 0;
+		$hourSelected = 0;
+		$minSelected = 0;
 
 		// Hours
 		if ($iSecond != '') {
@@ -6914,7 +6924,8 @@ class Form
 					$style = empty($tmpvalue['css']) ? ' class="'.$tmpvalue['css'].'"' : '';
 				} else {
 					$value = $tmpvalue;
-					$disabled = ''; $style = '';
+					$disabled = '';
+					$style = '';
 				}
 				if (!empty($disablebademail)) {
 					if (($disablebademail == 1 && !preg_match('/&lt;.+@.+&gt;/', $value))
@@ -7720,9 +7731,8 @@ class Form
 				//$linktoelem.=($linktoelem?' &nbsp; ':'');
 				if ($num > 0) {
 					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
-				}
-				//else $linktoelem.=$langs->trans($possiblelink['label']);
-				else {
+					// } else $linktoelem.=$langs->trans($possiblelink['label']);
+				} else {
 					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
 				}
 			}
@@ -7777,7 +7787,8 @@ class Form
 	{
 		global $langs;
 
-		$yes = "yes"; $no = "no";
+		$yes = "yes";
+		$no = "no";
 		if ($option) {
 			$yes = "1";
 			$no = "0";
@@ -8093,7 +8104,13 @@ class Form
 		$entity = (!empty($object->entity) ? $object->entity : $conf->entity);
 		$id = (!empty($object->id) ? $object->id : $object->rowid);
 
-		$ret = ''; $dir = ''; $file = ''; $originalfile = ''; $altfile = ''; $email = ''; $capture = '';
+		$ret = '';
+		$dir = '';
+		$file = '';
+		$originalfile = '';
+		$altfile = '';
+		$email = '';
+		$capture = '';
 		if ($modulepart == 'societe') {
 			$dir = $conf->societe->multidir_output[$entity];
 			if (!empty($object->logo)) {

+ 2 - 1
htdocs/core/class/html.formactions.class.php

@@ -227,7 +227,8 @@ class FormActions
 			print '<!-- formactions->showactions -->'."\n";
 			print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter);
 
-			$page = 0; $param = '';
+			$page = 0;
+			$param = '';
 
 			print '<div class="div-table-responsive-no-min">';
 			print '<table class="centpercent noborder'.($morecss ? ' '.$morecss : '').'">';

+ 6 - 3
htdocs/core/class/html.formcompany.class.php

@@ -547,7 +547,8 @@ class FormCompany extends Form
 			$num = $this->db->num_rows($resql);
 			if ($num) {
 				$i = 0;
-				$country = ''; $arraydata = array();
+				$country = '';
+				$arraydata = array();
 				while ($i < $num) {
 					$obj = $this->db->fetch_object($resql);
 
@@ -622,7 +623,8 @@ class FormCompany extends Form
 			// Use Ajax search
 			$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2);
 
-			$socid = 0; $name = '';
+			$socid = 0;
+			$name = '';
 			if ($selected > 0) {
 				$tmpthirdparty = new Societe($this->db);
 				$result = $tmpthirdparty->fetch($selected);
@@ -937,7 +939,8 @@ class FormCompany extends Form
 
 		$maxlength = $formlength;
 		if (empty($formlength)) {
-			$formlength = 24; $maxlength = 128;
+			$formlength = 24;
+			$maxlength = 128;
 		}
 
 		$out = '';

+ 26 - 15
htdocs/core/class/html.formfile.class.php

@@ -659,9 +659,8 @@ class FormFile
 				$file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
 				if (file_exists($file)) {
 					$res = include_once $file;
-				}
-				// For normalized external modules.
-				else {
+				} else {
+					// For normalized external modules.
 					$file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
 					$res = include_once $file;
 				}
@@ -699,7 +698,8 @@ class FormFile
 			$out .= '<tr class="liste_titre">';
 
 			$addcolumforpicto = ($delallowed || $printer || $morepicto);
-			$colspan = (3 + ($addcolumforpicto ? 1 : 0)); $colspanmore = 0;
+			$colspan = (3 + ($addcolumforpicto ? 1 : 0));
+			$colspanmore = 0;
 
 			$out .= '<th colspan="'.$colspan.'" class="formdoc liste_titre maxwidthonsmartphone center">';
 
@@ -1221,7 +1221,9 @@ class FormFile
 				include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
 			}
 
-			$i = 0; $nboflines = 0; $lastrowid = 0;
+			$i = 0;
+			$nboflines = 0;
+			$lastrowid = 0;
 			foreach ($filearray as $key => $file) {      // filearray must be only files here
 				if ($file['name'] != '.'
 						&& $file['name'] != '..'
@@ -1639,19 +1641,24 @@ class FormFile
 				// Define relative path used to store the file
 				$relativefile = preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']);
 
-				$id = 0; $ref = '';
+				$id = 0;
+				$ref = '';
 
 				// To show ref or specific information according to view to show (defined by $module)
 				$reg = array();
 				if ($modulepart == 'company' || $modulepart == 'tax') {
-					preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : '');
+					preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg);
+					$id = (isset($reg[1]) ? $reg[1] : '');
 				} elseif ($modulepart == 'invoice_supplier') {
-					preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) {
-						$id = $ref; $ref = '';
+					preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
+					$ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) {
+						$id = $ref;
+						$ref = '';
 					}
-				}	// $ref may be also id with old supplier invoices
-				elseif ($modulepart == 'user' || $modulepart == 'holiday') {
-					preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : '');
+				} elseif ($modulepart == 'user' || $modulepart == 'holiday') {
+					// $ref may be also id with old supplier invoices
+					preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
+					$id = (isset($reg[1]) ? $reg[1] : '');
 				} elseif (in_array($modulepart, array(
 					'invoice',
 					'propal',
@@ -1666,7 +1673,8 @@ class FormFile
 					'recruitment-recruitmentcandidature',
 					'mrp-mo',
 					'banque'))) {
-					preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : '');
+					preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
+					$ref = (isset($reg[1]) ? $reg[1] : '');
 				} else {
 					$parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file);
 					$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
@@ -1703,10 +1711,13 @@ class FormFile
 					}
 
 					if ($result > 0) {  // Save object loaded into a cache
-						$found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance;
+						$found = 1;
+						$this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance;
 					}
 					if ($result == 0) {
-						$found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound'; unset($filearray[$key]);
+						$found = 1;
+						$this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound';
+						unset($filearray[$key]);
 					}
 				}
 

+ 2 - 1
htdocs/core/class/html.formmail.class.php

@@ -911,7 +911,8 @@ class FormMail extends Form
 				}
 
 				// Complete substitution array with the url to make online payment
-				$paymenturl = ''; $validpaymentmethod = array();
+				$paymenturl = '';
+				$validpaymentmethod = array();
 				if (empty($this->substit['__REF__'])) {
 					$paymenturl = '';
 				} else {

+ 4 - 2
htdocs/core/class/html.formother.class.php

@@ -1211,7 +1211,8 @@ class FormOther
 		}
 
 		// Define boxlista and boxlistb
-		$boxlista = ''; $boxlistb = '';
+		$boxlista = '';
+		$boxlistb = '';
 		$nbboxactivated = count($boxidactivatedforuser);
 
 		if ($nbboxactivated) {
@@ -1357,7 +1358,8 @@ class FormOther
 	{
 		global $langs;
 
-		$automatic = "automatic"; $manual = "manual";
+		$automatic = "automatic";
+		$manual = "manual";
 		if ($option) {
 			$automatic = "1";
 			$manual = "0";

+ 2 - 1
htdocs/core/class/html.formprojet.class.php

@@ -393,7 +393,8 @@ class FormProjets
 							continue;
 						}
 
-						$labeltoshow = ''; $titletoshow = '';
+						$labeltoshow = '';
+						$titletoshow = '';
 
 						$disabled = 0;
 						if ($obj->fk_statut == Project::STATUS_DRAFT) {

+ 2 - 1
htdocs/core/class/html.formsms.class.php

@@ -200,7 +200,8 @@ function limitChars(textarea, limit, infodiv)
 					}
 				} elseif (!empty($conf->global->MAIN_SMS_SENDMODE)) {    // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module'
 					$tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE);
-					$classfile = $tmp[0]; $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
+					$classfile = $tmp[0];
+					$module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
 					dol_include_once('/'.$module.'/class/'.$classfile.'.class.php');
 					try {
 						$classname = ucfirst($classfile);

+ 2 - 1
htdocs/core/class/html.formwebsite.class.php

@@ -246,7 +246,8 @@ class FormWebsite
 
 		if ($atleastonepage) {
 			if (empty($pageid) && $action != 'createcontainer') {      // Page id is not defined, we try to take one
-				$firstpageid = 0; $homepageid = 0;
+				$firstpageid = 0;
+				$homepageid = 0;
 				foreach ($website->lines as $key => $valpage) {
 					if (empty($firstpageid)) {
 						$firstpageid = $valpage->id;

+ 17 - 17
htdocs/core/class/lessc.class.php

@@ -8,7 +8,7 @@
  * Copyright 2013, Leaf Corcoran <leafot@gmail.com>
  * Licensed under MIT or GPLv3, see LICENSE
  */
-
+// phpcs:disable
 /**
  * The LESS compiler and parser.
  *
@@ -3385,7 +3385,7 @@ class lessc_parser
 		return false;
 	}
 
-		// a # color
+	// a # color
 	protected function color(&$out)
 	{
 		if ($this->match('(#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3}))', $m)) {
@@ -3400,11 +3400,11 @@ class lessc_parser
 		return false;
 	}
 
-		// consume an argument definition list surrounded by ()
-		// each argument is a variable name with optional value
-		// or at the end a ... or a variable named followed by ...
-		// arguments are separated by , unless a ; is in the list, then ; is the
-		// delimiter.
+	// consume an argument definition list surrounded by ()
+	// each argument is a variable name with optional value
+	// or at the end a ... or a variable named followed by ...
+	// arguments are separated by , unless a ; is in the list, then ; is the
+	// delimiter.
 	protected function argumentDef(&$args, &$isVararg)
 	{
 		$s = $this->seek();
@@ -3726,7 +3726,7 @@ class lessc_parser
 		return false;
 	}
 
-		// consume a less variable
+	// consume a less variable
 	protected function variable(&$name)
 	{
 		$s = $this->seek();
@@ -3746,10 +3746,10 @@ class lessc_parser
 			return false;
 	}
 
-		/**
-		 * Consume an assignment operator
-		 * Can optionally take a name that will be set to the current property name
-		 */
+	/**
+	 * Consume an assignment operator
+	 * Can optionally take a name that will be set to the current property name
+	 */
 	protected function assign($name = null)
 	{
 		if ($name) {
@@ -3758,7 +3758,7 @@ class lessc_parser
 		return $this->literal(':') || $this->literal('=');
 	}
 
-		// consume a keyword
+	// consume a keyword
 	protected function keyword(&$word)
 	{
 		if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) {
@@ -3768,7 +3768,7 @@ class lessc_parser
 		return false;
 	}
 
-		// consume an end of statement delimiter
+	// consume an end of statement delimiter
 	protected function end()
 	{
 		if ($this->literal(';', false)) {
@@ -3807,8 +3807,8 @@ class lessc_parser
 		return true;
 	}
 
-		// a bunch of guards that are and'd together
-		// TODO rename to guardGroup
+	// a bunch of guards that are and'd together
+	// TODO rename to guardGroup
 	protected function guardGroup(&$guardGroup)
 	{
 		$s = $this->seek();
@@ -3846,7 +3846,7 @@ class lessc_parser
 		return false;
 	}
 
-		/* raw parsing functions */
+	/* raw parsing functions */
 
 	protected function literal($what, $eatWhitespace = null)
 	{

+ 4 - 1
htdocs/core/class/menubase.class.php

@@ -578,7 +578,10 @@ class Menubase
 					//var_dump($this->newmenu->liste);
 				} else {
 					// Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
-					$searchlastsub = 0; $lastid = 0; $nextid = 0; $found = 0;
+					$searchlastsub = 0;
+					$lastid = 0;
+					$nextid = 0;
+					$found = 0;
 					foreach ($this->newmenu->liste as $keyparent => $valparent) {
 						//var_dump($valparent);
 						if ($searchlastsub) {    // If we started to search for last submenu

+ 17 - 26
htdocs/core/class/rssparser.class.php

@@ -410,9 +410,10 @@ class RssParser
 					}
 				}
 				if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
-					$tmprss = xml2php($rss); $items = $tmprss['entry'];
-				} // With simplexml
-				else {
+					$tmprss = xml2php($rss);
+					$items = $tmprss['entry'];
+				} else {
+					// With simplexml
 					$items = $rss->items; // With xmlparse
 				}
 				//var_dump($items);exit;
@@ -552,45 +553,36 @@ class RssParser
 			if (isset($attrs['rdf:about'])) {
 				$this->current_item['about'] = $attrs['rdf:about'];
 			}
-		}
-
-		// if we're in the default namespace of an RSS feed,
-		//  record textinput or image fields
-		elseif ($this->_format == 'rss' and
+		} elseif ($this->_format == 'rss' and
 		$this->current_namespace == '' and
 		$el == 'textinput') {
+			// if we're in the default namespace of an RSS feed,
+			//  record textinput or image fields
 			$this->intextinput = true;
 		} elseif ($this->_format == 'rss' and
 		$this->current_namespace == '' and
 		$el == 'image') {
 			$this->inimage = true;
-		}
-
-		// handle atom content constructs
-		elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) {
+		} elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) {
+			// handle atom content constructs
 			// avoid clashing w/ RSS mod_content
 			if ($el == 'content') {
 				$el = 'atom_content';
 			}
 
 			$this->incontent = $el;
-		}
-
-		// if inside an Atom content construct (e.g. content or summary) field treat tags as text
-		elseif ($this->_format == 'atom' and $this->incontent) {
+		} elseif ($this->_format == 'atom' and $this->incontent) {
+			// if inside an Atom content construct (e.g. content or summary) field treat tags as text
 			// if tags are inlined, then flatten
 			$attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs)));
 
 			$this->append_content("<$element $attrs_str>");
 
 			array_unshift($this->stack, $el);
-		}
-
-		// Atom support many links per containging element.
-		// Magpie treats link elements of type rel='alternate'
-		// as being equivalent to RSS's simple link element.
-		//
-		elseif ($this->_format == 'atom' and $el == 'link') {
+		} elseif ($this->_format == 'atom' and $el == 'link') {
+			// Atom support many links per containging element.
+			// Magpie treats link elements of type rel='alternate'
+			// as being equivalent to RSS's simple link element.
 			if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') {
 				$link_el = 'link';
 			} elseif (!isset($attrs['rel'])) {
@@ -600,9 +592,8 @@ class RssParser
 			}
 
 			$this->append($link_el, $attrs['href']);
-		}
-		// set stack[0] to current element
-		else {
+		} else {
+			// set stack[0] to current element
 			array_unshift($this->stack, $el);
 		}
 	}

+ 21 - 32
htdocs/core/class/smtps.class.php

@@ -426,9 +426,8 @@ class SMTPs
 				if ($_retVal = $this->server_parse($this->socket, "220")) {
 					$_retVal = $this->socket;
 				}
-			}
-			// This connection attempt failed.
-			else {
+			} else {
+				// This connection attempt failed.
 				// @CHANGE LDR
 				if (empty($this->errstr)) {
 					$this->errstr = 'Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort();
@@ -580,10 +579,8 @@ class SMTPs
 			if (!empty($this->_smtpsID) && !empty($this->_smtpsPW)) {
 				// Send the RFC2554 specified EHLO.
 				$_retVal = $this->_server_authenticate();
-			}
-
-			// This is a "normal" SMTP Server "handshack"
-			else {
+			} else {
+				// This is a "normal" SMTP Server "handshack"
 				// Send the RFC821 specified HELO.
 				$host = $this->getHost();
 				$usetls = preg_match('@tls://@i', $host);
@@ -705,10 +702,8 @@ class SMTPs
 				$this->_setErr(110, '"'.$_strConfigPath.'" is not a valid path.');
 				$_retVal = false;
 			}
-		}
-
-		// Read the Systems php.ini file
-		else {
+		} else {
+			// Read the Systems php.ini file
 			// Set these properties ONLY if they are set in the php.ini file.
 			// Otherwise the default values will be used.
 			if ($_host = ini_get('SMTPs')) {
@@ -1048,10 +1043,8 @@ class SMTPs
 				if (strstr($_addrList, ',')) {
 					// "explode "list" into an array
 					$_addrList = explode(',', $_addrList);
-				}
-
-				// Stick it in an array
-				else {
+				} else {
+					// Stick it in an array
 					$_addrList = array($_addrList);
 				}
 			}
@@ -1070,9 +1063,8 @@ class SMTPs
 					$_tmpHost = explode('@', $_tmpaddr[1]);
 					$_tmpaddr[0] = trim($_tmpaddr[0], ' ">');
 					$aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = $_tmpaddr[0];
-				}
-				// We only have an eMail address
-				else {
+				} else {
+					// We only have an eMail address
 					// Strip off the beggining '<'
 					$_strAddr = str_replace('<', '', $_strAddr);
 
@@ -1449,10 +1441,8 @@ class SMTPs
 		// If we have ZERO, we have a problem
 		if ($keyCount === 0) {
 			die("Sorry, no content");
-		}
-
-		// If we have ONE, we can use the simple format
-		elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+		} elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+			// If we have ONE, we can use the simple format
 			$_msgData = $this->_msgContent;
 			$_msgData = $_msgData[$_types[0]];
 
@@ -1467,10 +1457,8 @@ class SMTPs
 
 			$content .= "\r\n"
 			.  $_msgData['data']."\r\n";
-		}
-
-		// If we have more than ONE, we use the multi-part format
-		elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+		} elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+			// If we have more than ONE, we use the multi-part format
 			// Since this is an actual multi-part message
 			// We need to define a content message Boundary
 			// NOTE: This was 'multipart/alternative', but Windows based mail servers have issues with this.
@@ -1512,9 +1500,8 @@ class SMTPs
 
 						$content .= "\r\n".$_data['data']."\r\n\r\n";
 					}
-				}
-				// @CHANGE LDR
-				elseif ($type == 'image') {
+				} elseif ($type == 'image') {
+					// @CHANGE LDR
 					// loop through all images
 					foreach ($_content as $_image => $_data) {
 						$content .= "--".$this->_getBoundary('related')."\r\n"; // always related for an inline image
@@ -1546,7 +1533,8 @@ class SMTPs
 						$content .= "--".$this->_getBoundary('related')."\r\n";
 					}
 
-					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {  // Add plain text message part before html part
+					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+						// Add plain text message part before html part
 						$content .= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"'."\r\n";
 						$content .= "\r\n";
 						   $content .= "--".$this->_getBoundary('alternative')."\r\n";
@@ -1566,7 +1554,8 @@ class SMTPs
 
 					$content .= "\r\n".$_content['data']."\r\n";
 
-					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {  // Add plain text message part after html part
+					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+						// Add plain text message part after html part
 						$content .= "--".$this->_getBoundary('alternative')."--\r\n";
 					}
 
@@ -1599,7 +1588,7 @@ class SMTPs
 			$this->_msgContent['attachment'][$strFileName]['data']     = $strContent;
 
 			if ($this->getMD5flag()) {
-				$this->_msgContent['attachment'][$strFileName]['md5']      = dol_hash($strContent, 3);
+				$this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3);
 			}
 		}
 	}

+ 6 - 3
htdocs/core/class/stats.class.php

@@ -424,7 +424,8 @@ abstract class Stats
 		$resql = $this->db->query($sql);
 		if ($resql) {
 			$num = $this->db->num_rows($resql);
-			$i = 0; $j = 0;
+			$i = 0;
+			$j = 0;
 			while ($i < $num) {
 				$row = $this->db->fetch_row($resql);
 				$j = $row[0] * 1;
@@ -539,7 +540,8 @@ abstract class Stats
 		$resql = $this->db->query($sql);
 		if ($resql) {
 			$num = $this->db->num_rows($resql);
-			$i = 0; $j = 0;
+			$i = 0;
+			$j = 0;
 			while ($i < $num) {
 				$row = $this->db->fetch_row($resql);
 				$j = $row[0] * 1;
@@ -594,7 +596,8 @@ abstract class Stats
 		$resql = $this->db->query($sql);
 		if ($resql) {
 			$num = $this->db->num_rows($resql);
-			$i = 0; $other = 0;
+			$i = 0;
+			$other = 0;
 			while ($i < $num) {
 				$row = $this->db->fetch_row($resql);
 				if ($i < $limit || $num == $limit) {

+ 6 - 7
htdocs/core/class/translate.class.php

@@ -81,7 +81,8 @@ class Translate
 			foreach ($conf->file->dol_document_root as $dir) {
 				$newdir = $dir.$conf->global->MAIN_FORCELANGDIR; // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX'
 				if (!in_array($newdir, $this->dir)) {
-					$more['module_'.$i] = $newdir; $i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir.
+					$more['module_'.$i] = $newdir;
+					$i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir.
 				}
 			}
 			$this->dir = array_merge($more, $this->dir); // Forced dir ($more) are before standard dirs ($this->dir)
@@ -267,9 +268,8 @@ class Translate
 				// Using a memcached server
 				if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER)) {
 					$usecachekey = $newdomain.'_'.$langofdir.'_'.md5($file_lang); // Should not contains special chars
-				}
-				// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
-				elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) {
+				} elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) {
+					// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
 					$usecachekey = $newdomain;
 				}
 
@@ -458,9 +458,8 @@ class Translate
 		// Using a memcached server
 		if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER)) {
 			$usecachekey = $newdomain.'_'.$langofdir; // Should not contains special chars
-		}
-		// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
-		elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) {
+		} elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) {
+			// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
 			$usecachekey = $newdomain;
 		}
 

+ 6 - 3
htdocs/core/class/utils.class.php

@@ -222,11 +222,13 @@ class Utils
 			$prefix = 'dump';
 			$ext = 'sql';
 			if (in_array($type, array('mysql', 'mysqli'))) {
-				$prefix = 'mysqldump'; $ext = 'sql';
+				$prefix = 'mysqldump';
+				$ext = 'sql';
 			}
 			//if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; }
 			if (in_array($type, array('pgsql'))) {
-				$prefix = 'pg_dump'; $ext = 'sql';
+				$prefix = 'pg_dump';
+				$ext = 'sql';
 			}
 			$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
 		}
@@ -350,7 +352,8 @@ class Utils
 
 				// TODO Replace with executeCLI function
 				if ($execmethod == 1) {
-					$output_arr = array(); $retval = null;
+					$output_arr = array();
+					$retval = null;
 					exec($fullcommandclear, $output_arr, $retval);
 
 					if ($retval != 0) {

+ 2 - 1
htdocs/core/class/vcard.class.php

@@ -63,7 +63,8 @@ function dol_quoted_printable_encode($input, $line_max = 76)
 			if (($dec == 32) && ($i == ($linlen - 1))) { // convert space at eol only
 				$c = "=20";
 			} elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required
-				$h2 = floor($dec / 16); $h1 = floor($dec % 16);
+				$h2 = floor($dec / 16);
+				$h1 = floor($dec % 16);
 				$c = $escape.$hex["$h2"].$hex["$h1"];
 			}
 			if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted

+ 7 - 7
htdocs/core/customreports.php

@@ -615,7 +615,9 @@ if ($sql) {
 		dol_print_error($db);
 	}
 
-	$ifetch = 0; $xi = 0; $oldlabeltouse = '';
+	$ifetch = 0;
+	$xi = 0;
+	$oldlabeltouse = '';
 	while ($obj = $db->fetch_object($resql)) {
 		$ifetch++;
 		if ($useagroupby) {
@@ -681,9 +683,8 @@ if ($sql) {
 							if ($objfieldforg == '0') {
 								// The record we fetch is for this group
 								$data[$xi][$fieldforybis] = $obj->$fieldfory;
-							}
-							// The record we fetch is not for this group
-							elseif (!isset($data[$xi][$fieldforybis])) {
+							} elseif (!isset($data[$xi][$fieldforybis])) {
+								// The record we fetch is not for this group
 								$data[$xi][$fieldforybis] = '0';
 							}
 						} else {
@@ -691,9 +692,8 @@ if ($sql) {
 							if ((string) $objfieldforg === (string) $gvaluepossiblekey) {
 								// The record we fetch is for this group
 								$data[$xi][$fieldforybis] = $obj->$fieldfory;
-							}
-							// The record we fetch is not for this group
-							elseif (!isset($data[$xi][$fieldforybis])) {
+							} elseif (!isset($data[$xi][$fieldforybis])) {
+								// The record we fetch is not for this group
 								$data[$xi][$fieldforybis] = '0';
 							}
 						}

+ 3 - 1
htdocs/core/datepicker.php

@@ -228,7 +228,9 @@ function displayBox($selectedDate, $month, $year)
 	$mydate = dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date
 
 	// Loop on each day of month
-	$stoploop = 0; $day = 1; $cols = 0;
+	$stoploop = 0;
+	$day = 1;
+	$cols = 0;
 	while (!$stoploop) {
 		//print_r($mydate);
 		if ($mydate < $firstdate) {	// At first run

+ 2 - 3
htdocs/core/extrafieldsinexport.inc.php

@@ -58,9 +58,8 @@ if ($resql) {    // This can fail when class is used on old database (during mig
 				$this->export_fields_array[$r][$fieldname] = $fieldlabel;
 				$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
 				$this->export_entities_array[$r][$fieldname] = $keyforelement;
-			}
-			// If this is a computed field
-			else {
+			} else {
+				// If this is a computed field
 				$this->export_fields_array[$r][$fieldname] = $fieldlabel;
 				$this->export_TypeFields_array[$r][$fieldname] = $typeFilter.'Compute';
 				$this->export_special_array[$r][$fieldname] = $obj->fieldcomputed;

+ 27 - 13
htdocs/core/lib/admin.lib.php

@@ -106,10 +106,12 @@ function versioncompare($versionarray1, $versionarray2)
 		$level++;
 		//print 'level '.$level.' '.$operande1.'-'.$operande2.'<br>';
 		if ($operande1 < $operande2) {
-			$ret = -$level; break;
+			$ret = -$level;
+			break;
 		}
 		if ($operande1 > $operande2) {
-			$ret = $level; break;
+			$ret = $level;
+			break;
 		}
 	}
 	//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'<br>'."\n";
@@ -1240,40 +1242,52 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
 								//var_dump($objMod->dictionaries['tabname']);
 								$nbtabname = $nbtablib = $nbtabsql = $nbtabsqlsort = $nbtabfield = $nbtabfieldvalue = $nbtabfieldinsert = $nbtabrowid = $nbtabcond = $nbtabfieldcheck = $nbtabhelp = 0;
 								foreach ($objMod->dictionaries['tabname'] as $val) {
-									$nbtabname++; $taborder[] = max($taborder) + 1; $tabname[] = $val;
+									$nbtabname++;
+									$taborder[] = max($taborder) + 1;
+									$tabname[] = $val;
 								}		// Position
 								foreach ($objMod->dictionaries['tablib'] as $val) {
-									$nbtablib++; $tablib[] = $val;
+									$nbtablib++;
+									$tablib[] = $val;
 								}
 								foreach ($objMod->dictionaries['tabsql'] as $val) {
-									$nbtabsql++; $tabsql[] = $val;
+									$nbtabsql++;
+									$tabsql[] = $val;
 								}
 								foreach ($objMod->dictionaries['tabsqlsort'] as $val) {
-									$nbtabsqlsort++; $tabsqlsort[] = $val;
+									$nbtabsqlsort++;
+									$tabsqlsort[] = $val;
 								}
 								foreach ($objMod->dictionaries['tabfield'] as $val) {
-									$nbtabfield++; $tabfield[] = $val;
+									$nbtabfield++;
+									$tabfield[] = $val;
 								}
 								foreach ($objMod->dictionaries['tabfieldvalue'] as $val) {
-									$nbtabfieldvalue++; $tabfieldvalue[] = $val;
+									$nbtabfieldvalue++;
+									$tabfieldvalue[] = $val;
 								}
 								foreach ($objMod->dictionaries['tabfieldinsert'] as $val) {
-									$nbtabfieldinsert++; $tabfieldinsert[] = $val;
+									$nbtabfieldinsert++;
+									$tabfieldinsert[] = $val;
 								}
 								foreach ($objMod->dictionaries['tabrowid'] as $val) {
-									$nbtabrowid++; $tabrowid[] = $val;
+									$nbtabrowid++;
+									$tabrowid[] = $val;
 								}
 								foreach ($objMod->dictionaries['tabcond'] as $val) {
-									$nbtabcond++; $tabcond[] = $val;
+									$nbtabcond++;
+									$tabcond[] = $val;
 								}
 								if (!empty($objMod->dictionaries['tabhelp'])) {
 									foreach ($objMod->dictionaries['tabhelp'] as $val) {
-										$nbtabhelp++; $tabhelp[] = $val;
+										$nbtabhelp++;
+										$tabhelp[] = $val;
 									}
 								}
 								if (!empty($objMod->dictionaries['tabfieldcheck'])) {
 									foreach ($objMod->dictionaries['tabfieldcheck'] as $val) {
-										$nbtabfieldcheck++; $tabfieldcheck[] = $val;
+										$nbtabfieldcheck++;
+										$tabfieldcheck[] = $val;
 									}
 								}
 

+ 5 - 2
htdocs/core/lib/barcode.lib.php

@@ -167,7 +167,9 @@ function barcode_encode($code, $encoding)
  */
 function barcode_gen_ean_sum($ean)
 {
-	$even = true; $esum = 0; $osum = 0;
+	$even = true;
+	$esum = 0;
+	$osum = 0;
 	$ln = strlen($ean) - 1;
 	for ($i = $ln; $i >= 0; $i--) {
 		if ($even) {
@@ -300,7 +302,8 @@ function barcode_encode_genbarcode($code, $encoding)
 	);
 	//var_dump($ret);
 	if (preg_match('/permission denied/i', $ret['bars'])) {
-		$ret['error'] = $ret['bars']; $ret['bars'] = '';
+		$ret['error'] = $ret['bars'];
+		$ret['bars'] = '';
 		return $ret;
 	}
 	if (!$ret['bars']) {

Some files were not shown because too many files changed in this diff