Test Failed
Push — master ( 0ba343...0c40ee )
by Alxarafe
39:21
created
dolibarr/htdocs/core/class/openid.class.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
     var $URLs = array();
31 31
     var $error = array();
32 32
     var $fields = array(
33
-		'required' => array(),
34
-		'optional' => array(),
33
+        'required' => array(),
34
+        'optional' => array(),
35 35
     );
36 36
 
37 37
     /**
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
         // phpcs:enable
400 400
         global $conf;
401 401
 
402
-		include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
403
-		if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
402
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
403
+        if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
404 404
 
405 405
         $response = getURLContent($url);
406 406
 
@@ -475,9 +475,9 @@  discard block
 block discarded – undo
475 475
     {
476 476
         // phpcs:enable
477 477
         $params = array(
478
-			'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
479
-			'openid.signed' => urlencode($_GET['openid_signed']),
480
-			'openid.sig' => urlencode($_GET['openid_sig'])
478
+            'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
479
+            'openid.signed' => urlencode($_GET['openid_signed']),
480
+            'openid.sig' => urlencode($_GET['openid_sig'])
481 481
         );
482 482
         // Send only required parameters to confirm validity
483 483
         $arr_signed = explode(",",str_replace('sreg.','sreg_',$_GET['openid_signed']));
@@ -520,16 +520,16 @@  discard block
 block discarded – undo
520 520
      */
521 521
     function sendDiscoveryRequestToGetXRDS($url='')
522 522
     {
523
-    	global $conf;
523
+        global $conf;
524 524
 
525
-		include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
526
-		if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
525
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
526
+        if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
527 527
 
528
-		dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
528
+        dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
529 529
 
530
-		$addheaders=array('Accept: application/xrds+xml');
530
+        $addheaders=array('Accept: application/xrds+xml');
531 531
         $response = getURLContent($url, 'GET', '', 1, $addheaders);
532
-		/* response should like this:
532
+        /* response should like this:
533 533
 		<?xml version="1.0" encoding="UTF-8"?>
534 534
 		<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
535 535
 		<XRD>
@@ -542,12 +542,12 @@  discard block
 block discarded – undo
542 542
 		</XRD>
543 543
 		</xrds:XRDS>
544 544
 		*/
545
-		$content=$response['content'];
545
+        $content=$response['content'];
546 546
 
547 547
         $server='';
548 548
         if (preg_match('/'.preg_quote('<URI>','/').'(.*)'.preg_quote('</URI>','/').'/is', $content, $reg))
549 549
         {
550
-        	$server=$reg[1];
550
+            $server=$reg[1];
551 551
         }
552 552
 
553 553
         if (empty($server))
@@ -556,10 +556,10 @@  discard block
 block discarded – undo
556 556
             return false;
557 557
         }
558 558
         else
559
-       {
560
-       		dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
561
-        	$this->SetOpenIDServer($server);
562
-        	return $server;
563
-	    }
559
+        {
560
+                dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
561
+            $this->SetOpenIDServer($server);
562
+            return $server;
563
+        }
564 564
     }
565 565
 }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     {
186 186
         // phpcs:enable
187 187
         $e = $this->error;
188
-        return array('code'=>$e[0],'description'=>$e[1]);
188
+        return array('code'=>$e[0], 'description'=>$e[1]);
189 189
     }
190 190
 
