Test Failed
Branch develop (86e751)
by Laurent
34:11
created
htdocs/public/notice.php 1 patch
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,13 +38,16 @@
 block discarded – undo
38 38
 {
39 39
     print 'Sorry, it seems your internet connexion is off.<br>';
40 40
     print 'You need to be connected to network to use this software.<br>';
41
-}
42
-else
41
+} else
43 42
 {
44 43
     $langs->load("error");
45 44
     $langs->load("other");
46 45
     
47
-    if (GETPOST('transphrase')) print GETPOST('transphrase'); 
48
-    if (GETPOST('transkey')) print $langs->trans(GETPOST('transkey'));
49
-}
46
+    if (GETPOST('transphrase')) {
47
+    	print GETPOST('transphrase');
48
+    }
49
+    if (GETPOST('transkey')) {
50
+    	print $langs->trans(GETPOST('transkey'));
51
+    }
52
+    }
50 53
 
Please login to merge, or discard this patch.
htdocs/public/websites/styles.css.php 1 patch
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,9 +24,15 @@  discard block
 block discarded – undo
24 24
 define('NOTOKENRENEWAL',1); // Disables token renewal
25 25
 define("NOLOGIN",1);
26 26
 define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
27
-if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
28
-if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
29
-if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
27
+if (! defined('NOREQUIREMENU')) {
28
+	define('NOREQUIREMENU','1');
29
+}
30
+if (! defined('NOREQUIREHTML')) {
31
+	define('NOREQUIREHTML','1');
32
+}
33
+if (! defined('NOREQUIREAJAX')) {
34
+	define('NOREQUIREAJAX','1');
35
+}
30 36
 
31 37
 /**
32 38
  * Header empty
@@ -59,7 +65,9 @@  discard block
 block discarded – undo
59 65
  */
60 66
 
61 67
 $appli=constant('DOL_APPLICATION_TITLE');
62
-if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
68
+if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
69
+	$appli=$conf->global->MAIN_APPLICATION_TITLE;
70
+}
63 71
 
64 72
 //print 'Directory with '.$appli.' websites.<br>';
65 73
 
@@ -73,8 +81,7 @@  discard block
 block discarded – undo
73 81
     {
74 82
         $object->fetch($websiteid);
75 83
         $website=$object->ref;
76
-    }
77
-    else
84
+    } else
78 85
     {
79 86
         $object->fetch(0, $website);
80 87
     }
@@ -142,5 +149,7 @@  discard block
 block discarded – undo
142 149
 require_once $original_file_osencoded;
143 150
 
144 151
 
145
-if (is_object($db)) $db->close();
152
+if (is_object($db)) {
153
+	$db->close();
154
+}
146 155
 
Please login to merge, or discard this patch.
htdocs/public/donations/donateurs_code.php 1 patch
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 require_once DOL_DOCUMENT_ROOT .'/don/class/don.class.php';
43 43
 
44 44
 // Security check
45
-if (empty($conf->don->enabled)) accessforbidden('',0,0,1);
45
+if (empty($conf->don->enabled)) {
46
+	accessforbidden('',0,0,1);
47
+}
46 48
 
47 49
 
48 50
 $langs->load("donations");
@@ -85,8 +87,7 @@  discard block
 block discarded – undo
85 87
 			if ($objp->public)
86 88
 			{
87 89
 				print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".$objp->societe."</td>\n";
88
-			}
89
-			else
90
+			} else
90 91
 			{
91 92
 				print "<td>Anonyme Anonyme</td>\n";
92 93
 			}
@@ -97,13 +98,11 @@  discard block
 block discarded – undo
97 98
 		}
98 99
 		print "</table>";
99 100
 
100
-	}
101
-	else
101
+	} else
102 102
 	{
103 103
 		print "Aucun don publique";
104 104
 	}
105
-}
106
-else
105
+} else
107 106
 {
108 107
 	dol_print_error($db);
109 108
 }
Please login to merge, or discard this patch.
htdocs/webservices/server_user.php 1 patch
Braces   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
  *       \brief      File that is entry point to call Dolibarr WebServices
21 21
  */
22 22
 
23
-if (! defined("NOCSRFCHECK"))    define("NOCSRFCHECK",'1');
23
+if (! defined("NOCSRFCHECK")) {
24
+	define("NOCSRFCHECK",'1');
25
+}
24 26
 
25 27
 require_once '../master.inc.php';
26 28
 require_once NUSOAP_PATH.'/nusoap.php';		// Include SOAP
@@ -193,8 +195,7 @@  discard block
 block discarded – undo
193 195
 foreach($extrafields->attribute_label as $key=>$label)
194 196
 {
195 197
 	$type =$extrafields->attribute_type[$key];
196
-	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
197
-	else {$type='xsd:string';}
198
+	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';}
198 199
 
199 200
 	$extrafield_array['contact_options_'.$key]=array('name'=>'contact_options_'.$key,'type'=>$type);
200 201
 }
@@ -306,7 +307,9 @@  discard block
 block discarded – undo
306 307
 
307 308
     dol_syslog("Function: getUser login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
308 309
 
309
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
310
+    if ($authentication['entity']) {
311
+    	$conf->entity=$authentication['entity'];
312
+    }
310 313
 
311 314
     // Init and check authentication
312 315
     $objectresp=array();
@@ -365,14 +368,12 @@  discard block
 block discarded – undo
365 368
 						'canvas' => $user->canvas
366 369
                     )
