Passed
Push — master ( 49af33...3cffbe )
by Alxarafe
21:21
created
dolibarr/htdocs/core/modules/cheque/mod_chequereceipt_mint.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -124,10 +124,12 @@  discard block
 block discarded – undo
124 124
 		if ($resql)
125 125
 		{
126 126
 			$obj = $db->fetch_object($resql);
127
-			if ($obj) $max = intval($obj->max);
128
-			else $max=0;
129
-		}
130
-		else
127
+			if ($obj) {
128
+			    $max = intval($obj->max);
129
+			} else {
130
+			    $max=0;
131
+			}
132
+		} else
131 133
 		{
132 134
 			dol_syslog(__METHOD__, LOG_DEBUG);
133 135
 			return -1;
@@ -137,8 +139,13 @@  discard block
 block discarded – undo
137 139
 		$date=$object->date_bordereau;
138 140
 		$yymm = strftime("%y%m",$date);
139 141
 
140
-    	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
141
-    	else $num = sprintf("%04s",$max+1);
142
+    	if ($max >= (pow(10, 4) - 1)) {
143
+    	    $num=$max+1;
144
+    	}
145
+    	// If counter > 9999, we do not format on 4 chars, we take number as it is
146
+    	else {
147
+    	    $num = sprintf("%04s",$max+1);
148
+    	}
142 149
 
143 150
 		dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
144 151
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/cheque/modules_chequereceipts.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -108,10 +108,18 @@  discard block
 block discarded – undo
108 108
 		global $langs;
109 109
 		$langs->load("admin");
110 110
 
111
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
112
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
113
-		if ($this->version == 'dolibarr') return DOL_VERSION;
114
-		if ($this->version) return $this->version;
111
+		if ($this->version == 'development') {
112
+		    return $langs->trans("VersionDevelopment");
113
+		}
114
+		if ($this->version == 'experimental') {
115
+		    return $langs->trans("VersionExperimental");
116
+		}
117
+		if ($this->version == 'dolibarr') {
118
+		    return DOL_VERSION;
119
+		}
120
+		if ($this->version) {
121
+		    return $this->version;
122
+		}
115 123
 		return $langs->trans("NotAvailable");
116 124
 	}
117 125
 }
@@ -177,8 +185,7 @@  discard block
 block discarded – undo
177 185
 		if (! empty($conf->global->CHEQUERECEIPT_ADDON_PDF))
178 186
 		{
179 187
 			$modele = $conf->global->CHEQUERECEIPT_ADDON_PDF;
180
-		}
181
-		else
188
+		} else
182 189
 		{
183 190
 			//print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined");
184 191
 			//return 0;
@@ -202,15 +209,13 @@  discard block
 block discarded – undo
202 209
 		{
203 210
 			$outputlangs->charset_output=$sav_charset_output;
204 211
 			return 1;
205
-		}
206
-		else
212
+		} else
207 213
 		{
208 214
 			$outputlangs->charset_output=$sav_charset_output;
209 215
 			dol_print_error($db,"chequereceipt_pdf_create Error: ".$obj->error);
210 216
 			return -1;
211 217
 		}
212
-	}
213
-	else
218
+	} else
214 219
 	{
215 220
 		dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
216 221
 		return -1;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modDeplacement.class.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -129,17 +129,25 @@
 block discarded – undo
129 129
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'user as u';
130 130
 		$this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'deplacement as d';
131 131
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid';
132
-		if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
132
+		if (empty($user->rights->societe->client->voir)) {
133
+		    $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
134
+		}
133 135
 		$this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid';
134 136
 		$this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('deplacement').')';
135
-		if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)';
137
+		if (empty($user->rights->societe->client->voir)) {
138
+		    $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)';
139
+		}
136 140
 
137
-		if (! empty($user))   // Not defined during migration process
141
+		if (! empty($user)) {
142
+		    // Not defined during migration process
138 143
 		{
139 144
     		$childids = $user->getAllChildIds();
145
+		}
140 146
     		$childids[]=$user->id;
141 147
 
142
-    		if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
148
+    		if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
149
+    		    $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
150
+    		}
143 151
 		}
144 152
 	}
145 153
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modCommande.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
236 236
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
237 237
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'societe as s';
238
-		if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
238
+		if (empty($user->rights->societe->client->voir)) {
239
+		    $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
240
+		}
239 241
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
240 242
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
241 243
 		$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande as c';
@@ -249,7 +251,9 @@  discard block
 block discarded – undo
249 251
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
250 252
 		$this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande';
251 253
 		$this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('commande').')';