191 191
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
     {
201 201
         // phpcs:enable
202 202
         $errs['OPENID_NOSERVERSFOUND'] = 'Cannot find OpenID Server TAG on Identity page.';
203
-        if ($desc == null){
203
+        if ($desc == null) {
204 204
             $desc = $errs[$code];
205 205
         }
206
-        $this->error = array($code,$desc);
206
+        $this->error = array($code, $desc);
207 207
     }
208 208
 
209 209
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     {
236 236
         $r = array();
237 237
         $response = explode("\n", $response);
238
-        foreach($response as $line) {
238
+        foreach ($response as $line) {
239 239
             $line = trim($line);
240 240
             if ($line != "") {
241 241
                 list($key, $value) = explode(":", $line, 2);
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
         if (!isset($u['path']) || ($u['path'] == '/')) {
264 264
             $u['path'] = '';
265 265
         }
266
-        if(substr($u['path'],-1,1) == '/'){
267
-            $u['path'] = substr($u['path'], 0, strlen($u['path'])-1);
266
+        if (substr($u['path'], -1, 1) == '/') {
267
+            $u['path'] = substr($u['path'], 0, strlen($u['path']) - 1);
268 268
         }
269
-        if (isset($u['query'])){ // If there is a query string, then use identity as is
270
-            return $u['host'] . $u['path'] . '?' . $u['query'];
271
-        }else{
272
-            return $u['host'] . $u['path'];
269
+        if (isset($u['query'])) { // If there is a query string, then use identity as is
270
+            return $u['host'].$u['path'].'?'.$u['query'];
271
+        } else {
272
+            return $u['host'].$u['path'];
273 273
         }
274 274
     }
275 275
 
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
     function array2url($arr)
283 283
     {
284 284
         // converts associated array to URL Query String
285
-        if (!is_array($arr)){
285
+        if (!is_array($arr)) {
286 286
             return false;
287 287
         }
288 288
         $query = '';
289
-        foreach($arr as $key => $value){
290
-            $query .= $key . "=" . $value . "&";
289
+        foreach ($arr as $key => $value) {
290
+            $query .= $key."=".$value."&";
291 291
         }
292 292
         return $query;
293 293
     }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      * @param string	$params		Params
302 302
      * @return boolean|unknown
303 303
      */
304
-    function FSOCK_Request($url, $method="GET", $params = "")
304
+    function FSOCK_Request($url, $method = "GET", $params = "")
305 305
     {
306 306
         // phpcs:enable
307 307
         $fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             $this->ErrorStore('OPENID_SOCKETERROR', $errstr);
310 310
             return false;
311 311
         } else {
312
-            $request = $method . " /server HTTP/1.0\r\n";
312
+            $request = $method." /server HTTP/1.0\r\n";
313 313
             $request .= "User-Agent: Dolibarr\r\n";
314 314
             $request .= "Connection: close\r\n\r\n";
315 315
             fwrite($fp, $request);
@@ -335,13 +335,13 @@  discard block
 block discarded – undo
335 335
      * @param 	string	$params		Params
336 336
      * @return string
337 337
      */
338
-    function CURL_Request($url, $method="GET", $params = "")
338
+    function CURL_Request($url, $method = "GET", $params = "")
339 339
     {
340 340
         // phpcs:enable
341 341
         // Remember, SSL MUST BE SUPPORTED
342 342
         if (is_array($params)) $params = $this->array2url($params);
343 343
 
344
-        $curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : ""));
344
+        $curl = curl_init($url.($method == "GET" && $params != "" ? "?".$params : ""));
345 345
         @curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
346 346
         curl_setopt($curl, CURLOPT_HEADER, false);
347 347
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
352 352
         $response = curl_exec($curl);
353 353
 
354
-        if (curl_errno($curl) == 0){
354
+        if (curl_errno($curl) == 0) {
355 355
             $response;
356
-        }else{
356
+        } else {
357 357
             $this->ErrorStore('OPENID_CURL', curl_error($curl));
358 358
         }
359 359
         return $response;
@@ -394,13 +394,13 @@  discard block
 block discarded – undo
394 394
      * @param	string	$url	Url to found endpoint
395 395
      * @return 	string			Endpoint
396 396
      */
397
-    function GetOpenIDServer($url='')
397
+    function GetOpenIDServer($url = '')
398 398
     {
399 399
         // phpcs:enable
400 400
         global $conf;
401 401
 
402 402
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
403
-		if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
403
+		if (empty($url)) $url = $conf->global->MAIN_AUTHENTICATION_OPENID_URL;
404 404
 
405 405
         $response = getURLContent($url);
406 406
 
@@ -434,13 +434,13 @@  discard block
 block discarded – undo
434 434
 
435 435
         if (isset($this->fields['required'])
436 436
         && (count($this->fields['required']) > 0)) {
437
-            $params['openid.sreg.required'] = implode(',',$this->fields['required']);
437
+            $params['openid.sreg.required'] = implode(',', $this->fields['required']);
438 438
         }
439 439
         if (isset($this->fields['optional'])
440 440
         && (count($this->fields['optional']) > 0)) {
441
-            $params['openid.sreg.optional'] = implode(',',$this->fields['optional']);
441
+            $params['openid.sreg.optional'] = implode(',', $this->fields['optional']);
442 442
         }
443
-        return $this->URLs['openid_server'] . "?". $this->array2url($params);
443
+        return $this->URLs['openid_server']."?".$this->array2url($params);
444 444
     }
445 445
 
446 446
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         }
462 462
         else
463 463
         {	// Default Header Redirect
464
-            header('Location: ' . $redirect_to);
464
+            header('Location: '.$redirect_to);
465 465
         }
466 466
     }
467 467
 
@@ -480,14 +480,14 @@  discard block
 block discarded – undo
480 480
 			'openid.sig' => urlencode($_GET['openid_sig'])
481 481
         );
482 482
         // Send only required parameters to confirm validity
483
-        $arr_signed = explode(",",str_replace('sreg.','sreg_',$_GET['openid_signed']));
483
+        $arr_signed = explode(",", str_replace('sreg.', 'sreg_', $_GET['openid_signed']));
484 484
         $num = count($arr_signed);
485 485
         for ($i = 0; $i < $num; $i++)
486 486
         {
487
-            $s = str_replace('sreg_','sreg.', $arr_signed[$i]);
488
-            $c = $_GET['openid_' . $arr_signed[$i]];
487
+            $s = str_replace('sreg_', 'sreg.', $arr_signed[$i]);
488
+            $c = $_GET['openid_'.$arr_signed[$i]];
489 489
             // if ($c != ""){
490
-            $params['openid.' . $s] = urlencode($c);
490
+            $params['openid.'.$s] = urlencode($c);
491 491
             // }
492 492
         }
493 493
         $params['openid.mode'] = "check_authentication";
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
         {
498 498
             return false;
499 499
         }
500
-        $response = $this->CURL_Request($openid_server,'POST',$params);
500
+        $response = $this->CURL_Request($openid_server, 'POST', $params);
501 501
         $data = $this->splitResponse($response);
502 502
         if ($data['is_valid'] == "true")
503 503
         {
@@ -518,16 +518,16 @@  discard block
 block discarded – undo
518 518
      * @param	string	$url	Url of endpoint to request
519 519
      * @return 	string			First endpoint OpenID server found. False if it failed to found.
520 520
      */
521
-    function sendDiscoveryRequestToGetXRDS($url='')
521
+    function sendDiscoveryRequestToGetXRDS($url = '')
522 522
     {
523 523
     	global $conf;
524 524
 
525 525
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
526
-		if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
526
+		if (empty($url)) $url = $conf->global->MAIN_AUTHENTICATION_OPENID_URL;
527 527
 
528 528
 		dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
529 529
 
530
-		$addheaders=array('Accept: application/xrds+xml');
530
+		$addheaders = array('Accept: application/xrds+xml');
531 531
         $response = getURLContent($url, 'GET', '', 1, $addheaders);
532 532
 		/* response should like this:
533 533
 		<?xml version="1.0" encoding="UTF-8"?>
@@ -542,12 +542,12 @@  discard block
 block discarded – undo
542 542
 		</XRD>
543 543
 		</xrds:XRDS>
544 544
 		*/
545
-		$content=$response['content'];
545
+		$content = $response['content'];
546 546
 
547
-        $server='';
548
-        if (preg_match('/'.preg_quote('<URI>','/').'(.*)'.preg_quote('</URI>','/').'/is', $content, $reg))
547
+        $server = '';
548
+        if (preg_match('/'.preg_quote('<URI>', '/').'(.*)'.preg_quote('</URI>', '/').'/is', $content, $reg))
549 549
         {
550
-        	$server=$reg[1];
550
+        	$server = $reg[1];
551 551
         }
552 552
 
553 553
         if (empty($server))
Please login to merge, or discard this patch.
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -218,8 +218,7 @@  discard block
 block discarded – undo
218 218
         if (count($this->error) > 0)
219 219
         {
220 220
             return true;
221
-        }
222
-        else
221
+        } else
223 222
         {
224 223
             return false;
225 224
         }
@@ -255,8 +254,9 @@  discard block
 block discarded – undo
255 254
     function OpenID_Standarize($openid_identity = null)
256 255
     {
257 256
         // phpcs:enable
258
-        if ($openid_identity === null)
259
-        $openid_identity = $this->openid_url_identity;
257
+        if ($openid_identity === null) {
258
+                $openid_identity = $this->openid_url_identity;
259
+        }
260 260
 
261 261
         $u = parse_url(strtolower(trim($openid_identity)));
262 262
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         }
269 269
         if (isset($u['query'])){ // If there is a query string, then use identity as is
270 270
             return $u['host'] . $u['path'] . '?' . $u['query'];
271
-        }else{
271
+        } else{
272 272
             return $u['host'] . $u['path'];
273 273
         }
274 274
     }
@@ -339,7 +339,9 @@  discard block
 block discarded – undo
339 339
     {
340 340
         // phpcs:enable
341 341
         // Remember, SSL MUST BE SUPPORTED
342
-        if (is_array($params)) $params = $this->array2url($params);
342
+        if (is_array($params)) {
343
+            $params = $this->array2url($params);
344
+        }
343 345
 
344 346
         $curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : ""));
345 347
         @curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
@@ -347,13 +349,15 @@  discard block
 block discarded – undo
347 349
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
348 350
         curl_setopt($curl, CURLOPT_HTTPGET, ($method == "GET"));
349 351
         curl_setopt($curl, CURLOPT_POST, ($method == "POST"));
350
-        if ($method == "POST") curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
352
+        if ($method == "POST") {
353
+            curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
354
+        }
351 355
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
352 356
         $response = curl_exec($curl);
353 357
 
354 358
         if (curl_errno($curl) == 0){
355 359
             $response;
356
-        }else{
360
+        } else{
357 361
             $this->ErrorStore('OPENID_CURL', curl_error($curl));
358 362
         }
359 363
         return $response;
@@ -400,7 +404,9 @@  discard block
 block discarded – undo
400 404
         global $conf;
401 405
 
402 406
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
403
-		if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
407
+		if (empty($url)) {
408
+		    $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
409
+		}
404 410
 
405 411
         $response = getURLContent($url);
406 412
 
@@ -458,8 +464,7 @@  discard block
 block discarded – undo
458 464
             echo '<script language="JavaScript" type="text/javascript">window.location=\'';
459 465
             echo $redirect_to;
460 466
             echo '\';</script>';
461
-        }
462
-        else
467
+        } else
463 468
         {	// Default Header Redirect
464 469
             header('Location: ' . $redirect_to);
465 470
         }
@@ -502,8 +507,7 @@  discard block
 block discarded – undo
502 507
         if ($data['is_valid'] == "true")
503 508
         {
504 509
             return true;
505
-        }
506
-        else
510
+        } else
507 511
         {
508 512
             return false;
509 513
         }
@@ -523,7 +527,9 @@  discard block
 block discarded – undo
523 527
     	global $conf;
524 528
 
525 529
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
526
-		if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
530
+		if (empty($url)) {
531
+		    $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
532
+		}
527 533
 
528 534
 		dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
529 535
 
@@ -554,8 +560,7 @@  discard block
 block discarded – undo
554 560
         {
555 561
             $this->ErrorStore('OPENID_NOSERVERSFOUND');
556 562
             return false;
557
-        }
558
-        else
563
+        } else
559 564
        {
560 565
        		dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
561 566
         	$this->SetOpenIDServer($server);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/emailsenderprofile.class.php 3 patches
Indentation   +385 added lines, -385 removed lines patch added patch discarded remove patch
@@ -35,401 +35,401 @@
 block discarded – undo
35 35
  */
36 36
 class EmailSenderProfile extends CommonObject
37 37
 {
38
-	/**
39
-	 * @var string ID to identify managed object
40
-	 */
41
-	public $element = 'emailsenderprofile';
42
-
43
-	/**
44
-	 * @var string Name of table without prefix where object is stored
45
-	 */
46
-	public $table_element = 'c_email_senderprofile';
47
-
48
-	/**
49
-	 * @var array  Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
50
-	 */
51
-	public $ismultientitymanaged = 1;
52
-
53
-	/**
54
-	 * @var string String with name of icon for emailsenderprofile
55
-	 */
56
-	public $picto = 'emailsenderprofile@monmodule';
57
-
58
-
59
-	/**
60
-	 *             'type' if the field format.
61
-	 *             'label' the translation key.
62
-	 *             'enabled' is a condition when the filed must be managed.
63
-	 *             'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed).
64
-	 *             'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
65
-	 *             'index' if we want an index in database.
66
-	 *             'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
67
-	 *             'position' is the sort order of field.
68
-	 *             'searchall' is 1 if we want to search in this field when making a search from the quick search button.
69
-	 *             'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
70
-	 *             'help' is a string visible as a tooltip on field
71
-	 *             'comment' is not used. You can store here any text of your choice.
72
-	 */
73
-
74
-	// BEGIN MODULEBUILDER PROPERTIES
75
-	/**
76
-	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
77
-	 */
78
-	public $fields=array(
79
-		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
80
-		'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
81
-		'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1),
82
-		'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
83
-		//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
84
-		//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
85
-		'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
86
-		'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
87
-		'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
88
-		'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
89
-		'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
90
-	);
91
-
92
-	/**
93
-	 * @var int ID
94
-	 */
95
-	public $rowid;
96
-
97
-	/**
98
-	 * @var int Entity
99
-	 */
100
-	public $entity;
101
-
102
-	/**
38
+    /**
39
+     * @var string ID to identify managed object
40
+     */
41
+    public $element = 'emailsenderprofile';
42
+
43
+    /**
44
+     * @var string Name of table without prefix where object is stored
45
+     */
46
+    public $table_element = 'c_email_senderprofile';
47
+
48
+    /**
49
+     * @var array  Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
50
+     */
51
+    public $ismultientitymanaged = 1;
52
+
53
+    /**
54
+     * @var string String with name of icon for emailsenderprofile
55
+     */
56
+    public $picto = 'emailsenderprofile@monmodule';
57
+
58
+
59
+    /**
60
+     *             'type' if the field format.
61
+     *             'label' the translation key.
62
+     *             'enabled' is a condition when the filed must be managed.
63
+     *             'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed).
64
+     *             'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
65
+     *             'index' if we want an index in database.
66
+     *             'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
67
+     *             'position' is the sort order of field.
68
+     *             'searchall' is 1 if we want to search in this field when making a search from the quick search button.
69
+     *             'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
70
+     *             'help' is a string visible as a tooltip on field
71
+     *             'comment' is not used. You can store here any text of your choice.
72
+     */
73
+
74
+    // BEGIN MODULEBUILDER PROPERTIES
75
+    /**
76
+     * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
77
+     */
78
+    public $fields=array(
79
+        'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
80
+        'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
81
+        'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1),
82
+        'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
83
+        //'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
84
+        //'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
85
+        'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
86
+        'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
87
+        'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
88
+        'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
89
+        'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
90
+    );
91
+
92
+    /**
93
+     * @var int ID
94
+     */
95
+    public $rowid;
96
+
97
+    /**
98
+     * @var int Entity
99
+     */
100
+    public $entity;
101
+
102
+    /**
103 103
      * @var string Email Sender Profile label
104 104
      */
105 105
     public $label;
106 106
 
107
-	public $email;
108
-	public $date_creation;
109
-	public $tms;
110
-	//public $fk_user_creat;
111
-	//public $fk_user_modif;
112
-	public $signature;
113
-	public $position;
114
-	public $active;
115
-	// END MODULEBUILDER PROPERTIES
116
-
117
-
118
-
119
-	// If this object has a subtable with lines
120
-
121
-	/**
122
-	 * @var int    Name of subtable line
123
-	 */
124
-	//public $table_element_line = 'emailsenderprofiledet';
125
-	/**
126
-	 * @var int    Field with ID of parent key if this field has a parent
127
-	 */
128
-	//public $fk_element = 'fk_emailsenderprofile';
129
-	/**
130
-	 * @var int    Name of subtable class that manage subtable lines
131
-	 */
132
-	//public $class_element_line = 'EmailSenderProfileline';
133
-	/**
134
-	 * @var array  Array of child tables (child tables to delete before deleting a record)
135
-	 */
136
-	//protected $childtables=array('emailsenderprofiledet');
137
-	/**
138
-	 * @var EmailSenderProfileLine[]     Array of subtable lines
139
-	 */
140
-	//public $lines = array();
141
-
142
-
143
-
144
-	/**
145
-	 * Constructor
146
-	 *
147
-	 * @param DoliDb $db Database handler
148
-	 */
149
-	public function __construct(DoliDB $db)
150
-	{
151
-		global $conf;
152
-
153
-		$this->db = $db;
154
-
155
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
156
-		if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
157
-	}
158
-
159
-	/**
160
-	 * Create object into database
161
-	 *
162
-	 * @param  User $user      User that creates
163
-	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
164
-	 * @return int             <0 if KO, Id of created object if OK
165
-	 */
166
-	public function create(User $user, $notrigger = false)
167
-	{
168
-		return $this->createCommon($user, $notrigger);
169
-	}
170
-
171
-	/**
172
-	 * Clone and object into another one
173
-	 *
174
-	 * @param  	User 	$user      	User that creates
175
-	 * @param  	int 	$fromid     Id of object to clone
176
-	 * @return 	mixed 				New object created, <0 if KO
177
-	 */
178
-	public function createFromClone(User $user, $fromid)
179
-	{
180
-		global $hookmanager, $langs;
181
-		$error = 0;
182
-
183
-		dol_syslog(__METHOD__, LOG_DEBUG);
184
-
185
-		$object = new self($this->db);
186
-
187
-		$this->db->begin();
188
-
189
-		// Load source object
190
-		$object->fetchCommon($fromid);
191
-		// Reset some properties
192
-		unset($object->id);
193
-		unset($object->fk_user_creat);
194
-		unset($object->import_key);
195
-
196
-		// Clear fields
197
-		$object->ref = "copy_of_".$object->ref;
198
-		$object->title = $langs->trans("CopyOf")." ".$object->title;
199
-		// ...
200
-
201
-		// Create clone
202
-		$object->context['createfromclone'] = 'createfromclone';
203
-		$result = $object->createCommon($user);
204
-		if ($result < 0) {
205
-			$error++;
206
-			$this->error = $object->error;
207
-			$this->errors = $object->errors;
208
-		}
209
-
210
-		// End
211
-		if (!$error) {
212
-			$this->db->commit();
213
-			return $object;
214
-		} else {
215
-			$this->db->rollback();
216
-			return -1;
217
-		}
218
-	}
219
-
220
-	/**
221
-	 * Load object in memory from the database
222
-	 *
223
-	 * @param int    $id   Id object
224
-	 * @param string $ref  Ref
225
-	 * @return int         <0 if KO, 0 if not found, >0 if OK
226
-	 */
227
-	public function fetch($id, $ref = null)
228
-	{
229
-		$result = $this->fetchCommon($id, $ref);
230
-		if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
231
-		return $result;
232
-	}
233
-
234
-	/**
235
-	 * Load object lines in memory from the database
236
-	 *
237
-	 * @return int         <0 if KO, 0 if not found, >0 if OK
238
-	 */
239
-	public function fetchLines()
240
-	{
241
-		$this->lines=array();
242
-
243
-		// Load lines with object EmailSenderProfileLine
244
-
245
-		return count($this->lines)?1:0;
246
-	}
247
-
248
-	/**
249
-	 * Update object into database
250
-	 *
251
-	 * @param  User $user      User that modifies
252
-	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
253
-	 * @return int             <0 if KO, >0 if OK
254
-	 */
255
-	public function update(User $user, $notrigger = false)
256
-	{
257
-		return $this->updateCommon($user, $notrigger);
258
-	}
259
-
260
-	/**
261
-	 * Delete object in database
262
-	 *
263
-	 * @param User $user       User that deletes
264
-	 * @param bool $notrigger  false=launch triggers after, true=disable triggers
265
-	 * @return int             <0 if KO, >0 if OK
266
-	 */
267
-	public function delete(User $user, $notrigger = false)
268
-	{
269
-		return $this->deleteCommon($user, $notrigger);
270
-	}
271
-
272
-	/**
273
-	 *  Return a link to the object card (with optionaly the picto)
274
-	 *
275
-	 *	@param	int		$withpicto					Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
276
-	 *	@return	string								String with URL
277
-	 */
278
-	function getNomUrl($withpicto=0)
279
-	{
280
-		global $db, $conf, $langs;
281
-		global $dolibarr_main_authentication, $dolibarr_main_demo;
282
-		global $menumanager;
283
-
284
-		$result = '';
285
-		$companylink = '';
107
+    public $email;
108
+    public $date_creation;
109
+    public $tms;
110
+    //public $fk_user_creat;
111
+    //public $fk_user_modif;
112
+    public $signature;
113
+    public $position;
114
+    public $active;
115
+    // END MODULEBUILDER PROPERTIES
116
+
117
+
118
+
119
+    // If this object has a subtable with lines
120
+
121
+    /**
122
+     * @var int    Name of subtable line
123
+     */
124
+    //public $table_element_line = 'emailsenderprofiledet';
125
+    /**
126
+     * @var int    Field with ID of parent key if this field has a parent
127
+     */
128
+    //public $fk_element = 'fk_emailsenderprofile';
129
+    /**
130
+     * @var int    Name of subtable class that manage subtable lines
131
+     */
132
+    //public $class_element_line = 'EmailSenderProfileline';
133
+    /**
134
+     * @var array  Array of child tables (child tables to delete before deleting a record)
135
+     */
136
+    //protected $childtables=array('emailsenderprofiledet');
137
+    /**
138
+     * @var EmailSenderProfileLine[]     Array of subtable lines
139
+     */
140
+    //public $lines = array();
141
+
142
+
143
+
144
+    /**
145
+     * Constructor
146
+     *
147
+     * @param DoliDb $db Database handler
148
+     */
149
+    public function __construct(DoliDB $db)
150
+    {
151
+        global $conf;
152
+
153
+        $this->db = $db;
154
+
155
+        if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
156
+        if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
157
+    }
158
+
159
+    /**
160
+     * Create object into database
161
+     *
162
+     * @param  User $user      User that creates
163
+     * @param  bool $notrigger false=launch triggers after, true=disable triggers
164
+     * @return int             <0 if KO, Id of created object if OK
165
+     */
166
+    public function create(User $user, $notrigger = false)
167
+    {
168
+        return $this->createCommon($user, $notrigger);
169
+    }
170
+
171
+    /**
172
+     * Clone and object into another one
173
+     *
174
+     * @param  	User 	$user      	User that creates
175
+     * @param  	int 	$fromid     Id of object to clone
176
+     * @return 	mixed 				New object created, <0 if KO
177
+     */
178
+    public function createFromClone(User $user, $fromid)
179
+    {
180
+        global $hookmanager, $langs;
181
+        $error = 0;
182
+
183
+        dol_syslog(__METHOD__, LOG_DEBUG);
184
+
185
+        $object = new self($this->db);
186
+
187
+        $this->db->begin();
188
+
189
+        // Load source object
190
+        $object->fetchCommon($fromid);
191
+        // Reset some properties
192
+        unset($object->id);
193
+        unset($object->fk_user_creat);
194
+        unset($object->import_key);
195
+
196
+        // Clear fields
197
+        $object->ref = "copy_of_".$object->ref;
198
+        $object->title = $langs->trans("CopyOf")." ".$object->title;
199
+        // ...
200
+
201
+        // Create clone
202
+        $object->context['createfromclone'] = 'createfromclone';
203
+        $result = $object->createCommon($user);
204
+        if ($result < 0) {
205
+            $error++;
206
+            $this->error = $object->error;
207
+            $this->errors = $object->errors;
208
+        }
209
+
210
+        // End
211
+        if (!$error) {
212
+            $this->db->commit();
213
+            return $object;
214
+        } else {
215
+            $this->db->rollback();
216
+            return -1;
217
+        }
218
+    }
219
+
220
+    /**
221
+     * Load object in memory from the database
222
+     *
223
+     * @param int    $id   Id object
224
+     * @param string $ref  Ref
225
+     * @return int         <0 if KO, 0 if not found, >0 if OK
226
+     */
227
+    public function fetch($id, $ref = null)
228
+    {
229
+        $result = $this->fetchCommon($id, $ref);
230
+        if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
231
+        return $result;
232
+    }
233
+
234
+    /**
235
+     * Load object lines in memory from the database
236
+     *
237
+     * @return int         <0 if KO, 0 if not found, >0 if OK
238
+     */
239
+    public function fetchLines()
240
+    {
241
+        $this->lines=array();
242
+
243
+        // Load lines with object EmailSenderProfileLine
244
+
245
+        return count($this->lines)?1:0;
246
+    }
247
+
248
+    /**
249
+     * Update object into database
250
+     *
251
+     * @param  User $user      User that modifies
252
+     * @param  bool $notrigger false=launch triggers after, true=disable triggers
253
+     * @return int             <0 if KO, >0 if OK
254
+     */
255
+    public function update(User $user, $notrigger = false)
256
+    {
257
+        return $this->updateCommon($user, $notrigger);
258
+    }
259
+
260
+    /**
261
+     * Delete object in database
262
+     *
263
+     * @param User $user       User that deletes
264
+     * @param bool $notrigger  false=launch triggers after, true=disable triggers
265
+     * @return int             <0 if KO, >0 if OK
266
+     */
267
+    public function delete(User $user, $notrigger = false)
268
+    {
269
+        return $this->deleteCommon($user, $notrigger);
270
+    }
271
+
272
+    /**
273
+     *  Return a link to the object card (with optionaly the picto)
274
+     *
275
+     *	@param	int		$withpicto					Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
276
+     *	@return	string								String with URL
277
+     */
278
+    function getNomUrl($withpicto=0)
279
+    {
280
+        global $db, $conf, $langs;
281
+        global $dolibarr_main_authentication, $dolibarr_main_demo;
282
+        global $menumanager;
283
+
284
+        $result = '';
285
+        $companylink = '';
286 286
 
287 287
     $label=$this->label;
288 288
 
289 289
     $url='';
290
-		//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
291
-
292
-		$linkstart = '';
293
-		$linkend='';
294
-
295
-		if ($withpicto)
296
-		{
297
-			$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
298
-			if ($withpicto != 2) $result.=' ';
299
-		}
300
-		$result.= $linkstart . $this->label . $linkend;
301
-		return $result;
302
-	}
303
-
304
-	/**
305
-	 * Return link to download file from a direct external access
306
-	 *
307
-	 * @param	int				$withpicto			Add download picto into link
308
-	 * @return	string			HTML link to file
309
-	 */
310
-	function getDirectExternalLink($withpicto=0)
311
-	{
312
-		return 'todo';
313
-	}
314
-
315
-	/**
316
-	 *  Retourne le libelle du status d'un user (actif, inactif)
317
-	 *
318
-	 *  @param	int		$mode          0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
319
-	 *  @return	string 			       Label of status
320
-	 */
321
-	function getLibStatut($mode=0)
322
-	{
323
-		return $this->LibStatut($this->status,$mode);
324
-	}
290
+        //$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
291
+
292
+        $linkstart = '';
293
+        $linkend='';
294
+
295
+        if ($withpicto)
296
+        {
297
+            $result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
298
+            if ($withpicto != 2) $result.=' ';
299
+        }
300
+        $result.= $linkstart . $this->label . $linkend;
301
+        return $result;
302
+    }
303
+
304
+    /**
305
+     * Return link to download file from a direct external access
306
+     *
307
+     * @param	int				$withpicto			Add download picto into link
308
+     * @return	string			HTML link to file
309
+     */
310
+    function getDirectExternalLink($withpicto=0)
311
+    {
312
+        return 'todo';
313
+    }
314
+
315
+    /**
316
+     *  Retourne le libelle du status d'un user (actif, inactif)
317
+     *
318
+     *  @param	int		$mode          0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
319
+     *  @return	string 			       Label of status
320
+     */
321
+    function getLibStatut($mode=0)
322
+    {
323
+        return $this->LibStatut($this->status,$mode);
324
+    }
325 325
 
326 326
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
327
-	/**
328
-	 *  Return the status
329
-	 *
330
-	 *  @param	int		$status        	Id status
331
-	 *  @param  int		$mode          	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
332
-	 *  @return string 			       	Label of status
333
-	 */
334
-	static function LibStatut($status,$mode=0)
335
-	{
336
-		global $langs;
337
-
338
-		if ($mode == 0 || $mode == 1)
339
-		{
340
-			if ($status == 1) return $langs->trans('Enabled');
341
-			if ($status == 0) return $langs->trans('Disabled');
342
-		}
343
-		elseif ($mode == 2)
344
-		{
345
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
346
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
347
-		}
348
-		elseif ($mode == 3)
349
-		{
350
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
351
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
352
-		}
353
-		elseif ($mode == 4)
354
-		{
355
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
356
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
357
-		}
358
-		elseif ($mode == 5)
359
-		{
360
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
361
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
362
-		}
363
-		elseif ($mode == 6)
364
-		{
365
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
366
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
367
-		}
368
-	}
369
-
370
-	/**
371
-	 *	Charge les informations d'ordre info dans l'objet commande
372
-	 *
373
-	 *	@param  int		$id       Id of order
374
-	 *	@return	void
375
-	 */
376
-	function info($id)
377
-	{
378
-		$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
379
-		$sql.= ' fk_user_creat, fk_user_modif';
380
-		$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
381
-		$sql.= ' WHERE t.rowid = '.$id;
382
-		$result=$this->db->query($sql);
383
-		if ($result)
384
-		{
385
-			if ($this->db->num_rows($result))
386
-			{
387
-				$obj = $this->db->fetch_object($result);
388
-				$this->id = $obj->rowid;
389
-				if ($obj->fk_user_author)
390
-				{
391
-					$cuser = new User($this->db);
392
-					$cuser->fetch($obj->fk_user_author);
393
-					$this->user_creation   = $cuser;
394
-				}
395
-
396
-				if ($obj->fk_user_valid)
397
-				{
398
-					$vuser = new User($this->db);
399
-					$vuser->fetch($obj->fk_user_valid);
400
-					$this->user_validation = $vuser;
401
-				}
402
-
403
-				if ($obj->fk_user_cloture)
404
-				{
405
-					$cluser = new User($this->db);
406
-					$cluser->fetch($obj->fk_user_cloture);
407
-					$this->user_cloture   = $cluser;
408
-				}
409
-
410
-				$this->date_creation     = $this->db->jdate($obj->datec);
411
-				$this->date_modification = $this->db->jdate($obj->datem);
412
-				$this->date_validation   = $this->db->jdate($obj->datev);
413
-			}
414
-
415
-			$this->db->free($result);
416
-		}
417
-		else
418
-		{
419
-			dol_print_error($this->db);
420
-		}
421
-	}
422
-
423
-	/**
424
-	 * Initialise object with example values
425
-	 * Id must be 0 if object instance is a specimen
426
-	 *
427
-	 * @return void
428
-	 */
429
-	public function initAsSpecimen()
430
-	{
431
-		$this->initAsSpecimenCommon();
432
-	}
327
+    /**
328
+     *  Return the status
329
+     *
330
+     *  @param	int		$status        	Id status
331
+     *  @param  int		$mode          	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
332
+     *  @return string 			       	Label of status
333
+     */
334
+    static function LibStatut($status,$mode=0)
335
+    {
336
+        global $langs;
337
+
338
+        if ($mode == 0 || $mode == 1)
339
+        {
340
+            if ($status == 1) return $langs->trans('Enabled');
341
+            if ($status == 0) return $langs->trans('Disabled');
342
+        }
343
+        elseif ($mode == 2)
344
+        {
345
+            if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
346
+            if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
347
+        }
348
+        elseif ($mode == 3)
349
+        {
350
+            if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
351
+            if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
352
+        }
353
+        elseif ($mode == 4)
354
+        {
355
+            if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
356
+            if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
357
+        }
358
+        elseif ($mode == 5)
359
+        {
360
+            if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
361
+            if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
362
+        }
363
+        elseif ($mode == 6)
364
+        {
365
+            if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
366
+            if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
367
+        }
368
+    }
369
+
370
+    /**
371
+     *	Charge les informations d'ordre info dans l'objet commande
372
+     *
373
+     *	@param  int		$id       Id of order
374
+     *	@return	void
375
+     */
376
+    function info($id)
377
+    {
378
+        $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
379
+        $sql.= ' fk_user_creat, fk_user_modif';
380
+        $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
381
+        $sql.= ' WHERE t.rowid = '.$id;
382
+        $result=$this->db->query($sql);
383
+        if ($result)
384
+        {
385
+            if ($this->db->num_rows($result))
386
+            {
387
+                $obj = $this->db->fetch_object($result);
388
+                $this->id = $obj->rowid;
389
+                if ($obj->fk_user_author)
390
+                {
391
+                    $cuser = new User($this->db);
392
+                    $cuser->fetch($obj->fk_user_author);
393
+                    $this->user_creation   = $cuser;
394
+                }
395
+
396
+                if ($obj->fk_user_valid)
397
+                {
398
+                    $vuser = new User($this->db);
399
+                    $vuser->fetch($obj->fk_user_valid);
400
+                    $this->user_validation = $vuser;
401
+                }
402
+
403
+                if ($obj->fk_user_cloture)
404
+                {
405
+                    $cluser = new User($this->db);
406
+                    $cluser->fetch($obj->fk_user_cloture);
407
+                    $this->user_cloture   = $cluser;
408
+                }
409
+
410
+                $this->date_creation     = $this->db->jdate($obj->datec);
411
+                $this->date_modification = $this->db->jdate($obj->datem);
412
+                $this->date_validation   = $this->db->jdate($obj->datev);
413
+            }
414
+
415
+            $this->db->free($result);
416
+        }
417
+        else
418
+        {
419
+            dol_print_error($this->db);
420
+        }
421
+    }
422
+
423
+    /**
424
+     * Initialise object with example values
425
+     * Id must be 0 if object instance is a specimen
426
+     *
427
+     * @return void
428
+     */
429
+    public function initAsSpecimen()
430
+    {
431
+        $this->initAsSpecimenCommon();
432
+    }
433 433
 }
434 434
 
435 435
 /**
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 
28 28
 // Put here all includes required by your class file
29
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30 30
 //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
31 31
 //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
32 32
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	/**
76 76
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
77 77
 	 */
78
-	public $fields=array(
78
+	public $fields = array(
79 79
 		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
80 80
 		'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
81 81
 		'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1),
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 
153 153
 		$this->db = $db;
154 154
 
155
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
156
-		if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
155
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0;
156
+		if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled'] = 0;
157 157
 	}
158 158
 
159 159
 	/**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	public function fetch($id, $ref = null)
228 228
 	{
229 229
 		$result = $this->fetchCommon($id, $ref);
230
-		if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
230
+		if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
231 231
 		return $result;
232 232
 	}
233 233
 
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function fetchLines()
240 240
 	{
241
-		$this->lines=array();
241
+		$this->lines = array();
242 242
 
243 243
 		// Load lines with object EmailSenderProfileLine
244 244
 
245
-		return count($this->lines)?1:0;
245
+		return count($this->lines) ? 1 : 0;
246 246
 	}
247 247
 
248 248
 	/**
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 *	@param	int		$withpicto					Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
276 276
 	 *	@return	string								String with URL
277 277
 	 */
278
-	function getNomUrl($withpicto=0)
278
+	function getNomUrl($withpicto = 0)
279 279
 	{
280 280
 		global $db, $conf, $langs;
281 281
 		global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -284,20 +284,20 @@  discard block
 block discarded – undo
284 284
 		$result = '';
285 285
 		$companylink = '';
286 286
 
287
-    $label=$this->label;
287
+    $label = $this->label;
288 288
 
289
-    $url='';
289
+    $url = '';
290 290
 		//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
291 291
 
292 292
 		$linkstart = '';
293
-		$linkend='';
293
+		$linkend = '';
294 294
 
295 295
 		if ($withpicto)
296 296
 		{
297
-			$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
298
-			if ($withpicto != 2) $result.=' ';
297
+			$result .= ($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
298
+			if ($withpicto != 2) $result .= ' ';
299 299
 		}
300
-		$result.= $linkstart . $this->label . $linkend;
300
+		$result .= $linkstart.$this->label.$linkend;
301 301
 		return $result;
302 302
 	}
303 303
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @param	int				$withpicto			Add download picto into link
308 308
 	 * @return	string			HTML link to file
309 309
 	 */
310
-	function getDirectExternalLink($withpicto=0)
310
+	function getDirectExternalLink($withpicto = 0)
311 311
 	{
312 312
 		return 'todo';
313 313
 	}
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 	 *  @param	int		$mode          0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
319 319
 	 *  @return	string 			       Label of status
320 320
 	 */
321
-	function getLibStatut($mode=0)
321
+	function getLibStatut($mode = 0)
322 322
 	{
323
-		return $this->LibStatut($this->status,$mode);
323
+		return $this->LibStatut($this->status, $mode);
324 324
 	}
325 325
 
326 326
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 *  @param  int		$mode          	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
332 332
 	 *  @return string 			       	Label of status
333 333
 	 */
334
-	static function LibStatut($status,$mode=0)
334
+	static function LibStatut($status, $mode = 0)
335 335
 	{
336 336
 		global $langs;
337 337
 
@@ -342,28 +342,28 @@  discard block
 block discarded – undo
342 342
 		}
343 343
 		elseif ($mode == 2)
344 344
 		{
345
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
346
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
345
+			if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
346
+			if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
347 347
 		}
348 348
 		elseif ($mode == 3)
349 349
 		{
350
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
351
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
350
+			if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
351
+			if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
352 352
 		}
353 353
 		elseif ($mode == 4)
354 354
 		{
355
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
356
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
355
+			if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
356
+			if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
357 357
 		}
358 358
 		elseif ($mode == 5)
359 359
 		{
360
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
361
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
360
+			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
361
+			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
362 362
 		}
363 363
 		elseif ($mode == 6)
364 364
 		{
365
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
366
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
365
+			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
366
+			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
367 367
 		}
368 368
 	}
369 369
 
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 	function info($id)
377 377
 	{
378 378
 		$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
379
-		$sql.= ' fk_user_creat, fk_user_modif';
380
-		$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
381
-		$sql.= ' WHERE t.rowid = '.$id;
382
-		$result=$this->db->query($sql);
379
+		$sql .= ' fk_user_creat, fk_user_modif';
380
+		$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
381
+		$sql .= ' WHERE t.rowid = '.$id;
382
+		$result = $this->db->query($sql);
383 383
 		if ($result)
384 384
 		{
385 385
 			if ($this->db->num_rows($result))
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 				{
391 391
 					$cuser = new User($this->db);
392 392
 					$cuser->fetch($obj->fk_user_author);
393
-					$this->user_creation   = $cuser;
393
+					$this->user_creation = $cuser;
394 394
 				}
395 395
 
396 396
 				if ($obj->fk_user_valid)
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 				{
405 405
 					$cluser = new User($this->db);
406 406
 					$cluser->fetch($obj->fk_user_cloture);
407
-					$this->user_cloture   = $cluser;
407
+					$this->user_cloture = $cluser;
408 408
 				}
409 409
 
410 410
 				$this->date_creation     = $this->db->jdate($obj->datec);
Please login to merge, or discard this patch.
Braces   +54 added lines, -28 removed lines patch added patch discarded remove patch
@@ -152,8 +152,12 @@  discard block
 block discarded – undo
152 152
 
153 153
 		$this->db = $db;
154 154
 
155
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
156
-		if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
155
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
156
+		    $this->fields['rowid']['visible']=0;
157
+		}
158
+		if (empty($conf->multicompany->enabled)) {
159
+		    $this->fields['entity']['enabled']=0;
160
+		}
157 161
 	}
158 162
 
159 163
 	/**
@@ -227,7 +231,9 @@  discard block
 block discarded – undo
227 231
 	public function fetch($id, $ref = null)
228 232
 	{
229 233
 		$result = $this->fetchCommon($id, $ref);
230
-		if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
234
+		if ($result > 0 && ! empty($this->table_element_line)) {
235
+		    $this->fetchLines();
236
+		}
231 237
 		return $result;
232 238
 	}
233 239
 
@@ -295,7 +301,9 @@  discard block
 block discarded – undo
295 301
 		if ($withpicto)
296 302
 		{
297 303
 			$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
298
-			if ($withpicto != 2) $result.=' ';
304
+			if ($withpicto != 2) {
305
+			    $result.=' ';
306
+			}
299 307
 		}
300 308
 		$result.= $linkstart . $this->label . $linkend;
301 309
 		return $result;
@@ -337,33 +345,52 @@  discard block
 block discarded – undo
337 345
 
338 346
 		if ($mode == 0 || $mode == 1)
339 347
 		{
340
-			if ($status == 1) return $langs->trans('Enabled');
341
-			if ($status == 0) return $langs->trans('Disabled');
342
-		}
343
-		elseif ($mode == 2)
348
+			if ($status == 1) {
349
+			    return $langs->trans('Enabled');
350
+			}
351
+			if ($status == 0) {
352
+			    return $langs->trans('Disabled');
353
+			}
354
+		} elseif ($mode == 2)
344 355
 		{
345
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
346
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
347
-		}
348
-		elseif ($mode == 3)
356
+			if ($status == 1) {
357
+			    return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
358
+			}
359
+			if ($status == 0) {
360
+			    return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
361
+			}
362
+		} elseif ($mode == 3)
349 363
 		{
350
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
351
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
352
-		}
353
-		elseif ($mode == 4)
364
+			if ($status == 1) {
365
+			    return img_picto($langs->trans('Enabled'),'statut4');
366
+			}
367
+			if ($status == 0) {
368
+			    return img_picto($langs->trans('Disabled'),'statut5');
369
+			}
370
+		} elseif ($mode == 4)
354 371
 		{
355
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
356
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
357
-		}
358
-		elseif ($mode == 5)
372
+			if ($status == 1) {
373
+			    return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
374
+			}
375
+			if ($status == 0) {
376
+			    return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
377
+			}
378
+		} elseif ($mode == 5)
359 379
 		{
360
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
361
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
362
-		}
363
-		elseif ($mode == 6)
380
+			if ($status == 1) {
381
+			    return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
382
+			}
383
+			if ($status == 0) {
384
+			    return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
385
+			}
386
+		} elseif ($mode == 6)
364 387
 		{
365
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
366
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
388
+			if ($status == 1) {
389
+			    return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
390
+			}
391
+			if ($status == 0) {
392
+			    return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
393
+			}
367 394
 		}
368 395
 	}
369 396
 
@@ -413,8 +440,7 @@  discard block
 block discarded – undo
413 440
 			}
414 441
 
415 442
 			$this->db->free($result);
416
-		}
417
-		else
443
+		} else
418 444
 		{
419 445
 			dol_print_error($this->db);
420 446
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/html.formwebsite.class.php 3 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
     private $db;
31 31
 
32 32
     /**
33
-	 * @var string Error code (or message)
34
-	 */
35
-	public $error;
33
+     * @var string Error code (or message)
34
+     */
35
+    public $error;
36 36
 
37 37
 
38 38
     /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     function selectWebsite($selected='',$htmlname='exportmodelid',$useempty=0)
58 58
     {
59
-    	$out='';
59
+        $out='';
60 60
 
61 61
         $sql = "SELECT rowid, ref";
62 62
         $sql.= " FROM ".MAIN_DB_PREFIX."website";
@@ -109,55 +109,55 @@  discard block
 block discarded – undo
109 109
      */
110 110
     function selectTypeOfContainer($htmlname, $selected='', $useempty=0, $moreattrib='')
111 111
     {
112
-    	global $langs, $conf, $user;
113
-
114
-    	$langs->load("admin");
115
-
116
-    	$sql = "SELECT rowid, code, label, entity";
117
-    	$sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
118
-    	$sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
119
-    	$sql.= " ORDER BY label";
120
-
121
-    	dol_syslog(get_class($this)."::selectTypeOfContainer", LOG_DEBUG);
122
-    	$result = $this->db->query($sql);
123
-    	if ($result)
124
-    	{
125
-    		$num = $this->db->num_rows($result);
126
-    		$i = 0;
127
-    		if ($num)
128
-    		{
129
-    			print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
130
-    			if ($useempty == 1 || ($useempty == 2 && $num > 1))
131
-    			{
132
-    				print '<option value="-1">&nbsp;</option>';
133
-    			}
134
-
135
-    			while ($i < $num)
136
-    			{
137
-    				$obj = $this->db->fetch_object($result);
138
-    				if ($selected == $obj->rowid || $selected == $obj->code)
139
-    				{
140
-    					print '<option value="'.$obj->code.'" selected>';
141
-    				}
142
-    				else
143
-    				{
144
-    					print '<option value="'.$obj->code.'">';
145
-    				}
146
-    				print $obj->label;
147
-    				print '</option>';
148
-    				$i++;
149
-    			}
150
-    			print "</select>";
151
-    			if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
152
-    		}
153
-    		else
154
-    		{
155
-    			print $langs->trans("NoTypeOfPagePleaseEditDictionary");
156
-    		}
157
-    	}
158
-    	else {
159
-    		dol_print_error($this->db);
160
-    	}
112
+        global $langs, $conf, $user;
113
+
114
+        $langs->load("admin");
115
+
116
+        $sql = "SELECT rowid, code, label, entity";
117
+        $sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
118
+        $sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
119
+        $sql.= " ORDER BY label";
120
+
121
+        dol_syslog(get_class($this)."::selectTypeOfContainer", LOG_DEBUG);
122
+        $result = $this->db->query($sql);
123
+        if ($result)
124
+        {
125
+            $num = $this->db->num_rows($result);
126
+            $i = 0;
127
+            if ($num)
128
+            {
129
+                print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
130
+                if ($useempty == 1 || ($useempty == 2 && $num > 1))
131
+                {
132
+                    print '<option value="-1">&nbsp;</option>';
133
+                }
134
+
135
+                while ($i < $num)
136
+                {
137
+                    $obj = $this->db->fetch_object($result);
138
+                    if ($selected == $obj->rowid || $selected == $obj->code)
139
+                    {
140
+                        print '<option value="'.$obj->code.'" selected>';
141
+                    }
142
+                    else
143
+                    {
144
+                        print '<option value="'.$obj->code.'">';
145
+                    }
146
+                    print $obj->label;
147
+                    print '</option>';
148
+                    $i++;
149
+                }
150
+                print "</select>";
151
+                if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
152
+            }
153
+            else
154
+            {
155
+                print $langs->trans("NoTypeOfPagePleaseEditDictionary");
156
+            }
157
+        }
158
+        else {
159
+            dol_print_error($this->db);
160
+        }
161 161
     }
162 162
 
163 163
 
@@ -172,35 +172,35 @@  discard block
 block discarded – undo
172 172
      */
173 173
     function selectSampleOfContainer($htmlname, $selected='', $useempty=0, $moreattrib='')
174 174
     {
175
-    	global $langs, $conf, $user;
176
-
177
-    	$langs->load("admin");
178
-
179
-    	$arrayofsamples=array('empty'=>'EmptyPage', 'corporatehome'=>'CorporateHomePage');
180
-
181
-    	$out = '';
182
-    	$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
183
-
184
-    	if ($useempty == 1 || $useempty == 2)
185
-    	{
186
-    		$out .= '<option value="-1">&nbsp;</option>';
187
-    	}
188
-
189
-    	foreach($arrayofsamples as $key => $val)
190
-    	{
191
-    		if ($selected == $key)
192
-    		{
193
-    			$out .= '<option value="'.$key.'" selected>';
194
-    		}
195
-    		else
196
-    		{
197
-    			$out .= '<option value="'.$key.'">';
198
-    		}
199
-    		$out .= $langs->trans($val);
200
-    		$out .= '</option>';
201
-    	}
202
-    	$out .= "</select>";
203
-
204
-    	return $out;
175
+        global $langs, $conf, $user;
176
+
177
+        $langs->load("admin");
178
+
179
+        $arrayofsamples=array('empty'=>'EmptyPage', 'corporatehome'=>'CorporateHomePage');
180
+
181
+        $out = '';
182
+        $out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
183
+
184
+        if ($useempty == 1 || $useempty == 2)
185
+        {
186
+            $out .= '<option value="-1">&nbsp;</option>';
187
+        }
188
+
189
+        foreach($arrayofsamples as $key => $val)
190
+        {
191
+            if ($selected == $key)
192
+            {
193
+                $out .= '<option value="'.$key.'" selected>';
194
+            }
195
+            else
196
+            {
197
+                $out .= '<option value="'.$key.'">';
198
+            }
199
+            $out .= $langs->trans($val);
200
+            $out .= '</option>';
201
+        }
202
+        $out .= "</select>";
203
+
204
+        return $out;
205 205
     }
206 206
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
      *    @param    int		$useempty          Show empty value or not
55 55
      *    @return	string					   Html component
56 56
      */
57
-    function selectWebsite($selected='',$htmlname='exportmodelid',$useempty=0)
57
+    function selectWebsite($selected = '', $htmlname = 'exportmodelid', $useempty = 0)
58 58
     {
59
-    	$out='';
59
+    	$out = '';
60 60
 
61 61
         $sql = "SELECT rowid, ref";
62
-        $sql.= " FROM ".MAIN_DB_PREFIX."website";
63
-        $sql.= " WHERE 1 = 1";
64
-        $sql.= " ORDER BY rowid";
62
+        $sql .= " FROM ".MAIN_DB_PREFIX."website";
63
+        $sql .= " WHERE 1 = 1";
64
+        $sql .= " ORDER BY rowid";
65 65
         $result = $this->db->query($sql);
66 66
         if ($result)
67 67
         {
68
-            $out.='<select class="flat minwidth100" name="'.$htmlname.'" id="'.$htmlname.'">';
68
+            $out .= '<select class="flat minwidth100" name="'.$htmlname.'" id="'.$htmlname.'">';
69 69
             if ($useempty)
70 70
             {
71
-                $out.='<option value="-1">&nbsp;</option>';
71
+                $out .= '<option value="-1">&nbsp;</option>';
72 72
             }
73 73
 
74 74
             $num = $this->db->num_rows($result);
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
                 $obj = $this->db->fetch_object($result);
79 79
                 if ($selected == $obj->rowid)
80 80
                 {
81
-                    $out.='<option value="'.$obj->rowid.'" selected>';
81
+                    $out .= '<option value="'.$obj->rowid.'" selected>';
82 82
                 }
83 83
                 else
84 84
                 {
85
-                    $out.='<option value="'.$obj->rowid.'">';
85
+                    $out .= '<option value="'.$obj->rowid.'">';
86 86
                 }
87
-                $out.=$obj->ref;
88
-                $out.='</option>';
87
+                $out .= $obj->ref;
88
+                $out .= '</option>';
89 89
                 $i++;
90 90
             }
91
-            $out.="</select>";
91
+            $out .= "</select>";
92 92
         }
93 93
         else {
94 94
             dol_print_error($this->db);
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
      *  @param  string  $moreattrib         More attributes on HTML select tag
108 108
      * 	@return	void
109 109
      */
110
-    function selectTypeOfContainer($htmlname, $selected='', $useempty=0, $moreattrib='')
110
+    function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
111 111
     {
112 112
     	global $langs, $conf, $user;
113 113
 
114 114
     	$langs->load("admin");
115 115
 
116 116
     	$sql = "SELECT rowid, code, label, entity";
117
-    	$sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
118
-    	$sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
119
-    	$sql.= " ORDER BY label";
117
+    	$sql .= " FROM ".MAIN_DB_PREFIX.'c_type_container';
118
+    	$sql .= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
119
+    	$sql .= " ORDER BY label";
120 120
 
121 121
     	dol_syslog(get_class($this)."::selectTypeOfContainer", LOG_DEBUG);
122 122
     	$result = $this->db->query($sql);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     		$i = 0;
127 127
     		if ($num)
128 128
     		{
129
-    			print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
129
+    			print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
130 130
     			if ($useempty == 1 || ($useempty == 2 && $num > 1))
131 131
     			{
132 132
     				print '<option value="-1">&nbsp;</option>';
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     				$i++;
149 149
     			}
150 150
     			print "</select>";
151
-    			if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
151
+    			if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
152 152
     		}
153 153
     		else
154 154
     		{
@@ -170,23 +170,23 @@  discard block
 block discarded – undo
170 170
      *  @param  string  $moreattrib         More attributes on HTML select tag
171 171
      * 	@return	void
172 172
      */
173
-    function selectSampleOfContainer($htmlname, $selected='', $useempty=0, $moreattrib='')
173
+    function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
174 174
     {
175 175
     	global $langs, $conf, $user;
176 176
 
177 177
     	$langs->load("admin");
178 178
 
179
-    	$arrayofsamples=array('empty'=>'EmptyPage', 'corporatehome'=>'CorporateHomePage');
179
+    	$arrayofsamples = array('empty'=>'EmptyPage', 'corporatehome'=>'CorporateHomePage');
180 180
 
181 181
     	$out = '';
182
-    	$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
182
+    	$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
183 183
 
184 184
     	if ($useempty == 1 || $useempty == 2)
185 185
     	{
186 186
     		$out .= '<option value="-1">&nbsp;</option>';
187 187
     	}
188 188
 
189
-    	foreach($arrayofsamples as $key => $val)
189
+    	foreach ($arrayofsamples as $key => $val)
190 190
     	{
191 191
     		if ($selected == $key)
192 192
     		{
Please login to merge, or discard this patch.
Braces   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
                 if ($selected == $obj->rowid)
80 80
                 {
81 81
                     $out.='<option value="'.$obj->rowid.'" selected>';
82
-                }
83
-                else
82
+                } else
84 83
                 {
85 84
                     $out.='<option value="'.$obj->rowid.'">';
86 85
                 }
@@ -89,8 +88,7 @@  discard block
 block discarded – undo
89 88
                 $i++;
90 89
             }
91 90
             $out.="</select>";
92
-        }
93
-        else {
91
+        } else {
94 92
             dol_print_error($this->db);
95 93
         }
96 94
 
@@ -138,8 +136,7 @@  discard block
 block discarded – undo
138 136
     				if ($selected == $obj->rowid || $selected == $obj->code)
139 137
     				{
140 138
     					print '<option value="'.$obj->code.'" selected>';
141
-    				}
142
-    				else
139
+    				} else
143 140
     				{
144 141
     					print '<option value="'.$obj->code.'">';
145 142
     				}
@@ -148,14 +145,14 @@  discard block
 block discarded – undo
148 145
     				$i++;
149 146
     			}
150 147
     			print "</select>";
151
-    			if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
152
-    		}
153
-    		else
148
+    			if ($user->admin) {
149
+    			    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
150
+    			}
151
+    		} else
154 152
     		{
155 153
     			print $langs->trans("NoTypeOfPagePleaseEditDictionary");
156 154
     		}
157
-    	}
158
-    	else {
155
+    	} else {
159 156
     		dol_print_error($this->db);
160 157
     	}
161 158
     }
@@ -191,8 +188,7 @@  discard block
 block discarded – undo
191 188
     		if ($selected == $key)
192 189
     		{
193 190
     			$out .= '<option value="'.$key.'" selected>';
194
-    		}
195
-    		else
191
+    		} else
196 192
     		{
197 193
     			$out .= '<option value="'.$key.'">';
198 194
     		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/actions_addupdatedelete.inc.php 3 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -32,187 +32,187 @@
 block discarded – undo
32 32
 
33 33
 if ($cancel)
34 34
 {
35
-	if (! empty($backtopage))
36
-	{
37
-		header("Location: ".$backtopage);
38
-		exit;
39
-	}
40
-	$action='';
35
+    if (! empty($backtopage))
36
+    {
37
+        header("Location: ".$backtopage);
38
+        exit;
39
+    }
40
+    $action='';
41 41
 }
42 42
 
43 43
 // Action to add record
44 44
 if ($action == 'add' && ! empty($permissiontoadd))
45 45
 {
46
-	foreach ($object->fields as $key => $val)
47
-	{
48
-		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
49
-
50
-		// Set value to insert
51
-		if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
52
-			$value = GETPOST($key,'none');
53
-		} elseif ($object->fields[$key]['type']=='date') {
54
-			$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
55
-		} elseif ($object->fields[$key]['type']=='datetime') {
56
-			$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
57
-		} elseif ($object->fields[$key]['type']=='price') {
58
-			$value = price2num(GETPOST($key));
59
-		} else {
60
-			$value = GETPOST($key,'alpha');
61
-		}
62
-		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
63
-		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
64
-
65
-		$object->$key=$value;
66
-		if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
67
-		{
68
-			$error++;
69
-			setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
70
-		}
71
-	}
72
-
73
-	if (! $error)
74
-	{
75
-		$result=$object->create($user);
76
-		if ($result > 0)
77
-		{
78
-			// Creation OK
79
-			$urltogo=$backtopage?str_replace('__ID__', $result, $backtopage):$backurlforlist;
80
-			header("Location: ".$urltogo);
81
-			exit;
82
-		}
83
-		else
84
-		{
85
-			// Creation KO
86
-			if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
87
-			else  setEventMessages($object->error, null, 'errors');
88
-			$action='create';
89
-		}
90
-	}
91
-	else
92
-	{
93
-		$action='create';
94
-	}
46
+    foreach ($object->fields as $key => $val)
47
+    {
48
+        if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
49
+
50
+        // Set value to insert
51
+        if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
52
+            $value = GETPOST($key,'none');
53
+        } elseif ($object->fields[$key]['type']=='date') {
54
+            $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
55
+        } elseif ($object->fields[$key]['type']=='datetime') {
56
+            $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
57
+        } elseif ($object->fields[$key]['type']=='price') {
58
+            $value = price2num(GETPOST($key));
59
+        } else {
60
+            $value = GETPOST($key,'alpha');
61
+        }
62
+        if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
63
+        if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
64
+
65
+        $object->$key=$value;
66
+        if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
67
+        {
68
+            $error++;
69
+            setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
70
+        }
71
+    }
72
+
73
+    if (! $error)
74
+    {
75
+        $result=$object->create($user);
76
+        if ($result > 0)
77
+        {
78
+            // Creation OK
79
+            $urltogo=$backtopage?str_replace('__ID__', $result, $backtopage):$backurlforlist;
80
+            header("Location: ".$urltogo);
81
+            exit;
82
+        }
83
+        else
84
+        {
85
+            // Creation KO
86
+            if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
87
+            else  setEventMessages($object->error, null, 'errors');
88
+            $action='create';
89
+        }
90
+    }
91
+    else
92
+    {
93
+        $action='create';
94
+    }
95 95
 }
