Passed
Push — master ( 8f7a8e...7e4a07 )
by Alxarafe
20:11
created
htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class doc_generic_reception_odt extends ModelePdfReception
37 37
 {
38
-	var $emetteur;	// Objet societe qui emet
38
+	var $emetteur; // Objet societe qui emet
39 39
 
40
-	var $phpmin = array(5,2,0);	// Minimum version of PHP required by module
40
+	var $phpmin = array(5, 2, 0); // Minimum version of PHP required by module
41 41
 	var $version = 'dolibarr';
42 42
 
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	function __construct($db)
50 50
 	{
51
-		global $conf,$langs,$mysoc;
51
+		global $conf, $langs, $mysoc;
52 52
 
53 53
 		$langs->load("main");
54 54
 		$langs->load("companies");
@@ -56,32 +56,32 @@  discard block
 block discarded – undo
56 56
 		$this->db = $db;
57 57
 		$this->name = "ODT templates";
58 58
 		$this->description = $langs->trans("DocumentModelOdt");
59
-		$this->scandir = 'RECEPTION_ADDON_PDF_ODT_PATH';	// Name of constant that is used to save list of directories to scan
59
+		$this->scandir = 'RECEPTION_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
60 60
 
61 61
 		// Dimension page pour format A4
62 62
 		$this->type = 'odt';
63 63
 		$this->page_largeur = 0;
64 64
 		$this->page_hauteur = 0;
65
-		$this->format = array($this->page_largeur,$this->page_hauteur);
66
-		$this->marge_gauche=0;
67
-		$this->marge_droite=0;
68
-		$this->marge_haute=0;
69
-		$this->marge_basse=0;
70
-
71
-		$this->option_logo = 1;                    // Affiche logo
72
-		$this->option_tva = 0;                     // Gere option tva RECEPTION_TVAOPTION
73
-		$this->option_modereg = 0;                 // Affiche mode reglement
74
-		$this->option_condreg = 0;                 // Affiche conditions reglement
75
-		$this->option_codeproduitservice = 0;      // Affiche code produit-service
76
-		$this->option_multilang = 1;               // Dispo en plusieurs langues
77
-		$this->option_escompte = 0;                // Affiche si il y a eu escompte
78
-		$this->option_credit_note = 0;             // Support credit notes
79
-		$this->option_freetext = 1;				   // Support add of a personalised text
80
-		$this->option_draft_watermark = 0;		   // Support add of a watermark on drafts
65
+		$this->format = array($this->page_largeur, $this->page_hauteur);
66
+		$this->marge_gauche = 0;
67
+		$this->marge_droite = 0;
68
+		$this->marge_haute = 0;
69
+		$this->marge_basse = 0;
70
+
71
+		$this->option_logo = 1; // Affiche logo
72
+		$this->option_tva = 0; // Gere option tva RECEPTION_TVAOPTION
73
+		$this->option_modereg = 0; // Affiche mode reglement
74
+		$this->option_condreg = 0; // Affiche conditions reglement
75
+		$this->option_codeproduitservice = 0; // Affiche code produit-service
76
+		$this->option_multilang = 1; // Dispo en plusieurs langues
77
+		$this->option_escompte = 0; // Affiche si il y a eu escompte
78
+		$this->option_credit_note = 0; // Support credit notes
79
+		$this->option_freetext = 1; // Support add of a personalised text
80
+		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
81 81
 
82 82
 		// Recupere emetteur
83
-		$this->emetteur=$mysoc;
84
-		if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default if not defined
83
+		$this->emetteur = $mysoc;
84
+		if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
85 85
 	}
86 86
 
87 87
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	function info($langs)
95 95
 	{
96
-		global $conf,$langs;
96
+		global $conf, $langs;
97 97
 
98 98
 		$langs->load("companies");
99 99
 		$langs->load("errors");
@@ -101,74 +101,74 @@  discard block
 block discarded – undo
101 101
 		$form = new Form($this->db);
102 102
 
103 103
 		$texte = $this->description.".<br>\n";
104
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
105
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
106
-		$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
107
-		$texte.= '<input type="hidden" name="param1" value="RECEPTION_ADDON_PDF_ODT_PATH">';
108
-		$texte.= '<table class="nobordernopadding" width="100%">';
104
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
105
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
106
+		$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
107
+		$texte .= '<input type="hidden" name="param1" value="RECEPTION_ADDON_PDF_ODT_PATH">';
108
+		$texte .= '<table class="nobordernopadding" width="100%">';
109 109
 
110 110
 		// List of directories area
111
-		$texte.= '<tr><td>';
112
-		$texttitle=$langs->trans("ListOfDirectories");
113
-		$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->RECEPTION_ADDON_PDF_ODT_PATH)));
114
-		$listoffiles=array();
115
-		foreach($listofdir as $key=>$tmpdir)
111
+		$texte .= '<tr><td>';
112
+		$texttitle = $langs->trans("ListOfDirectories");
113
+		$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->RECEPTION_ADDON_PDF_ODT_PATH)));
114
+		$listoffiles = array();
115
+		foreach ($listofdir as $key=>$tmpdir)
116 116
 		{
117
-			$tmpdir=trim($tmpdir);
118
-			$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
119
-			if (! $tmpdir) {
117
+			$tmpdir = trim($tmpdir);
118
+			$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
119
+			if (!$tmpdir) {
120 120
 				unset($listofdir[$key]); continue;
121 121
 			}
122
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
122
+			if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
123 123
 			else
124 124
 			{
125
-				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
126
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
125
+				$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
126
+				if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
127 127
 			}
128 128
 		}
129
-		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
129
+		$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
130 130
 		// Add list of substitution keys
131
-		$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
132
-		$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");    // This contains an url, we don't modify it
133
-
134
-		$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
135
-		$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
136
-		$texte.= '<textarea class="flat" cols="60" name="value1">';
137
-		$texte.=$conf->global->RECEPTION_ADDON_PDF_ODT_PATH;
138
-		$texte.= '</textarea>';
139
-		$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
140
-		$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
141
-		$texte.= '<br></div></div>';
131
+		$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
132
+		$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
133
+
134
+		$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
135
+		$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
136
+		$texte .= '<textarea class="flat" cols="60" name="value1">';
137
+		$texte .= $conf->global->RECEPTION_ADDON_PDF_ODT_PATH;
138
+		$texte .= '</textarea>';
139
+		$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
140
+		$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
141
+		$texte .= '<br></div></div>';
142 142
 
143 143
 		// Scan directories
144
-		$nbofiles=count($listoffiles);
145
-		if (! empty($conf->global->RECEPTION_ADDON_PDF_ODT_PATH))
144
+		$nbofiles = count($listoffiles);
145
+		if (!empty($conf->global->RECEPTION_ADDON_PDF_ODT_PATH))
146 146
 		{
147
-			$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
147
+			$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
148 148
 			//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
149
-			$texte.=count($listoffiles);
149
+			$texte .= count($listoffiles);
150 150
 			//$texte.=$nbofiles?'</a>':'';
151
-			$texte.='</b>';
151
+			$texte .= '</b>';
152 152
 		}
153 153
 		if ($nbofiles)
154 154
 		{
155
-   			$texte.='<div id="div_'.get_class($this).'" class="hidden">';
156
-   			foreach($listoffiles as $file)
155
+   			$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
156
+   			foreach ($listoffiles as $file)
157 157
    			{
158
-                $texte.=$file['name'].'<br>';
158
+                $texte .= $file['name'].'<br>';
159 159
    			}
160
-   			$texte.='<div id="div_'.get_class($this).'">';
160
+   			$texte .= '<div id="div_'.get_class($this).'">';
161 161
 		}
162 162
 
163
-		$texte.= '</td>';
163
+		$texte .= '</td>';
164 164
 
165
-		$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
166
-		$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
167
-		$texte.= '</td>';
168
-		$texte.= '</tr>';
165
+		$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
166
+		$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
167
+		$texte .= '</td>';
168
+		$texte .= '</tr>';
169 169
 
170
-		$texte.= '</table>';
171
-		$texte.= '</form>';
170
+		$texte .= '</table>';
171
+		$texte .= '</form>';
172 172
 
173 173
 		return $texte;
174 174
 	}
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 	 *  @param		int			$hideref			Do not show ref
186 186
 	 *	@return		int         					1 if OK, <=0 if KO