252
-		if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND sc.fk_user = '.(empty($user)?0:$user->id);
254
+		if (empty($user->rights->societe->client->voir)) {
255
+		    $this->export_sql_end[$r] .=' AND sc.fk_user = '.(empty($user)?0:$user->id);
256
+		}
253 257
 	}
254 258
 
255 259
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,7 +110,9 @@  discard block
 block discarded – undo
110 110
 		global $_GET;
111 111
 
112 112
 		$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
113
-		if (empty($tcpdfEncoding)) return -1;
113
+		if (empty($tcpdfEncoding)) {
114
+		    return -1;
115
+		}
114 116
 
115 117
 		$color = array(0,0,0);
116 118
 
@@ -160,7 +162,9 @@  discard block
 block discarded – undo
160 162
 		$file=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
161 163
 
162 164
 		$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
163
-		if (empty($tcpdfEncoding)) return -1;
165
+		if (empty($tcpdfEncoding)) {
166
+		    return -1;
167
+		}
164 168
 
165 169
 		$color = array(0,0,0);
166 170
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/barcode/doc/phpbarcode.modules.php 1 patch
Braces   +33 added lines, -11 removed lines patch added patch discarded remove patch
@@ -96,16 +96,28 @@  discard block
 block discarded – undo
96 96
         //print 'genbarcode_loc='.$genbarcode_loc.' encoding='.$encoding;exit;
97 97
 
98 98
 		$supported=0;
99
-		if ($encoding == 'EAN13') $supported=1;
100
-		if ($encoding == 'ISBN')  $supported=1;
99
+		if ($encoding == 'EAN13') {
100
+		    $supported=1;
101
+		}
102
+		if ($encoding == 'ISBN') {
103
+		    $supported=1;
104
+		}
101 105
 		// Formats that hangs on Windows (when genbarcode.exe for Windows is called, so they are not
102 106
 		// activated on Windows)
103 107
 		if (file_exists($genbarcode_loc) && empty($_SERVER["WINDIR"]))
104 108
 		{
105
-			if ($encoding == 'EAN8')  $supported=1;
106
-			if ($encoding == 'UPC')   $supported=1;
107
-			if ($encoding == 'C39')   $supported=1;
108
-			if ($encoding == 'C128')  $supported=1;
109
+			if ($encoding == 'EAN8') {
110
+			    $supported=1;
111
+			}
112
+			if ($encoding == 'UPC') {
113
+			    $supported=1;
114
+			}
115
+			if ($encoding == 'C39') {
116
+			    $supported=1;
117
+			}
118
+			if ($encoding == 'C128') {
119
+			    $supported=1;
120
+			}
109 121
 		}
110 122
 		return $supported;
111 123
 	}
@@ -126,10 +138,16 @@  discard block
 block discarded – undo
126 138
 		global $conf;
127 139
 		global $genbarcode_loc, $bar_color, $bg_color, $text_color, $font_loc;
128 140
 
129
-		if (! $this->encodingIsSupported($encoding)) return -1;
141
+		if (! $this->encodingIsSupported($encoding)) {
142
+		    return -1;
143
+		}
130 144
 
131
-		if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN';
132
-		if ($encoding == 'C39' || $encoding == 'C128')   $encoding = substr($encoding,1);
145
+		if ($encoding == 'EAN8' || $encoding == 'EAN13') {
146
+		    $encoding = 'EAN';
147
+		}
148
+		if ($encoding == 'C39' || $encoding == 'C128') {
149
+		    $encoding = substr($encoding,1);
150
+		}
133 151
 
134 152
 		$mode='png';
135 153
 
@@ -139,12 +157,16 @@  discard block
 block discarded – undo
139 157
 		$_GET["mode"]=$mode;
140 158
 
141 159
 		dol_syslog(get_class($this)."::buildBarCode $code,$encoding,$scale,$mode");
142
-		if ($code) $result=barcode_print($code,$encoding,$scale,$mode);
160
+		if ($code) {
161
+		    $result=barcode_print($code,$encoding,$scale,$mode);
162
+		}
143 163
 
144 164
 		if (! is_array($result))
145 165
 		{
146 166
 			$this->error=$result;
147
-			if (empty($nooutputiferror)) print $this->error;
167
+			if (empty($nooutputiferror)) {
168
+			    print $this->error;
169
+			}
148 170
 			return -1;
149 171
 		}
150 172
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/barcode/mod_barcode_product_standard.php 1 patch
Braces   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -152,7 +152,9 @@  discard block
 block discarded – undo
152 152
 
153 153
 		// Get Mask value
154 154
 		$mask = '';