96 96
 
97 97
 // Action to update record
98 98
 if ($action == 'update' && ! empty($permissiontoadd))
99 99
 {
100
-	foreach ($object->fields as $key => $val)
101
-	{
102
-		if (! GETPOSTISSET($key)) continue;		// The field was not submited to be edited
103
-		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
104
-
105
-		// Set value to update
106
-		if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
107
-			$value = GETPOST($key,'none');
108
-		} elseif ($object->fields[$key]['type']=='date') {
109
-			$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
110
-		} elseif ($object->fields[$key]['type']=='datetime') {
111
-			$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
112
-		} elseif ($object->fields[$key]['type']=='price') {
113
-			$value = price2num(GETPOST($key));
114
-		} else {
115
-			$value = GETPOST($key,'alpha');
116
-		}
117
-		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
118
-		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
119
-
120
-		$object->$key=$value;
121
-		if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
122
-		{
123
-			$error++;
124
-			setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
125
-		}
126
-	}
127
-
128
-	if (! $error)
129
-	{
130
-		$result=$object->update($user);
131
-		if ($result > 0)
132
-		{
133
-			$action='view';
134
-		}
135
-		else
136
-		{
137
-			// Creation KO
138
-			setEventMessages($object->error, $object->errors, 'errors');
139
-			$action='edit';
140
-		}
141
-	}
142
-	else
143
-	{
144
-		$action='edit';
145
-	}
100
+    foreach ($object->fields as $key => $val)
101
+    {
102
+        if (! GETPOSTISSET($key)) continue;		// The field was not submited to be edited
103
+        if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
104
+
105
+        // Set value to update
106
+        if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
107
+            $value = GETPOST($key,'none');
108
+        } elseif ($object->fields[$key]['type']=='date') {
109
+            $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
110
+        } elseif ($object->fields[$key]['type']=='datetime') {
111
+            $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
112
+        } elseif ($object->fields[$key]['type']=='price') {
113
+            $value = price2num(GETPOST($key));
114
+        } else {
115
+            $value = GETPOST($key,'alpha');
116
+        }
117
+        if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
118
+        if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
119
+
120
+        $object->$key=$value;
121
+        if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
122
+        {
123
+            $error++;
124
+            setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
125
+        }
126
+    }
127
+
128
+    if (! $error)
129
+    {
130
+        $result=$object->update($user);
131
+        if ($result > 0)
132
+        {
133
+            $action='view';
134
+        }
135
+        else
136
+        {
137
+            // Creation KO
138
+            setEventMessages($object->error, $object->errors, 'errors');
139
+            $action='edit';
140
+        }
141
+    }
142
+    else
143
+    {
144
+        $action='edit';
145
+    }
146 146
 }