367 370
                 );
368
-            }
369
-            else
371
+            } else
370 372
             {
371 373
                 $error++;
372 374
                 $errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
373 375
             }
374
-        }
375
-        else
376
+        } else
376 377
         {
377 378
             $error++;
378 379
             $errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -401,7 +402,9 @@  discard block
 block discarded – undo
401 402
 
402 403
 	dol_syslog("Function: getListOfGroups login=".$authentication['login']);
403 404
 
404
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
405
+	if ($authentication['entity']) {
406
+		$conf->entity=$authentication['entity'];
407
+	}
405 408
 
406 409
 	// Init and check authentication
407 410
 	$objectresp=array();
@@ -419,8 +422,7 @@  discard block
 block discarded – undo
419 422
 		if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity)))
420 423
 		{
421 424
 			$sql.= " WHERE g.entity IS NOT NULL";
422
-		}
423
-		else
425
+		} else
424 426
 		{
425 427
 			$sql.= " WHERE g.entity IN (0,".$conf->entity.")";
426 428
 		}
@@ -437,8 +439,7 @@  discard block
 block discarded – undo
437 439
 				$arraygroups[]=array('id'=>$obj->rowid,'name'=>$obj->name,'datec'=>$obj->datec,'nb'=>$obj->nb);
438 440
 				$i++;
439 441
 			}
440
-		}
441
-		else
442
+		} else
442 443
 		{
443 444
 			$error++;
444 445
 			$errorcode=$db->lasterrno();
@@ -452,8 +453,7 @@  discard block
 block discarded – undo
452 453
 		'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel),
453 454
 		'groups'=>$arraygroups
454 455
 		);