155
-		if (! empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) $mask = $conf->global->BARCODE_STANDARD_PRODUCT_MASK;
155
+		if (! empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) {
156
+		    $mask = $conf->global->BARCODE_STANDARD_PRODUCT_MASK;
157
+		}
156 158
 
157 159
 		if (empty($mask))
158 160
 		{
@@ -198,12 +200,10 @@  discard block
 block discarded – undo
198 200
 		if (empty($code) && $this->code_null && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK))
199 201
 		{
200 202
 			$result=0;
201
-		}
202
-		else if (empty($code) && (! $this->code_null || ! empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) )
203
+		} else if (empty($code) && (! $this->code_null || ! empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) )
203 204
 		{
204 205
 			$result=-2;
205
-		}
206
-		else
206
+		} else
207 207
 		{
208 208
 			if ($this->verif_syntax($code, $type) >= 0)
209 209
 			{
@@ -211,19 +211,16 @@  discard block
 block discarded – undo
211 211
 				if ($is_dispo <> 0)
212 212
 				{
213 213
 					$result=-3;
214
-				}
215
-				else
214
+				} else
216 215
 				{
217 216
 					$result=0;
218 217
 				}
219
-			}
220
-			else
218
+			} else
221 219
 			{
222 220
 				if (dol_strlen($code) == 0)
223 221
 				{
224 222
 					$result=-2;
225
-				}
226
-				else
223
+				} else
227 224
 				{
228 225
 					$result=-1;
229 226
 				}
@@ -249,7 +246,9 @@  discard block
 block discarded – undo
249 246
         // phpcs:enable
250 247
 		$sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."product";
251 248
 		$sql.= " WHERE barcode = '".$code."'";
252
-		if ($product->id > 0) $sql.= " AND rowid <> ".$product->id;
249
+		if ($product->id > 0) {
250
+		    $sql.= " AND rowid <> ".$product->id;
251
+		}
253 252
 
254 253
 		$resql=$db->query($sql);
255 254
 		if ($resql)
@@ -257,13 +256,11 @@  discard block
 block discarded – undo
257 256
 			if ($db->num_rows($resql) == 0)
258 257
 			{
259 258
 				return 0;
260
-			}
261
-			else
259
+			} else
262 260
 			{
263 261
 				return -1;
264 262
 			}
265
-		}
266
-		else
263
+		} else
267 264
 		{
268 265
 			return -2;
269 266
 		}
@@ -297,11 +294,13 @@  discard block
 block discarded – undo
297 294
 		$newcodefortest=$codefortest;
298 295
 
299 296
 		// Special case, if mask is on 12 digits instead of 13, we remove last char into code to test
300
-		if (in_array($typefortest,array('EAN13','ISBN')))	// We remove the CRC char not included into mask
297
+		if (in_array($typefortest,array('EAN13','ISBN'))) {
298
+		    // We remove the CRC char not included into mask
301 299
 		{
302 300
     		if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg))
303 301
     	    {
304 302
     	        if (strlen($reg[1]) == 12) $newcodefortest=substr($newcodefortest,0,12);
303
+		}
305 304
     	        dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest);
306 305
     	    }
307 306
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/barcode/modules_barcode.class.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -111,10 +111,18 @@  discard block
 block discarded – undo
111 111
         global $langs;
112 112
         $langs->load("admin");
113 113
 
114
-        if ($this->version == 'development') return $langs->trans("VersionDevelopment");
115
-        if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
116
-        if ($this->version == 'dolibarr') return DOL_VERSION;
117
-        if ($this->version) return $this->version;
114
+        if ($this->version == 'development') {
115
+            return $langs->trans("VersionDevelopment");
116
+        }
117
+        if ($this->version == 'experimental') {
118
+            return $langs->trans("VersionExperimental");
119
+        }
120
+        if ($this->version == 'dolibarr') {
121
+            return DOL_VERSION;
122
+        }
123
+        if ($this->version) {
124
+            return $this->version;
125
+        }
118 126
         return $langs->trans("NotAvailable");
119 127
     }
120 128
 
@@ -135,31 +143,45 @@  discard block
 block discarded – undo
135 143
         $s='';
136 144
         $s.=$langs->trans("Name").': <b>'.$this->name.'</b><br>';
137 145
         $s.=$langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
138
-        if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
146
+        if ($type != -1) {
147
+            $s.=$langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
148
+        }
139 149
         $s.='<br>';
140 150
         $s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
141 151
         if ($type == 0)
142 152
         {
143 153
             $s.=$langs->trans("RequiredIfProduct").': ';
144
-            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='<strike>';
154
+            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) {
155
+                $s.='<strike>';
156
+            }
145 157
             $s.=yn(!$this->code_null,1,2);