147 147
 
148 148
 // Action to update one extrafield
149 149
 if ($action == "update_extras" && ! empty($permissiontoadd))
150 150
 {
151
-	$object->fetch(GETPOST('id','int'));
152
-	$attributekey = GETPOST('attribute','alpha');
153
-	$attributekeylong = 'options_'.$attributekey;
154
-	$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
155
-
156
-	$result = $object->insertExtraFields(empty($triggermodname)?'':$triggermodname, $user);
157
-	if ($result > 0)
158
-	{
159
-		setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
160
-		$action = 'view';
161
-	}
162
-	else
163
-	{
164
-		setEventMessages($object->error, $object->errors, 'errors');
165
-		$action = 'edit_extras';
166
-	}
151
+    $object->fetch(GETPOST('id','int'));
152
+    $attributekey = GETPOST('attribute','alpha');
153
+    $attributekeylong = 'options_'.$attributekey;
154
+    $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
155
+
156
+    $result = $object->insertExtraFields(empty($triggermodname)?'':$triggermodname, $user);
157
+    if ($result > 0)
158
+    {
159
+        setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
160
+        $action = 'view';
161
+    }
162
+    else
163
+    {
164
+        setEventMessages($object->error, $object->errors, 'errors');
165
+        $action = 'edit_extras';
166
+    }
167 167
 }