455
-	}
456
-	else
456
+	} else
457 457
 	{
458 458
 		$objectresp = array(
459 459
 		'result'=>array('result_code' => 'OK', 'result_label' => ''),
@@ -478,7 +478,9 @@  discard block
 block discarded – undo
478 478
 
479 479
 	dol_syslog("Function: createUserFromThirdparty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
480 480
 
481
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
481
+	if ($authentication['entity']) {
482
+		$conf->entity=$authentication['entity'];
483
+	}
482 484
 
483 485
 	$objectresp=array();
484 486
 	$errorcode='';$errorlabel='';
@@ -486,7 +488,9 @@  discard block
 block discarded – undo
486 488
 
487 489
 	$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
488 490
 
489
-	if ($fuser->societe_id) $socid=$fuser->societe_id;
491
+	if ($fuser->societe_id) {
492
+		$socid=$fuser->societe_id;
493
+	}
490 494
 
491 495
 	if (! $error && ! $thirdpartywithuser)
492 496
 	{
@@ -519,8 +523,7 @@  discard block
 block discarded – undo
519 523
 				{
520 524
 					$error++;
521 525
 					$errorcode='ALREADY_EXIST'; $errorlabel='Object not create : company or contact exists '.$thirdpartywithuser['email'];
522
-				}
523
-				else
526
+				} else
524 527
 				{
525 528
 					$db->begin();
526 529
 					/*
@@ -619,16 +622,15 @@  discard block
 block discarded – undo
619 622
 							{
620 623
 								$edituser->setPassword($fuser,trim($thirdpartywithuser['password']));
621 624
 
622
-								if($thirdpartywithuser['group_id'] > 0 )
623
-									$edituser->SetInGroup($thirdpartywithuser['group_id'],$conf->entity);
624
-							}
625
-							else
625
+								if($thirdpartywithuser['group_id'] > 0 ) {
626
+																	$edituser->SetInGroup($thirdpartywithuser['group_id'],$conf->entity);
627
+								}
628
+							} else
626 629
 							{
627 630
 								$error++;
628 631
 								$errorcode='NOT_CREATE'; $errorlabel='Object not create : '.$edituser->error;
629 632
 							}
630
-						}
631
-						else
633
+						} else
632 634
 						{
633 635
 							$error++;
634 636
 							$errorcode='NOT_CREATE'; $errorlabel='Object not create : '.$contact->error;
@@ -639,22 +641,19 @@  discard block
 block discarded – undo
639 641
 							$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>'SUCCESS'),'id'=>$socid_return);
640 642
 							$error=0;
641 643
 						}
642
-					}
643
-					else
644
+					} else
644 645
 					{
645 646
 						$error++;
646 647
 						$errors=($thirdparty->error?array($thirdparty->error):$thirdparty->errors);
647 648
 					}
648 649
 				}
649
-			}
650
-			else
650
+			} else
651 651
 			{
652 652
 				// retour creation KO
653 653
 				$error++;
654 654
 				$errorcode='NOT_CREATE'; $errorlabel='Object not create';
655 655
 			}
656
-		}
657
-		else
656
+		} else
658 657
 		{
659 658
 			$error++;
660 659
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -686,7 +685,9 @@  discard block
 block discarded – undo
686 685
 
687 686
 	dol_syslog("Function: setUserPassword login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
688 687
 
689
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
688
+	if ($authentication['entity']) {
689
+		$conf->entity=$authentication['entity'];
690
+	}
690 691
 
691 692
 	$objectresp=array();
692 693
 	$errorcode='';$errorlabel='';
@@ -694,7 +695,9 @@  discard block
 block discarded – undo
694 695
 
695 696
 	$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
696 697
 
697
-	if ($fuser->societe_id) $socid=$fuser->societe_id;
698
+	if ($fuser->societe_id) {
699
+		$socid=$fuser->societe_id;
700
+	}
698 701
 
699 702
 	if (! $error && ! $shortuser)
700 703
 	{
@@ -719,21 +722,18 @@  discard block
 block discarded – undo
719 722
 						'result'=>array('result_code' => 'OK', 'result_label' => ''),
720 723
 						'groups'=>$arraygroups
721 724
 					);
722
-				}
723
-				else
725
+				} else
724 726
 				{
725 727
 					$error++;
726 728
 					$errorcode='NOT_MODIFIED'; $errorlabel='Error when changing password';
727 729
 				}
728
-			}
729
-			else
730
+			} else
730 731
 			{
731 732
 				$error++;
732 733
 				$errorcode='NOT_FOUND'; $errorlabel='User not found';
733 734
 			}
734 735
 
735
-		}
736
-		else
736
+		} else
737 737
 		{
738 738
 			$error++;
739 739
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
Please login to merge, or discard this patch.
htdocs/webservices/server_invoice.php 1 patch
Braces   +48 added lines, -31 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
  *       \brief      File that is entry point to call Dolibarr WebServices
22 22
  */
23 23
 
24
-if (! defined("NOCSRFCHECK"))    define("NOCSRFCHECK",'1');
24
+if (! defined("NOCSRFCHECK")) {
25
+	define("NOCSRFCHECK",'1');
26
+}
25 27
 
26 28
 require_once '../master.inc.php';
27 29
 require_once NUSOAP_PATH.'/nusoap.php';		// Include SOAP
@@ -292,7 +294,9 @@  discard block
 block discarded – undo
292 294
 
293 295
 	dol_syslog("Function: getInvoice login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
294 296
 
295
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
297
+	if ($authentication['entity']) {
298
+		$conf->entity=$authentication['entity'];
299
+	}
296 300
 
297 301
     // Init and check authentication
298 302
     $objectresp=array();
@@ -369,14 +373,12 @@  discard block
 block discarded – undo
369 373
 			        	'payment_mode_id' => $invoice->mode_reglement_id?$invoice->mode_reglement_id:'',
370 374
 			        	'lines' => $linesresp
371 375
 			        ));
372
-			}
373
-			else
376
+			} else
374 377
 			{
375 378
 				$error++;
376 379
 				$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
377 380
 			}
378
-		}
379
-		else
381
+		} else
380 382
 		{
381 383
 			$error++;
382 384
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -405,7 +407,9 @@  discard block
 block discarded – undo
405 407
 
406 408
 	dol_syslog("Function: getInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
407 409
 
408
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
410
+	if ($authentication['entity']) {
411
+		$conf->entity=$authentication['entity'];
412
+	}
409 413
 
410 414
     // Init and check authentication
411 415
     $objectresp=array();
@@ -413,7 +417,9 @@  discard block
 block discarded – undo
413 417
     $error=0;
414 418
     $fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
415 419
 
416
-	if ($fuser->socid) $socid=$fuser->socid;
420
+	if ($fuser->socid) {
421
+		$socid=$fuser->socid;
422
+	}
417 423
 
418 424
 	// Check parameters
419 425
 	if (! $error && empty($idthirdparty))
@@ -429,7 +435,9 @@  discard block
 block discarded – undo
429 435
 		$sql ='SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva';
430 436
 		$sql.=' FROM '.MAIN_DB_PREFIX.'facture as f';
431 437
 		$sql.=" WHERE f.entity = ".$conf->entity;
432
-		if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
438
+		if ($idthirdparty != 'all' ) {
439
+			$sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
440
+		}
433 441
 
434 442
 		$resql=$db->query($sql);
435 443
 		if ($resql)
@@ -510,8 +518,7 @@  discard block
 block discarded – undo
510 518
 		        'invoices'=>$linesinvoice
511 519
 
512 520
 			);
513
-		}
514
-		else
521
+		} else
515 522
 		{
516 523
 			$error++;
517 524
 			$errorcode=$db->lasterrno(); $errorlabel=$db->lasterror();
@@ -543,7 +550,9 @@  discard block
 block discarded – undo
543 550
     dol_syslog("Function: createInvoice login=".$authentication['login']." id=".$invoice->id.
544 551
     		", ref=".$invoice->ref.", ref_ext=".$invoice->ref_ext);
545 552
 
546
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
553
+    if ($authentication['entity']) {
554
+    	$conf->entity=$authentication['entity'];
555
+    }
547 556
 
548 557
     // Init and check authentication
549 558
     $objectresp=array();
@@ -575,13 +584,17 @@  discard block
 block discarded – undo
575 584
         if ($res > 0) {
576 585
     	    $new_invoice->mode_reglement_id = ! empty($invoice['payment_mode_id'])?$invoice['payment_mode_id']:$soc->mode_reglement_id;
577 586
             $new_invoice->cond_reglement_id  = $soc->cond_reglement_id; 
587
+        } else {
588
+        	$new_invoice->mode_reglement_id = $invoice['payment_mode_id'];
578 589
         }
579
-        else $new_invoice->mode_reglement_id = $invoice['payment_mode_id'];
580 590
 
581 591
         // Trick because nusoap does not store data with same structure if there is one or several lines
582 592
         $arrayoflines=array();
583
-        if (isset($invoice['lines']['line'][0])) $arrayoflines=$invoice['lines']['line'];
584
-        else $arrayoflines=$invoice['lines'];
593
+        if (isset($invoice['lines']['line'][0])) {
594
+        	$arrayoflines=$invoice['lines']['line'];
595
+        } else {
596
+        	$arrayoflines=$invoice['lines'];
597
+        }
585 598
 
586 599
         foreach($arrayoflines as $key => $line)
587 600
         {
@@ -612,9 +625,11 @@  discard block
 block discarded – undo
612 625
             $error++;
613 626
         }
614 627
 
615
-        if (!$error && $invoice['status'] == Facture::STATUS_VALIDATED)   // We want invoice to have status validated
628
+        if (!$error && $invoice['status'] == Facture::STATUS_VALIDATED) {
629
+        	// We want invoice to have status validated
616 630
         {
617 631
             $result=$new_invoice->validate($fuser);
632
+        }
618 633
             if ($result < 0)
619 634
             {
620 635
                 $error++;
@@ -626,8 +641,7 @@  discard block
 block discarded – undo
626 641
             $db->commit();
627 642
             $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$new_invoice->id,
628 643
             		'ref'=>$new_invoice->ref,'ref_ext'=>$new_invoice->ref_ext);
629
-        }
630
-        else
644
+        } else
631 645
         {
632 646
             $db->rollback();
633 647
             $error++;
@@ -664,14 +678,18 @@  discard block
 block discarded – undo
664 678
 	dol_syslog("Function: createInvoiceFromOrder login=".$authentication['login']." id=".$id_order.
665 679
 			", ref=".$ref_order.", ref_ext=".$ref_ext_order);
666 680
 
667
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
681
+	if ($authentication['entity']) {
682
+		$conf->entity=$authentication['entity'];
683
+	}
668 684
 
669 685
 	// Init and check authentication
670 686
 	$objectresp=array();
671 687
 	$errorcode='';$errorlabel='';
672 688
 	$error=0;
673 689
 	$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
674
-    if ($fuser->socid) $socid=$fuser->socid;
690
+    if ($fuser->socid) {
691
+    	$socid=$fuser->socid;
692
+    }
675 693
 
676 694
 	// Check parameters
677 695
 	if (empty($id_order) && empty($ref_order) && empty($ref_ext_order))	{
@@ -709,14 +727,12 @@  discard block
 block discarded – undo
709 727
 					}
710 728
 					
711 729
 				}
