浏览代码

Fix php-cs

Laurent Destailleur 1 年之前
父节点
当前提交
1c9429643a
共有 61 个文件被更改,包括 552 次插入406 次删除
  1. 6 2
      htdocs/intracommreport/card.php
  2. 0 1
      htdocs/intracommreport/class/intracommreport.class.php
  3. 7 5
      htdocs/intracommreport/list.php
  4. 8 4
      htdocs/knowledgemanagement/class/knowledgerecord.class.php
  5. 4 2
      htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php
  6. 0 1
      htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php
  7. 1 1
      htdocs/knowledgemanagement/knowledgerecord_agenda.php
  8. 1 1
      htdocs/knowledgemanagement/knowledgerecord_contact.php
  9. 1 1
      htdocs/knowledgemanagement/knowledgerecord_document.php
  10. 1 1
      htdocs/knowledgemanagement/knowledgerecord_list.php
  11. 1 1
      htdocs/knowledgemanagement/knowledgerecord_note.php
  12. 11 7
      htdocs/loan/card.php
  13. 1 1
      htdocs/loan/class/loan.class.php
  14. 4 3
      htdocs/loan/class/loanschedule.class.php
  15. 16 13
      htdocs/loan/class/paymentloan.class.php
  16. 1 1
      htdocs/loan/document.php
  17. 65 66
      htdocs/loan/payment/payment.php
  18. 3 3
      htdocs/margin/admin/margin.php
  19. 2 2
      htdocs/margin/agentMargins.php
  20. 4 3
      htdocs/margin/checkMargins.php
  21. 6 6
      htdocs/margin/customerMargins.php
  22. 4 4
      htdocs/margin/productMargins.php
  23. 2 2
      htdocs/margin/tabs/productMargins.php
  24. 2 2
      htdocs/margin/tabs/thirdpartyMargins.php
  25. 124 124
      htdocs/modulebuilder/index.php
  26. 2 1
      htdocs/modulebuilder/template/admin/about.php
  27. 2 1
      htdocs/modulebuilder/template/admin/myobject_extrafields.php
  28. 6 3
      htdocs/modulebuilder/template/admin/setup.php
  29. 4 2
      htdocs/modulebuilder/template/class/actions_mymodule.class.php
  30. 8 4
      htdocs/modulebuilder/template/class/myobject.class.php
  31. 3 1
      htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
  32. 4 2
      htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php
  33. 1 2
      htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php
  34. 2 1
      htdocs/modulebuilder/template/css/mymodule.css.php
  35. 2 1
      htdocs/modulebuilder/template/js/mymodule.js.php
  36. 2 1
      htdocs/modulebuilder/template/mymoduleindex.php
  37. 6 3
      htdocs/modulebuilder/template/myobject_agenda.php
  38. 8 4
      htdocs/modulebuilder/template/myobject_card.php
  39. 6 3
      htdocs/modulebuilder/template/myobject_contact.php
  40. 3 2
      htdocs/modulebuilder/template/myobject_document.php
  41. 6 2
      htdocs/modulebuilder/template/myobject_list.php
  42. 6 3
      htdocs/modulebuilder/template/myobject_note.php
  43. 7 3
      htdocs/modulebuilder/template/scripts/mymodule.php
  44. 6 2
      htdocs/mrp/ajax/interface.php
  45. 44 18
      htdocs/mrp/class/mo.class.php
  46. 2 2
      htdocs/mrp/mo_agenda.php
  47. 7 6
      htdocs/mrp/mo_card.php
  48. 1 1
      htdocs/mrp/mo_document.php
  49. 6 4
      htdocs/mrp/mo_list.php
  50. 4 3
      htdocs/mrp/mo_movements.php
  51. 29 13
      htdocs/mrp/mo_production.php
  52. 3 1
      htdocs/mrp/tpl/linkedobjectblock.tpl.php
  53. 2 2
      htdocs/mrp/tpl/originproductline.tpl.php
  54. 2 1
      htdocs/multicurrency/class/api_multicurrencies.class.php
  55. 24 24
      htdocs/multicurrency/class/multicurrency.class.php
  56. 55 22
      htdocs/multicurrency/multicurrency_rate.php
  57. 1 1
      htdocs/opensurvey/card.php
  58. 6 4
      htdocs/opensurvey/class/opensurveysondage.class.php
  59. 1 1
      htdocs/opensurvey/lib/opensurvey.lib.php
  60. 5 4
      htdocs/opensurvey/list.php
  61. 1 1
      htdocs/opensurvey/results.php

+ 6 - 2
htdocs/intracommreport/card.php

@@ -84,8 +84,12 @@ $permissiontodelete = $user->rights->intracommreport->delete;
 //if ($user->socid > 0) $socid = $user->socid;
 //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
 //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->intracommreport->enabled)) accessforbidden();
-if (!$permissiontoread) accessforbidden();
+if (empty($conf->intracommreport->enabled)) {
+	accessforbidden();
+}
+if (!$permissiontoread) {
+	accessforbidden();
+}
 
 
 

+ 0 - 1
htdocs/intracommreport/class/intracommreport.class.php