168 168
 
169 169
 // Action to delete
170 170
 if ($action == 'confirm_delete' && ! empty($permissiontodelete))
171 171
 {
172
-	$result=$object->delete($user);
173
-	if ($result > 0)
174
-	{
175
-		// Delete OK
176
-		setEventMessages("RecordDeleted", null, 'mesgs');
177
-		header("Location: ".$backurlforlist);
178
-		exit;
179
-	}
180
-	else
181
-	{
182
-		if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
183
-		else setEventMessages($object->error, null, 'errors');
184
-	}
172
+    $result=$object->delete($user);
173
+    if ($result > 0)
174
+    {
175
+        // Delete OK
176
+        setEventMessages("RecordDeleted", null, 'mesgs');
177
+        header("Location: ".$backurlforlist);
178
+        exit;
179
+    }
180
+    else
181
+    {
182
+        if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
183
+        else setEventMessages($object->error, null, 'errors');
184
+    }
185 185
 }
186 186
 
187 187
 // Action clone object
188 188
 if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd))
189 189
 {
190
-	if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
191
-	{
192
-		setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
193
-	}
194
-	else
195
-	{
196
-		if ($object->id > 0)
197
-		{
198
-			// Because createFromClone modifies the object, we must clone it so that we can restore it later
199
-			$orig = clone $object;
200
-
201
-			$result=$object->createFromClone($user, $object->id);
202
-			if ($result > 0)
203
-			{
204
-				$newid = 0;
205
-				if (is_object($result)) $newid = $result->id;
206
-				else $newid = $result;
207
-				header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid);	// Open record of new object
208
-				exit;
209
-			}
210
-			else
211
-			{
212
-				setEventMessages($object->error, $object->errors, 'errors');
213
-				$object = $orig;
214
-				$action='';
215
-			}
216
-		}
217
-	}
190
+    if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
191
+    {
192
+        setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
193
+    }
194
+    else
195
+    {
196
+        if ($object->id > 0)
197
+        {
198
+            // Because createFromClone modifies the object, we must clone it so that we can restore it later
199
+            $orig = clone $object;
200
+
201
+            $result=$object->createFromClone($user, $object->id);
202
+            if ($result > 0)
203
+            {
204
+                $newid = 0;
205
+                if (is_object($result)) $newid = $result->id;
206
+                else $newid = $result;
207
+                header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid);	// Open record of new object
208
+                exit;
209
+            }
210
+            else
211
+            {
212
+                setEventMessages($object->error, $object->errors, 'errors');
213
+                $object = $orig;
214
+                $action='';
215
+            }
216
+        }
217
+    }
218 218
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -32,128 +32,128 @@  discard block
 block discarded – undo