712
-			}
713
-			else
730
+			} else
714 731
 			{
715 732
 				$error++;
716 733
 				$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id_order.' nor ref='.$ref_order.' nor ref_ext='.$ref_ext_order;
717 734
 			}
718
-		}
719
-		else
735
+		} else
720 736
 		{
721 737
 			$error++;
722 738
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -726,8 +742,7 @@  discard block
 block discarded – undo
726 742
 	if ($error)
727 743
 	{
728 744
 		$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
729
-	}
730
-	else
745
+	} else
731 746
 	{
732 747
 		$objectresp= array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id,'ref'=>$newobject->ref,'ref_ext'=>$newobject->ref_ext);
733 748
 	}
@@ -749,7 +764,9 @@  discard block
 block discarded – undo
749 764
 	dol_syslog("Function: updateInvoice login=".$authentication['login']." id=".$invoice['id'].
750 765
     		", ref=".$invoice['ref'].", ref_ext=".$invoice['ref_ext']);
751 766
 
752
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
767
+	if ($authentication['entity']) {
768
+		$conf->entity=$authentication['entity'];
769
+	}
753 770
 
754 771
 	// Init and check authentication
755 772
 	$objectresp=array();
@@ -796,8 +813,9 @@  discard block
 block discarded – undo
796 813
 				{
797 814
 					$result = $object->set_paid($fuser,$invoice->close_code,$invoice->close_note);			
798 815
 				}
799
-				if ($invoice['status'] == Facture::STATUS_ABANDONED)
800
-					$result = $object->set_canceled($fuser,$invoice->close_code,$invoice->close_note);
816
+				if ($invoice['status'] == Facture::STATUS_ABANDONED) {
817
+									$result = $object->set_canceled($fuser,$invoice->close_code,$invoice->close_note);
818
+				}
801 819
 			}
802 820
 		}
803 821
 	
@@ -810,8 +828,7 @@  discard block
 block discarded – undo
810 828
 					'ref'=>$object->ref,
811 829
 					'ref_ext'=>$object->ref_ext
812 830
 			);
813
-		}
814
-		elseif ($objectfound)
831
+		} elseif ($objectfound)
815 832
 		{
816 833
 			$db->rollback();
817 834
 			$error++;
Please login to merge, or discard this patch.
htdocs/webservices/server_actioncomm.php 1 patch
Braces   +22 added lines, -19 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
  *       \brief      File that is entry point to call Dolibarr WebServices
24 24
  */
25 25
 
26
-if (! defined("NOCSRFCHECK"))    define("NOCSRFCHECK",'1');
26
+if (! defined("NOCSRFCHECK")) {
27
+	define("NOCSRFCHECK",'1');
28
+}
27 29
 
28 30
 require_once("../master.inc.php");
29 31
 require_once(NUSOAP_PATH.'/nusoap.php');		// Include SOAP
@@ -121,8 +123,7 @@  discard block
 block discarded – undo
121 123
 foreach($extrafields->attribute_label as $key=>$label)
122 124
 {
123 125
 	$type =$extrafields->attribute_type[$key];
124
-	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
125
-	else {$type='xsd:string';}
126
+	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';}
126 127
 
127 128
 	$extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
128 129
 }
@@ -249,7 +250,9 @@  discard block
 block discarded – undo
249 250
 
250 251
     dol_syslog("Function: getActionComm login=".$authentication['login']." id=".$id);
251 252
 
252
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
253
+    if ($authentication['entity']) {
254
+    	$conf->entity=$authentication['entity'];
255
+    }
253 256
 
254 257
     // Init and check authentication
255 258
     $objectresp=array();
@@ -316,14 +319,12 @@  discard block
 block discarded – undo
316 319
                 $objectresp = array(
317 320
 			    	'result'=>array('result_code'=>'OK', 'result_label'=>''),
318 321
 			        'actioncomm'=>$actioncomm_result_fields);
319
-            }
320
-            else
322
+            } else
321 323
             {
322 324
                 $error++;
323 325
                 $errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
324 326
             }