@@ -401,7 +401,6 @@ class IntracommReport extends CommonObject
 	 */
 	public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i)
 	{
-
 		global $conf;
 
 		if ($type == 'expedition') {

+ 7 - 5
htdocs/intracommreport/list.php

@@ -38,7 +38,7 @@ $show_files = GETPOST('show_files', 'int');
 $confirm = GETPOST('confirm', 'alpha');
 $toselect = GETPOST('toselect', 'array');
 
-$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
+$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
 $search_ref = GETPOST("search_ref", 'alpha');
 $search_type = GETPOST("search_type", 'int');
 $optioncss = GETPOST('optioncss', 'alpha');
@@ -46,7 +46,7 @@ $type = GETPOST("type", "int");
 
 $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;
 
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -65,14 +65,16 @@ if (!$sortorder) {
 }
 
 // Initialize context for list
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'intracommreportlist';
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'intracommreportlist';
 if ((string) $type == '1') {
-	$contextpage = 'DESlist'; if ($search_type == '') {
+	$contextpage = 'DESlist';
+	if ($search_type == '') {
 		$search_type = '1';
 	}
 }
 if ((string) $type == '0') {
-	$contextpage = 'DEBlist'; if ($search_type == '') {
+	$contextpage = 'DEBlist';
+	if ($search_type == '') {
 		$search_type = '0';
 	}
 }

+ 8 - 4
htdocs/knowledgemanagement/class/knowledgerecord.class.php

@@ -599,13 +599,15 @@ class KnowledgeRecord extends CommonObject
 				$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'knowledgerecord/".$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();
 				}
 				$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'knowledgerecord/".$this->db->escape($this->newref)."'";
 				$sql .= " WHERE filepath = 'knowledgerecord/".$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
@@ -809,7 +811,7 @@ class KnowledgeRecord extends CommonObject
 				$label = $langs->trans("ShowKnowledgeRecord");
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
 			}
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
 			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
 		} else {
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
@@ -912,7 +914,9 @@ class KnowledgeRecord extends CommonObject
 		}
 
 		$statusType = 'status'.$status;
-		if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
+		if ($status == self::STATUS_VALIDATED) {
+			$statusType = 'status4';
+		}
 		if ($status == self::STATUS_CANCELED) {
 			$statusType = 'status6';
 		}

+ 4 - 2
htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php

@@ -83,7 +83,8 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord
 	{
 		global $conf, $langs, $db;
 
-		$coyymm = ''; $max = '';
+		$coyymm = '';
+		$max = '';
 
 		$posindice = strlen($this->prefix) + 6;
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
@@ -99,7 +100,8 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord
 		if ($resql) {
 			$row = $db->fetch_row($resql);
 			if ($row) {
-				$coyymm = substr($row[0], 0, 6); $max = $row[0];
+				$coyymm = substr($row[0], 0, 6);
+				$max = $row[0];
 			}
 		}
 		if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {

+ 0 - 1
htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php

@@ -37,7 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
  */
 abstract class ModelePDFKnowledgeRecord extends CommonDocGenerator
 {
-
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *  Return list of active generation modules

+ 1 - 1
htdocs/knowledgemanagement/knowledgerecord_agenda.php

@@ -54,7 +54,7 @@ if (GETPOST('actioncode', 'array')) {
 $search_rowid = GETPOST('search_rowid');
 $search_agenda_label = GETPOST('search_agenda_label');
 
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

+ 1 - 1
htdocs/knowledgemanagement/knowledgerecord_contact.php

@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_kno
 // Load translation files required by the page
 $langs->loadLangs(array("knowledgemanagement", "companies", "other", "mails"));
 
-$id     = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
+$id     = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
 $ref    = GETPOST('ref', 'alpha');
 $lineid = GETPOST('lineid', 'int');
 $socid  = GETPOST('socid', 'int');

+ 1 - 1
htdocs/knowledgemanagement/knowledgerecord_document.php

@@ -113,7 +113,7 @@ if ($object->id) {
 
 
 	// Build file list
-	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
 	$totalsize = 0;
 	foreach ($filearray as $key => $file) {
 		$totalsize += $file['size'];

+ 1 - 1
htdocs/knowledgemanagement/knowledgerecord_list.php

@@ -43,7 +43,7 @@ if (isModEnabled('categorie')) {
 // Load translation files required by the page
 $langs->loadLangs(array("knowledgemanagement", "other"));
 
-$action     = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$action     = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
 $confirm    = GETPOST('confirm', 'alpha'); // Result of a confirmation

+ 1 - 1
htdocs/knowledgemanagement/knowledgerecord_note.php

@@ -134,7 +134,7 @@ if ($id > 0 || !empty($ref)) {
 	 }
 	 }
 	 }*/
-	 $morehtmlref .= '</div>';
+	$morehtmlref .= '</div>';
 
 
 	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

+ 11 - 7
htdocs/loan/card.php

@@ -110,19 +110,23 @@ if (empty($reshook)) {
 			$rate = price2num(GETPOST('rate'));
 
 			if (!$capital) {
-				$error++; $action = 'create';
+				$error++;
+				$action = 'create';
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
 			}
 			if (!$datestart) {
-				$error++; $action = 'create';
+				$error++;
+				$action = 'create';
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
 			}
 			if (!$dateend) {
-				$error++; $action = 'create';
+				$error++;
+				$action = 'create';
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
 			}
 			if ($rate == '') {
-				$error++; $action = 'create';
+				$error++;
+				$action = 'create';
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
 			}
 
@@ -357,19 +361,19 @@ if ($action == 'create') {
 		// Accountancy_account_capital
 		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
 		print '<td>';
-		print $formaccounting->select_account(GETPOST('accountancy_account_capital') ?GETPOST('accountancy_account_capital') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_CAPITAL'), 'accountancy_account_capital', 1, '', 1, 1);
+		print $formaccounting->select_account(GETPOST('accountancy_account_capital') ? GETPOST('accountancy_account_capital') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_CAPITAL'), 'accountancy_account_capital', 1, '', 1, 1);
 		print '</td></tr>';
 
 		// Accountancy_account_insurance
 		print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
 		print '<td>';
-		print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ?GETPOST('accountancy_account_insurance') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INSURANCE'), 'accountancy_account_insurance', 1, '', 1, 1);
+		print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ? GETPOST('accountancy_account_insurance') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INSURANCE'), 'accountancy_account_insurance', 1, '', 1, 1);
 		print '</td></tr>';
 
 		// Accountancy_account_interest
 		print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInterestCode").'</td>';
 		print '<td>';
-		print $formaccounting->select_account(GETPOST('accountancy_account_interest') ?GETPOST('accountancy_account_interest') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INTEREST'), 'accountancy_account_interest', 1, '', 1, 1);
+		print $formaccounting->select_account(GETPOST('accountancy_account_interest') ? GETPOST('accountancy_account_interest') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INTEREST'), 'accountancy_account_interest', 1, '', 1, 1);
 		print '</td></tr>';
 	} else {
 		// For external software

+ 1 - 1
htdocs/loan/class/loan.class.php

@@ -588,7 +588,7 @@ class Loan extends CommonObject
 			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
 		}
 		if ($withpicto != 2) {
-			$result .= ($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref);
+			$result .= ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref);
 		}
 		$result .= $linkend;
 

+ 4 - 3
htdocs/loan/class/loanschedule.class.php

@@ -352,7 +352,8 @@ class LoanSchedule 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
@@ -387,7 +388,8 @@ class LoanSchedule 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();
 			}
 		}
 
@@ -565,7 +567,6 @@ class LoanSchedule extends CommonObject
 	 */
 	public function paimenttorecord($loanid, $datemax)
 	{
-
 		$result = array();
 
 		$sql = "SELECT p.rowid";

+ 16 - 13
htdocs/loan/class/paymentloan.class.php

@@ -350,7 +350,7 @@ class PaymentLoan extends CommonObject
 		$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
 		$sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").",";
 		$sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").",";
-		$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ?((int) $this->fk_user_modif) : "null");
+		$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null");
 		$sql .= " WHERE rowid=".((int) $this->id);
 
 		$this->db->begin();
@@ -358,7 +358,8 @@ class PaymentLoan 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
@@ -397,7 +398,8 @@ class PaymentLoan 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();
 			}
 		}
 
@@ -408,7 +410,8 @@ class PaymentLoan 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();
 			}
 		}
 
@@ -431,15 +434,15 @@ class PaymentLoan extends CommonObject
 		//{
 		//	if (! $notrigger)
 		//	{
-				// Uncomment this and change MYOBJECT to your own tag if you
-				// want this action call a trigger.
-
-				//// Call triggers
-				//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
-				//$interface=new Interfaces($this->db);
-				//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
-				//if ($result < 0) { $error++; $this->errors=$interface->errors; }
-				//// End call triggers
+		// Uncomment this and change MYOBJECT to your own tag if you
+		// want this action call a trigger.
+
+		//// Call triggers
+		//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
+		//$interface=new Interfaces($this->db);
+		//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
+		//if ($result < 0) { $error++; $this->errors=$interface->errors; }
+		//// End call triggers
 		//	}
 		//}
 

+ 1 - 1
htdocs/loan/document.php

@@ -147,7 +147,7 @@ if ($object->id) {
 
 
 	// Build file list
-	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
 	$totalsize = 0;
 	foreach ($filearray as $key => $file) {
 		$totalsize += $file['size'];

+ 65 - 66
htdocs/loan/payment/payment.php

@@ -196,8 +196,7 @@ if ($action == 'add_payment') {
 							break;
 						}
 					}
-				} else // Only add fk_bank bank to schedule line (mark as paid)
-				{
+				} else { // Only add fk_bank bank to schedule line (mark as paid)
 					$line->fk_bank = $payment->fk_bank;
 					$line->fk_payment_loan = $payment->id;
 					$result = $line->update($user, 0);
@@ -282,62 +281,62 @@ if ($action == 'create') {
 	print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
 	if (empty($datepaid)) {
 		if (empty($ts_temppaid)) {
-			$datepayment = !getDolGlobalString('MAIN_AUTOFILL_DATE') ?-1 : dol_now();
+			$datepayment = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : dol_now();
 		} else {
 			$datepayment = $ts_temppaid;
 		}
 	} else {
 		$datepayment = $datepaid;
 	}
-		print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
-		print "</td>";
-		print '</tr>';
-
-		print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td colspan="2">';
-		print img_picto('', 'money-bill-alt', 'class="pictofixedwidth"');
-		$form->select_types_paiements(GETPOSTISSET("paymenttype") ? GETPOST("paymenttype", 'alphanohtml') : $loan->fk_typepayment, "paymenttype");
-		print "</td>\n";
-		print '</tr>';
-
-		print '<tr>';
-		print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
-		print '<td colspan="2">';
-		print img_picto('', 'bank_account', 'class="pictofixedwidth"');
-		$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $loan->accountid, "accountid", 0, 'courant = '.Account::TYPE_CURRENT, 1); // Show opend bank account list
-		print '</td></tr>';
-
-		// Number
-		print '<tr><td>'.$langs->trans('Numero');
-		print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
-		print '</td>';
-		print '<td colspan="2"><input name="num_payment" type="text" value="'.GETPOST('num_payment', 'alphanohtml').'"></td>'."\n";
-		print "</tr>";
-
-		print '<tr>';
-		print '<td class="tdtop">'.$langs->trans("NotePrivate").'</td>';
-		print '<td valign="top" colspan="2"><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
-		print '</tr>';
-
-		print '<tr>';
-		print '<td class="tdtop">'.$langs->trans("NotePublic").'</td>';
-		print '<td valign="top" colspan="2"><textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
-		print '</tr>';
-
-		print '</table>';
-
-		print dol_get_fiche_end();
-
-
-		print '<table class="noborder centpercent">';
-		print '<tr class="liste_titre">';
-		print '<td class="left">'.$langs->trans("DateDue").'</td>';
-		print '<td class="right">'.$langs->trans("LoanCapital").'</td>';
-		print '<td class="right">'.$langs->trans("AlreadyPaid").'</td>';
-		print '<td class="right">'.$langs->trans("RemainderToPay").'</td>';
-		print '<td class="right">'.$langs->trans("Amount").'</td>';
-		print "</tr>\n";
-
-		print '<tr class="oddeven">';
+	print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
+	print "</td>";
+	print '</tr>';
+
+	print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td colspan="2">';
+	print img_picto('', 'money-bill-alt', 'class="pictofixedwidth"');
+	$form->select_types_paiements(GETPOSTISSET("paymenttype") ? GETPOST("paymenttype", 'alphanohtml') : $loan->fk_typepayment, "paymenttype");
+	print "</td>\n";
+	print '</tr>';
+
+	print '<tr>';
+	print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
+	print '<td colspan="2">';
+	print img_picto('', 'bank_account', 'class="pictofixedwidth"');
+	$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $loan->accountid, "accountid", 0, 'courant = '.Account::TYPE_CURRENT, 1); // Show opend bank account list
+	print '</td></tr>';
+
+	// Number
+	print '<tr><td>'.$langs->trans('Numero');
+	print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
+	print '</td>';
+	print '<td colspan="2"><input name="num_payment" type="text" value="'.GETPOST('num_payment', 'alphanohtml').'"></td>'."\n";
+	print "</tr>";
+
+	print '<tr>';
+	print '<td class="tdtop">'.$langs->trans("NotePrivate").'</td>';
+	print '<td valign="top" colspan="2"><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
+	print '</tr>';
+
+	print '<tr>';
+	print '<td class="tdtop">'.$langs->trans("NotePublic").'</td>';
+	print '<td valign="top" colspan="2"><textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
+	print '</tr>';
+
+	print '</table>';
+
+	print dol_get_fiche_end();
+
+
+	print '<table class="noborder centpercent">';
+	print '<tr class="liste_titre">';
+	print '<td class="left">'.$langs->trans("DateDue").'</td>';
+	print '<td class="right">'.$langs->trans("LoanCapital").'</td>';
+	print '<td class="right">'.$langs->trans("AlreadyPaid").'</td>';
+	print '<td class="right">'.$langs->trans("RemainderToPay").'</td>';
+	print '<td class="right">'.$langs->trans("Amount").'</td>';
+	print "</tr>\n";
+
+	print '<tr class="oddeven">';
 
 	if ($loan->datestart > 0) {
 		print '<td class="left" valign="center">'.dol_print_date($loan->datestart, 'day').'</td>';
@@ -345,39 +344,39 @@ if ($action == 'create') {
 		print '<td class="center" valign="center"><b>!!!</b></td>';
 	}
 
-		print '<td class="right" valign="center">'.price($loan->capital)."</td>";
+	print '<td class="right" valign="center">'.price($loan->capital)."</td>";
 
-		print '<td class="right" valign="center">'.price($sumpaid)."</td>";
+	print '<td class="right" valign="center">'.price($sumpaid)."</td>";
 
-		print '<td class="right" valign="center">'.price($loan->capital - $sumpaid)."</td>";
+	print '<td class="right" valign="center">'.price($loan->capital - $sumpaid)."</td>";
 
-		print '<td class="right">';
+	print '<td class="right">';
 	if ($sumpaid < $loan->capital) {
-		print $langs->trans("LoanCapital").': <input type="text" size="8" name="amount_capital" value="'.(GETPOSTISSET('amount_capital') ?GETPOST('amount_capital') : $amount_capital).'">';
+		print $langs->trans("LoanCapital").': <input type="text" size="8" name="amount_capital" value="'.(GETPOSTISSET('amount_capital') ? GETPOST('amount_capital') : $amount_capital).'">';
 	} else {
 		print '-';
 	}
-		print '<br>';
+	print '<br>';
 	if ($sumpaid < $loan->capital) {
-		print $langs->trans("Insurance").': <input type="text" size="8" name="amount_insurance" value="'.(GETPOSTISSET('amount_insurance') ?GETPOST('amount_insurance') : $amount_insurance).'">';
+		print $langs->trans("Insurance").': <input type="text" size="8" name="amount_insurance" value="'.(GETPOSTISSET('amount_insurance') ? GETPOST('amount_insurance') : $amount_insurance).'">';
 	} else {
 		print '-';
 	}
-		print '<br>';
+	print '<br>';
 	if ($sumpaid < $loan->capital) {
-		print $langs->trans("Interest").': <input type="text" size="8" name="amount_interest" value="'.(GETPOSTISSET('amount_interest') ?GETPOST('amount_interest') : $amount_interest).'" '.(!empty($line) ? 'disabled title="'.$langs->trans('CantModifyInterestIfScheduleIsUsed').'"' : '').'>';
+		print $langs->trans("Interest").': <input type="text" size="8" name="amount_interest" value="'.(GETPOSTISSET('amount_interest') ? GETPOST('amount_interest') : $amount_interest).'" '.(!empty($line) ? 'disabled title="'.$langs->trans('CantModifyInterestIfScheduleIsUsed').'"' : '').'>';
 	} else {
 		print '-';
 	}
-		print "</td>";
+	print "</td>";
 
-		print "</tr>\n";
+	print "</tr>\n";
 
-		print '</table>';
+	print '</table>';
 
-		print $form->buttonsSaveCancel();
+	print $form->buttonsSaveCancel();
 
-		print "</form>\n";
+	print "</form>\n";
 }
 
 llxFooter();

+ 3 - 3
htdocs/margin/admin/margin.php

@@ -65,7 +65,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
 
 if ($action == 'remises') {
 	if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', GETPOST('MARGIN_METHODE_FOR_DISCOUNT'), 'chaine', 0, '', $conf->entity) > 0) {
-		  setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
+		setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
 	} else {
 		dol_print_error($db);
 	}
@@ -73,7 +73,7 @@ if ($action == 'remises') {
 
 if ($action == 'typemarges') {
 	if (dolibarr_set_const($db, 'MARGIN_TYPE', GETPOST('MARGIN_TYPE'), 'chaine', 0, '', $conf->entity) > 0) {
-		  setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
+		setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
 	} else {
 		dol_print_error($db);
 	}
@@ -81,7 +81,7 @@ if ($action == 'typemarges') {
 
 if ($action == 'contact') {
 	if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0) {
-		  setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
+		setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
 	} else {
 		dol_print_error($db);
 	}

+ 2 - 2
htdocs/margin/agentMargins.php

@@ -36,7 +36,7 @@ $langs->loadLangs(array('companies', 'bills', 'products', 'margins'));
 $mesg = '';
 
 // Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -157,7 +157,7 @@ $sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))'
 
 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
 $sql .= ", ".MAIN_DB_PREFIX."facture as f";
-$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(!getDolGlobalString('AGENT_CONTACT_TYPE') ?-1 : $conf->global->AGENT_CONTACT_TYPE);
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(!getDolGlobalString('AGENT_CONTACT_TYPE') ? -1 : $conf->global->AGENT_CONTACT_TYPE);
 $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
 $sql .= ", ".MAIN_DB_PREFIX."user as u";

+ 4 - 3
htdocs/margin/checkMargins.php

@@ -35,12 +35,12 @@ $langs->loadLangs(array('companies', 'bills', 'products', 'margins'));
 $action     = GETPOST('action', 'alpha');
 $massaction = GETPOST('massaction', 'alpha');
 $toselect   = GETPOST('toselect', 'array');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'margindetail'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'margindetail'; // To manage different context of search
 $backtopage = GETPOST('backtopage', 'alpha');
 $optioncss  = GETPOST('optioncss', 'alpha');
 
 // Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -80,7 +80,8 @@ if (GETPOST("button_search_x") || GETPOST("button_search")) {
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';

+ 6 - 6
htdocs/margin/customerMargins.php

@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
 $langs->loadLangs(array('companies', 'bills', 'products', 'margins'));
 
 // Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -52,7 +52,7 @@ if (!$sortorder) {
 
 $startdate = $enddate = '';
 if (GETPOST('startdatemonth')) {
-	$startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'),  GETPOST('startdateday', 'int'),  GETPOST('startdateyear', 'int'));
+	$startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int'));
 }
 if (GETPOST('enddatemonth')) {
 	$enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear'));
@@ -347,8 +347,8 @@ if ($result) {
 			$marge = $objp->marge;
 
 			if ($marge < 0) {
-				$marginRate = ($pa != 0) ?-1 * (100 * $marge / $pa) : '';
-				$markRate = ($pv != 0) ?-1 * (100 * $marge / $pv) : '';
+				$marginRate = ($pa != 0) ? -1 * (100 * $marge / $pa) : '';
+				$markRate = ($pv != 0) ? -1 * (100 * $marge / $pv) : '';
 			} else {
 				$marginRate = ($pa != 0) ? (100 * $marge / $pa) : '';
 				$markRate = ($pv != 0) ? (100 * $marge / $pv) : '';
@@ -401,8 +401,8 @@ if ($result) {
 	}
 	else
 	{*/
-		$marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : '';
-		$markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : '';
+	$marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : '';
+	$markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : '';
 	//}
 
 	print '<tr class="liste_total">';

+ 4 - 4
htdocs/margin/productMargins.php

@@ -43,7 +43,7 @@ $socid = 0;
 $mesg = '';
 
 // Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -65,7 +65,7 @@ if (!$sortfield) {
 
 $startdate = $enddate = '';
 if (GETPOST('startdatemonth')) {
-	$startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'),  GETPOST('startdateday', 'int'),  GETPOST('startdateyear', 'int'));
+	$startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int'));
 }
 if (GETPOST('enddatemonth')) {
 	$enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear'));
@@ -300,8 +300,8 @@ if ($result) {
 			$marge = $objp->marge;
 
 			if ($marge < 0) {
-				$marginRate = ($pa != 0) ?-1 * (100 * $marge / $pa) : '';
-				$markRate = ($pv != 0) ?-1 * (100 * $marge / $pv) : '';
+				$marginRate = ($pa != 0) ? -1 * (100 * $marge / $pa) : '';
+				$markRate = ($pv != 0) ? -1 * (100 * $marge / $pv) : '';
 			} else {
 				$marginRate = ($pa != 0) ? (100 * $marge / $pa) : '';
 				$markRate = ($pv != 0) ? (100 * $marge / $pv) : '';

+ 2 - 2
htdocs/margin/tabs/productMargins.php

@@ -253,8 +253,8 @@ if ($id > 0 || !empty($ref)) {
 
 				$totalMargin = $cumul_vente - $cumul_achat;
 				if ($totalMargin < 0) {
-					$marginRate = ($cumul_achat != 0) ?-1 * (100 * $totalMargin / $cumul_achat) : '';
-					$markRate = ($cumul_vente != 0) ?-1 * (100 * $totalMargin / $cumul_vente) : '';
+					$marginRate = ($cumul_achat != 0) ? -1 * (100 * $totalMargin / $cumul_achat) : '';
+					$markRate = ($cumul_vente != 0) ? -1 * (100 * $totalMargin / $cumul_vente) : '';
 				} else {
 					$marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : '';
 					$markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : '';

+ 2 - 2
htdocs/margin/tabs/thirdpartyMargins.php

@@ -264,8 +264,8 @@ if ($socid > 0) {
 
 		$totalMargin = $cumul_vente - $cumul_achat;
 		if ($totalMargin < 0) {
-			$marginRate = ($cumul_achat != 0) ?-1 * (100 * $totalMargin / $cumul_achat) : '';
-			$markRate = ($cumul_vente != 0) ?-1 * (100 * $totalMargin / $cumul_vente) : '';
+			$marginRate = ($cumul_achat != 0) ? -1 * (100 * $totalMargin / $cumul_achat) : '';
+			$markRate = ($cumul_vente != 0) ? -1 * (100 * $totalMargin / $cumul_vente) : '';
 		} else {
 			$marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : '';
 			$markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : '';

+ 124 - 124
htdocs/modulebuilder/index.php

@@ -1455,13 +1455,13 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
 
 			$moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php';
 		}
-			// TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1
-			// TODO Avoid duplicate addition
+		// TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1
+		// TODO Avoid duplicate addition
 
-			// load class and check if menu exist with same object name
-			$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
-			dol_include_once($pathtofile);
-				$class = 'mod'.$module;
+		// load class and check if menu exist with same object name
+		$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
+		dol_include_once($pathtofile);
+		$class = 'mod'.$module;
 		if (class_exists($class)) {
 			try {
 				$moduleobj = new $class($db);
@@ -1470,8 +1470,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
 				dol_print_error($db, $e->getMessage());
 			}
 		}
-			$menus = $moduleobj->menu;
-			$counter = 0 ;
+		$menus = $moduleobj->menu;
+		$counter = 0 ;
 		foreach ($menus as $menu) {
 			if ($menu['leftmenu'] == strtolower($objectname)) {
 				$counter++;
@@ -1486,8 +1486,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
 				dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($objectname).'*/'.$stringtoadd."\n\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */'));
 			}
 		}
-			// Add module descriptor to list of files to replace "MyObject' string with real name of object.
-			$filetogenerate[] = 'core/modules/mod'.$module.'.class.php';
+		// Add module descriptor to list of files to replace "MyObject' string with real name of object.
+		$filetogenerate[] = 'core/modules/mod'.$module.'.class.php';
 	}
 
 	if (!$error) {
@@ -1917,7 +1917,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
 		// load class and check if menu,permission,documentation exist for this object
 		$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
 		dol_include_once($pathtofile);
-			$class = 'mod'.$module;
+		$class = 'mod'.$module;
 		if (class_exists($class)) {
 			try {
 				$moduleobj = new $class($db);
@@ -2091,7 +2091,7 @@ if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey')) {
 	$destdir = $dirins.'/'.strtolower($module);
 	$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
 	dol_include_once($pathtofile);
-		$class = 'mod'.$module;
+	$class = 'mod'.$module;
 
 	if (class_exists($class)) {
 		try {
@@ -2212,7 +2212,7 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
 	// load class and check if right exist
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
 	dol_include_once($pathtofile);
-		$class = 'mod'.$module;
+	$class = 'mod'.$module;
 	if (class_exists($class)) {
 		try {
 			$moduleobj = new $class($db);
@@ -2283,9 +2283,9 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
 			setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
 		}
 	}
-		$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
-		//rewriting all permissions after add a right
-		$rewrite = checkExistComment($moduledescriptorfile, 1);
+	$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+	//rewriting all permissions after add a right
+	$rewrite = checkExistComment($moduledescriptorfile, 1);
 	if ($rewrite < 0) {
 		setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings');
 	} else {
@@ -2308,7 +2308,7 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
 	// load class and check if right exist
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
 	dol_include_once($pathtofile);
-		$class = 'mod'.$module;
+	$class = 'mod'.$module;
 	if (class_exists($class)) {
 		try {
 			$moduleobj = new $class($db);
@@ -2351,15 +2351,15 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
 	$x1 = $permissions[$key][1];
 	$x2 = $permissions[$key][4];
 	$x3 = $permissions[$key][5];
-		//check existing object permission
-		$counter = 0;
-		$permsForObject =array();
-		$permissions = $moduleobj->rights;
-		$firstRight = 0;
-		$existRight = 0;
-		$allObject = array();
+	//check existing object permission
+	$counter = 0;
+	$permsForObject =array();
+	$permissions = $moduleobj->rights;
+	$firstRight = 0;
+	$existRight = 0;
+	$allObject = array();
 
-		$countPerms = count($permissions);
+	$countPerms = count($permissions);
 	for ($i =0; $i<$countPerms; $i++) {
 		if ($permissions[$i][4] == $objectForPerms) {
 			$counter++;
@@ -2585,7 +2585,7 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) {
 	// load class and check if menu exist
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
 	dol_include_once($pathtofile);
-		$class = 'mod'.$module;
+	$class = 'mod'.$module;
 	if (class_exists($class)) {
 		try {
 			$moduleobj = new $class($db);
@@ -2647,7 +2647,7 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
 	// load class and check if right exist
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
 	dol_include_once($pathtofile);
-		$class = 'mod'.$module;
+	$class = 'mod'.$module;
 	if (class_exists($class)) {
 		try {
 			$moduleobj = new $class($db);
@@ -2706,9 +2706,9 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
 			setEventMessages($langs->trans("WarningFieldsMustContains", $langs->transnoentities("leftmenu")), null, 'errors');
 		}
 	}
-	 $dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
-	 $destdir = $dirins.'/'.strtolower($module);
-	 $objects = dolGetListOfObjectClasses($destdir);
+	$dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
+	$destdir = $dirins.'/'.strtolower($module);
+	$objects = dolGetListOfObjectClasses($destdir);
 
 	if (GETPOST('type', 'alpha') == 'left') {
 		if (empty(GETPOST('leftmenu')) && count($objects) >0) {
@@ -2816,8 +2816,8 @@ if ($dirins && $action == "update_menu" && GETPOST('menukey', 'int') && GETPOST(
 		$key = (int) GETPOST('menukey', 'int') - 1;
 
 		$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
-			//stock forms in array
-			$menuModify = array(
+		//stock forms in array
+		$menuModify = array(
 				'fk_menu' => GETPOST('fk_menu', 'alpha'),
 				'type'  => GETPOST('type', 'alpha'),
 				'titre' => ucfirst(GETPOST('titre', 'alpha')),
@@ -2831,52 +2831,52 @@ if ($dirins && $action == "update_menu" && GETPOST('menukey', 'int') && GETPOST(
 				'target' => GETPOST('target', 'alpha'),
 				'user' => GETPOST('user', 'alpha'),
 			);
-			if (!empty(GETPOST('fk_menu')) && GETPOST('fk_menu') != $menus[$key]['fk_menu']) {
-				$menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu').',fk_leftmenu='.GETPOST('fk_menu');
-			} elseif (GETPOST('fk_menu') == $menus[$key]['fk_menu']) {
-				$menuModify['fk_menu'] = $menus[$key]['fk_menu'];
-			} else {
-				$menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu');
-			}
-			if ($menuModify['enabled'] === '') {
-				$menuModify['enabled'] = '1';
-			}
-			if ($menuModify['perms'] === '') {
-				$menuModify['perms'] = '1';
-			}
-
-			if (GETPOST('type', 'alpha') == 'top') {
-				$error++;
-				setEventMessages($langs->trans("ErrorTypeMenu", $langs->transnoentities("type")), null, 'errors');
-			}
+		if (!empty(GETPOST('fk_menu')) && GETPOST('fk_menu') != $menus[$key]['fk_menu']) {
+			$menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu').',fk_leftmenu='.GETPOST('fk_menu');
+		} elseif (GETPOST('fk_menu') == $menus[$key]['fk_menu']) {
+			$menuModify['fk_menu'] = $menus[$key]['fk_menu'];
+		} else {
+			$menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu');
+		}
+		if ($menuModify['enabled'] === '') {
+			$menuModify['enabled'] = '1';
+		}
+		if ($menuModify['perms'] === '') {
+			$menuModify['perms'] = '1';
+		}
 
-			if (!$error) {
-				//update menu
-				$checkComment = checkExistComment($moduledescriptorfile, 0);
+		if (GETPOST('type', 'alpha') == 'top') {
+			$error++;
+			setEventMessages($langs->trans("ErrorTypeMenu", $langs->transnoentities("type")), null, 'errors');
+		}
 
-				if ($checkComment < 0) {
-					setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings');
-				} else {
-					// Write all menus
-					$result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2);
+		if (!$error) {
+			//update menu
+			$checkComment = checkExistComment($moduledescriptorfile, 0);
 
-					clearstatcache(true);
-					if (function_exists('opcache_invalidate')) {
-						opcache_reset();
-					}
+			if ($checkComment < 0) {
+				setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings');
+			} else {
+				// Write all menus
+				$result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2);
 
-					if ($result < 0) {
-						setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors');
-						//var_dump($_SESSION);exit;
-						header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1));
-						exit;
-					}
+				clearstatcache(true);
+				if (function_exists('opcache_invalidate')) {
+					opcache_reset();
+				}
 
-					setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null);
-					header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
+				if ($result < 0) {
+					setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors');
+					//var_dump($_SESSION);exit;
+					header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1));
 					exit;
 				}
+
+				setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null);
+				header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
+				exit;
 			}
+		}
 	} else {
 		$_POST['type'] = '';
 		$_POST['titre'] = '';
@@ -2904,7 +2904,7 @@ if ($dirins && $action == "update_props_module" && !empty(GETPOST('keydescriptio
 
 	dol_include_once($pathtofile);
 
-		$class = 'mod'.$module;
+	$class = 'mod'.$module;
 	if (class_exists($class)) {
 		try {
 			$moduleobj = new $class($db);
@@ -3322,7 +3322,7 @@ if ($module == 'initmodule') {
 		$h++;
 
 		$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '');
-		$head2[$h][1] = ($countDictionaries == 0  ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').'<span class="marginleftonlyshort badge">'.$countDictionaries."</span>");
+		$head2[$h][1] = ($countDictionaries == 0 ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').'<span class="marginleftonlyshort badge">'.$countDictionaries."</span>");
 		$head2[$h][2] = 'dictionaries';
 		$h++;
 
@@ -3633,7 +3633,7 @@ if ($module == 'initmodule') {
 				print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', 0, 'formodulesuffix');
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', '');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 
 				print dol_get_fiche_end();
 
@@ -3713,7 +3713,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'text'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'text'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -3845,7 +3845,7 @@ if ($module == 'initmodule') {
 
 				print '</form>';
 			} elseif ($tabobj == 'createproperty') {
-				$attributesUnique = array (
+				$attributesUnique = array(
 					'proplabel' => $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")),
 					'propname' => $form->textwithpicto($langs->trans("Code"), $langs->trans("PropertyDesc"), 1, 'help', 'extracss', 0, 3, 'propertyhelp'),
 					'proptype' => $form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelpIntro").'<br><br>'.$langs->trans("TypeOfFieldsHelp"), 1, 'help', 'extracss', 0, 3, 'typehelp'),
@@ -4006,7 +4006,7 @@ if ($module == 'initmodule') {
 					// Print form confirm
 					print $formconfirm;
 				}
-				if ($action != 'editfile' || empty($file) ) {
+				if ($action != 'editfile' || empty($file)) {
 					try {
 						//$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
 
@@ -4133,7 +4133,7 @@ if ($module == 'initmodule') {
 
 						// API file
 						print '<br>';
-						print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'</span></strike>').'</strong>';
+						print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi) ? '' : '</span></strike>').'</strong>';
 						if (dol_is_file($realpathtoapi)) {
 							$file = file_get_contents($realpathtoapi);
 							if (preg_match('/var '.$tabobj.'\s+([^\s]*)\s/ims', $file, $objs)) {
@@ -4155,7 +4155,7 @@ if ($module == 'initmodule') {
 						}
 						// PHPUnit
 						print '<br>';
-						print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtophpunit) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit)?'':'</span></strike>').'</strong>';
+						print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtophpunit) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit) ? '' : '</span></strike>').'</strong>';
 						if (dol_is_file($realpathtophpunit)) {
 							print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
 							print ' ';
@@ -4344,26 +4344,26 @@ if ($module == 'initmodule') {
 									$propname = $propkey;
 									$proplabel = $propval['label'];
 									$proptype = $propval['type'];
-									$proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:'';
+									$proparrayofkeyval = !empty($propval['arrayofkeyval']) ? $propval['arrayofkeyval'] : '';
 									$propnotnull = !empty($propval['notnull']) ? $propval['notnull'] : '0';
-									$propdefault = !empty($propval['default'])?$propval['default']:'';
-									$propindex = !empty($propval['index'])?$propval['index']:'';
-									$propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:'';
+									$propdefault = !empty($propval['default']) ? $propval['default'] : '';
+									$propindex = !empty($propval['index']) ? $propval['index'] : '';
+									$propforeignkey = !empty($propval['foreignkey']) ? $propval['foreignkey'] : '';
 									$propposition = $propval['position'];
 									$propenabled = $propval['enabled'];
 									$propvisible = $propval['visible'];
-									$propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0;
+									$propnoteditable = !empty($propval['noteditable']) ? $propval['noteditable'] : 0;
 									//$propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0;
-									$propsearchall = !empty($propval['searchall'])?$propval['searchall']:0;
-									$propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0;
-									$propcss = !empty($propval['css'])?$propval['css']:'';
-									$propcssview = !empty($propval['cssview'])?$propval['cssview']:'';
-									$propcsslist = !empty($propval['csslist'])?$propval['csslist']:'';
-									$prophelp = !empty($propval['help'])?$propval['help']:'';
-									$propshowoncombobox = !empty($propval['showoncombobox'])?$propval['showoncombobox']:0;
+									$propsearchall = !empty($propval['searchall']) ? $propval['searchall'] : 0;
+									$propisameasure = !empty($propval['isameasure']) ? $propval['isameasure'] : 0;
+									$propcss = !empty($propval['css']) ? $propval['css'] : '';
+									$propcssview = !empty($propval['cssview']) ? $propval['cssview'] : '';
+									$propcsslist = !empty($propval['csslist']) ? $propval['csslist'] : '';
+									$prophelp = !empty($propval['help']) ? $propval['help'] : '';
+									$propshowoncombobox = !empty($propval['showoncombobox']) ? $propval['showoncombobox'] : 0;
 									//$propdisabled=$propval['disabled'];
-									$propvalidate = !empty($propval['validate'])?$propval['validate']:0;
-									$propcomment = !empty($propval['comment'])?$propval['comment']:'';
+									$propvalidate = !empty($propval['validate']) ? $propval['validate'] : 0;
+									$propcomment = !empty($propval['comment']) ? $propval['comment'] : '';
 
 									print '<!-- line for object property -->'."\n";
 									print '<tr class="oddeven">';
@@ -4464,7 +4464,7 @@ if ($module == 'initmodule') {
 										} elseif (strpos($proptype, 'real') === 0) {
 											$pictoType = 'double';
 										}
-										print (!empty($pictoType) ? getPictoForType($pictoType) : getPictoForType($proptype)).'<span title="'.dol_escape_htmltag($proptype).'">'.dol_escape_htmltag($proptype).'</span>';
+										print(!empty($pictoType) ? getPictoForType($pictoType) : getPictoForType($proptype)).'<span title="'.dol_escape_htmltag($proptype).'">'.dol_escape_htmltag($proptype).'</span>';
 										print '</td>';
 										print '<td class="tdoverflowmax200">';
 										if ($proparrayofkeyval) {
@@ -4580,7 +4580,7 @@ if ($module == 'initmodule') {
 										print '<input type="hidden" name="module" value="'.$module.'">';
 
 										$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-										print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+										print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 										print '<br>';
 										print '<center>';
 										print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -4622,7 +4622,7 @@ if ($module == 'initmodule') {
 					print '<input type="hidden" name="module" value="'.$module.($forceddirread ? '@'.$dirread : '').'">';
 
 					$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-					print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+					print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 					print '<br>';
 					print '<center>';
 					print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -4766,7 +4766,7 @@ if ($module == 'initmodule') {
 								print '<input type="hidden" name="dictionnarykey" value="'.($i+1).'">';
 
 								print '<td class="tdsticky tdstickygray">';
-								print ($i + 1);
+								print($i + 1);
 								print '</td>';
 
 								print '<td>';
@@ -4819,7 +4819,7 @@ if ($module == 'initmodule') {
 								print '<tr class="oddeven">';
 
 								print '<td class="tdsticky tdstickygray">';
-								print ($i + 1);
+								print($i + 1);
 								print '</td>';
 
 								print '<td>';
@@ -4975,7 +4975,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5011,18 +5011,18 @@ if ($module == 'initmodule') {
 				}
 				$groupedRights[$key][] = $right;
 			}
-				$groupedRights_json = json_encode($groupedRights);
+			$groupedRights_json = json_encode($groupedRights);
 
 			if ($action == 'deletemenu') {
-					$formconfirms = $form->formconfirm(
-						$_SERVER["PHP_SELF"].'?menukey='.urlencode(GETPOST('menukey', 'int')).'&tab='.urlencode($tab).'&module='.urlencode($module),
-						$langs->trans('Delete'),
-						($menus[GETPOST('menukey')]['fk_menu'] === 'fk_mainmenu='.strtolower($module) ? $langs->trans('Warning: you will delete all menus linked to this one.', GETPOST('menukey', 'int')) : $langs->trans('Confirm Delete Menu', GETPOST('menukey', 'int'))),
-						'confirm_deletemenu',
-						'',
-						0,
-						1
-					);
+				$formconfirms = $form->formconfirm(
+					$_SERVER["PHP_SELF"].'?menukey='.urlencode(GETPOST('menukey', 'int')).'&tab='.urlencode($tab).'&module='.urlencode($module),
+					$langs->trans('Delete'),
+					($menus[GETPOST('menukey')]['fk_menu'] === 'fk_mainmenu='.strtolower($module) ? $langs->trans('Warning: you will delete all menus linked to this one.', GETPOST('menukey', 'int')) : $langs->trans('Confirm Delete Menu', GETPOST('menukey', 'int'))),
+					'confirm_deletemenu',
+					'',
+					0,
+					1
+				);
 				print $formconfirms;
 			}
 			if ($action != 'editfile' || empty($file)) {
@@ -5149,7 +5149,7 @@ if ($module == 'initmodule') {
 						$propMainmenu = !empty($menu['mainmenu']) ? $menu['mainmenu'] : GETPOST('mainmenu');
 						$propLeftmenu = !empty($menu['leftmenu']) ? $menu['leftmenu'] : GETPOST('leftmenu');
 						$propUrl = !empty($menu['url']) ? $menu['url'] : GETPOST('url', 'alpha');
-						$propPerms = !empty($menu['perms']) ?  $menu['perms'] : GETPOST('perms');
+						$propPerms = !empty($menu['perms']) ? $menu['perms'] : GETPOST('perms');
 						$propUser = !empty($menu['user']) ? $menu['user'] : GETPOST('user');
 						$propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target');
 						$propEnabled = !empty($menu['enabled']) ? $menu['enabled'] : GETPOST('enabled');
@@ -5178,7 +5178,7 @@ if ($module == 'initmodule') {
 										<option value="'.dol_escape_htmltag($menu['type']).'">
 										'.dol_escape_htmltag($menu['type']).'
 										</option>';
-										print '<option value="'.($menu['type'] == 'left' ? 'top' : 'left').'">';
+							print '<option value="'.($menu['type'] == 'left' ? 'top' : 'left').'">';
 							if ($menu['type'] == 'left') {
 								print 'top';
 							} else {
@@ -5331,8 +5331,8 @@ if ($module == 'initmodule') {
 							print '</td>';
 							print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
 							if ($menu['titre'] != 'Module'.$module.'Name') {
-									print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($i).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_edit().'</a>';
-									print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletemenu&token='.newToken().'&menukey='.urlencode($i-1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
+								print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($i).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_edit().'</a>';
+								print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletemenu&token='.newToken().'&menukey='.urlencode($i-1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
 							}
 							print '</td>';
 						}
@@ -5409,7 +5409,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5659,7 +5659,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5714,7 +5714,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5780,7 +5780,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5826,7 +5826,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5872,7 +5872,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5924,7 +5924,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -5964,7 +5964,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -6044,7 +6044,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -6166,7 +6166,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -6225,7 +6225,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
@@ -6469,7 +6469,7 @@ if ($module == 'initmodule') {
 				print '<input type="hidden" name="module" value="'.$module.'">';
 
 				$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
-				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
+				print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html'));
 				print '<br>';
 				print '<center>';
 				print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';

+ 2 - 1
htdocs/modulebuilder/template/admin/about.php

@@ -31,7 +31,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";

+ 2 - 1
htdocs/modulebuilder/template/admin/myobject_extrafields.php

@@ -35,7 +35,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";

+ 6 - 3
htdocs/modulebuilder/template/admin/setup.php

@@ -31,7 +31,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
@@ -199,7 +200,9 @@ if ($action == 'updateMask') {
 	$tmpobject->initAsSpecimen();
 
 	// Search template files
-	$file = ''; $classname = ''; $filefound = 0;
+	$file = '';
+	$classname = '';
+	$filefound = 0;
 	$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
 	foreach ($dirmodels as $reldir) {
 		$file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
@@ -499,7 +502,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
 
 									if ($modulequalified) {
 										print '<tr class="oddeven"><td width="100">';
-										print (empty($module->name) ? $name : $module->name);
+										print(empty($module->name) ? $name : $module->name);
 										print "</td><td>\n";
 										if (method_exists($module, 'info')) {
 											print $module->info($langs);

+ 4 - 2
htdocs/modulebuilder/template/class/actions_mymodule.class.php

@@ -203,7 +203,8 @@ class ActionsMyModule extends CommonHookActions
 
 		$outputlangs = $langs;
 
-		$ret = 0; $deltemp = array();
+		$ret = 0;
+		$deltemp = array();
 		dol_syslog(get_class($this).'::executeHooks action='.$action);
 
 		/* print_r($parameters); print_r($object); echo "action: " . $action; */
@@ -230,7 +231,8 @@ class ActionsMyModule extends CommonHookActions
 
 		$outputlangs = $langs;
 
-		$ret = 0; $deltemp = array();
+		$ret = 0;
+		$deltemp = array();
 		dol_syslog(get_class($this).'::executeHooks action='.$action);
 
 		/* print_r($parameters); print_r($object); echo "action: " . $action; */

+ 8 - 4
htdocs/modulebuilder/template/class/myobject.class.php

@@ -475,7 +475,9 @@ class MyObject extends CommonObject
 							// single value
 							$sqlwhere[] = $key . " = " . intval($value);
 						} elseif (is_array($value)) {
-							if (empty($value)) continue;
+							if (empty($value)) {
+								continue;
+							}
 							$sqlwhere[] = $key . ' IN (' . $this->db->sanitize(implode(',', array_map('intval', $value))) . ')';
 						}
 						continue;
@@ -662,13 +664,15 @@ class MyObject extends CommonObject
 				$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'myobject/".$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();
 				}
 				$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'myobject/".$this->db->escape($this->newref)."'";
 				$sql .= " WHERE filepath = 'myobject/".$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
@@ -866,7 +870,7 @@ class MyObject extends CommonObject
 				$label = $langs->trans("ShowMyObject");
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
 			}
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
 			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
 		} else {
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

+ 3 - 1
htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php

@@ -913,7 +913,9 @@ class pdf_standard_myobject extends ModelePDFMyObject
 		global $conf, $langs;
 
 		$ltrdirection = 'L';
-		if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
+		if ($outputlangs->trans("DIRECTION") == 'rtl') {
+			$ltrdirection = 'R';
+		}
 
 		// Load traductions files required by page
 		$outputlangs->loadLangs(array("main", "bills", "propal", "companies"));

+ 4 - 2
htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php

@@ -83,7 +83,8 @@ class mod_myobject_standard extends ModeleNumRefMyObject
 	{
 		global $conf, $langs, $db;
 
-		$coyymm = ''; $max = '';
+		$coyymm = '';
+		$max = '';
 
 		$posindice = strlen($this->prefix) + 6;
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
@@ -99,7 +100,8 @@ class mod_myobject_standard extends ModeleNumRefMyObject
 		if ($resql) {
 			$row = $db->fetch_row($resql);
 			if ($row) {
-				$coyymm = substr($row[0], 0, 6); $max = $row[0];
+				$coyymm = substr($row[0], 0, 6);
+				$max = $row[0];
 			}
 		}
 		if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {

+ 1 - 2
htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php

@@ -41,8 +41,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
 	$trclass = 'oddeven';
 	if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
 		$trclass .= ' liste_sub_total';
-	}
-	?>
+	} ?>
 <tr class="<?php echo $trclass; ?>">
 	<td><?php echo $langs->trans("MyObject"); ?></td>
 	<td><?php echo $objectlink->getNomUrl(1); ?></td>

+ 2 - 1
htdocs/modulebuilder/template/css/mymodule.css.php

@@ -56,7 +56,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";

+ 2 - 1
htdocs/modulebuilder/template/js/mymodule.js.php

@@ -64,7 +64,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";

+ 2 - 1
htdocs/modulebuilder/template/mymoduleindex.php

@@ -33,7 +33,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";

+ 6 - 3
htdocs/modulebuilder/template/myobject_agenda.php

@@ -50,7 +50,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
@@ -150,7 +151,9 @@ if ($enablepermissioncheck) {
 if (!isModEnabled("mymodule")) {
 	accessforbidden();
 }
-if (!$permissiontoread) accessforbidden();
+if (!$permissiontoread) {
+	accessforbidden();
+}
 
 
 /*
@@ -310,7 +313,7 @@ if ($object->id > 0) {
 		//require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
 		//$cachekey = 'count_events_myobject_'.$object->id;
 		//$nbEvent = dol_getcache($cachekey);
-		$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': '');
+		$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
 
 		print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);
 

+ 8 - 4
htdocs/modulebuilder/template/myobject_card.php

@@ -54,7 +54,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
@@ -501,9 +502,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 
 				$parameters = array();
 				$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
-				if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-				if (empty($reshook))
+				if ($reshook < 0) {
+					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+				}
+				if (empty($reshook)) {
 					$object->formAddObjectLine(1, $mysoc, $soc);
+				}
 			}
 		}
 
@@ -551,7 +555,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 
 			// Clone
 			if ($permissiontoadd) {
-				print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
+				print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd);
 			}
 
 			/*

+ 6 - 3
htdocs/modulebuilder/template/myobject_contact.php

@@ -31,7 +31,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
@@ -61,7 +62,7 @@ dol_include_once('/mymodule/lib/mymodule_myobject.lib.php');
 // Load translation files required by the page
 $langs->loadLangs(array("mymodule@mymodule", "companies", "other", "mails"));
 
-$id     = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
+$id     = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
 $ref    = GETPOST('ref', 'alpha');
 $lineid = GETPOST('lineid', 'int');
 $socid  = GETPOST('socid', 'int');
@@ -97,7 +98,9 @@ if ($enablepermissioncheck) {
 if (!isModEnabled("mymodule")) {
 	accessforbidden();
 }
-if (!$permissiontoread) accessforbidden();
+if (!$permissiontoread) {
+	accessforbidden();
+}
 
 
 /*

+ 3 - 2
htdocs/modulebuilder/template/myobject_document.php

@@ -52,7 +52,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
@@ -181,7 +182,7 @@ print dol_get_fiche_head($head, 'document', $langs->trans("MyObject"), -1, $obje
 
 
 // Build file list
-$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
 $totalsize = 0;
 foreach ($filearray as $key => $file) {
 	$totalsize += $file['size'];

+ 6 - 2
htdocs/modulebuilder/template/myobject_list.php

@@ -203,7 +203,9 @@ if ($enablepermissioncheck) {
 }
 
 // Security check (enable the most restrictive one)
-if ($user->socid > 0) accessforbidden();
+if ($user->socid > 0) {
+	accessforbidden();
+}
 //if ($user->socid > 0) accessforbidden();
 //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
 //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
@@ -211,7 +213,9 @@ if ($user->socid > 0) accessforbidden();
 if (!isModEnabled("mymodule")) {
 	accessforbidden('Module mymodule not enabled');
 }
-if (!$permissiontoread) accessforbidden();
+if (!$permissiontoread) {
+	accessforbidden();
+}
 
 
 /*

+ 6 - 3
htdocs/modulebuilder/template/myobject_note.php

@@ -53,7 +53,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
@@ -124,7 +125,9 @@ if ($enablepermissioncheck) {
 if (!isModEnabled("mymodule")) {
 	accessforbidden();
 }
-if (!$permissiontoread) accessforbidden();
+if (!$permissiontoread) {
+	accessforbidden();
+}
 
 
 /*
@@ -202,7 +205,7 @@ if ($id > 0 || !empty($ref)) {
 	 }
 	 }
 	 }*/
-	 $morehtmlref .= '</div>';
+	$morehtmlref .= '</div>';
 
 
 	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

+ 7 - 3
htdocs/modulebuilder/template/scripts/mymodule.php

@@ -41,7 +41,9 @@
 //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule');	// Force authentication handler
 //if (! defined('CSRFCHECK_WITH_TOKEN'))     define('CSRFCHECK_WITH_TOKEN', '1');		// Force use of CSRF protection with tokens even for GET
 //if (! defined('NOBROWSERNOTIF'))     		 define('NOBROWSERNOTIF', '1');				// Disable browser notification
-if (!defined('NOSESSION')) define('NOSESSION', '1');	// On CLI mode, no need to use web sessions
+if (!defined('NOSESSION')) {
+	define('NOSESSION', '1');
+}	// On CLI mode, no need to use web sessions
 
 
 $sapi_type = php_sapi_name();
@@ -68,7 +70,8 @@ $res = 0;
 // Try master.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
-	$i--; $j--;
+	$i--;
+	$j--;
 }
 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/master.inc.php")) {
 	$res = @include substr($tmp, 0, ($i + 1))."/master.inc.php";
@@ -99,7 +102,8 @@ $langs->load("main"); // To load language file for default language
 // Load user and its permissions
 $result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
 if (!($result > 0)) {
-	dol_print_error('', $user->error); exit;
+	dol_print_error('', $user->error);
+	exit;
 }
 $user->getrights();
 

+ 6 - 2
htdocs/mrp/ajax/interface.php

@@ -50,7 +50,9 @@ if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) {
 	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock";
 	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")";
 	$sql .= " WHERE ps.fk_product = " .((int) $fk_product);
-	if ($warehouse_id > 0) $sql .= " AND fk_entrepot = '" . ((int) $warehouse_id) . "'";
+	if ($warehouse_id > 0) {
+		$sql .= " AND fk_entrepot = '" . ((int) $warehouse_id) . "'";
+	}
 	$sql .= " ORDER BY e.ref, pb.batch";
 
 	$resql = $db->query($sql);
@@ -74,7 +76,9 @@ if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) {
 	$sql .= " JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock";
 	$sql .= " JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")";
 	$sql .= " WHERE ps.fk_product = " .((int) $fk_product);
-	if ($batch) $sql.= " AND pb.batch = '" . $db->escape($batch) . "'";
+	if ($batch) {
+		$sql.= " AND pb.batch = '" . $db->escape($batch) . "'";
+	}
 	$sql .= " ORDER BY e.ref, pb.batch";
 
 	$resql = $db->query($sql);

+ 44 - 18
htdocs/mrp/class/mo.class.php

@@ -739,11 +739,13 @@ class Mo extends CommonObject
 							$moline->fk_mo = $this->id;
 							$moline->origin_id = $line->id;
 							$moline->origin_type = 'bomline';
-							if (!empty($line->fk_unit)) $moline->fk_unit = $line->fk_unit;
+							if (!empty($line->fk_unit)) {
+								$moline->fk_unit = $line->fk_unit;
+							}
 							if ($line->qty_frozen) {
 								$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
 							} else {
-								$moline->qty = price2num(($line->qty / ( !empty($bom->qty) ? $bom->qty : 1 ) ) * $this->qty / ( !empty($line->efficiency) ? $line->efficiency : 1 ), 'MS'); // Calculate with Qty to produce and  more presition
+								$moline->qty = price2num(($line->qty / (!empty($bom->qty) ? $bom->qty : 1)) * $this->qty / (!empty($line->efficiency) ? $line->efficiency : 1), 'MS'); // Calculate with Qty to produce and  more presition
 							}
 							if ($moline->qty <= 0) {
 								$error++;
@@ -755,7 +757,9 @@ class Mo extends CommonObject
 								$moline->position = $line->position;
 								$moline->qty_frozen = $line->qty_frozen;
 								$moline->disable_stock_change = $line->disable_stock_change;
-								if (!empty($line->fk_default_workstation)) $moline->fk_default_workstation = $line->fk_default_workstation;
+								if (!empty($line->fk_default_workstation)) {
+									$moline->fk_default_workstation = $line->fk_default_workstation;
+								}
 
 								$resultline = $moline->create($user, false); // Never use triggers here
 								if ($resultline <= 0) {
@@ -792,7 +796,9 @@ class Mo extends CommonObject
 	{
 		$error = 0;
 
-		if ($this->status != self::STATUS_DRAFT) return 1;
+		if ($this->status != self::STATUS_DRAFT) {
+			return 1;
+		}
 
 		$this->db->begin();
 
@@ -805,14 +811,18 @@ class Mo extends CommonObject
 				while ($obj = $this->db->fetch_object($resql)) {
 					$moLine = new MoLine($this->db);
 					$res = $moLine->fetch($obj->rowid);
-					if (!$res) $error++;
+					if (!$res) {
+						$error++;
+					}
 
 					if ($moLine->role == 'toconsume' || $moLine->role == 'toproduce') {
 						if (empty($moLine->qty_frozen)) {
 							$qty = $newQty * $moLine->qty / $oldQty;
 							$moLine->qty = price2num($qty, 'MS');
 							$res = $moLine->update($user);
-							if (!$res) $error++;
+							if (!$res) {
+								$error++;
+							}
 						}
 					}
 				}
@@ -1074,13 +1084,15 @@ class Mo extends CommonObject
 				$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'mrp/".$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();
 				}
 				$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'mrp/".$this->db->escape($this->newref)."'";
 				$sql .= " WHERE filepath = 'mrp/".$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
@@ -1430,7 +1442,7 @@ class Mo extends CommonObject
 				$label = $langs->trans("ShowMo");
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
 			}
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
 			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
 		} else {
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
@@ -1574,7 +1586,9 @@ class Mo extends CommonObject
 		$objectline = new MoLine($this->db);
 
 		$TFilters = array('customsql'=>'fk_mo = '.((int) $this->id));
-		if (!empty($rolefilter)) $TFilters['role'] = $rolefilter;
+		if (!empty($rolefilter)) {
+			$TFilters['role'] = $rolefilter;
+		}
 		$result = $objectline->fetchAll('ASC', 'position', 0, 0, $TFilters);
 
 		if (is_numeric($result)) {
@@ -1713,7 +1727,9 @@ class Mo extends CommonObject
 				$reshook = 0;
 				if (is_object($hookmanager)) {
 					$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
-					if (!empty($line->fk_parent_line)) { $parameters['fk_parent_line'] = $line->fk_parent_line; }
+					if (!empty($line->fk_parent_line)) {
+						$parameters['fk_parent_line'] = $line->fk_parent_line;
+					}
 					$reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
 				}
 				if (empty($reshook)) {
@@ -1798,7 +1814,6 @@ class Mo extends CommonObject
 	 */
 	public function getMoChilds()
 	{
-
 		$TMoChilds = array();
 		$error = 0;
 
@@ -1814,8 +1829,11 @@ class Mo extends CommonObject
 				while ($obj = $this->db->fetch_object($resql)) {
 					$MoChild = new Mo($this->db);
 					$res = $MoChild->fetch($obj->rowid);
-					if ($res > 0) $TMoChilds[$MoChild->id] = $MoChild;
-					else $error++;
+					if ($res > 0) {
+						$TMoChilds[$MoChild->id] = $MoChild;
+					} else {
+						$error++;
+					}
 				}
 			}
 		} else {
@@ -1837,16 +1855,22 @@ class Mo extends CommonObject
 	 */
 	public function getAllMoChilds($depth = 0)
 	{
-		if ($depth > 1000) return -1;
+		if ($depth > 1000) {
+			return -1;
+		}
 
 		$TMoChilds = array();
 		$error = 0;
 
 		$childMoList = $this->getMoChilds();
 
-		if ($childMoList == -1) return -1;
+		if ($childMoList == -1) {
+			return -1;
+		}
 
-		foreach ($childMoList as $childMo) $TMoChilds[$childMo->id] = $childMo;
+		foreach ($childMoList as $childMo) {
+			$TMoChilds[$childMo->id] = $childMo;
+		}
 
 		foreach ($childMoList as $childMo) {
 			$childMoChildren = $childMo->getAllMoChilds($depth + 1);
@@ -1889,7 +1913,9 @@ class Mo extends CommonObject
 			if ($this->db->num_rows($resql) > 0) {
 				$obj = $this->db->fetch_object($resql);
 				$res = $MoParent->fetch($obj->id_moparent);
-				if ($res < 0) $error++;
+				if ($res < 0) {
+					$error++;
+				}
 			} else {
 				return 0;
 			}

+ 2 - 2
htdocs/mrp/mo_agenda.php

@@ -50,12 +50,12 @@ if (GETPOST('actioncode', 'array')) {
 		$actioncode = '0';
 	}
 } else {
-	$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
+	$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
 }
 $search_rowid = GETPOST('search_rowid');
 $search_agenda_label = GETPOST('search_agenda_label');
 
-$limit 		= GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit 		= GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield	= GETPOST('sortfield', 'aZ09comma');
 $sortorder	= GETPOST('sortorder', 'aZ09comma');
 $page 		= GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

+ 7 - 6
htdocs/mrp/mo_card.php

@@ -49,7 +49,7 @@ $ref = GETPOST('ref', 'alpha');
 $action = GETPOST('action', 'aZ09');
 $confirm = GETPOST('confirm', 'alpha');
 $cancel = GETPOST('cancel', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
 $backtopage = GETPOST('backtopage', 'alpha');
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
 $TBomLineId = GETPOST('bomlineid', 'array');
@@ -365,9 +365,7 @@ if ($action == 'create') {
 
 	print dol_get_fiche_end();
 
-	mrpCollapseBomManagement();
-
-	?>
+	mrpCollapseBomManagement(); ?>
 	<script>
 		 $(document).ready(function () {
 			 jQuery('#fk_bom').change(function() {
@@ -496,8 +494,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 	if ($action == 'delete') {
 		$numberofmochilds = count($object->getAllMoChilds());
 
-		if ($numberofmochilds > 0)$label = $langs->trans("DeleteMoChild", '('.strval($numberofmochilds).')');
-		else $label = $langs->trans("DeleteMoChild");
+		if ($numberofmochilds > 0) {
+			$label = $langs->trans("DeleteMoChild", '('.strval($numberofmochilds).')');
+		} else {
+			$label = $langs->trans("DeleteMoChild");
+		}
 
 		$formquestion = array(
 			array('type' => 'checkbox', 'name' => 'deletechilds', 'label' => $label, 'value' => 0),

+ 1 - 1
htdocs/mrp/mo_document.php

@@ -114,7 +114,7 @@ if ($object->id) {
 	print dol_get_fiche_head($head, 'document', $langs->trans("ManufacturingOrder"), -1, $object->picto);
 
 	// Build file list
-	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
 	$totalsize = 0;
 	foreach ($filearray as $key => $file) {
 		$totalsize += $file['size'];

+ 6 - 4
htdocs/mrp/mo_list.php

@@ -38,7 +38,7 @@ require_once __DIR__.'/class/mo.class.php';
 // Load translation files required by the page
 $langs->loadLangs(array("mrp", "other"));
 
-$action     = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$action     = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
 $confirm    = GETPOST('confirm', 'alpha'); // Result of a confirmation
@@ -52,7 +52,7 @@ $mode = GETPOST('mode', 'alpha');
 $id = GETPOST('id', 'int');
 
 // Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -640,7 +640,7 @@ while ($i < $imaxinloop) {
 				$selected = 1;
 			}
 		}
-		print $object->getKanbanView('', array('bom'=>($obj->fk_bom > 0 ? $bom : null), 'product'=>($obj->fk_product > 0 ? $product: null), 'selected' => $selected));
+		print $object->getKanbanView('', array('bom'=>($obj->fk_bom > 0 ? $bom : null), 'product'=>($obj->fk_product > 0 ? $product : null), 'selected' => $selected));
 		if ($i == ($imaxinloop - 1)) {
 			print '</div>';
 			print '</td></tr>';
@@ -686,7 +686,9 @@ while ($i < $imaxinloop) {
 					print $object->getLibStatut(5);
 				} elseif ($key == 'fk_parent_line') {
 					$moparent = $object->getMoParent();
-					if (is_object($moparent)) print $moparent->getNomUrl(1);
+					if (is_object($moparent)) {
+						print $moparent->getNomUrl(1);
+					}
 				} elseif ($key == 'rowid') {
 					print $object->showOutputField($val, $key, $object->id, '');
 				} else {

+ 4 - 3
htdocs/mrp/mo_movements.php

@@ -45,7 +45,7 @@ $ref         = GETPOST('ref', 'alpha');
 $action      = GETPOST('action', 'aZ09');
 $confirm     = GETPOST('confirm', 'alpha');
 $cancel      = GETPOST('cancel', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mostockmovement'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'mostockmovement'; // To manage different context of search
 $backtopage  = GETPOST('backtopage', 'alpha');
 $optioncss   = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
 $massaction  = GETPOST('massaction', 'aZ09');
@@ -66,7 +66,7 @@ $search_batch = trim(GETPOST("search_batch", 'alpha'));
 $search_qty = trim(GETPOST("search_qty", 'alpha'));
 $search_type_mouvement = GETPOST('search_type_mouvement', 'int');
 
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $page  = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
@@ -168,7 +168,8 @@ $arrayofselected = array();
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';

+ 29 - 13
htdocs/mrp/mo_production.php

@@ -49,7 +49,7 @@ $ref         = GETPOST('ref', 'alpha');
 $action      = GETPOST('action', 'aZ09');
 $confirm     = GETPOST('confirm', 'alpha');
 $cancel      = GETPOST('cancel', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
 $backtopage  = GETPOST('backtopage', 'alpha');
 $lineid      = GETPOST('lineid', 'int');
 $fk_movement = GETPOST('fk_movement', 'int');
@@ -204,7 +204,9 @@ if (empty($reshook)) {
 				$moline->fk_default_workstation = $tmpproduct->fk_default_workstation;
 			}
 			$moline->disable_stock_change = ($tmpproduct->type == Product::TYPE_SERVICE ? 1 : 0);
-			if ($conf->global->PRODUCT_USE_UNITS) $moline->fk_unit = $tmpproduct->fk_unit;
+			if ($conf->global->PRODUCT_USE_UNITS) {
+				$moline->fk_unit = $tmpproduct->fk_unit;
+			}
 		}
 		// Extrafields
 		$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -216,7 +218,9 @@ if (empty($reshook)) {
 				unset($_POST["options_".$key]);
 			}
 		}
-		if (is_array($array_options) && count($array_options) > 0) $moline->array_options = $array_options;
+		if (is_array($array_options) && count($array_options) > 0) {
+			$moline->array_options = $array_options;
+		}
 
 		$resultline = $moline->create($user, false); // Never use triggers here
 		if ($resultline <= 0) {
@@ -1307,7 +1311,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 						print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-' . $line->id . '-' . $i . '" name="qty-' . $line->id . '-' . $i . '" value="' . $preselected . '" ' . $disable . '></td>';
 
 						// Unit
-						if ($conf->global->PRODUCT_USE_UNITS)  print '<td></td>';
+						if ($conf->global->PRODUCT_USE_UNITS) {
+							print '<td></td>';
+						}
 
 						// Cost
 						if ($permissiontoupdatecost && getDolGlobalString('MRP_SHOW_COST_FOR_CONSUMPTION')) {
@@ -1430,7 +1436,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 		// Qty
 		print '<td class="right">'.$langs->trans("Qty").'</td>';
 		/// Unit
-		if ($conf->global->PRODUCT_USE_UNITS) print '<td class="right">'.$langs->trans("Unit").'</td>';
+		if ($conf->global->PRODUCT_USE_UNITS) {
+			print '<td class="right">'.$langs->trans("Unit").'</td>';
+		}
 		// Cost price
 		if ($permissiontoupdatecost) {
 			if (empty($bomcostupdated)) {
@@ -1481,7 +1489,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 			// Qty
 			print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
 			//Unit
-			if ($conf->global->PRODUCT_USE_UNITS) print '<td></td>';
+			if ($conf->global->PRODUCT_USE_UNITS) {
+				print '<td></td>';
+			}
 			// Cost price
 			if ($permissiontoupdatecost) {
 				print '<td></td>';
@@ -1546,7 +1556,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 					// Qty
 					print '<td class="right">'.$line->qty.'</td>';
 					// Unit
-					if ($conf->global->PRODUCT_USE_UNITS) print '<td class="right">'.measuringUnitString($line->fk_unit, '', '', 1).'</td>';
+					if ($conf->global->PRODUCT_USE_UNITS) {
+						print '<td class="right">'.measuringUnitString($line->fk_unit, '', '', 1).'</td>';
+					}
 					// Cost price
 					if ($permissiontoupdatecost) {
 						// Defined $manufacturingcost
@@ -1643,7 +1655,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 						// Qty
 						print '<td></td>';
 						// Unit
-						if ($conf->global->PRODUCT_USE_UNITS) print '<td></td>';
+						if ($conf->global->PRODUCT_USE_UNITS) {
+							print '<td></td>';
+						}
 						// Cost price
 						if ($permissiontoupdatecost) {
 							print '<td></td>';
@@ -1694,7 +1708,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 						// Qty
 						print '<td class="right"><input type="text" class="width50 right" id="qtytoproduce-'.$line->id.'-'.$i.'" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
 						//Unit
-						if ($conf->global->PRODUCT_USE_UNITS) print '<td class="right"></td>';
+						if ($conf->global->PRODUCT_USE_UNITS) {
+							print '<td class="right"></td>';
+						}
 						// Cost
 						if ($permissiontoupdatecost) {
 							// Defined $manufacturingcost
@@ -1751,7 +1767,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 								print '</td>';
 
 								print '<td align="right"  class="splitall">';
-								if (($action == 'consumeorproduce' || $action == 'consumeandproduceall') && $tmpproduct->status_batch == 2) print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" onClick="addDispatchLine('.$line->id.', \'batch\', \'alltoproduce\')"'); //
+								if (($action == 'consumeorproduce' || $action == 'consumeandproduceall') && $tmpproduct->status_batch == 2) {
+									print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" onClick="addDispatchLine('.$line->id.', \'batch\', \'alltoproduce\')"');
+								} //
 								print '</td>';
 							} else {
 								print '<td></td>';
@@ -1778,9 +1796,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 
 	if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline'))) {
 		print "</form>\n";
-	}
-
-	?>
+	} ?>
 
 		<script  type="text/javascript" language="javascript">
 

+ 3 - 1
htdocs/mrp/tpl/linkedobjectblock.tpl.php

@@ -77,7 +77,9 @@ if ($object->element == 'mo') {
 			$k = 0;
 			if ($resql) {
 				$obj = $db->fetch_object($resql);
-				if ($obj->rowid && $obj->rowid > 0) $k = $obj->rowid;
+				if ($obj->rowid && $obj->rowid > 0) {
+					$k = $obj->rowid;
+				}
 			}
 			echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>';
 			echo '</td>';

+ 2 - 2
htdocs/mrp/tpl/originproductline.tpl.php

@@ -28,7 +28,7 @@ if (!empty($form) && !is_object($form)) {
 	$form = new Form($db);
 }
 
-$qtytoconsumeforline = $this->tpl['qty'] / ( !empty($this->tpl['efficiency']) ? $this->tpl['efficiency'] : 1 );
+$qtytoconsumeforline = $this->tpl['qty'] / (!empty($this->tpl['efficiency']) ? $this->tpl['efficiency'] : 1);
 /*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) {
 	$qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom'];
 }*/
@@ -52,7 +52,7 @@ if ($res) {
 		print ' ' . $langs->trans("or") . ' ';
 		print $tmpbom->getNomUrl(1);
 		print ' <a class="collapse_bom" id="collapse-' . $line->id . '" href="#">';
-		print (!getDolGlobalString('BOM_SHOW_ALL_BOM_BY_DEFAULT') ? img_picto('', 'folder') : img_picto('', 'folder-open'));
+		print(!getDolGlobalString('BOM_SHOW_ALL_BOM_BY_DEFAULT') ? img_picto('', 'folder') : img_picto('', 'folder-open'));
 	}
 	print '</a>';
 } else {

+ 2 - 1
htdocs/multicurrency/class/api_multicurrencies.class.php

@@ -375,8 +375,9 @@ class MultiCurrencies extends DolibarrApi
 
 		// Clear all fields out of interrest
 		foreach ($object as $key => $value) {
-			if ($key == "id" || $key == "rate" || $key == "date_sync")
+			if ($key == "id" || $key == "rate" || $key == "date_sync") {
 				continue;
+			}
 			unset($object->$key);
 		}
 

+ 24 - 24
htdocs/multicurrency/class/multicurrency.class.php

@@ -458,12 +458,12 @@ class MultiCurrency extends CommonObject
 		return -1;
 	}
 
-	 /**
-	  * Add new entry into llx_multicurrency_rate
-	  *
-	  * @param double	$rate	rate value
-	  * @return int Return integer <0 if KO, >0 if OK
-	  */
+	/**
+	 * Add new entry into llx_multicurrency_rate
+	 *
+	 * @param double	$rate	rate value
+	 * @return int Return integer <0 if KO, >0 if OK
+	 */
 	public function updateRate($rate)
 	{
 		return $this->addRate($rate);
@@ -491,14 +491,14 @@ class MultiCurrency extends CommonObject
 		return -1;
 	}
 
-	 /**
-	  * Get id of currency from code
-	  *
-	  * @param  DoliDB	$dbs	    object db
-	  * @param  string	$code	    code value search
-	  *
-	  * @return int                 0 if not found, >0 if OK
-	  */
+	/**
+	 * Get id of currency from code
+	 *
+	 * @param  DoliDB	$dbs	    object db
+	 * @param  string	$code	    code value search
+	 *
+	 * @return int                 0 if not found, >0 if OK
+	 */
 	public static function getIdFromCode($dbs, $code)
 	{
 		global $conf;
@@ -514,16 +514,16 @@ class MultiCurrency extends CommonObject
 		}
 	}
 
-	 /**
-	  * Get id and rate of currency from code
-	  *
-	  * @param DoliDB	$dbs	        Object db
-	  * @param string	$code	        Code value search
-	  * @param integer	$date_document	Date from document (propal, order, invoice, ...)
-	  *
-	  * @return 	array	[0] => id currency
-	  *						[1] => rate
-	  */
+	/**
+	 * Get id and rate of currency from code
+	 *
+	 * @param DoliDB	$dbs	        Object db
+	 * @param string	$code	        Code value search
+	 * @param integer	$date_document	Date from document (propal, order, invoice, ...)
+	 *
+	 * @return 	array	[0] => id currency
+	 *						[1] => rate
+	 */
 	public static function getIdAndTxFromCode($dbs, $code, $date_document = '')
 	{
 		global $conf;

+ 55 - 22
htdocs/multicurrency/multicurrency_rate.php

@@ -49,7 +49,7 @@ $show_files			= GETPOST('show_files', 'int');
 $confirm			= GETPOST('confirm', 'alpha');
 $toselect = GETPOST('toselect', 'array');
 $id_rate_selected = GETPOST('id_rate', 'int');
-$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
+$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
 $search_date_sync = dol_mktime(0, 0, 0, GETPOST('search_date_syncmonth', 'int'), GETPOST('search_date_syncday', 'int'), GETPOST('search_date_syncyear', 'int'));
 $search_date_sync_end	= dol_mktime(0, 0, 0, GETPOST('search_date_sync_endmonth', 'int'), GETPOST('search_date_sync_endday', 'int'), GETPOST('search_date_sync_endyear', 'int'));
 $search_rate		= GETPOST('search_rate', 'alpha');
@@ -60,10 +60,10 @@ $dateinput 			= dol_mktime(0, 0, 0, GETPOST('dateinputmonth', 'int'), GETPOST('d
 $rateinput 			= price2num(GETPOST('rateinput', 'alpha'));
 $rateindirectinput 	= price2num(GETPOST('rateinidirectinput', 'alpha'));
 $optioncss 			= GETPOST('optioncss', 'alpha');
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield 			= GETPOST('sortfield', 'aZ09comma');
 $sortorder 			= GETPOST('sortorder', 'aZ09comma');
-$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
+$page = (GETPOST("page", 'int') ? GETPOST("page", 'int') : 0);
 
 if (empty($page) || $page == -1) {
 	$page = 0;
@@ -71,8 +71,12 @@ if (empty($page) || $page == -1) {
 $offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
-if (!$sortfield) $sortfield = "cr.date_sync";
-if (!$sortorder) $sortorder = "DESC";
+if (!$sortfield) {
+	$sortfield = "cr.date_sync";
+}
+if (!$sortorder) {
+	$sortorder = "DESC";
+}
 
 
 // Initialize technical objects
@@ -218,12 +222,19 @@ if ($action == "confirm_delete") {
 }
 
 
-if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
+if (GETPOST('cancel', 'alpha')) {
+	$action = 'list';
+	$massaction = '';
+}
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
+	$massaction = '';
+}
 
 $parameters = array();
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+if ($reshook < 0) {
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
 if (empty($reshook)) {
 	// Selection of new fields
 	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
@@ -326,14 +337,20 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
 $sql .= $hookmanager->resPrint;
 $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr ';
 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid";
-if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
-if ($search_date_sync && $search_date_sync_end ) {
+if ($sall) {
+	$sql .= natural_search(array_keys($fieldstosearchall), $sall);
+}
+if ($search_date_sync && $search_date_sync_end) {
 	$sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')";
 } elseif ($search_date_sync && !$search_date_sync_end) {
 	$sql .= natural_search('cr.date_sync', $db->idate($search_date_sync));
 }
-if ($search_rate) $sql .= natural_search('cr.rate', $search_rate);
-if ($search_code) $sql .= natural_search('m.code', $search_code);
+if ($search_rate) {
+	$sql .= natural_search('cr.rate', $search_rate);
+}
+if ($search_code) {
+	$sql .= natural_search('m.code', $search_code);
+}
 $sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'";
 
 // Add where from hooks
@@ -383,10 +400,18 @@ if ($resql) {
 		$param .= "&sall=".urlencode($sall);
 	}
 
-	if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync;
-	if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end;
-	if ($search_rate) $param = "&search_rate=".urlencode($search_rate);
-	if ($search_code != '') $param.="&search_code=".urlencode($search_code);
+	if ($search_date_sync) {
+		$param = "&search_date_sync=".$search_date_sync;
+	}
+	if ($search_date_sync_end) {
+		$param="&search_date_sync_end=".$search_date_sync_end;
+	}
+	if ($search_rate) {
+		$param = "&search_rate=".urlencode($search_rate);
+	}
+	if ($search_code != '') {
+		$param.="&search_code=".urlencode($search_code);
+	}
 
 	// Add $param from extra fields
 	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -459,13 +484,13 @@ if ($resql) {
 		print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1);
 		print '</td>';
 	}
-		// code
+	// code
 	if (!empty($arrayfields['m.code']['checked'])) {
 		print '<td class="liste_titre" align="left">';
 		print  $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true);
 		print '</td>';
 	}
-		// rate
+	// rate
 	if (!empty($arrayfields['cr.rate']['checked'])) {
 		print '<td class="liste_titre" align="left">';
 		print '<input class="flat maxwidth75" type="text" name="search_rate" value="'.dol_escape_htmltag($search_rate).'">';
@@ -529,7 +554,9 @@ if ($resql) {
 				print '<td class="tdoverflowmax200">';
 				print $obj->date_sync;
 				print "</td>\n";
-				if (!$i) $totalarray['nbfield']++;
+				if (!$i) {
+					$totalarray['nbfield']++;
+				}
 			}
 
 			// code
@@ -539,7 +566,9 @@ if ($resql) {
 				print ' - <span class="opacitymedium">'.$obj->name.'</span>';
 				print "</td>\n";
 
-				if (! $i) $totalarray['nbfield']++;
+				if (! $i) {
+					$totalarray['nbfield']++;
+				}
 			}
 
 			// rate
@@ -547,7 +576,9 @@ if ($resql) {
 				print '<td class="tdoverflowmax200">';
 				print $obj->rate;
 				print "</td>\n";
-				if (! $i) $totalarray['nbfield']++;
+				if (! $i) {
+					$totalarray['nbfield']++;
+				}
 			}
 
 			// rate indirect
@@ -555,7 +586,9 @@ if ($resql) {
 				print '<td class="tdoverflowmax200">';
 				print $obj->rate_indirect;
 				print "</td>\n";
-				if (! $i) $totalarray['nbfield']++;
+				if (! $i) {
+					$totalarray['nbfield']++;
+				}
 			}
 
 

+ 1 - 1
htdocs/opensurvey/card.php

@@ -259,7 +259,7 @@ if ($action == 'edit') {
 	$doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%');
 	$doleditor->Create(0, '');
 } else {
-	print (dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true));
+	print(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true));
 }
 print '</td></tr>';
 

+ 6 - 4
htdocs/opensurvey/class/opensurveysondage.class.php

@@ -230,10 +230,11 @@ class Opensurveysondage extends CommonObject
 
 		$this->db->begin();
 
-		   dol_syslog(get_class($this)."::create", LOG_DEBUG);
+		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 && !$notrigger) {
@@ -435,7 +436,8 @@ class Opensurveysondage 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();
 			}
 		}
 
@@ -523,7 +525,7 @@ class Opensurveysondage extends CommonObject
 				$label = $langs->trans("ShowMyObject");
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
 			}
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
 			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
 		} else {
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

+ 1 - 1
htdocs/opensurvey/lib/opensurvey.lib.php

@@ -217,7 +217,7 @@ function dol_survey_random($car)
 {
 	$string = "";
 	$chaine = "abcdefghijklmnopqrstuvwxyz123456789";
-	mt_srand((double) microtime() * 1000000);
+	mt_srand((float) microtime() * 1000000);
 	for ($i = 0; $i < $car; $i++) {
 		$string .= $chaine[mt_rand() % strlen($chaine)];
 	}

+ 5 - 4
htdocs/opensurvey/list.php

@@ -31,13 +31,13 @@ require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php";
 // Load translation files required by the page
 $langs->load("opensurvey");
 
-$action     = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$action     = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
 $confirm    = GETPOST('confirm', 'alpha'); // Result of a confirmation
 $cancel     = GETPOST('cancel', 'alpha'); // We click on a Cancel button
 $toselect   = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'opensurveylist'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'opensurveylist'; // To manage different context of search
 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
 $optioncss  = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
 $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
@@ -48,7 +48,7 @@ $search_title = GETPOST('search_title', 'alpha');
 $search_status = GETPOST('search_status', 'alpha');
 
 // Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
 $sortfield = GETPOST('sortfield', 'aZ09comma');
 $sortorder = GETPOST('sortorder', 'aZ09comma');
 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -118,7 +118,8 @@ $permissiontodelete = $user->rights->opensurvey->write;
  */
 
 if (GETPOST('cancel', 'alpha')) {
-	$action = 'list'; $massaction = '';
+	$action = 'list';
+	$massaction = '';
 }
 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
 	$massaction = '';

+ 1 - 1
htdocs/opensurvey/results.php

@@ -486,7 +486,7 @@ if ($action == 'edit') {
 	$doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%');
 	$doleditor->Create(0, '');
 } else {
-	print (dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true));
+	print(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true));
 }
 print '</td></tr>';