32 32
 
33 33
 if ($cancel)
34 34
 {
35
-	if (! empty($backtopage))
35
+	if (!empty($backtopage))
36 36
 	{
37 37
 		header("Location: ".$backtopage);
38 38
 		exit;
39 39
 	}
40
-	$action='';
40
+	$action = '';
41 41
 }
42 42
 
43 43
 // Action to add record
44
-if ($action == 'add' && ! empty($permissiontoadd))
44
+if ($action == 'add' && !empty($permissiontoadd))
45 45
 {
46 46
 	foreach ($object->fields as $key => $val)
47 47
 	{
48
-		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
48
+		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
49 49
 
50 50
 		// Set value to insert
51 51
 		if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
52
-			$value = GETPOST($key,'none');
53
-		} elseif ($object->fields[$key]['type']=='date') {
52
+			$value = GETPOST($key, 'none');
53
+		} elseif ($object->fields[$key]['type'] == 'date') {
54 54
 			$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
55
-		} elseif ($object->fields[$key]['type']=='datetime') {
55
+		} elseif ($object->fields[$key]['type'] == 'datetime') {
56 56
 			$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
57
-		} elseif ($object->fields[$key]['type']=='price') {
57
+		} elseif ($object->fields[$key]['type'] == 'price') {
58 58
 			$value = price2num(GETPOST($key));
59 59
 		} else {
60
-			$value = GETPOST($key,'alpha');
60
+			$value = GETPOST($key, 'alpha');
61 61
 		}
62
-		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
63
-		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
62
+		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field
63
+		if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field
64 64
 
65
-		$object->$key=$value;
65
+		$object->$key = $value;
66 66
 		if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
67 67
 		{
68 68
 			$error++;
69
-			setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
69
+			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
70 70
 		}
71 71
 	}
72 72
 
73
-	if (! $error)
73
+	if (!$error)
74 74
 	{
75
-		$result=$object->create($user);
75
+		$result = $object->create($user);
76 76
 		if ($result > 0)
77 77
 		{
78 78
 			// Creation OK
79
-			$urltogo=$backtopage?str_replace('__ID__', $result, $backtopage):$backurlforlist;
79
+			$urltogo = $backtopage ?str_replace('__ID__', $result, $backtopage) : $backurlforlist;
80 80
 			header("Location: ".$urltogo);
81 81
 			exit;
82 82
 		}
83 83
 		else
84 84
 		{
85 85
 			// Creation KO
86
-			if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
86
+			if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
87 87
 			else  setEventMessages($object->error, null, 'errors');
88
-			$action='create';
88
+			$action = 'create';
89 89
 		}
90 90
 	}
91 91
 	else
92 92
 	{
93
-		$action='create';
93
+		$action = 'create';
94 94
 	}
95 95
 }
96 96
 
97 97
 // Action to update record
98
-if ($action == 'update' && ! empty($permissiontoadd))
98
+if ($action == 'update' && !empty($permissiontoadd))
99 99
 {
100 100
 	foreach ($object->fields as $key => $val)
101 101
 	{
102
-		if (! GETPOSTISSET($key)) continue;		// The field was not submited to be edited
103
-		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
102
+		if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
103
+		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
104 104
 
105 105
 		// Set value to update
106 106
 		if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
107
-			$value = GETPOST($key,'none');
108
-		} elseif ($object->fields[$key]['type']=='date') {
107
+			$value = GETPOST($key, 'none');
108
+		} elseif ($object->fields[$key]['type'] == 'date') {
109 109
 			$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
110
-		} elseif ($object->fields[$key]['type']=='datetime') {
110
+		} elseif ($object->fields[$key]['type'] == 'datetime') {
111 111
 			$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
112
-		} elseif ($object->fields[$key]['type']=='price') {
112
+		} elseif ($object->fields[$key]['type'] == 'price') {
113 113
 			$value = price2num(GETPOST($key));
114 114
 		} else {
115
-			$value = GETPOST($key,'alpha');
115
+			$value = GETPOST($key, 'alpha');
116 116
 		}
117
-		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
118
-		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
117
+		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field
118
+		if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field
119 119
 
120
-		$object->$key=$value;
120
+		$object->$key = $value;
121 121
 		if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
122 122
 		{
123 123
 			$error++;
124
-			setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
124
+			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
125 125
 		}
126 126
 	}
127 127
 
128
-	if (! $error)
128
+	if (!$error)
129 129
 	{
130
-		$result=$object->update($user);
130
+		$result = $object->update($user);
131 131
 		if ($result > 0)
132 132
 		{
133
-			$action='view';
133
+			$action = 'view';
134 134
 		}
135 135
 		else
136 136
 		{
137 137
 			// Creation KO
138 138
 			setEventMessages($object->error, $object->errors, 'errors');
139
-			$action='edit';
139
+			$action = 'edit';
140 140
 		}
141 141
 	}
142 142
 	else
143 143
 	{
144
-		$action='edit';
144
+		$action = 'edit';
145 145
 	}
146 146
 }
147 147
 
148 148
 // Action to update one extrafield
149
-if ($action == "update_extras" && ! empty($permissiontoadd))
149
+if ($action == "update_extras" && !empty($permissiontoadd))
150 150
 {
151
-	$object->fetch(GETPOST('id','int'));
152
-	$attributekey = GETPOST('attribute','alpha');
151
+	$object->fetch(GETPOST('id', 'int'));
152
+	$attributekey = GETPOST('attribute', 'alpha');
153 153
 	$attributekeylong = 'options_'.$attributekey;
154
-	$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
154
+	$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, ' alpha');
155 155
 
156
-	$result = $object->insertExtraFields(empty($triggermodname)?'':$triggermodname, $user);
156
+	$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
157 157
 	if ($result > 0)
158 158
 	{
159 159
 		setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 }
168 168
 
169 169
 // Action to delete
170
-if ($action == 'confirm_delete' && ! empty($permissiontodelete))
170
+if ($action == 'confirm_delete' && !empty($permissiontodelete))
171 171
 {
172
-	$result=$object->delete($user);
172
+	$result = $object->delete($user);
173 173
 	if ($result > 0)
174 174
 	{
175 175
 		// Delete OK
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	}
180 180
 	else
181 181
 	{
182
-		if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
182
+		if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
183 183
 		else setEventMessages($object->error, null, 'errors');
184 184
 	}
185 185
 }
186 186
 
187 187
 // Action clone object
188
-if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd))
188
+if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
189 189
 {
190
-	if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
190
+	if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers'))
191 191
 	{
192 192
 		setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
193 193
 	}
@@ -198,20 +198,20 @@  discard block
 block discarded – undo
198 198
 			// Because createFromClone modifies the object, we must clone it so that we can restore it later
199 199
 			$orig = clone $object;
200 200
 
201
-			$result=$object->createFromClone($user, $object->id);
201
+			$result = $object->createFromClone($user, $object->id);
202 202
 			if ($result > 0)
203 203
 			{
204 204
 				$newid = 0;
205 205
 				if (is_object($result)) $newid = $result->id;
206 206
 				else $newid = $result;
207
-				header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid);	// Open record of new object
207
+				header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
208 208
 				exit;
209 209
 			}
210 210
 			else
211 211
 			{
212 212
 				setEventMessages($object->error, $object->errors, 'errors');
213 213
 				$object = $orig;
214
-				$action='';
214
+				$action = '';
215 215
 			}
216 216
 		}
217 217
 	}
Please login to merge, or discard this patch.
Braces   +51 added lines, -29 removed lines patch added patch discarded remove patch
@@ -45,7 +45,10 @@  discard block
 block discarded – undo
45 45
 {
46 46
 	foreach ($object->fields as $key => $val)
47 47
 	{
48
-		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
48
+		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) {
49
+		    continue;
50
+		}
51
+		// Ignore special fields
49 52
 
50 53
 		// Set value to insert
51 54
 		if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
@@ -59,8 +62,14 @@  discard block
 block discarded – undo
59 62
 		} else {
60 63
 			$value = GETPOST($key,'alpha');
61 64
 		}
62
-		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
63
-		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
65
+		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
66
+		    $value='';
67
+		}
68
+		// This is an implicit foreign key field
69
+		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') {
70
+		    $value='';
71
+		}
72
+		// This is an explicit foreign key field
64 73
 
65 74
 		$object->$key=$value;
66 75
 		if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
@@ -79,16 +88,17 @@  discard block
 block discarded – undo
79 88
 			$urltogo=$backtopage?str_replace('__ID__', $result, $backtopage):$backurlforlist;
80 89
 			header("Location: ".$urltogo);
81 90
 			exit;
82
-		}
83
-		else
91
+		} else
84 92
 		{
85 93
 			// Creation KO
86
-			if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
87
-			else  setEventMessages($object->error, null, 'errors');
94
+			if (! empty($object->errors)) {
95
+			    setEventMessages(null, $object->errors, 'errors');
96
+			} else {
97
+			    setEventMessages($object->error, null, 'errors');
98
+			}
88 99
 			$action='create';
89 100
 		}
90
-	}
91
-	else
101
+	} else
92 102
 	{
93 103
 		$action='create';
94 104
 	}
@@ -99,8 +109,14 @@  discard block
 block discarded – undo
99 109
 {
100 110
 	foreach ($object->fields as $key => $val)
101 111
 	{
102
-		if (! GETPOSTISSET($key)) continue;		// The field was not submited to be edited
103
-		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;	// Ignore special fields
112
+		if (! GETPOSTISSET($key)) {
113
+		    continue;
114
+		}
115
+		// The field was not submited to be edited
116
+		if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) {
117
+		    continue;
118
+		}
119
+		// Ignore special fields
104 120
 
105 121
 		// Set value to update
106 122
 		if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
@@ -114,8 +130,14 @@  discard block
 block discarded – undo
114 130
 		} else {
115 131
 			$value = GETPOST($key,'alpha');
116 132
 		}