325
-        }
326
-        else
327
+        } else
327 328
         {
328 329
             $error++;
329 330
             $errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -351,7 +352,9 @@  discard block
 block discarded – undo
351 352
 
352 353
 	dol_syslog("Function: getListActionCommType login=".$authentication['login']);
353 354
 
354
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
355
+	if ($authentication['entity']) {
356
+		$conf->entity=$authentication['entity'];
357
+	}
355 358
 
356 359
 	// Init and check authentication
357 360
 	$objectresp=array();
@@ -378,14 +381,12 @@  discard block
 block discarded – undo
378 381
 			    	'result'=>array('result_code'=>'OK', 'result_label'=>''),
379 382
 			        'actioncommtypes'=>$resultarray);
380 383
 
381
-			}
382
-			else
384
+			} else
383 385
 			{
384 386
 				$error++;
385 387
 				$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
386 388
 			}
387
-		}
388
-		else
389
+		} else
389 390
 		{
390 391
 			$error++;
391 392
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -416,7 +417,9 @@  discard block
 block discarded – undo
416 417
 
417 418
 	dol_syslog("Function: createActionComm login=".$authentication['login']);
418 419
 
419
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
420
+	if ($authentication['entity']) {
421
+		$conf->entity=$authentication['entity'];
422
+	}
420 423
 
421 424
 	// Init and check authentication
422 425
 	$objectresp=array();
@@ -466,8 +469,7 @@  discard block
 block discarded – undo
466 469
 		{
467 470
 			$db->commit();
468 471
 			$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id);
469
-		}
470
-		else
472
+		} else
471 473
 		{
472 474
 			$db->rollback();
473 475
 			$error++;
@@ -499,7 +501,9 @@  discard block
 block discarded – undo
499 501
 
500 502
 	dol_syslog("Function: updateActionComm login=".$authentication['login']);
501 503
 
502
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
504
+	if ($authentication['entity']) {
505
+		$conf->entity=$authentication['entity'];
506
+	}
503 507
 
504 508
 	// Init and check authentication
505 509
 	$objectresp=array();
@@ -563,8 +567,7 @@  discard block
 block discarded – undo
563 567
 					'result'=>array('result_code'=>'OK', 'result_label'=>''),
564 568
 					'id'=>$object->id
565 569
 			);
566
-		}
567
-		elseif ($objectfound)
570
+		} elseif ($objectfound)
568 571
 		{
569 572
 			$db->rollback();
570 573
 			$error++;
Please login to merge, or discard this patch.
htdocs/webservices/server_productorservice.php 1 patch
Braces   +80 added lines, -55 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
  *       \brief      File that is entry point to call Dolibarr WebServices
24 24
  */
25 25
 
26
-if (! defined("NOCSRFCHECK"))    define("NOCSRFCHECK",'1');
26
+if (! defined("NOCSRFCHECK")) {
27
+	define("NOCSRFCHECK",'1');
28
+}
27 29
 
28 30
 require_once '../master.inc.php';
29 31
 require_once NUSOAP_PATH.'/nusoap.php';        // Include SOAP
@@ -140,8 +142,7 @@  discard block
 block discarded – undo
140 142
 foreach($extrafields->attribute_label as $key=>$label)
141 143
 {
142 144
 	$type =$extrafields->attribute_type[$key];
143
-	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
144
-	else {$type='xsd:string';}
145
+	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';}
145 146
 
146 147
 	$extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
147 148
 }
@@ -341,7 +342,9 @@  discard block
 block discarded – undo
341 342
     $langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
342 343
     $langs->setDefaultLang($langcode);
343 344
 
344
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
345
+    if ($authentication['entity']) {
346
+    	$conf->entity=$authentication['entity'];
347
+    }
345 348
 
346 349
     // Init and check authentication
347 350
     $objectresp=array();
@@ -376,9 +379,15 @@  discard block
 block discarded – undo
376 379
             	$pdir = get_exdir($product->id,2,0,0,$product,'product') . $product->ref . "/";
377 380
             	$dir = $dir . '/'. $pdir;
378 381
 
379
-            	if (! empty($product->multilangs[$langs->defaultlang]["label"]))     		$product->label =  $product->multilangs[$langs->defaultlang]["label"];
380
-            	if (! empty($product->multilangs[$langs->defaultlang]["description"]))     	$product->description =  $product->multilangs[$langs->defaultlang]["description"];
381
-            	if (! empty($product->multilangs[$langs->defaultlang]["note"]))     		$product->note =  $product->multilangs[$langs->defaultlang]["note"];
382
+            	if (! empty($product->multilangs[$langs->defaultlang]["label"])) {
383
+            		$product->label =  $product->multilangs[$langs->defaultlang]["label"];
384
+            	}
385
+            	if (! empty($product->multilangs[$langs->defaultlang]["description"])) {
386
+            		$product->description =  $product->multilangs[$langs->defaultlang]["description"];
387
+            	}
388
+            	if (! empty($product->multilangs[$langs->defaultlang]["note"])) {
389
+            		$product->note =  $product->multilangs[$langs->defaultlang]["note"];
390
+            	}
382 391
 
383 392
             	$productorservice_result_fields = array(
384 393
 	            	'id' => $product->id,
@@ -436,14 +445,12 @@  discard block
 block discarded – undo
436 445
 			    	'result'=>array('result_code'=>'OK', 'result_label'=>''),
437 446
 			        'product'=>$productorservice_result_fields
438 447
                 );
439
-            }
440
-            else
448
+            } else
441 449
             {
442 450
                 $error++;
443 451
                 $errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
444 452
             }