187 187
 	 */
188
-	function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
188
+	function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
189 189
 	{
190 190
 		// phpcs:enable
191
-		global $user,$langs,$conf,$mysoc,$hookmanager;
191
+		global $user, $langs, $conf, $mysoc, $hookmanager;
192 192
 
193 193
 		if (empty($srctemplatepath))
194 194
 		{
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
 		}
198 198
 
199 199
 		// Add odtgeneration hook
200
-		if (! is_object($hookmanager))
200
+		if (!is_object($hookmanager))
201 201
 		{
202 202
 			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
203
-			$hookmanager=new HookManager($this->db);
203
+			$hookmanager = new HookManager($this->db);
204 204
 		}
205 205
 		$hookmanager->initHooks(array('odtgeneration'));
206 206
 		global $action;
207 207
 
208
-		if (! is_object($outputlangs)) $outputlangs=$langs;
209
-		$sav_charset_output=$outputlangs->charset_output;
210
-		$outputlangs->charset_output='UTF-8';
208
+		if (!is_object($outputlangs)) $outputlangs = $langs;
209
+		$sav_charset_output = $outputlangs->charset_output;
210
+		$outputlangs->charset_output = 'UTF-8';
211 211
 
212 212
 		$outputlangs->load("main");
213 213
 		$outputlangs->load("dict");
@@ -217,28 +217,28 @@  discard block
 block discarded – undo
217 217
 		if ($conf->reception->dir_output."/reception")
218 218
 		{
219 219
 			// If $object is id instead of object
220
-			if (! is_object($object))
220
+			if (!is_object($object))
221 221
 			{
222 222
 				$id = $object;
223 223
 				$object = new Reception($this->db);
224
-				$result=$object->fetch($id);
224
+				$result = $object->fetch($id);
225 225
 				if ($result < 0)
226 226
 				{
227
-					dol_print_error($this->db,$object->error);
227
+					dol_print_error($this->db, $object->error);
228 228
 					return -1;
229 229
 				}
230 230
 			}
231 231
 
232 232
 			$dir = $conf->reception->dir_output."/reception";
233 233
 			$objectref = dol_sanitizeFileName($object->ref);
234
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
235
-			$file = $dir . "/" . $objectref . ".odt";
234
+			if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
235
+			$file = $dir."/".$objectref.".odt";
236 236
 
237
-			if (! file_exists($dir))
237
+			if (!file_exists($dir))
238 238
 			{
239 239
 				if (dol_mkdir($dir) < 0)
240 240
 				{
241
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
241
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
242 242
 					return -1;
243 243
 				}
244 244
 			}
@@ -246,25 +246,25 @@  discard block
 block discarded – undo
246 246
 			if (file_exists($dir))
247 247
 			{
248 248
 				//print "srctemplatepath=".$srctemplatepath;	// Src filename
249
-				$newfile=basename($srctemplatepath);
250
-				$newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
251
-				$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
252
-				$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
253
-				$newfiletmp=$objectref.'_'.$newfiletmp;
249
+				$newfile = basename($srctemplatepath);
250
+				$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
251
+				$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
252
+				$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
253
+				$newfiletmp = $objectref.'_'.$newfiletmp;
254 254
 				//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
255 255
 				// Get extension (ods or odt)
256
-				$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
257
-				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
256
+				$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
257
+				if (!empty($conf->global->MAIN_DOC_USE_TIMING))
258 258
 				{
259
-				    $format=$conf->global->MAIN_DOC_USE_TIMING;
260
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
261
-					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
259
+				    $format = $conf->global->MAIN_DOC_USE_TIMING;
260
+				    if ($format == '1') $format = '%Y%m%d%H%M%S';
261
+					$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
262 262
 				}
263 263
 				else
264 264
 				{
265
-					$filename=$newfiletmp.'.'.$newfileformat;
265
+					$filename = $newfiletmp.'.'.$newfileformat;
266 266
 				}
267
-				$file=$dir.'/'.$filename;
267
+				$file = $dir.'/'.$filename;
268 268
 				//print "newdir=".$dir;
269 269
 				//print "newfile=".$newfile;
270 270
 				//print "file=".$file;
@@ -274,28 +274,28 @@  discard block
 block discarded – undo
274 274
 
275 275
 
276 276
 				// If BILLING contact defined on invoice, we use it
277
-				$usecontact=false;
278
-				$arrayidcontact=$object->getIdContact('external','BILLING');
277
+				$usecontact = false;
278
+				$arrayidcontact = $object->getIdContact('external', 'BILLING');
279 279
 				if (count($arrayidcontact) > 0)
280 280
 				{
281
-					$usecontact=true;
282
-					$result=$object->fetch_contact($arrayidcontact[0]);
281
+					$usecontact = true;
282
+					$result = $object->fetch_contact($arrayidcontact[0]);
283 283
 				}
284 284
 
285 285
 				// Recipient name
286
-				if (! empty($usecontact))
286
+				if (!empty($usecontact))
287 287
 				{
288 288
 					// On peut utiliser le nom de la societe du contact
289
-					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
289
+					if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
290 290
 					else $socobject = $object->thirdparty;
291 291
 				}
292 292
 				else
293 293
 				{
294
-					$socobject=$object->thirdparty;
294
+					$socobject = $object->thirdparty;
295 295
 				}
296 296
 
297 297
 				// Make substitution
298
-				$substitutionarray=array(
298
+				$substitutionarray = array(
299 299
 				'__FROM_NAME__' => $this->emetteur->name,
300 300
 				'__FROM_EMAIL__' => $this->emetteur->email,
301 301
 				'__TOTAL_TTC__' => $object->total_ttc,
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
 				);
305 305
 				complete_substitutions_array($substitutionarray, $langs, $object);
306 306
 				// Call the ODTSubstitution hook
307
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
308
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
307
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
308
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
309 309
 
310 310
 				// Line of free text
311
-				$newfreetext='';
312
-				$paramfreetext='RECEPTION_FREE_TEXT';
313
-				if (! empty($conf->global->$paramfreetext))
311
+				$newfreetext = '';
312
+				$paramfreetext = 'RECEPTION_FREE_TEXT';
313
+				if (!empty($conf->global->$paramfreetext))
314 314
 				{
315
-					$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
315
+					$newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
316 316
 				}
317 317
 
318 318
 				// Open and load template
@@ -322,15 +322,15 @@  discard block
 block discarded – undo
322 322
 						$srctemplatepath,
323 323
 						array(
324 324
 						'PATH_TO_TMP'	  => $conf->reception->dir_temp,
325
-						'ZIP_PROXY'		  => 'PclZipProxy',	// PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
325
+						'ZIP_PROXY'		  => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
326 326
 						'DELIMITER_LEFT'  => '{',
327 327
 						'DELIMITER_RIGHT' => '}'
328 328
 						)
329 329
 					);
330 330
 				}
331
-				catch(Exception $e)
331
+				catch (Exception $e)
332 332
 				{
333
-					$this->error=$e->getMessage();
333
+					$this->error = $e->getMessage();
334 334
 					return -1;
335 335
 				}
336 336
 				// After construction $odfHandler->contentXml contains content and
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
 				try {
345 345
 					$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
346 346
 				}
347
-				catch(OdfException $e)
347
+				catch (OdfException $e)
348 348
 				{
349 349
 				}
350 350
 
351 351
 				// Make substitutions into odt of user info
352
-				$tmparray=$this->get_substitutionarray_user($user,$outputlangs);
352
+				$tmparray = $this->get_substitutionarray_user($user, $outputlangs);
353 353
 				//var_dump($tmparray); exit;
354
-				foreach($tmparray as $key=>$value)
354
+				foreach ($tmparray as $key=>$value)
355 355
 				{
356 356
 					try {
357
-						if (preg_match('/logo$/',$key)) // Image
357
+						if (preg_match('/logo$/', $key)) // Image
358 358
 						{
359 359
 							//var_dump($value);exit;
360 360
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
@@ -365,17 +365,17 @@  discard block
 block discarded – undo
365 365
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
366 366
 						}
367 367
 					}
368
-					catch(OdfException $e)
368
+					catch (OdfException $e)
369 369
 					{
370 370
 					}
371 371
 				}
372 372
 				// Make substitutions into odt of mysoc
373
-				$tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
373
+				$tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
374 374
 				//var_dump($tmparray); exit;
375
-				foreach($tmparray as $key=>$value)
375
+				foreach ($tmparray as $key=>$value)
376 376
 				{
377 377
 					try {
378
-						if (preg_match('/logo$/',$key))	// Image
378
+						if (preg_match('/logo$/', $key))	// Image
379 379
 						{
380 380
 							//var_dump($value);exit;
381 381
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
@@ -386,16 +386,16 @@  discard block
 block discarded – undo
386 386
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
387 387
 						}
388 388
 					}
389
-					catch(OdfException $e)
389
+					catch (OdfException $e)
390 390
 					{
391 391
 					}
392 392
 				}
393 393
 				// Make substitutions into odt of thirdparty
394
-				$tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
395
-				foreach($tmparray as $key=>$value)
394
+				$tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
395
+				foreach ($tmparray as $key=>$value)
396 396
 				{
397 397
 					try {
398
-						if (preg_match('/logo$/',$key))	// Image
398
+						if (preg_match('/logo$/', $key))	// Image
399 399
 						{
400 400
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
401 401
 							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
406 406
 						}
407 407
 					}
408
-					catch(OdfException $e)
408
+					catch (OdfException $e)
409 409
 					{
410 410
 					}
411 411
 				}
412 412
 				// Replace tags of object + external modules
413
-				$tmparray=$this->get_substitutionarray_reception($object,$outputlangs);
413
+				$tmparray = $this->get_substitutionarray_reception($object, $outputlangs);
414 414
 				complete_substitutions_array($tmparray, $outputlangs, $object);
415 415
 				// Call the ODTSubstitution hook
416
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
417
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
418
-				foreach($tmparray as $key=>$value)
416
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
417
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
418
+				foreach ($tmparray as $key=>$value)
419 419
 				{
420 420
 					try {
421
-						if (preg_match('/logo$/',$key)) // Image
421
+						if (preg_match('/logo$/', $key)) // Image
422 422
 						{
423 423
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
424 424
 							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
429 429
 						}
430 430
 					}
431
-					catch(OdfException $e)
431
+					catch (OdfException $e)
432 432
 					{
433 433
 					}
434 434
 				}
@@ -438,21 +438,21 @@  discard block
 block discarded – undo
438 438
 					$listlines = $odfHandler->setSegment('lines');
439 439
 					foreach ($object->lines as $line)
440 440
 					{
441
-						$tmparray=$this->get_substitutionarray_reception_lines($line,$outputlangs);
441
+						$tmparray = $this->get_substitutionarray_reception_lines($line, $outputlangs);
442 442
 						complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
443 443
 						// Call the ODTSubstitutionLine hook
444
-						$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
445
-						$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
446
-						foreach($tmparray as $key => $val)
444
+						$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
445
+						$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
446
+						foreach ($tmparray as $key => $val)
447 447
 						{
448 448
 							try
449 449
 							{
450 450
 								$listlines->setVars($key, $val, true, 'UTF-8');
451 451
 							}
452
-							catch(OdfException $e)
452
+							catch (OdfException $e)
453 453
 							{
454 454
 							}
455
-							catch(SegmentException $e)
455
+							catch (SegmentException $e)
456 456
 							{
457 457
 							}
458 458
 						}
@@ -460,59 +460,59 @@  discard block
 block discarded – undo
460 460
 					}
461 461
 					$odfHandler->mergeSegment($listlines);
462 462
 				}
463
-				catch(OdfException $e)
463
+				catch (OdfException $e)
464 464
 				{
465
-					$this->error=$e->getMessage();
465
+					$this->error = $e->getMessage();
466 466
 					dol_syslog($this->error, LOG_WARNING);
467 467
 					return -1;
468 468
 				}
469 469
 
470 470
 				// Replace labels translated
471
-				$tmparray=$outputlangs->get_translations_for_substitutions();
472
-				foreach($tmparray as $key=>$value)
471
+				$tmparray = $outputlangs->get_translations_for_substitutions();
472
+				foreach ($tmparray as $key=>$value)
473 473
 				{
474 474
 					try {
475 475
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
476 476
 					}
477
-					catch(OdfException $e)
477
+					catch (OdfException $e)
478 478
 					{
479 479
 					}
480 480
 				}
481 481
 
482 482
 				// Call the beforeODTSave hook
483
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
484
-				$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
483
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
484
+				$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
485 485
 
486 486
 				// Write new file
487 487
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
488 488
 					try {
489 489
 						$odfHandler->exportAsAttachedPDF($file);
490
-					}catch (Exception $e){
491
-						$this->error=$e->getMessage();
490
+					} catch (Exception $e) {
491
+						$this->error = $e->getMessage();
492 492
 						return -1;
493 493
 					}
494 494
 				}
