Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -134,8 +134,11 @@  discard block
 block discarded – undo
134 134
 		if ($resql)
135 135
 		{
136 136
 			$obj = $db->fetch_object($resql);
137
-			if ($obj) $max = intval($obj->max);
138
-			else $max = 0;
137
+			if ($obj) {
138
+				$max = intval($obj->max);
139
+			} else {
140
+				$max = 0;
141
+			}
139 142
 		} else {
140 143
 			dol_syslog(__METHOD__, LOG_DEBUG);
141 144
 			return -1;
@@ -145,8 +148,13 @@  discard block
 block discarded – undo
145 148
 		$date = $object->datepaye;
146 149
 		$yymm = strftime("%y%m", $date);
147 150
 
148
-		if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
149
-		else $num = sprintf("%04s", $max + 1);
151
+		if ($max >= (pow(10, 4) - 1)) {
152
+			$num = $max + 1;
153
+		}
154
+		// If counter > 9999, we do not format on 4 chars, we take number as it is
155
+		else {
156
+			$num = sprintf("%04s", $max + 1);
157
+		}
150 158
 
151 159
 		dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
152 160
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
htdocs/core/modules/bom/mod_bom_standard.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,11 @@  discard block
 block discarded – undo
127 127
 		if ($resql)
128 128
 		{
129 129
 			$obj = $db->fetch_object($resql);
130
-			if ($obj) $max = intval($obj->max);
131
-			else $max = 0;
130
+			if ($obj) {
131
+				$max = intval($obj->max);
132
+			} else {
133
+				$max = 0;
134
+			}
132 135
 		} else {
133 136
 			dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG);
134 137
 			return -1;
@@ -138,8 +141,13 @@  discard block
 block discarded – undo
138 141
 		$date = $object->date_creation;
139 142
 		$yymm = strftime("%y%m", $date);
140 143
 
141
-		if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
142
-		else $num = sprintf("%04s", $max + 1);
144
+		if ($max >= (pow(10, 4) - 1)) {
145
+			$num = $max + 1;
146
+		}
147
+		// If counter > 9999, we do not format on 4 chars, we take number as it is
148
+		else {
149
+			$num = sprintf("%04s", $max + 1);
150
+		}
143 151
 
144 152
 		dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
145 153
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
htdocs/core/modules/printsheet/modules_labels.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,7 +103,9 @@  discard block
 block discarded – undo
103 103
 		} else {
104 104
 			$code = $modele;
105 105
 		}
106
-	} else $code = $modele;
106
+	} else {
107
+		$code = $modele;
108
+	}
107 109
 
108 110
 	// If selected modele is a filename template (then $modele="modelname:filename")
109 111
 	$tmp = explode(':', $template, 2);
@@ -111,14 +113,18 @@  discard block
 block discarded – undo
111 113
 	{
112 114
 		$template = $tmp[0];
113 115
 		$srctemplatepath = $tmp[1];
114
-	} else $srctemplatepath = $code;
116
+	} else {
117
+		$srctemplatepath = $code;
118
+	}
115 119
 
116 120
 	dol_syslog("modele=".$modele." outputdir=".$outputdir." template=".$template." code=".$code." srctemplatepath=".$srctemplatepath." filename=".$filename, LOG_DEBUG);
117 121
 
118 122
 	// Search template files
119 123
 	$file = ''; $classname = ''; $filefound = 0;
120 124
 	$dirmodels = array('/');
121
-	if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
125
+	if (is_array($conf->modules_parts['models'])) {
126
+		$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
127
+	}
122 128
 	foreach ($dirmodels as $reldir)
123 129
 	{
124 130
 		foreach (array('doc', 'pdf') as $prefix)
@@ -134,7 +140,9 @@  discard block
 block discarded – undo
134 140
 				break;
135 141
 			}
136 142
 		}
137
-		if ($filefound) break;
143
+		if ($filefound) {
144
+			break;
145
+		}
138 146
 	}
139 147
 