445
-        }
446
-        else
453
+        } else
447 454
         {
448 455
             $error++;
449 456
             $errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -474,7 +481,9 @@  discard block
 block discarded – undo
474 481
 
475 482
     dol_syslog("Function: createProductOrService login=".$authentication['login']);
476 483
 
477
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
484
+    if ($authentication['entity']) {
485
+    	$conf->entity=$authentication['entity'];
486
+    }
478 487
 
479 488
     // Init and check authentication
480 489
     $objectresp=array();
@@ -482,8 +491,12 @@  discard block
 block discarded – undo
482 491
     $error=0;
483 492
     $fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
484 493
     // Check parameters
485
-    if ($product['price_net'] > 0) $product['price_base_type']='HT';
486
-    if ($product['price'] > 0)     $product['price_base_type']='TTC';
494
+    if ($product['price_net'] > 0) {
495
+    	$product['price_base_type']='HT';
496
+    }
497
+    if ($product['price'] > 0) {
498
+    	$product['price_base_type']='TTC';
499
+    }
487 500
 
488 501
     if ($product['price_net'] > 0 && $product['price'] > 0)
489 502
     {
@@ -528,7 +541,9 @@  discard block
 block discarded – undo
528 541
         $newobject->seuil_stock_alert=$product['stock_alert'];
529 542
 
530 543
         $newobject->country_id=$product['country_id'];
531
-        if ($product['country_code']) $newobject->country_id=getCountry($product['country_code'],3);
544
+        if ($product['country_code']) {
545
+        	$newobject->country_id=getCountry($product['country_code'],3);
546
+        }
532 547
         $newobject->customcode=$product['customcode'];
533 548
 
534 549
         $newobject->canvas=$product['canvas'];
@@ -594,8 +609,7 @@  discard block
 block discarded – undo
594 609
 							$error++;
595 610
 							$newobject->error='You set a different value for stock, but correction of stock count (before='.$getstockreal.', after='.$savstockreal.') fails with error '.$newobject->error;
596 611
 						}
597
-					}
598
-					else
612
+					} else
599 613
 					{
600 614
 						$error++;
601 615
 						$newobject->error='You set a different value for stock but we failed to find warehouse '.$product['warehouse_ref'].' to make correction.';
@@ -608,8 +622,7 @@  discard block
 block discarded – undo
608 622
         {
609 623
             $db->commit();
610 624
             $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id,'ref'=>$newobject->ref);
611
-        }
612
-        else
625
+        } else
613 626
         {
614 627
             $db->rollback();
615 628
             $error++;
@@ -643,7 +656,9 @@  discard block
 block discarded – undo
643 656
 
644 657
     dol_syslog("Function: updateProductOrService login=".$authentication['login']);
645 658
 
646
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
659
+    if ($authentication['entity']) {
660
+    	$conf->entity=$authentication['entity'];
661
+    }
647 662
 
648 663
     // Init and check authentication
649 664
     $objectresp=array();
@@ -651,8 +666,12 @@  discard block
 block discarded – undo
651 666
     $error=0;
652 667
     $fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
653 668
     // Check parameters
654
-    if ($product['price_net'] > 0) $product['price_base_type']='HT';
655
-    if ($product['price'] > 0)     $product['price_base_type']='TTC';
669
+    if ($product['price_net'] > 0) {
670
+    	$product['price_base_type']='HT';
671
+    }
672
+    if ($product['price'] > 0) {
673
+    	$product['price_base_type']='TTC';
674
+    }
656 675
 
657 676
     if ($product['price_net'] > 0 && $product['price'] > 0)
658 677
     {
@@ -672,8 +691,12 @@  discard block
 block discarded – undo
672 691
         $newobject=new Product($db);
673 692
         $newobject->fetch($product['id']);
674 693
 
675
-        if (isset($product['ref']))     $newobject->ref=$product['ref'];
676
-        if (isset($product['ref_ext'])) $newobject->ref_ext=$product['ref_ext'];
694
+        if (isset($product['ref'])) {
695
+        	$newobject->ref=$product['ref'];
696
+        }
697
+        if (isset($product['ref_ext'])) {
698
+        	$newobject->ref_ext=$product['ref_ext'];
699
+        }
677 700
         $newobject->type=$product['type'];
678 701
         $newobject->libelle=$product['label'];    // @deprecated
679 702
         $newobject->label=$product['label'];
@@ -698,7 +721,9 @@  discard block
 block discarded – undo
698 721
         $newobject->seuil_stock_alert=$product['stock_alert'];
699 722
 
700 723
         $newobject->country_id=$product['country_id'];
701
-        if ($product['country_code']) $newobject->country_id=getCountry($product['country_code'],3);
724
+        if ($product['country_code']) {
725
+        	$newobject->country_id=getCountry($product['country_code'],3);
726
+        }
702 727
         $newobject->customcode=$product['customcode'];
703 728
 
704 729
         $newobject->canvas=$product['canvas'];
@@ -732,8 +757,7 @@  discard block
 block discarded – undo
732 757
         if ($result <= 0)
733 758
         {
734 759
             $error++;
735
-        }
736
-        else
760
+        } else
737 761
 		{
738 762
         	// Update stock if stock count is provided and differs from database after creation or update
739 763
 			if (isset($product['stock_real']) && $product['stock_real'] != '' && ! empty($conf->global->stock->enabled))
@@ -763,8 +787,7 @@  discard block
 block discarded – undo
763 787
 							$error++;
764 788
 							$newobject->error='You set a different value for stock, but correction of stock count (before='.$getstockreal.', after='.$savstockreal.') fails with error '.$newobject->error;
765 789
 						}
766
-					}
767
-					else
790
+					} else
768 791
 					{
769 792
 						$error++;
770 793
 						$newobject->error='You set a different value for stock but we failed to find warehouse '.$product['warehouse_ref'].' to make correction.';
@@ -782,8 +805,7 @@  discard block
 block discarded – undo
782 805
                 {
783 806
                     $error++;
784 807
                 }
785
-            }
786
-            elseif ($newobject->price_base_type == 'TTC')
808
+            } elseif ($newobject->price_base_type == 'TTC')
787 809
             {
788 810
                 $result=$newobject->updatePrice($newobject->price_ttc, $newobject->price_base_type);
789 811
                 if ($result <= 0)
@@ -797,8 +819,7 @@  discard block
 block discarded – undo
797 819
         {
798 820
             $db->commit();
799 821
             $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id,'ref'=>$newobject->ref);
800
-        }
801
-        else
822
+        } else
802 823
 		{
803 824
             $db->rollback();
804 825
             $error++;
@@ -832,7 +853,9 @@  discard block
 block discarded – undo
832 853
 
833 854
     dol_syslog("Function: deleteProductOrService login=".$authentication['login']);
834 855
 
835
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
856
+    if ($authentication['entity']) {
857
+    	$conf->entity=$authentication['entity'];
858
+    }
836 859
 
837 860
     // Init and check authentication
838 861
     $objectresp=array();
@@ -869,8 +892,7 @@  discard block
 block discarded – undo
869 892
 	        	$error++;
870 893
 		        $firsterror='Product or service with id '.$id.' not found';
871 894
 		        break;
872
-	        }
873
-	        else
895
+	        } else
874 896
 			{
875 897
 		        $result=$newobject->delete($user);
876 898
 		        if ($result <= 0)
@@ -889,8 +911,7 @@  discard block
 block discarded – undo
889 911
 	        $db->commit();
890 912
             //$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'listofid'=>$listofiddeleted);
891 913
             $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'nbdeleted'=>count($listofiddeleted));