495 495
 				else {
496 496
 					try {
497 497
 					$odfHandler->saveToDisk($file);
498
-					}catch (Exception $e){
499
-						$this->error=$e->getMessage();
498
+					} catch (Exception $e) {
499
+						$this->error = $e->getMessage();
500 500
 						return -1;
501 501
 					}
502 502
 				}
503
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
504
-				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
503
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
504
+				$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
505 505
 
506
-				if (! empty($conf->global->MAIN_UMASK))
506
+				if (!empty($conf->global->MAIN_UMASK))
507 507
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
508 508
 
509
-				$odfHandler=null;	// Destroy object
509
+				$odfHandler = null; // Destroy object
510 510
 
511
-				return 1;   // Success
511
+				return 1; // Success
512 512
 			}
513 513
 			else
514 514
 			{
515
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
515
+				$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
516 516
 				return -1;
517 517
 			}
518 518
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/reception/mod_reception_beryl.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
  *  \ingroup    reception
22 22
  *  \brief      File of class to manage shipments numbering rules Beryl
23 23
  */
24
-require_once DOL_DOCUMENT_ROOT .'/core/modules/reception/modules_reception.php';
24
+require_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php';
25 25
 
26 26
 /**
27 27
  *	Class to manage reception numbering rules Beryl
28 28
  */