146
-            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
158
+            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) {
159
+                $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
160
+            }
147 161
             $s.='<br>';
148 162
         }
149 163
         if ($type == 1)
150 164
         {
151 165
             $s.=$langs->trans("RequiredIfService").': ';
152
-            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='<strike>';
166
+            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) {
167
+                $s.='<strike>';
168
+            }
153 169
             $s.=yn(!$this->code_null,1,2);
154
-            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
170
+            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) {
171
+                $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
172
+            }
155 173
             $s.='<br>';
156 174
         }
157 175
         if ($type == -1)
158 176
         {
159 177
             $s.=$langs->trans("Required").': ';
160
-            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='<strike>';
178
+            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) {
179
+                $s.='<strike>';
180
+            }
161 181
             $s.=yn(!$this->code_null,1,2);
162
-            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
182
+            if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) {
183
+                $s.='</strike> '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
184
+            }
163 185
             $s.='<br>';
164 186
         }
165 187
         /*$s.=$langs->trans("CanBeModifiedIfOk").': ';
@@ -171,7 +193,9 @@  discard block
 block discarded – undo
171 193
         $s.='<br>';
172 194
 
173 195
         $nextval=$this->getNextValue($soc,'');
174
-        if (empty($nextval)) $nextval=$langs->trans("Undefined");
196
+        if (empty($nextval)) {
197
+            $nextval=$langs->trans("Undefined");
198
+        }
175 199
         $s.=$langs->trans("NextValue").': <b>'.$nextval.'</b><br>';
176 200
 
177 201
         return $s;
Please login to merge, or discard this patch.
modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php 1 patch
Braces   +45 added lines, -39 removed lines patch added patch discarded remove patch
@@ -97,7 +97,10 @@  discard block
 block discarded – undo
97 97
 
98 98
 		// Recupere emetteur
99 99
 		$this->emetteur=$mysoc;
100
-		if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default if not defined
100
+		if (! $this->emetteur->country_code) {
101
+		    $this->emetteur->country_code=substr($langs->defaultlang,-2);
102
+		}
103
+		// By default if not defined
101 104
 	}
102 105
 
103 106
 
@@ -141,11 +144,14 @@  discard block
 block discarded – undo
141 144
 			if (! $tmpdir) {
142 145
 				unset($listofdir[$key]); continue;
143 146
 			}
144
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
145
-			else
147
+			if (! is_dir($tmpdir)) {
148
+			    $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
149
+			} else
146 150
 			{
147 151
 				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
148
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
152
+				if (count($tmpfiles)) {
153
+				    $listoffiles=array_merge($listoffiles,$tmpfiles);
154
+				}
149 155
 			}
150 156
 		}
151 157
 		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
@@ -253,7 +259,9 @@  discard block
 block discarded – undo
253 259
 		$hookmanager->initHooks(array('odtgeneration'));
254 260
 		global $action;
255 261
 
256
-		if (! is_object($outputlangs)) $outputlangs=$langs;
262
+		if (! is_object($outputlangs)) {
263
+		    $outputlangs=$langs;
264
+		}
257 265
 		$sav_charset_output=$outputlangs->charset_output;
258 266
 		$outputlangs->charset_output='UTF-8';
259 267
 
@@ -277,7 +285,9 @@  discard block
 block discarded – undo
277 285
 
278 286
 			$dir = $conf->supplier_proposal->dir_output;
279 287
 			$objectref = dol_sanitizeFileName($object->ref);
280
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
288
+			if (! preg_match('/specimen/i',$objectref)) {
289
+			    $dir.= "/" . $objectref;
290
+			}
281 291
 			$file = $dir . "/" . $objectref . ".odt";
282 292
 
283 293
 			if (! file_exists($dir))
@@ -304,10 +314,11 @@  discard block
 block discarded – undo
304 314
 				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
305 315
 				{
306 316
 				    $format=$conf->global->MAIN_DOC_USE_TIMING;
307
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
317
+				    if ($format == '1') {
318
+				        $format='%Y%m%d%H%M%S';
319
+				    }
308 320
 					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
309
-				}
310
-				else
321
+				} else
311 322
 				{
312 323
 					$filename=$newfiletmp.'.'.$newfileformat;
313 324
 				}
@@ -333,10 +344,12 @@  discard block
 block discarded – undo
333 344
 				if (! empty($usecontact))
334 345
 				{
335 346
 					// On peut utiliser le nom de la societe du contact
336
-					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
337
-					else $socobject = $object->thirdparty;
338
-				}
339
-				else
347
+					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
348
+					    $socobject = $object->contact;
349
+					} else {
350
+					    $socobject = $object->thirdparty;
351
+					}
352
+				} else
340 353
 				{
341 354
 					$socobject=$object->thirdparty;
342 355
 				}
@@ -374,8 +387,7 @@  discard block
 block discarded – undo
374 387
 							'DELIMITER_RIGHT' => '}'
375 388
 						)
376 389
 					);
377
-				}
378
-				catch (Exception $e)
390
+				} catch (Exception $e)
379 391
 				{
380 392
 					$this->error=$e->getMessage();
381 393
 					dol_syslog($e->getMessage(), LOG_INFO);
@@ -391,8 +403,7 @@  discard block
 block discarded – undo
391 403
 				// Make substitutions into odt of freetext
392 404
 				try {
393 405
 					$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
394
-				}
395
-				catch (OdfException $e)
406
+				} catch (OdfException $e)
396 407
 				{
397 408
 					dol_syslog($e->getMessage(), LOG_INFO);
398 409
 				}
@@ -415,17 +426,18 @@  discard block
 block discarded – undo
415 426
 				foreach($tmparray as $key=>$value)
416 427
 				{
417 428
 					try {
418
-						if (preg_match('/logo$/',$key)) // Image
429
+						if (preg_match('/logo$/',$key)) {
430
+						    // Image
419 431
 						{
420 432
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
421
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
422
-						}
423
-						else    // Text
433
+						} else {
434
+							    $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
435
+							}
436
+						} else    // Text
424 437
 						{
425 438
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
426 439
 						}
427
-					}
428
-					catch(OdfException $e)
440
+					} catch(OdfException $e)
429 441
 					{
430 442
                         dol_syslog($e->getMessage(), LOG_INFO);
431 443
 					}
@@ -436,8 +448,7 @@  discard block
 block discarded – undo
436 448
 					$foundtagforlines = 1;
437 449
 					try {
438 450
 						$listlines = $odfHandler->setSegment('lines');
439
-					}
440
-					catch(OdfException $e)
451
+					} catch(OdfException $e)
441 452
 					{
442 453
 						// We may arrive here if tags for lines not present into template
443 454
 						$foundtagforlines = 0;
@@ -457,12 +468,10 @@  discard block
 block discarded – undo
457 468
 								try
458 469
 								{
459 470
 									$listlines->setVars($key, $val, true, 'UTF-8');
460
-								}
461
-								catch(OdfException $e)
471
+								} catch(OdfException $e)
462 472
 								{
463 473
 									dol_syslog($e->getMessage(), LOG_INFO);
464
-								}
465
-								catch(SegmentException $e)
474
+								} catch(SegmentException $e)
466 475
 								{
467 476
 									dol_syslog($e->getMessage(), LOG_INFO);
468 477
 								}
@@ -471,8 +480,7 @@  discard block
 block discarded – undo
471 480
 						}
472 481
 						$odfHandler->mergeSegment($listlines);
473 482
 					}
474
-				}
475
-				catch(OdfException $e)
483
+				} catch(OdfException $e)
476 484
 				{
477 485
 					$this->error=$e->getMessage();
478 486
 					dol_syslog($this->error, LOG_WARNING);
@@ -485,8 +493,7 @@  discard block
 block discarded – undo
485 493
 				{
486 494
 					try {
487 495
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
488
-					}
489
-					catch(OdfException $e)
496
+					} catch(OdfException $e)
490 497
 					{
491 498
                         dol_syslog($e->getMessage(), LOG_INFO);
492 499
 					}
@@ -505,8 +512,7 @@  discard block
 block discarded – undo
505 512
                         dol_syslog($e->getMessage(), LOG_INFO);
506 513
 						return -1;
507 514
 					}
508
-				}
509
-				else {
515
+				} else {
510 516
 					try {
511 517
 						$odfHandler->saveToDisk($file);
512 518
 					} catch (Exception $e) {
@@ -518,16 +524,16 @@  discard block
 block discarded – undo
518 524
 				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
519 525
 				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
520 526
 
521
-				if (! empty($conf->global->MAIN_UMASK))
522
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
527
+				if (! empty($conf->global->MAIN_UMASK)) {
528
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
529
+				}
523 530
 
524 531
 				$odfHandler=null;	// Destroy object
525 532
 
526 533
 				$this->result = array('fullpath'=>$file);
527 534
 
528 535
 				return 1;   // Success
529
-			}
530
-			else
536
+			} else
531 537
 			{
532 538
 				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
533 539
 				return -1;
Please login to merge, or discard this patch.