892
-	    }
893
-	    else
914
+	    } else
894 915
 	    {
895 916
 	    	$db->rollback();
896 917
 	        $error++;
@@ -903,8 +924,7 @@  discard block
 block discarded – undo
903 924
     {
904 925
         //$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'listofid'=>$listofiddeleted);
905 926
         $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'nbdeleted'=>0);
906
-    }
907
-    else if (count($listofiddeleted) == 0)
927
+    } else if (count($listofiddeleted) == 0)
908 928
     {
909 929
    		//$objectresp=array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.join(',',$listofid).' found'), 'listofid'=>$listofiddeleted);
910 930
    		$objectresp=array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.join(',',$listofid).' found'), 'nbdeleted'=>0);
@@ -929,7 +949,9 @@  discard block
 block discarded – undo
929 949
 
930 950
     dol_syslog("Function: getListOfProductsOrServices login=".$authentication['login']);
931 951
 
932
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
952
+    if ($authentication['entity']) {
953
+    	$conf->entity=$authentication['entity'];
954
+    }
933 955
 
934 956
     // Init and check authentication
935 957
     $objectresp=array();
@@ -946,9 +968,15 @@  discard block
 block discarded – undo
946 968
         $sql.=" WHERE entity=".$conf->entity;
947 969
         foreach($filterproduct as $key => $val)
948 970
         {
949
-		if ($key == 'type' && $val >= 0)   	$sql.=" AND fk_product_type = ".$db->escape($val);
950
-		if ($key == 'status_tosell') 				$sql.=" AND tosell = ".$db->escape($val);
951
-		if ($key == 'status_tobuy')  				$sql.=" AND tobuy = ".$db->escape($val);
971
+		if ($key == 'type' && $val >= 0) {
972
+			$sql.=" AND fk_product_type = ".$db->escape($val);
973
+		}
974
+		if ($key == 'status_tosell') {
975
+			$sql.=" AND tosell = ".$db->escape($val);
976
+		}
977
+		if ($key == 'status_tobuy') {
978
+			$sql.=" AND tobuy = ".$db->escape($val);
979
+		}
952 980
         }
953 981
 		$resql=$db->query($sql);
954 982
         if ($resql)
@@ -962,8 +990,7 @@  discard block
 block discarded – undo