29 29
 class mod_reception_beryl extends ModelNumRefReception
30 30
 {
31
-	var $version='dolibarr';
32
-	var $prefix='RCP';
33
-	var $error='';
34
-	var $nom='Beryl';
31
+	var $version = 'dolibarr';
32
+	var $prefix = 'RCP';
33
+	var $error = '';
34
+	var $nom = 'Beryl';
35 35
 
36 36
 
37 37
 	/**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     function info()
43 43
     {
44 44
     	global $langs;
45
-      	return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
45
+      	return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
46 46
     }
47 47
 
48 48
 
@@ -64,26 +64,26 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	function canBeActivated()
66 66
 	{
67
-		global $conf,$langs,$db;
67
+		global $conf, $langs, $db;
68 68
 
69
-		$coyymm=''; $max='';
69
+		$coyymm = ''; $max = '';
70 70
 
71
-		$posindice=8;
71
+		$posindice = 8;
72 72
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
73
-		$sql.= " FROM ".MAIN_DB_PREFIX."reception";
74
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
75
-		$sql.= " AND entity = ".$conf->entity;
73
+		$sql .= " FROM ".MAIN_DB_PREFIX."reception";
74
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
75
+		$sql .= " AND entity = ".$conf->entity;
76 76
 
77
-		$resql=$db->query($sql);
77
+		$resql = $db->query($sql);
78 78
 		if ($resql)
79 79
 		{
80 80
 			$row = $db->fetch_row($resql);
81
-			if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; }
81
+			if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
82 82
 		}
83
-		if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm))
83
+		if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
84 84
 		{
85 85
 			$langs->load("errors");
86
-			$this->error=$langs->trans('ErrorNumRefModel', $max);
86
+			$this->error = $langs->trans('ErrorNumRefModel', $max);
87 87
 			return false;
88 88
 		}
89 89
 
@@ -97,22 +97,22 @@  discard block
 block discarded – undo
97 97
 	 *	@param	Object		$shipment	Shipment object
98 98
 	 *	@return string      			Value if OK, 0 if KO
99 99
 	 */
100
-	function getNextValue($objsoc,$shipment)
100
+	function getNextValue($objsoc, $shipment)
101 101
 	{
102
-		global $db,$conf;
102
+		global $db, $conf;
103 103
 
104
-		$posindice=9;
104
+		$posindice = 9;
105 105
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
106
-		$sql.= " FROM ".MAIN_DB_PREFIX."reception";
107
-		$sql.= " WHERE ref like '".$db->escape($this->prefix)."____-%'";
108
-		$sql.= " AND entity = ".$conf->entity;
106
+		$sql .= " FROM ".MAIN_DB_PREFIX."reception";
107
+		$sql .= " WHERE ref like '".$db->escape($this->prefix)."____-%'";
108
+		$sql .= " AND entity = ".$conf->entity;
109 109
 
110
-		$resql=$db->query($sql);
110
+		$resql = $db->query($sql);
111 111
 		if ($resql)
112 112
 		{
113 113
 			$obj = $db->fetch_object($resql);
114 114
 			if ($obj) $max = intval($obj->max);
115
-			else $max=0;
115
+			else $max = 0;
116 116
 		}
117 117
 		else
118 118
 		{
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 			return -1;
121 121
 		}
122 122
 
123
-		$date=time();
124
-		$yymm = strftime("%y%m",$date);
123
+		$date = time();
124
+		$yymm = strftime("%y%m", $date);
125 125
 
126
-		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
127
-		else $num = sprintf("%04s",$max+1);
126
+		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
127
+		else $num = sprintf("%04s", $max + 1);
128 128
 
129 129
 		dol_syslog("mod_reception_beryl::getNextValue return ".$this->prefix.$yymm."-".$num);
130 130
 		return $this->prefix.$yymm."-".$num;
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	 *	@param	Object		$objforref	Shipment object
139 139
 	 *	@return string      			Next free value
140 140
 	 */
141
-	function reception_get_num($objsoc,$objforref)
141
+	function reception_get_num($objsoc, $objforref)
142 142
 	{
143 143
 		// phpcs:enable
144
-		return $this->getNextValue($objsoc,$objforref);
144
+		return $this->getNextValue($objsoc, $objforref);
145 145
 	}
146 146
 }
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/reception/modules_reception.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 abstract class ModelePdfReception extends CommonDocGenerator
31 31
 {
32
-    var $error='';
32
+    var $error = '';
33 33
 
34 34
 
35 35
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
      *  @param  integer	$maxfilenamelength  Max length of value to show
41 41
      *  @return	array						List of templates
42 42
 	 */
43
-	static function liste_modeles($db,$maxfilenamelength=0)
43
+	static function liste_modeles($db, $maxfilenamelength = 0)
44 44
 	{
45 45
 		// phpcs:enable
46 46
 		global $conf;
47 47
 
48
-		$type='reception';
49
-		$liste=array();
48
+		$type = 'reception';
49
+		$liste = array();
50 50
 
51 51
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
52
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
52
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
53 53
 
54 54
 		return $liste;
55 55
 	}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
  */
62 62
 abstract class ModelNumRefReception
63 63
 {
64
-	var $error='';
64
+	var $error = '';
65 65
 
66 66
 	/** Return if a model can be used or not
67 67
 	 *
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/reception/mod_reception_moonstone.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
  *  \brief      File of class to manage reception numbering rules Moonstone
23 23
  */
24 24
 
25
-require_once DOL_DOCUMENT_ROOT .'/core/modules/reception/modules_reception.php';
25
+require_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php';
26 26
 
27 27
 /**
28 28
  *	Class to manage reception numbering rules Moonstone
29 29
  */
30 30
 class mod_reception_moonstone extends ModelNumRefReception
31 31
 {
32
-	var $version='dolibarr';
32
+	var $version = 'dolibarr';
33 33
 	var $error = '';
34 34
 	var $nom = 'Moonstone';
35 35
 
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	function info()
42 42
     {
43
-    	global $conf,$langs;
43
+    	global $conf, $langs;
44 44
 
45 45
 		$langs->load("bills");
46 46
 
47 47
 		$form = new Form($this->db);
48 48
 
49 49
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
50
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
51
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
52
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
53
-		$texte.= '<input type="hidden" name="maskconstreception" value="RECEPTION_MOONSTONE_MASK">';
54
-		$texte.= '<table class="nobordernopadding" width="100%">';
55
-
56
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
57
-		$tooltip.=$langs->trans("GenericMaskCodes2");
58
-		$tooltip.=$langs->trans("GenericMaskCodes3");
59
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
60
-		$tooltip.=$langs->trans("GenericMaskCodes5");
61
-
62
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
63
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreception" value="'.$conf->global->RECEPTION_MOONSTONE_MASK.'">',$tooltip,1,1).'</td>';
64
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
65
-		$texte.= '</tr>';
66
-		$texte.= '</table>';
67
-		$texte.= '</form>';
50
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
51
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
52
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
53
+		$texte .= '<input type="hidden" name="maskconstreception" value="RECEPTION_MOONSTONE_MASK">';
54
+		$texte .= '<table class="nobordernopadding" width="100%">';
55
+
56
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Reception"), $langs->transnoentities("Reception"));
57
+		$tooltip .= $langs->trans("GenericMaskCodes2");
58
+		$tooltip .= $langs->trans("GenericMaskCodes3");
59
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Reception"), $langs->transnoentities("Reception"));
60
+		$tooltip .= $langs->trans("GenericMaskCodes5");
61
+
62
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
63
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreception" value="'.$conf->global->RECEPTION_MOONSTONE_MASK.'">', $tooltip, 1, 1).'</td>';
64
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
65
+		$texte .= '</tr>';
66
+		$texte .= '</table>';
67
+		$texte .= '</form>';
68 68
 
69 69
 		return $texte;
70 70
     }
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
     function getExample()
78 78
     {
79
-     	global $conf,$langs,$mysoc;
79
+     	global $conf, $langs, $mysoc;
80 80
 
81
-    	$old_code_client=$mysoc->code_client;
82
-    	$old_code_type=$mysoc->typent_code;
83
-    	$mysoc->code_client='CCCCCCCCCC';
84
-    	$mysoc->typent_code='TTTTTTTTTT';
85
-     	$numExample = $this->getNextValue($mysoc,'');
86
-		$mysoc->code_client=$old_code_client;
87
-		$mysoc->typent_code=$old_code_type;
81
+    	$old_code_client = $mysoc->code_client;
82
+    	$old_code_type = $mysoc->typent_code;
83
+    	$mysoc->code_client = 'CCCCCCCCCC';
84
+    	$mysoc->typent_code = 'TTTTTTTTTT';
85
+     	$numExample = $this->getNextValue($mysoc, '');
86
+		$mysoc->code_client = $old_code_client;
87
+		$mysoc->typent_code = $old_code_type;
88 88
 
89
-		if (! $numExample)
89
+		if (!$numExample)
90 90
 		{
91 91
 			$numExample = $langs->trans('NotConfigured');
92 92
 		}
@@ -100,23 +100,23 @@  discard block
 block discarded – undo
100 100
 	 *	@param	Object		$reception	Reception object
101 101
 	 *	@return string      			Value if OK, 0 if KO
102 102
 	 */
103
-    function getNextValue($objsoc,$reception)
103
+    function getNextValue($objsoc, $reception)
104 104
     {
105
-		global $db,$conf;
105
+		global $db, $conf;
106 106
 
107
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
107
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
108 108
 
109
-		$mask=$conf->global->RECEPTION_MOONSTONE_MASK;
109
+		$mask = $conf->global->RECEPTION_MOONSTONE_MASK;
110 110
 
111
-		if (! $mask)
111
+		if (!$mask)
112 112
 		{
113
-			$this->error='NotConfigured';
113
+			$this->error = 'NotConfigured';
114 114
 			return 0;
115 115
 		}
116 116
 
117 117
 		$date = $reception->date_reception;
118 118
 
119
-		$numFinal=get_next_value($db,$mask,'reception','ref','',$objsoc,$date);
119
+		$numFinal = get_next_value($db, $mask, 'reception', 'ref', '', $objsoc, $date);
120 120
 
121 121
 		return  $numFinal;
122 122
 	}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 *	@param	Object		$objforref	Reception object
130 130
 	 *	@return string      			Next free value
131 131
 	 */
132
-	function reception_get_num($objsoc,$objforref)
132
+	function reception_get_num($objsoc, $objforref)
133 133
 	{
134 134
 		// phpcs:enable
135
-		return $this->getNextValue($objsoc,$objforref);
135
+		return $this->getNextValue($objsoc, $objforref);
136 136
 	}
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/payment/mod_payment_ant.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * \brief      File containing class for numbering module Ant
23 23
  */
24 24
 
25
-require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php';
25
+require_once DOL_DOCUMENT_ROOT.'/core/modules/payment/modules_payment.php';
26 26
 
27 27
 
28 28
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * Dolibarr version of the loaded document
35 35
      * @public string
36 36
      */
37
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
37
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
38 38
 
39 39
 	/**
40 40
 	 * @var string Error message
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	 * @deprecated
47 47
 	 * @see name
48 48
 	 */
49
-	public $nom='Ant';
49
+	public $nom = 'Ant';
50 50
 
51 51
 	/**
52 52
 	 * @var string model name
53 53
 	 */
54
-	public $name='Ant';
54
+	public $name = 'Ant';
55 55
 
56 56
 
57 57
     /**
@@ -68,28 +68,28 @@  discard block
 block discarded – undo
68 68
 		$form = new Form($this->db);
69 69
 
70 70
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
71
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
72
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
73
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
74
-		$texte.= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
75
-		$texte.= '<table class="nobordernopadding" width="100%">';
76
-
77
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
78
-		$tooltip.=$langs->trans("GenericMaskCodes2");
79
-		$tooltip.=$langs->trans("GenericMaskCodes3");
80
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
81
-		$tooltip.=$langs->trans("GenericMaskCodes5");
71
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
72
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
73
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
74
+		$texte .= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
75
+		$texte .= '<table class="nobordernopadding" width="100%">';
76
+
77
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
78
+		$tooltip .= $langs->trans("GenericMaskCodes2");
79
+		$tooltip .= $langs->trans("GenericMaskCodes3");
80
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
81
+		$tooltip .= $langs->trans("GenericMaskCodes5");
82 82
 
83 83
 		// Parametrage du prefix
84
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
85
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskpayment" value="'.$conf->global->PAYMENT_ANT_MASK.'">',$tooltip,1,1).'</td>';
84
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
85
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskpayment" value="'.$conf->global->PAYMENT_ANT_MASK.'">', $tooltip, 1, 1).'</td>';
86 86
 
87
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
87
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
88 88
 
89
-		$texte.= '</tr>';
89
+		$texte .= '</tr>';
90 90
 
91
-		$texte.= '</table>';
92
-		$texte.= '</form>';
91
+		$texte .= '</table>';
92
+		$texte .= '</form>';
93 93
 
94 94
 		return $texte;
95 95
     }
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
      */
102 102
     function getExample()
103 103
     {
104
-     	global $conf,$langs,$mysoc;
104
+     	global $conf, $langs, $mysoc;
105 105
 
106
-    	$old_code_client=$mysoc->code_client;
107
-    	$mysoc->code_client='CCCCCCCCCC';
108
-     	$numExample = $this->getNextValue($mysoc,'');
109
-		$mysoc->code_client=$old_code_client;
106
+    	$old_code_client = $mysoc->code_client;
107
+    	$mysoc->code_client = 'CCCCCCCCCC';
108
+     	$numExample = $this->getNextValue($mysoc, '');
109
+		$mysoc->code_client = $old_code_client;
110 110
 
111
-		if (! $numExample)
111
+		if (!$numExample)
112 112
 		{
113 113
 			$numExample = $langs->trans('NotConfigured');
114 114
 		}
@@ -122,22 +122,22 @@  discard block
 block discarded – undo
122 122
 	 *  @param  Object		$object		Object we need next value for
123 123
 	 *  @return string      			Value if KO, <0 if KO
124 124
 	 */
125
-    function getNextValue($objsoc,$object)
125
+    function getNextValue($objsoc, $object)
126 126
     {
127
-		global $db,$conf;
127
+		global $db, $conf;
128 128
 
129
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
129
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
130 130
 
131 131
 		// We get cursor rule
132
-		$mask=$conf->global->PAYMENT_ANT_MASK;
132
+		$mask = $conf->global->PAYMENT_ANT_MASK;
133 133
 
134
-		if (! $mask)
134
+		if (!$mask)
135 135
 		{
136
-			$this->error='NotConfigured';
136
+			$this->error = 'NotConfigured';
137 137
 			return 0;
138 138
 		}
139 139
 
140
-		$numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->datepaye);
140
+		$numFinal = get_next_value($db, $mask, 'paiement', 'ref', '', $objsoc, $object->datepaye);
141 141
 
142 142
 		return  $numFinal;
143 143
 	}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * 	@param	string		$objforref	Object for number to search
152 152
 	 *  @return string      			Next free value
153 153
      */
154
-    function commande_get_num($objsoc,$objforref)
154
+    function commande_get_num($objsoc, $objforref)
155 155
     {
156 156
         // phpcs:enable
157
-        return $this->getNextValue($objsoc,$objforref);
157
+        return $this->getNextValue($objsoc, $objforref);
158 158
     }
159 159
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/payment/mod_payment_cicada.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * \brief      File containing class for numbering module Cicada
23 23
  */
24 24
 
25
-require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php';
25
+require_once DOL_DOCUMENT_ROOT.'/core/modules/payment/modules_payment.php';
26 26
 
27 27
 /**
28 28
  *	Class to manage customer payment numbering rules Cicada
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
      * Dolibarr version of the loaded document
34 34
      * @public string
35 35
      */
36
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
36
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
37 37
 
38
-	public $prefix='PAY';
38
+	public $prefix = 'PAY';
39 39
 
40 40
 	/**
41 41
 	 * @var string Error code (or message)
42 42
 	 */
43
-	public $error='';
43
+	public $error = '';
44 44
 
45 45
 	/**
46 46
 	 * @var string Nom du modele
47 47
 	 * @deprecated
48 48
 	 * @see name
49 49
 	 */
50
-	public $nom='Cicada';
50
+	public $nom = 'Cicada';
51 51
 
52 52
 	/**
53 53
 	 * @var string model name
54 54
 	 */
55
-	public $name='Cicada';
55
+	public $name = 'Cicada';
56 56
 
57 57
 
58 58
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     function info()
64 64
     {
65 65
     	global $langs;
66
-      	return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
66
+      	return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
67 67
     }
68 68
 
69 69
 
@@ -86,26 +86,26 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	function canBeActivated()
88 88
 	{
89
-		global $conf,$langs,$db;
89
+		global $conf, $langs, $db;
90 90
 
91
-		$payyymm=''; $max='';
91
+		$payyymm = ''; $max = '';
92 92
 
93
-		$posindice=9;
93
+		$posindice = 9;
94 94
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
95
-		$sql.= " FROM ".MAIN_DB_PREFIX."paiement";
96
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
97
-		$sql.= " AND entity = ".$conf->entity;
95
+		$sql .= " FROM ".MAIN_DB_PREFIX."paiement";
96
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
97
+		$sql .= " AND entity = ".$conf->entity;
98 98
 
99
-		$resql=$db->query($sql);
99
+		$resql = $db->query($sql);
100 100
 		if ($resql)
101 101
 		{
102 102
 			$row = $db->fetch_row($resql);
103
-			if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; }
103
+			if ($row) { $payyymm = substr($row[0], 0, 6); $max = $row[0]; }
104 104
 		}
105
-		if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm))
105
+		if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm))
106 106
 		{
107 107
 			$langs->load("errors");
108
-			$this->error=$langs->trans('ErrorNumRefModel', $max);
108
+			$this->error = $langs->trans('ErrorNumRefModel', $max);
109 109
 			return false;
110 110
 		}
111 111
 
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
 	 *  @param  Object		$object		Object we need next value for
120 120
 	 *  @return string      			Value if KO, <0 if KO
121 121
 	 */
122
-	function getNextValue($objsoc,$object)
122
+	function getNextValue($objsoc, $object)
123 123
 	{
124
-		global $db,$conf;
124
+		global $db, $conf;
125 125
 
126 126
 		// D'abord on recupere la valeur max
127
-		$posindice=9;
127
+		$posindice = 9;
128 128
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
129
-		$sql.= " FROM ".MAIN_DB_PREFIX."paiement";
130
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
131
-		$sql.= " AND entity = ".$conf->entity;
129
+		$sql .= " FROM ".MAIN_DB_PREFIX."paiement";
130
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
131
+		$sql .= " AND entity = ".$conf->entity;
132 132
 
133
-		$resql=$db->query($sql);
133
+		$resql = $db->query($sql);
134 134
 		if ($resql)
135 135
 		{
136 136
 			$obj = $db->fetch_object($resql);
137 137
 			if ($obj) $max = intval($obj->max);
138
-			else $max=0;
138
+			else $max = 0;
139 139
 		}
140 140
 		else
141 141
 		{
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		//$date=time();
147
-		$date=$object->datepaye;
148
-		$yymm = strftime("%y%m",$date);
147
+		$date = $object->datepaye;
148
+		$yymm = strftime("%y%m", $date);
149 149
 
150
-    	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
151
-    	else $num = sprintf("%04s",$max+1);
150
+    	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
151
+    	else $num = sprintf("%04s", $max + 1);
152 152
 
153 153
 		dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
154 154
 		return $this->prefix.$yymm."-".$num;
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 	 *  @param	string		$objforref	Object for number to search
164 164
 	 *  @return string      			Next free value
165 165
 	 */
166
-	function payment_get_num($objsoc,$objforref)
166
+	function payment_get_num($objsoc, $objforref)
167 167
 	{
168 168
         // phpcs:enable
169
-		return $this->getNextValue($objsoc,$objforref);
169
+		return $this->getNextValue($objsoc, $objforref);
170 170
 	}
171 171
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/payment/modules_payment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @var string Error code (or message)
28 28
 	 */
29
-	public $error='';
29
+	public $error = '';
30 30
 
31 31
 	/**
32 32
 	 *	Return if a module can be used or not
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *	@param	Object		$object		Object we need next value for
80 80
 	 *	@return	string      Valeur
81 81
 	 */
82
-	function getNextValue($objsoc,$object)
82
+	function getNextValue($objsoc, $object)
83 83
 	{
84 84
 		global $langs;
85 85
 		return $langs->trans("NotAvailable");
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modDon.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *	\brief      Description and activation file for module Donation
27 27
  */
28 28
 
29
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
29
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
30 30
 
31 31
 
32 32
 /**
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$this->family = "financial";
49 49
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50
-		$this->name = preg_replace('/^mod/i','',get_class($this));
50
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
51 51
 		$this->description = "Gestion des dons";
52 52
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53 53
 		$this->version = 'dolibarr';
54 54
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55 55
 		// Name of png file (without png) used for this module.
56 56
 		// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
57
-		$this->picto='bill';
57
+		$this->picto = 'bill';
58 58
 
59 59
 		// Data directories to create when module is enabled
60 60
 		$this->dirs = array("/don/temp");
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		// Constants
70 70
 		$this->const = array();
71
-		$r=0;
71
+		$r = 0;
72 72
 
73 73
 		$this->const[$r][0] = "DON_ADDON_MODEL";
74 74
 		$this->const[$r][1] = "chaine";
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 		// Menus
141 141
 		//-------
142
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
142
+		$this->menu = 1; // This module add menu entries. They are coded into menu manager.
143 143
 	}
144 144
 
145 145
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
152 152
 	 *      @return     int             	1 if OK, 0 if KO
153 153
 	 */
154
-	function init($options='')
154
+	function init($options = '')
155 155
 	{
156 156
 		global $conf;
157 157
 
@@ -160,6 +160,6 @@  discard block
 block discarded – undo
160 160
 			 "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".$conf->entity.")",
161 161
 		);
162 162
 
163
-		return $this->_init($sql,$options);
163
+		return $this->_init($sql, $options);
164 164
 	}
165 165
 }
166 166
\ No newline at end of file
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modAsset.class.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *  \ingroup    asset
25 25
  *  \brief      Description and activation file for module Assets
26 26
  */
27
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 28
 
29 29
 
30 30
 /**
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function __construct($db)
41 41
 	{
42
-		global $langs,$conf;
42
+		global $langs, $conf;
43 43
 
44 44
 		$this->db = $db;
45 45
 
46 46
 		// Id for module (must be unique).
47 47
 		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
48
-		$this->numero = 51000;		// TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
48
+		$this->numero = 51000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
49 49
 		// Key text used to identify module (for permissions, menus, etc...)
50 50
 		$this->rights_class = 'asset';
51 51
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
59 59
 
60 60
 		// Module label (no space allowed), used if translation string 'ModuleAssetsName' not found (MyModue is name of module).
61
-		$this->name = preg_replace('/^mod/i','',get_class($this));
61
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
62 62
 		// Module description, used if translation string 'ModuleAssetsDesc' not found (MyModue is name of module).
63 63
 		$this->description = "Assets module";
64 64
 		// Used only if file README.md and README-LL.md not found.
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		// Name of image file used for this module.
72 72
 		// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
73 73
 		// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
74
-		$this->picto='generic';
74
+		$this->picto = 'generic';
75 75
 
76 76
 		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
77 77
 		// for default path (eg: /asset/core/xxxxx) (0=disable, 1=enable)
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
 		$this->config_page_url = array("setup.php@asset");
88 88
 
89 89
 		// Dependencies
90
-		$this->hidden = false;			// A condition to hide module
91
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
92
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
93
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
90
+		$this->hidden = false; // A condition to hide module
91
+		$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
92
+		$this->requiredby = array(); // List of module ids to disable if this one is disabled
93
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with
94 94
 		$this->langfiles = array("assets");
95
-		$this->phpmin = array(5,4);					// Minimum version of PHP required by module
96
-		$this->need_dolibarr_version = array(7,0);	// Minimum version of Dolibarr required by module
97
-		$this->warnings_activation = array();                     // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
98
-		$this->warnings_activation_ext = array();                 // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
95
+		$this->phpmin = array(5, 4); // Minimum version of PHP required by module
96
+		$this->need_dolibarr_version = array(7, 0); // Minimum version of Dolibarr required by module
97
+		$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
98
+		$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
99 99
 		//$this->automatic_activation = array('FR'=>'AssetsWasAutomaticallyActivatedBecauseOfYourCountryChoice');
100 100
 		//$this->always_enabled = true;								// If true, can't be disabled
101 101
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 		);
110 110
 
111 111
 
112
-		if (! isset($conf->asset) || ! isset($conf->asset->enabled))
112
+		if (!isset($conf->asset) || !isset($conf->asset->enabled))
113 113
 		{
114
-			$conf->asset=new stdClass();
115
-			$conf->asset->enabled=0;
114
+			$conf->asset = new stdClass();
115
+			$conf->asset->enabled = 0;
116 116
 		}
117 117
 
118 118
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 
148 148
 		// Dictionaries
149
-		$this->dictionaries=array();
149
+		$this->dictionaries = array();
150 150
 		/* Example:
151 151
 		$this->dictionaries=array(
152 152
 			'langs'=>'mylangfile@assets',
@@ -183,40 +183,40 @@  discard block
 block discarded – undo
183 183
 
184 184
 
185 185
 		// Permissions
186
-		$this->rights = array();		// Permission array used by this module
186
+		$this->rights = array(); // Permission array used by this module
187 187
 
188
-		$r=0;
189
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
190
-		$this->rights[$r][1] = 'Read assets';		// Permission label
191
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
192
-		$this->rights[$r][4] = 'read';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
193
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
188
+		$r = 0;
189
+		$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
190
+		$this->rights[$r][1] = 'Read assets'; // Permission label
191
+		$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
192
+		$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
193
+		$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
194 194
 
195 195
 		$r++;
196
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
197
-		$this->rights[$r][1] = 'Create/Update assets';	// Permission label
198
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
199
-		$this->rights[$r][4] = 'write';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
200
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
196
+		$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
197
+		$this->rights[$r][1] = 'Create/Update assets'; // Permission label
198
+		$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
199
+		$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
200
+		$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
201 201
 
202 202
 		$r++;
203
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
204
-		$this->rights[$r][1] = 'Delete assets';		// Permission label
205
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
206
-		$this->rights[$r][4] = 'delete';			// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
207
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
203
+		$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
204
+		$this->rights[$r][1] = 'Delete assets'; // Permission label
205
+		$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
206
+		$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
207
+		$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
208 208
 
209 209
 
210 210
 		// Main menu entries
211
-		$this->menu = array();			// List of menus to add
212
-		$r=0;
211
+		$this->menu = array(); // List of menus to add
212
+		$r = 0;
213 213
 
214 214
 		// Add here entries to declare new menus
215
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
215
+		$this->menu = 1; // This module add menu entries. They are coded into menu manager.
216 216
 
217 217
 		// Exports
218 218
 		//--------
219
-		$r=1;
219
+		$r = 1;
220 220
 
221 221
 		// $this->export_code[$r]          Code unique identifiant l'export (tous modules confondus)
222 222
 		// $this->export_label[$r]         Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 *	@param      string	$options    Options when enabling module ('', 'noboxes')
321 321
 	 *	@return     int             	1 if OK, 0 if KO
322 322
 	 */
323
-	function init($options='')
323
+	function init($options = '')
324 324
 	{
325 325
 		global $conf;
326 326
 
@@ -329,6 +329,6 @@  discard block
 block discarded – undo
329 329
 
330 330
 		$sql = array();
331 331
 
332
-		return $this->_init($sql,$options);
332
+		return $this->_init($sql, $options);
333 333
 	}
334 334
 }
Please login to merge, or discard this patch.