140 148
 	// Charge le modele
Please login to merge, or discard this patch.
htdocs/core/modules/reception/mod_reception_beryl.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,8 +111,11 @@  discard block
 block discarded – undo
111 111
 		if ($resql)
112 112
 		{
113 113
 			$obj = $db->fetch_object($resql);
114
-			if ($obj) $max = intval($obj->max);
115
-			else $max = 0;
114
+			if ($obj) {
115
+				$max = intval($obj->max);
116
+			} else {
117
+				$max = 0;
118
+			}
116 119
 		} else {
117 120
 			dol_syslog("mod_reception_beryl::getNextValue", LOG_DEBUG);
118 121
 			return -1;
@@ -121,8 +124,13 @@  discard block
 block discarded – undo
121 124
 		$date = time();
122 125
 		$yymm = strftime("%y%m", $date);
123 126
 
124
-		if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
125
-		else $num = sprintf("%04s", $max + 1);
127
+		if ($max >= (pow(10, 4) - 1)) {
128
+			$num = $max + 1;
129
+		}
130
+		// If counter > 9999, we do not format on 4 chars, we take number as it is
131
+		else {
132
+			$num = sprintf("%04s", $max + 1);
133
+		}
126 134
 
127 135
 		dol_syslog("mod_reception_beryl::getNextValue return ".$this->prefix.$yymm."-".$num);
128 136
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
htdocs/core/modules/commande/mod_commande_marbre.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,11 @@  discard block
 block discarded – undo
127 127
 		if ($resql)
128 128
 		{
129 129
 			$obj = $db->fetch_object($resql);
130
-			if ($obj) $max = intval($obj->max);
131
-			else $max = 0;
130
+			if ($obj) {
131
+				$max = intval($obj->max);
132
+			} else {
133
+				$max = 0;
134
+			}
132 135
 		} else {
133 136
 			dol_syslog("mod_commande_marbre::getNextValue", LOG_DEBUG);
134 137
 			return -1;
@@ -138,8 +141,13 @@  discard block
 block discarded – undo
138 141
 		$date = $object->date;
139 142
 		$yymm = strftime("%y%m", $date);
140 143
 
141
-		if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
142
-		else $num = sprintf("%04s", $max + 1);
144
+		if ($max >= (pow(10, 4) - 1)) {
145
+			$num = $max + 1;
146
+		}
147
+		// If counter > 9999, we do not format on 4 chars, we take number as it is
148
+		else {
149
+			$num = sprintf("%04s", $max + 1);
150
+		}
143 151
 
144 152
 		dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
145 153
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
htdocs/core/modules/fichinter/modules_fichinter.php 1 patch
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -140,11 +140,17 @@  discard block
 block discarded – undo
140 140
 		global $langs;
141 141
 		$langs->load("admin");
142 142
 
143
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
144
-		elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
145
-		elseif ($this->version == 'dolibarr') return DOL_VERSION;
146
-		elseif ($this->version) return $this->version;
147
-		else return $langs->trans("NotAvailable");
143
+		if ($this->version == 'development') {
144
+			return $langs->trans("VersionDevelopment");
145
+		} elseif ($this->version == 'experimental') {
146
+			return $langs->trans("VersionExperimental");
147
+		} elseif ($this->version == 'dolibarr') {
148
+			return DOL_VERSION;
149
+		} elseif ($this->version) {
150
+			return $this->version;
151
+		} else {
152
+			return $langs->trans("NotAvailable");
153
+		}
148 154
 	}
149 155
 }
150 156
 
@@ -194,7 +200,9 @@  discard block
 block discarded – undo
194 200
 	// Search template files
195 201
 	$file = ''; $classname = ''; $filefound = 0;
196 202
 	$dirmodels = array('/');
197
-	if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
203
+	if (is_array($conf->modules_parts['models'])) {
204
+		$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
205
+	}
198 206
 	foreach ($dirmodels as $reldir)