117
-		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value='';		// This is an implicit foreign key field
118
-		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value='';					// This is an explicit foreign key field
133
+		if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
134
+		    $value='';
135
+		}
136
+		// This is an implicit foreign key field
137
+		if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') {
138
+		    $value='';
139
+		}
140
+		// This is an explicit foreign key field
119 141
 
120 142
 		$object->$key=$value;
121 143
 		if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
@@ -131,15 +153,13 @@  discard block
 block discarded – undo
131 153
 		if ($result > 0)
132 154
 		{
133 155
 			$action='view';
134
-		}
135
-		else
156
+		} else
136 157
 		{
137 158
 			// Creation KO
138 159
 			setEventMessages($object->error, $object->errors, 'errors');
139 160
 			$action='edit';
140 161
 		}
141
-	}
142
-	else
162
+	} else
143 163
 	{
144 164
 		$action='edit';
145 165
 	}
@@ -158,8 +178,7 @@  discard block
 block discarded – undo
158 178
 	{
159 179
 		setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
160 180
 		$action = 'view';
161
-	}
162
-	else
181
+	} else
163 182
 	{
164 183
 		setEventMessages($object->error, $object->errors, 'errors');
165 184
 		$action = 'edit_extras';
@@ -176,11 +195,13 @@  discard block
 block discarded – undo
176 195
 		setEventMessages("RecordDeleted", null, 'mesgs');
177 196
 		header("Location: ".$backurlforlist);
178 197
 		exit;
179
-	}
180
-	else
198
+	} else
181 199
 	{
182
-		if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
183
-		else setEventMessages($object->error, null, 'errors');
200
+		if (! empty($object->errors)) {
201
+		    setEventMessages(null, $object->errors, 'errors');
202
+		} else {
203
+		    setEventMessages($object->error, null, 'errors');
204
+		}
184 205
 	}
185 206
 }
186 207
 
@@ -190,8 +211,7 @@  discard block
 block discarded – undo
190 211
 	if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