962 990
          		$arrayproducts[]=array('id'=>$obj->rowid,'ref'=>$obj->ref,'ref_ext'=>$obj->ref_ext);
963 991
          		$i++;
964 992
          	}
965
-        }
966
-        else
993
+        } else
967 994
         {
968 995
             $error++;
969 996
             $errorcode=$db->lasterrno();
@@ -977,8 +1004,7 @@  discard block
 block discarded – undo
977 1004
 			'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel),
978 1005
         	'products'=>$arrayproducts
979 1006
         );
980
-    }
981
-    else
1007
+    } else
982 1008
     {
983 1009
         $objectresp = array(
984 1010
 			'result'=>array('result_code' => 'OK', 'result_label' => ''),
@@ -1007,7 +1033,9 @@  discard block
 block discarded – undo
1007 1033
 
1008 1034
 	dol_syslog("Function: getProductsForCategory login=".$authentication['login']." id=".$id);
1009 1035
 
1010
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
1036
+	if ($authentication['entity']) {
1037
+		$conf->entity=$authentication['entity'];
1038
+	}
1011 1039
 
1012 1040
 	$objectresp=array();
1013 1041
 	$errorcode='';$errorlabel='';
@@ -1113,22 +1141,19 @@  discard block
 block discarded – undo
1113 1141
 					'products'=> $products
1114 1142
 					);
1115 1143
 
1116
-				}
1117
-				else
1144
+				} else
1118 1145
 				{
1119 1146
 					$errorcode='NORECORDS_FOR_ASSOCIATION'; $errorlabel='No products associated'.$sql;
1120 1147
 					$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
1121 1148
 					dol_syslog("getProductsForCategory:: ".$c->error, LOG_DEBUG);
1122 1149
 
1123 1150
 				}
1124
-			}
1125
-			else
1151
+			} else
1126 1152
 			{
1127 1153
 				$error++;
1128 1154
 				$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id;
1129 1155
 			}
1130
-		}
1131
-		else
1156
+		} else
1132 1157
 		{
1133 1158
 			$error++;
1134 1159
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
Please login to merge, or discard this patch.
htdocs/webservices/server_payment.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -146,7 +146,9 @@  discard block
 block discarded – undo
146 146
     dol_syslog("Function: createPayment login=".$authentication['login']." id=".$payment->id.
147 147
                ", ref=".$payment->ref.", ref_ext=".$payment->ref_ext);
148 148
 
149
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
149
+    if ($authentication['entity']) {
150
+    	$conf->entity=$authentication['entity'];
151
+    }
150 152
 
151 153
     // Init and check authentication
152 154
     $objectresp = array();
@@ -196,8 +198,7 @@  discard block
 block discarded – undo
196 198
         {
197 199
             $db->commit();
198 200
             $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$new_payment->id);
199
-        }
200
-        else
201
+        } else
201 202
         {
202 203
             $db->rollback();
203 204
             $error++;
Please login to merge, or discard this patch.
htdocs/webservices/server_supplier_invoice.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
  *       \brief      File that is entry point to call Dolibarr WebServices
21 21
  */
22 22
 
23
-if (! defined("NOCSRFCHECK"))    define("NOCSRFCHECK",'1');
23
+if (! defined("NOCSRFCHECK")) {
24
+	define("NOCSRFCHECK",'1');
25
+}
24 26
 
25 27
 require_once '../master.inc.php';
26 28
 require_once NUSOAP_PATH.'/nusoap.php';        // Include SOAP
@@ -229,7 +231,9 @@  discard block
 block discarded – undo
229 231
 
230 232
 	dol_syslog("Function: getSupplierInvoice login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
231 233
 
232
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
234
+	if ($authentication['entity']) {
235
+		$conf->entity=$authentication['entity'];
236
+	}
233 237
 
234 238
     // Init and check authentication
235 239
     $objectresp=array();
@@ -302,14 +306,12 @@  discard block
 block discarded – undo
302 306
 //				        				 '1'=>array('id'=>333,'type'=>1))
303 307
 
304 308
 			    ));
305
-			}
306
-			else
309
+			} else
307 310
 			{
308 311
 				$error++;
309 312
 				$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
310 313
 			}
311
-		}
312
-		else
314
+		} else
313 315
 		{
314 316
 			$error++;
315 317
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -339,7 +341,9 @@  discard block
 block discarded – undo
339 341
 
340 342
 	dol_syslog("Function: getSupplierInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
341 343
 
342
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
344
+	if ($authentication['entity']) {
345
+		$conf->entity=$authentication['entity'];
346
+	}
343 347
 
344 348
     // Init and check authentication
345 349
     $objectresp=array();
@@ -364,7 +368,9 @@  discard block
 block discarded – undo
364 368
 		//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
365 369
 		//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
366 370
         $sql.=" WHERE f.entity = ".$conf->entity;
367
-		if ($idthirdparty != 'all') $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
371
+		if ($idthirdparty != 'all') {
372
+			$sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
373
+		}
368 374
 
369 375
 		$resql=$db->query($sql);
370 376
 		if ($resql)
@@ -440,8 +446,7 @@  discard block
 block discarded – undo
440 446
 		        'invoices'=>$linesinvoice
441 447
 
442 448
 			);
443
-		}
444
-		else
449
+		} else
445 450
 		{
446 451
 			$error++;
447 452
 			$errorcode=$db->lasterrno(); $errorlabel=$db->lasterror();
Please login to merge, or discard this patch.