199 207
 	{
200 208
 		foreach (array('doc', 'pdf') as $prefix)
@@ -210,7 +218,9 @@  discard block
 block discarded – undo
210 218
 				break;
211 219
 			}
212 220
 		}
213
-		if ($filefound) break;
221
+		if ($filefound) {
222
+			break;
223
+		}
214 224
 	}
215 225
 
216 226
 	// Charge le modele
Please login to merge, or discard this patch.
htdocs/core/modules/project/task/mod_task_simple.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,8 +136,11 @@  discard block
 block discarded – undo
136 136
 		if ($resql)
137 137
 		{
138 138
 			$obj = $db->fetch_object($resql);
139
-			if ($obj) $max = intval($obj->max);
140
-			else $max = 0;
139
+			if ($obj) {
140
+				$max = intval($obj->max);
141
+			} else {
142
+				$max = 0;
143
+			}
141 144
 		} else {
142 145
 			dol_syslog("mod_task_simple::getNextValue", LOG_DEBUG);
143 146
 			return -1;
@@ -148,8 +151,13 @@  discard block
 block discarded – undo
148 151
 		//$yymm = strftime("%y%m",time());
149 152
 		$yymm = strftime("%y%m", $date);
150 153
 
151
-		if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
152
-		else $num = sprintf("%04s", $max + 1);
154
+		if ($max >= (pow(10, 4) - 1)) {
155
+			$num = $max + 1;
156
+		}
157
+		// If counter > 9999, we do not format on 4 chars, we take number as it is
158
+		else {
159
+			$num = sprintf("%04s", $max + 1);
160
+		}
153 161
 
154 162
 		dol_syslog("mod_task_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
155 163
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php 1 patch
Braces   +57 added lines, -21 removed lines patch added patch discarded remove patch
@@ -38,16 +38,36 @@  discard block
 block discarded – undo
38 38
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
39 39
 require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
40 40
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41
-if (!empty($conf->propal->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
42
-if (!empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
43
-if (!empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
44
-if (!empty($conf->commande->enabled))    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
45
-if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
46
-if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
47
-if (!empty($conf->contrat->enabled))     require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
48
-if (!empty($conf->ficheinter->enabled))  require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
49
-if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
50
-if (!empty($conf->agenda->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
41
+if (!empty($conf->propal->enabled)) {
42
+	require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
43
+}
44
+if (!empty($conf->facture->enabled)) {
45
+	require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
46
+}
47
+if (!empty($conf->facture->enabled)) {
48
+	require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
49
+}
50
+if (!empty($conf->commande->enabled)) {
51
+	require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
52
+}
53
+if (!empty($conf->fournisseur->enabled)) {
54
+	require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
55
+}
56
+if (!empty($conf->fournisseur->enabled)) {
57
+	require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
58
+}
59
+if (!empty($conf->contrat->enabled)) {
60
+	require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
61
+}
62
+if (!empty($conf->ficheinter->enabled)) {
63
+	require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
64
+}
65
+if (!empty($conf->deplacement->enabled)) {
66
+	require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
67
+}
68
+if (!empty($conf->agenda->enabled)) {
69
+	require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
70
+}
51 71
 
52 72
 
53 73
 /**
@@ -114,7 +134,10 @@  discard block
 block discarded – undo
114 134
 
115 135
 		// Recupere emetteur
116 136
 		$this->emetteur = $mysoc;
117
-		if (!$this->emetteur->pays_code) $this->emetteur->pays_code = substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini
137
+		if (!$this->emetteur->pays_code) {
138
+			$this->emetteur->pays_code = substr($langs->defaultlang, -2);
139
+		}
140
+		// Par defaut, si n'etait pas defini
118 141
 	}
119 142
 
120 143
 
@@ -376,10 +399,13 @@  discard block
 block discarded – undo
376 399
 			if (!$tmpdir) {
377 400
 				unset($listofdir[$key]); continue;
378 401
 			}
379
-			if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
380
-			else {
402
+			if (!is_dir($tmpdir)) {
403
+				$texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
404
+			} else {
381 405
 				$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
382
-				if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
406
+				if (count($tmpfiles)) {
407
+					$listoffiles = array_merge($listoffiles, $tmpfiles);
408
+				}
383 409
 			}
384 410
 		}
385 411
 		$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
@@ -450,7 +476,9 @@  discard block
 block discarded – undo
450 476
 			return -1;
451 477
 		}
452 478
 
453
-		if (!is_object($outputlangs)) $outputlangs = $langs;
479
+		if (!is_object($outputlangs)) {
480
+			$outputlangs = $langs;
481
+		}
454 482
 		$sav_charset_output = $outputlangs->charset_output;
455 483
 		$outputlangs->charset_output = 'UTF-8';
456 484
 
@@ -477,7 +505,9 @@  discard block
 block discarded – undo
477 505
 
478 506
 			$dir = $conf->projet->dir_output."/".$project->ref."/";
479 507
 			$objectref = dol_sanitizeFileName($object->ref);
480
-			if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
508
+			if (!preg_match('/specimen/i', $objectref)) {
509
+				$dir .= "/".$objectref;
510
+			}
481 511
 			$file = $dir."/".$objectref.".odt";
482 512
 
483 513
 			if (!file_exists($dir))
@@ -558,10 +588,13 @@  discard block
 block discarded – undo
558 588
 				foreach ($tmparray as $key=>$value)
559 589
 				{
560 590
 					try {
561
-						if (preg_match('/logo$/', $key)) // Image
591
+						if (preg_match('/logo$/', $key)) {
592
+							// Image
562 593
 						{
563 594
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
564
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
595
+						} else {
596
+								$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
597
+							}
565 598
 						} else // Text
566 599
 						{
567 600
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
@@ -575,7 +608,9 @@  discard block
 block discarded – undo
575 608
 				try {
576 609
 					// Security check
577 610
 					$socid = 0;
578
-					if (!empty($project->fk_soc)) $socid = $project->fk_soc;
611
+					if (!empty($project->fk_soc)) {
612
+						$socid = $project->fk_soc;
613
+					}
579 614
 
580 615
 					$tmparray = $this->get_substitutionarray_tasks($object, $outputlangs);
581 616
 					complete_substitutions_array($tmparray, $outputlangs, $object);
@@ -843,8 +878,9 @@  discard block
 block discarded – undo
843 878
 				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
844 879
 				$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
845 880
 
846
-				if (!empty($conf->global->MAIN_UMASK))
847
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
881
+				if (!empty($conf->global->MAIN_UMASK)) {
882
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
883
+				}
848 884
 
849 885
 				$odfHandler = null; // Destroy object
850 886
 
Please login to merge, or discard this patch.
htdocs/core/modules/project/mod_project_simple.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,8 +136,11 @@  discard block
 block discarded – undo
136 136
 		if ($resql)
137 137
 		{
138 138
 			$obj = $db->fetch_object($resql);
139
-			if ($obj) $max = intval($obj->max);
140
-			else $max = 0;
139
+			if ($obj) {
140
+				$max = intval($obj->max);
141
+			} else {
142
+				$max = 0;
143
+			}
141 144
 		} else {
142 145
 			dol_syslog("mod_project_simple::getNextValue", LOG_DEBUG);
143 146
 			return -1;
@@ -148,8 +151,13 @@  discard block
 block discarded – undo
148 151
 		//$yymm = strftime("%y%m",time());
149 152
 		$yymm = strftime("%y%m", $date);
150 153
 
151
-		if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
152
-		else $num = sprintf("%04s", $max + 1);
154
+		if ($max >= (pow(10, 4) - 1)) {
155
+			$num = $max + 1;
156
+		}
157
+		// If counter > 9999, we do not format on 4 chars, we take number as it is
158
+		else {
159
+			$num = sprintf("%04s", $max + 1);
160
+		}
153 161
 
154 162
 		dol_syslog("mod_project_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
155 163
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.