191 212
 	{
192 213
 		setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
193
-	}
194
-	else
214
+	} else
195 215
 	{
196 216
 		if ($object->id > 0)
197 217
 		{
@@ -202,12 +222,14 @@  discard block
 block discarded – undo
202 222
 			if ($result > 0)
203 223
 			{
204 224
 				$newid = 0;
205
-				if (is_object($result)) $newid = $result->id;
206
-				else $newid = $result;
225
+				if (is_object($result)) {
226
+				    $newid = $result->id;
227
+				} else {
228
+				    $newid = $result;
229
+				}
207 230
 				header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid);	// Open record of new object
208 231
 				exit;
209
-			}
210
-			else
232
+			} else
211 233
 			{
212 234
 				setEventMessages($object->error, $object->errors, 'errors');
213 235
 				$object = $orig;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/actions_comments.inc.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -35,42 +35,42 @@
 block discarded – undo
35 35
 
36 36
 if ($action == 'addcomment')
37 37
 {
38
-	$description = GETPOST('comment_description', 'none');
39
-	if (!empty($description))
40
-	{
41
-		$comment->description = $description;
42
-		$comment->datec = time();
43
-		$comment->fk_element = GETPOST('id','int');
44
-		$comment->element_type = GETPOST('comment_element_type','alpha');
45
-		$comment->fk_user_author = $user->id;
46
-		$comment->entity = $conf->entity;
47
-		if ($comment->create($user) > 0)
48
-		{
49
-			setEventMessages($langs->trans("CommentAdded"), null, 'mesgs');
50
-			header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
51
-			exit;
52
-		}
53
-		else
54
-		{
55
-			setEventMessages($comment->error, $comment->errors,'errors');
56
-			$action='';
57
-		}
58
-	}
38
+    $description = GETPOST('comment_description', 'none');
39
+    if (!empty($description))
40
+    {
41
+        $comment->description = $description;
42
+        $comment->datec = time();
43
+        $comment->fk_element = GETPOST('id','int');
44
+        $comment->element_type = GETPOST('comment_element_type','alpha');
45
+        $comment->fk_user_author = $user->id;
46
+        $comment->entity = $conf->entity;
47
+        if ($comment->create($user) > 0)
48
+        {
49
+            setEventMessages($langs->trans("CommentAdded"), null, 'mesgs');
50
+            header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
51
+            exit;
52
+        }
53
+        else
54
+        {
55
+            setEventMessages($comment->error, $comment->errors,'errors');
56
+            $action='';
57
+        }
58
+    }
59 59
 }
60 60
 if ($action == 'deletecomment')
61 61
 {
62
-	if ($comment->fetch($idcomment) >= 0)
63
-	{
64
-		if ($comment->delete($user) > 0)
65
-		{
66
-			setEventMessages($langs->trans("CommentDeleted"), null, 'mesgs');
67
-			header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
68
-			exit;
69
-		}
70
-		else
71
-		{
72
-			setEventMessages($comment->error, $comment->errors,'errors');
73
-			$action='';
74
-		}
75
-	}
62
+    if ($comment->fetch($idcomment) >= 0)
63
+    {
64
+        if ($comment->delete($user) > 0)
65
+        {
66
+            setEventMessages($langs->trans("CommentDeleted"), null, 'mesgs');
67
+            header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
68
+            exit;
69
+        }
70
+        else
71
+        {
72
+            setEventMessages($comment->error, $comment->errors,'errors');
73
+            $action='';
74
+        }
75
+    }
76 76
 }
77 77
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php';
28 28
 
29
-$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
29
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
30 30
 $comment = new Comment($db);
31 31
 
32 32
 /*
@@ -40,20 +40,20 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$comment->description = $description;
42 42
 		$comment->datec = time();
43
-		$comment->fk_element = GETPOST('id','int');
44
-		$comment->element_type = GETPOST('comment_element_type','alpha');
43
+		$comment->fk_element = GETPOST('id', 'int');
44
+		$comment->element_type = GETPOST('comment_element_type', 'alpha');
45 45
 		$comment->fk_user_author = $user->id;
46 46
 		$comment->entity = $conf->entity;
47 47
 		if ($comment->create($user) > 0)
48 48
 		{
49 49
 			setEventMessages($langs->trans("CommentAdded"), null, 'mesgs');
50
-			header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
50
+			header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1' : ''));
51 51
 			exit;
52 52
 		}
53 53
 		else
54 54
 		{
55
-			setEventMessages($comment->error, $comment->errors,'errors');
56
-			$action='';
55
+			setEventMessages($comment->error, $comment->errors, 'errors');
56
+			$action = '';
57 57
 		}
58 58
 	}
59 59
 }
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
 		if ($comment->delete($user) > 0)
65 65
 		{
66 66
 			setEventMessages($langs->trans("CommentDeleted"), null, 'mesgs');
67
-			header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
67
+			header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1' : ''));
68 68
 			exit;
69 69
 		}
70 70
 		else
71 71
 		{
72
-			setEventMessages($comment->error, $comment->errors,'errors');
73
-			$action='';
72
+			setEventMessages($comment->error, $comment->errors, 'errors');
73
+			$action = '';
74 74
 		}
75 75
 	}
76 76
 }
77 77
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@  discard block
 block discarded – undo
49 49
 			setEventMessages($langs->trans("CommentAdded"), null, 'mesgs');
50 50
 			header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
51 51
 			exit;
52
-		}
53
-		else
52
+		} else
54 53
 		{
55 54
 			setEventMessages($comment->error, $comment->errors,'errors');
56 55
 			$action='';
@@ -66,8 +65,7 @@  discard block
 block discarded – undo
66 65
 			setEventMessages($langs->trans("CommentDeleted"), null, 'mesgs');
67 66
 			header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1':''));
68 67
 			exit;
69
-		}
70
-		else
68
+		} else
71 69
 		{
72 70
 			setEventMessages($comment->error, $comment->errors,'errors');
73 71
 			$action='';
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/browser/default/browser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
 //define('NOTOKENRENEWAL',1); // Disables token renewal
23 23
 //require '../../../../main.inc.php';
24
-require '../../connectors/php/config.php';      // This include the define('NOTOKENRENEWAL',1) and the require main.in.php
24
+require '../../connectors/php/config.php'; // This include the define('NOTOKENRENEWAL',1) and the require main.in.php
25 25
 
26 26
 global $Config;
27 27
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/basexml.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function SetXmlHeaders()
32 32
 {
33
-	ob_end_clean();
34
-
35
-	// Prevent the browser from caching the result.
36
-	// Date in the past
37
-	header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
38
-	// always modified
39
-	header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
40
-	// HTTP/1.1
41
-	header('Cache-Control: no-store, no-cache, must-revalidate');
42
-	header('Cache-Control: post-check=0, pre-check=0', false);
43
-	// HTTP/1.0
44
-	header('Pragma: no-cache');
45
-
46
-	// Set the response format.
47
-	header('Content-Type: text/xml; charset=utf-8');
33
+    ob_end_clean();
34
+
35
+    // Prevent the browser from caching the result.
36
+    // Date in the past
37
+    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
38
+    // always modified
39
+    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
40
+    // HTTP/1.1
41
+    header('Cache-Control: no-store, no-cache, must-revalidate');
42
+    header('Cache-Control: post-check=0, pre-check=0', false);
43
+    // HTTP/1.0
44
+    header('Pragma: no-cache');
45
+
46
+    // Set the response format.
47
+    header('Content-Type: text/xml; charset=utf-8');
48 48
 }
49 49
 
50 50
 /**
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
  */
58 58
 function CreateXmlHeader( $command, $resourceType, $currentFolder )
59 59
 {
60
-	SetXmlHeaders();
60
+    SetXmlHeaders();
61 61
 
62
-	// Create the XML document header.
63
-	echo '<?xml version="1.0" encoding="utf-8" ?>' ;
62
+    // Create the XML document header.
63
+    echo '<?xml version="1.0" encoding="utf-8" ?>' ;
64 64
 
65
-	// Create the main "Connector" node.
66
-	echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
65
+    // Create the main "Connector" node.
66
+    echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
67 67
 
68
-	// Add the current folder node.
69
-	echo '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(GetUrlFromPath($resourceType, $currentFolder, $command)) . '" />' ;
68
+    // Add the current folder node.
69
+    echo '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(GetUrlFromPath($resourceType, $currentFolder, $command)) . '" />' ;
70 70
 
71
-	$GLOBALS['HeaderSent'] = true ;
71
+    $GLOBALS['HeaderSent'] = true ;
72 72
 }
73 73
 
74 74
 /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function CreateXmlFooter()
80 80
 {
81
-	echo '</Connector>' ;
81
+    echo '</Connector>' ;
82 82
 }
83 83
 
84 84
 /**
@@ -90,30 +90,30 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function SendError($number, $text)
92 92
 {
93
-	if ( $_GET['Command'] == 'FileUpload' )
94
-		SendUploadResults($number, "", "", $text);
95
-
96
-	if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
97
-	{
98
-		SendErrorNode($number, $text);
99
-		CreateXmlFooter();
100
-	}
101
-	else
102
-	{
103
-		SetXmlHeaders();
104
-
105
-		dol_syslog('Error: '.$number.' '.$text, LOG_ERR);
93
+    if ( $_GET['Command'] == 'FileUpload' )
94
+        SendUploadResults($number, "", "", $text);
95
+
96
+    if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
97
+    {
98
+        SendErrorNode($number, $text);
99
+        CreateXmlFooter();
100
+    }
101
+    else
102
+    {
103
+        SetXmlHeaders();
104
+
105
+        dol_syslog('Error: '.$number.' '.$text, LOG_ERR);
106 106
 		
107
-		// Create the XML document header
108
-		echo '<?xml version="1.0" encoding="utf-8" ?>' ;
107
+        // Create the XML document header
108
+        echo '<?xml version="1.0" encoding="utf-8" ?>' ;
109 109
 
110
-		echo '<Connector>' ;
110
+        echo '<Connector>' ;
111 111
 
112
-		SendErrorNode($number, $text);
112
+        SendErrorNode($number, $text);
113 113
 
114
-		echo '</Connector>' ;
115
-	}
116
-	exit ;
114
+        echo '</Connector>' ;
115
+    }
116
+    exit ;
117 117
 }
118 118
 
119 119
 /**
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
  */
126 126
 function SendErrorNode($number, $text)
127 127
 {
128
-	if ($text)
129
-		echo '<Error number="' . $number . '" text="' . htmlspecialchars($text) . '" />' ;
130
-	else
131
-		echo '<Error number="' . $number . '" />' ;
128
+    if ($text)
129
+        echo '<Error number="' . $number . '" text="' . htmlspecialchars($text) . '" />' ;
130
+    else
131
+        echo '<Error number="' . $number . '" />' ;
132 132
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	// Date in the past
37 37
 	header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
38 38
 	// always modified
39
-	header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
39
+	header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
40 40
 	// HTTP/1.1
41 41
 	header('Cache-Control: no-store, no-cache, must-revalidate');
42 42
 	header('Cache-Control: post-check=0, pre-check=0', false);
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
  * @param string	$currentFolder	Current folder
56 56
  * @return void
57 57
  */
58
-function CreateXmlHeader( $command, $resourceType, $currentFolder )
58
+function CreateXmlHeader($command, $resourceType, $currentFolder)
59 59
 {
60 60
 	SetXmlHeaders();
61 61
 
62 62
 	// Create the XML document header.
63
-	echo '<?xml version="1.0" encoding="utf-8" ?>' ;
63
+	echo '<?xml version="1.0" encoding="utf-8" ?>';
64 64
 
65 65
 	// Create the main "Connector" node.
66
-	echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
66
+	echo '<Connector command="'.$command.'" resourceType="'.$resourceType.'">';
67 67
 
68 68
 	// Add the current folder node.
69
-	echo '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(GetUrlFromPath($resourceType, $currentFolder, $command)) . '" />' ;
69
+	echo '<CurrentFolder path="'.ConvertToXmlAttribute($currentFolder).'" url="'.ConvertToXmlAttribute(GetUrlFromPath($resourceType, $currentFolder, $command)).'" />';
70 70
 
71
-	$GLOBALS['HeaderSent'] = true ;
71
+	$GLOBALS['HeaderSent'] = true;
72 72
 }
73 73
 
74 74
 /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function CreateXmlFooter()
80 80
 {
81
-	echo '</Connector>' ;
81
+	echo '</Connector>';
82 82
 }
83 83
 
84 84
 /**
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function SendError($number, $text)
92 92
 {
93
-	if ( $_GET['Command'] == 'FileUpload' )
93
+	if ($_GET['Command'] == 'FileUpload')
94 94
 		SendUploadResults($number, "", "", $text);
95 95
 
96
-	if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
96
+	if (isset($GLOBALS['HeaderSent']) && $GLOBALS['HeaderSent'])
97 97
 	{
98 98
 		SendErrorNode($number, $text);
99 99
 		CreateXmlFooter();
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 		dol_syslog('Error: '.$number.' '.$text, LOG_ERR);
106 106
 		
107 107
 		// Create the XML document header
108
-		echo '<?xml version="1.0" encoding="utf-8" ?>' ;
108
+		echo '<?xml version="1.0" encoding="utf-8" ?>';
109 109
 
110
-		echo '<Connector>' ;
110
+		echo '<Connector>';
111 111
 
112 112
 		SendErrorNode($number, $text);
113 113
 
114
-		echo '</Connector>' ;
114
+		echo '</Connector>';
115 115
 	}
116
-	exit ;
116
+	exit;
117 117
 }
118 118
 
119 119
 /**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 function SendErrorNode($number, $text)
127 127
 {
128 128
 	if ($text)
129
-		echo '<Error number="' . $number . '" text="' . htmlspecialchars($text) . '" />' ;
129
+		echo '<Error number="'.$number.'" text="'.htmlspecialchars($text).'" />';
130 130
 	else
131
-		echo '<Error number="' . $number . '" />' ;
131
+		echo '<Error number="'.$number.'" />';
132 132
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function SendError($number, $text)
92 92
 {
93
-	if ( $_GET['Command'] == 'FileUpload' )
94
-		SendUploadResults($number, "", "", $text);
93
+	if ( $_GET['Command'] == 'FileUpload' ) {
94
+			SendUploadResults($number, "", "", $text);
95
+	}
95 96
 
96 97
 	if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
97 98
 	{
98 99
 		SendErrorNode($number, $text);
99 100
 		CreateXmlFooter();
100
-	}
101
-	else
101
+	} else
102 102
 	{
103 103
 		SetXmlHeaders();
104 104
 
@@ -125,8 +125,9 @@  discard block
 block discarded – undo
125 125
  */
126 126
 function SendErrorNode($number, $text)
127 127
 {
128
-	if ($text)
129
-		echo '<Error number="' . $number . '" text="' . htmlspecialchars($text) . '" />' ;
130
-	else
131
-		echo '<Error number="' . $number . '" />' ;
132
-}
128
+	if ($text) {
129
+			echo '<Error number="' . $number . '" text="' . htmlspecialchars($text) . '" />' ;
130
+	} else {
131
+			echo '<Error number="' . $number . '" />' ;
132
+	}
133
+	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/connector.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 require 'commands.php';
32 32
 
33 33
 if ( !$Config['Enabled'] )
34
-	SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
34
+    SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
35 35
 
36 36
 DoResponse();
37 37
 
@@ -45,47 +45,47 @@  discard block
 block discarded – undo
45 45
     if (!isset($_GET)) {
46 46
         global $_GET;
47 47
     }
48
-	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
49
-		return;
48
+    if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
49
+        return;
50 50
 
51
-	// Get the main request informaiton.
52
-	$sCommand		= $_GET['Command'] ;
53
-	$sResourceType	= $_GET['Type'] ;
54
-	$sCurrentFolder	= GetCurrentFolder();
51
+    // Get the main request informaiton.
52
+    $sCommand		= $_GET['Command'] ;
53
+    $sResourceType	= $_GET['Type'] ;
54
+    $sCurrentFolder	= GetCurrentFolder();
55 55
 
56
-	// Check if it is an allowed command
57
-	if (! IsAllowedCommand($sCommand))
58
-	{
59
-		SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
60
-	}
61
-	// Check if it is an allowed type.
62
-	if (! IsAllowedType($sResourceType))
63
-		SendError(1, 'Invalid type specified');
56
+    // Check if it is an allowed command
57
+    if (! IsAllowedCommand($sCommand))
58
+    {
59
+        SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
60
+    }
61
+    // Check if it is an allowed type.
62
+    if (! IsAllowedType($sResourceType))
63
+        SendError(1, 'Invalid type specified');
64 64
 
65
-	// File Upload doesn't have to Return XML, so it must be intercepted before anything.
66
-	if ( $sCommand == 'FileUpload' )
67
-	{
68
-		FileUpload($sResourceType, $sCurrentFolder, $sCommand);
69
-		return;
70
-	}
65
+    // File Upload doesn't have to Return XML, so it must be intercepted before anything.
66
+    if ( $sCommand == 'FileUpload' )
67
+    {
68
+        FileUpload($sResourceType, $sCurrentFolder, $sCommand);
69
+        return;
70
+    }
71 71
 
72
-	CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
72
+    CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
73 73
 
74
-	// Execute the required command.
75
-	switch ( $sCommand )
76
-	{
77
-		case 'GetFolders' :
78
-			GetFolders($sResourceType, $sCurrentFolder);
79
-			break;
80
-		case 'GetFoldersAndFiles' :
81
-			GetFoldersAndFiles($sResourceType, $sCurrentFolder);
82
-			break;
83
-		case 'CreateFolder' :
84
-			CreateFolder($sResourceType, $sCurrentFolder);
85
-			break;
86
-	}
74
+    // Execute the required command.
75
+    switch ( $sCommand )
76
+    {
77
+        case 'GetFolders' :
78
+            GetFolders($sResourceType, $sCurrentFolder);
79
+            break;
80
+        case 'GetFoldersAndFiles' :
81
+            GetFoldersAndFiles($sResourceType, $sCurrentFolder);
82
+            break;
83
+        case 'CreateFolder' :
84
+            CreateFolder($sResourceType, $sCurrentFolder);
85
+            break;
86
+    }
87 87
 
88
-	CreateXmlFooter();
88
+    CreateXmlFooter();
89 89
 
90
-	exit;
90
+    exit;
91 91
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 require 'basexml.php';
31 31
 require 'commands.php';
32 32
 
33
-if ( !$Config['Enabled'] )
33
+if (!$Config['Enabled'])
34 34
 	SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
35 35
 
36 36
 DoResponse();
@@ -45,25 +45,25 @@  discard block
 block discarded – undo
45 45
     if (!isset($_GET)) {
46 46
         global $_GET;
47 47
     }
48
-	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
48
+	if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder']))
49 49
 		return;
50 50
 
51 51
 	// Get the main request informaiton.
52
-	$sCommand		= $_GET['Command'] ;
53
-	$sResourceType	= $_GET['Type'] ;
54
-	$sCurrentFolder	= GetCurrentFolder();
52
+	$sCommand = $_GET['Command'];
53
+	$sResourceType = $_GET['Type'];
54
+	$sCurrentFolder = GetCurrentFolder();
55 55
 
56 56
 	// Check if it is an allowed command
57
-	if (! IsAllowedCommand($sCommand))
57
+	if (!IsAllowedCommand($sCommand))
58 58
 	{
59
-		SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
59
+		SendError(1, 'The "'.$sCommand.'" command isn\'t allowed');
60 60
 	}
61 61
 	// Check if it is an allowed type.
62
-	if (! IsAllowedType($sResourceType))
62
+	if (!IsAllowedType($sResourceType))
63 63
 		SendError(1, 'Invalid type specified');
64 64
 
65 65
 	// File Upload doesn't have to Return XML, so it must be intercepted before anything.
66
-	if ( $sCommand == 'FileUpload' )
66
+	if ($sCommand == 'FileUpload')
67 67
 	{
68 68
 		FileUpload($sResourceType, $sCurrentFolder, $sCommand);
69 69
 		return;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
73 73
 
74 74
 	// Execute the required command.
75
-	switch ( $sCommand )
75
+	switch ($sCommand)
76 76
 	{
77 77
 		case 'GetFolders' :
78 78
 			GetFolders($sResourceType, $sCurrentFolder);
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@  discard block
 block discarded – undo
30 30
 require 'basexml.php';
31 31
 require 'commands.php';
32 32
 
33
-if ( !$Config['Enabled'] )
33
+if ( !$Config['Enabled'] ) {
34 34
 	SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
35
+}
35 36
 
36 37
 DoResponse();
37 38
 
@@ -45,8 +46,9 @@  discard block
 block discarded – undo
45 46
     if (!isset($_GET)) {
46 47
         global $_GET;
47 48
     }
48
-	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
49
-		return;
49
+	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) {
50
+			return;
51
+	}
50 52
 
51 53
 	// Get the main request informaiton.
52 54
 	$sCommand		= $_GET['Command'] ;
@@ -59,8 +61,9 @@  discard block
 block discarded – undo
59 61
 		SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
60 62
 	}
61 63
 	// Check if it is an allowed type.
62
-	if (! IsAllowedType($sResourceType))
63
-		SendError(1, 'Invalid type specified');
64
+	if (! IsAllowedType($sResourceType)) {
65
+			SendError(1, 'Invalid type specified');
66
+	}
64 67
 
65 68
 	// File Upload doesn't have to Return XML, so it must be intercepted before anything.
66 69
 	if ( $sCommand == 'FileUpload' )
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/upload.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function SendError($number, $text)
38 38
 {
39
-	SendUploadResults($number, '', '', $text);
39
+    SendUploadResults($number, '', '', $text);
40 40
 }
41 41
 
42 42
 
43 43
 // Check if this uploader has been enabled.
44 44
 if ( !$Config['Enabled'] )
45
-	SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
45
+    SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
46 46
 
47 47
 $sCommand = 'QuickUpload' ;
48 48
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 // Is enabled the upload?
55 55
 if (! IsAllowedCommand($sCommand))
56
-	SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
56
+    SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
57 57
 
58 58
 // Check if it is an allowed type.
59 59
 if (! IsAllowedType($sType))
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,22 +41,22 @@
 block discarded – undo
41 41
 
42 42
 
43 43
 // Check if this uploader has been enabled.
44
-if ( !$Config['Enabled'] )
44
+if (!$Config['Enabled'])
45 45
 	SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
46 46
 
47
-$sCommand = 'QuickUpload' ;
47
+$sCommand = 'QuickUpload';
48 48
 
49 49
 // The file type (from the QueryString, by default 'File').
50
-$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
50
+$sType = isset($_GET['Type']) ? $_GET['Type'] : 'File';
51 51
 
52
-$sCurrentFolder	= "/" ;
52
+$sCurrentFolder = "/";
53 53
 
54 54
 // Is enabled the upload?
55
-if (! IsAllowedCommand($sCommand))
56
-	SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
55
+if (!IsAllowedCommand($sCommand))
56
+	SendUploadResults('1', '', '', 'The ""'.$sCommand.'"" command isn\'t allowed');
57 57
 
58 58
 // Check if it is an allowed type.
59
-if (! IsAllowedType($sType))
59
+if (!IsAllowedType($sType))
60 60
     SendUploadResults(1, '', '', 'Invalid type specified');
61 61
 
62 62
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 // Check if this uploader has been enabled.
44
-if ( !$Config['Enabled'] )
44
+if ( !$Config['Enabled'] ) {
45 45
 	SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
46
+}
46 47
 
47 48
 $sCommand = 'QuickUpload' ;
48 49
 
@@ -52,12 +53,14 @@  discard block
 block discarded – undo
52 53
 $sCurrentFolder	= "/" ;
53 54
 
54 55
 // Is enabled the upload?
55
-if (! IsAllowedCommand($sCommand))
56
+if (! IsAllowedCommand($sCommand)) {
56 57
 	SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
58
+}
57 59
 
58 60
 // Check if it is an allowed type.
59
-if (! IsAllowedType($sType))
61
+if (! IsAllowedType($sType)) {
60 62
     SendUploadResults(1, '', '', 'Invalid type specified');
63
+}
61 64
 
62 65
 
63 66
 // @CHANGE
Please login to merge, or discard this patch.