Test Failed
Branch develop (86e751)
by Laurent
34:11
created
htdocs/webservices/server_project.php 1 patch
Braces   +15 added lines, -15 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
@@ -170,8 +172,7 @@  discard block
 block discarded – undo
170 172
 {
171 173
     //$value=$object->array_options["options_".$key];
172 174
     $type =$extrafields->attribute_type[$key];
173
-    if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
174
-    else {$type='xsd:string';}
175
+    if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';}
175 176
     $extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
176 177
 }
177 178
 $project_fields=array_merge($project_fields,$extrafield_array);
@@ -234,7 +235,9 @@  discard block
 block discarded – undo
234 235
 
235 236
     dol_syslog("Function: createProject login=".$authentication['login']);
236 237
 
237
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
238
+    if ($authentication['entity']) {
239
+    	$conf->entity=$authentication['entity'];
240
+    }
238 241
 
239 242
     // Init and check authentication
240 243
     $objectresp=array();
@@ -286,8 +289,7 @@  discard block
 block discarded – undo
286 289
                 {
287 290
                     $error++;
288 291
                 }
289
-            }
290
-            else
292
+            } else
291 293
             {
292 294
                 $error++;
293 295
             }
@@ -296,16 +298,14 @@  discard block
 block discarded – undo
296 298
             {
297 299
                 $db->commit();
298 300
                 $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id,'ref'=>$newobject->ref);
299
-            }
300
-            else
301
+            } else
301 302
             {
302 303
                 $db->rollback();
303 304
                 $error++;
304 305
                 $errorcode='KO';
305 306
                 $errorlabel=$newobject->error;
306 307
             }
307
-        }
308
-        else
308
+        } else
309 309
         {
310 310
             $error++;
311 311
             $errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -334,7 +334,9 @@  discard block
 block discarded – undo
334 334
 
335 335
     dol_syslog("Function: getProject login=".$authentication['login']." id=".$id." ref=".$ref);
336 336
 
337
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
337
+    if ($authentication['entity']) {
338
+    	$conf->entity=$authentication['entity'];
339
+    }
338 340
 
339 341
     // Init and check authentication
340 342
     $objectresp=array();
@@ -407,14 +409,12 @@  discard block
 block discarded – undo
407 409
                     'result'=>array('result_code'=>'OK', 'result_label'=>''),
408 410
                     'project'=>$project_result_fields
409 411
                 );
410
-            }
411
-            else
412
+            } else
412 413
             {
413 414
                 $error++;
414 415
                 $errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref;
415 416
             }
416
-        }
417
-        else
417
+        } else
418 418
         {
419 419
             $error++;
420 420
             $errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
Please login to merge, or discard this patch.
htdocs/webservices/server_order.php 1 patch
Braces   +61 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
  *       \brief      File that is entry point to call Dolibarr WebServices
23 23
  */
24 24
 
25
-if (! defined("NOCSRFCHECK"))    define("NOCSRFCHECK",'1');
25
+if (! defined("NOCSRFCHECK")) {
26
+	define("NOCSRFCHECK",'1');
27
+}
26 28
 
27 29
 require_once '../master.inc.php';
28 30
 require_once NUSOAP_PATH.'/nusoap.php';        // Include SOAP
@@ -123,8 +125,7 @@  discard block
 block discarded – undo
123 125
 {
124 126
 	//$value=$object->array_options["options_".$key];
125 127
 	$type =$extrafields->attribute_type[$key];
126
-	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
127
-	else {$type='xsd:string';}
128
+	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';}
128 129
 	$extrafield_line_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
129 130
 }
130 131
 $line_fields=array_merge($line_fields,$extrafield_line_array);
@@ -222,8 +223,7 @@  discard block
 block discarded – undo
222 223
 {
223 224
 	//$value=$object->array_options["options_".$key];
224 225
 	$type =$extrafields->attribute_type[$key];
225
-	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
226
-	else {$type='xsd:string';}
226
+	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';}
227 227
 	$extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
228 228
 }
229 229
 $order_fields=array_merge($order_fields,$extrafield_array);
@@ -349,7 +349,9 @@  discard block
 block discarded – undo
349 349
 
350 350
 	dol_syslog("Function: getOrder login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
351 351
 
352
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
352
+	if ($authentication['entity']) {
353
+		$conf->entity=$authentication['entity'];
354
+	}
353 355
 
354 356
 	// Init and check authentication
355 357
 	$objectresp=array();
@@ -358,7 +360,9 @@  discard block
 block discarded – undo
358 360
 
359 361
 	$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
360 362
 
361
-	if ($fuser->societe_id) $socid=$fuser->societe_id;
363
+	if ($fuser->societe_id) {
364
+		$socid=$fuser->societe_id;
365
+	}
362 366
 
363 367
 	// Check parameters
364 368
 	if (! $error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext)))
@@ -465,14 +469,12 @@  discard block
 block discarded – undo
465 469
 					'lines' => $linesresp
466 470
 					));
467 471
 				}
468
-			}
469
-			else
472
+			} else
470 473
 			{
471 474
 				$error++;
472 475
 				$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
473 476
 			}
474
-		}
475
-		else
477
+		} else
476 478
 		{
477 479
 			$error++;
478 480
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
@@ -501,7 +503,9 @@  discard block
 block discarded – undo
501 503
 
502 504
 	dol_syslog("Function: getOrdersForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
503 505
 
504
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
506
+	if ($authentication['entity']) {
507
+		$conf->entity=$authentication['entity'];
508
+	}
505 509
 
506 510
 	// Init and check authentication
507 511
 	$objectresp=array();
@@ -509,7 +513,9 @@  discard block
 block discarded – undo
509 513
 	$error=0;
510 514
 	$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
511 515
 
512
-	if ($fuser->societe_id) $socid=$fuser->societe_id;
516
+	if ($fuser->societe_id) {
517
+		$socid=$fuser->societe_id;
518
+	}
513 519
 
514 520
 	// Check parameters
515 521
 	if (! $error && empty($idthirdparty))
@@ -525,7 +531,9 @@  discard block
 block discarded – undo
525 531
 		$sql.='SELECT c.rowid as orderid';
526 532
 		$sql.=' FROM '.MAIN_DB_PREFIX.'commande as c';
527 533
 		$sql.=" WHERE c.entity = ".$conf->entity;
528
-		if ($idthirdparty != 'all' ) $sql.=" AND c.fk_soc = ".$db->escape($idthirdparty);
534
+		if ($idthirdparty != 'all' ) {
535
+			$sql.=" AND c.fk_soc = ".$db->escape($idthirdparty);
536
+		}
529 537
 
530 538
 
531 539
 		$resql=$db->query($sql);
@@ -630,8 +638,7 @@  discard block
 block discarded – undo
630 638
 			'orders'=>$linesorders
631 639
 
632 640
 			);
633
-		}
634
-		else
641
+		} else
635 642
 		{
636 643
 			$error++;
637 644
 			$errorcode=$db->lasterrno(); $errorlabel=$db->lasterror();
@@ -664,7 +671,9 @@  discard block
 block discarded – undo
664 671
 
665 672
 	dol_syslog("Function: createOrder login=".$authentication['login']." socid :".$order['socid']);
666 673
 
667
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
674
+	if ($authentication['entity']) {
675
+		$conf->entity=$authentication['entity'];
676
+	}
668 677
 
669 678
 	// Init and check authentication
670 679
 	$objectresp=array();
@@ -705,8 +714,11 @@  discard block
 block discarded – undo
705 714
 
706 715
 		// Trick because nusoap does not store data with same structure if there is one or several lines
707 716
 		$arrayoflines=array();
708
-		if (isset($order['lines']['line'][0])) $arrayoflines=$order['lines']['line'];
709
-		else $arrayoflines=$order['lines'];
717
+		if (isset($order['lines']['line'][0])) {
718
+			$arrayoflines=$order['lines']['line'];
719
+		} else {
720
+			$arrayoflines=$order['lines'];
721
+		}
710 722
 
711 723
 		foreach($arrayoflines as $key => $line)
712 724
 		{
@@ -751,9 +763,11 @@  discard block
 block discarded – undo
751 763
 
752 764
 		}
753 765
 
754
-		if ($order['status'] == 1)   // We want order to have status validated
766
+		if ($order['status'] == 1) {
767
+			// We want order to have status validated
755 768
 		{
756 769
 			dol_syslog("Webservice server_order:: order validation start", LOG_DEBUG);
770
+		}
757 771
 			$result=$newobject->valid($fuser);
758 772
 			if ($result < 0)
759 773
 			{
@@ -767,8 +781,7 @@  discard block
 block discarded – undo
767 781
 			dol_syslog("Webservice server_order:: order creation & validation succeeded, commit", LOG_DEBUG);
768 782
 			$db->commit();
769 783
 			$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id,'ref'=>$newobject->ref);
770
-		}
771
-		else
784
+		} else
772 785
 		{
773 786
 			dol_syslog("Webservice server_order:: order creation or validation failed, rollback", LOG_ERR);
774 787
 			$db->rollback();
@@ -806,7 +819,9 @@  discard block
 block discarded – undo
806 819
 	$objectresp=array();
807 820
 	$errorcode='';$errorlabel='';
808 821
 	$error=0;
809
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
822
+	if ($authentication['entity']) {
823
+		$conf->entity=$authentication['entity'];
824
+	}
810 825
 	$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
811 826
 
812 827
 	if (! $error)
@@ -831,16 +846,14 @@  discard block
 block discarded – undo
831 846
 					$outputlangs = $langs;
832 847
 					$order->generateDocument($order->modelpdf, $outputlangs);
833 848
 
834
-				}
835
-				else
849
+				} else
836 850
 				{
837 851
 					$db->rollback();
838 852
 					$error++;
839 853
 					$errorcode='KO';
840 854
 					$errorlabel=$newobject->error;
841 855
 				}
842
-			}
843
-			else
856
+			} else
844 857
 			{
845 858
 				$db->rollback();
846 859
 				$error++;
@@ -848,8 +861,7 @@  discard block
 block discarded – undo
848 861
 				$errorlabel=$newobject->error;
849 862
 			}
850 863
 
851
-		}
852
-		else
864
+		} else
853 865
 		{
854 866
 			$db->rollback();
855 867
 			$error++;
@@ -862,8 +874,7 @@  discard block
 block discarded – undo
862 874
 	if ($error)
863 875
 	{
864 876
 		$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
865
-	}
866
-	else
877
+	} else
867 878
 	{
868 879
 		$db->commit();
869 880
 		$objectresp= array('result'=>array('result_code'=>'OK', 'result_label'=>''));
@@ -887,7 +898,9 @@  discard block
 block discarded – undo
887 898
 
888 899
 	dol_syslog("Function: updateOrder login=".$authentication['login']);
889 900
 
890
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
901
+	if ($authentication['entity']) {
902
+		$conf->entity=$authentication['entity'];
903
+	}
891 904
 
892 905
 	// Init and check authentication
893 906
 	$objectresp=array();
@@ -916,7 +929,9 @@  discard block
 block discarded – undo
916 929
 
917 930
 			if (isset($order['status']))
918 931
 			{
919
-				if ($order['status'] == -1) $result=$object->cancel($fuser);
932
+				if ($order['status'] == -1) {
933
+					$result=$object->cancel($fuser);
934
+				}
920 935
 				if ($order['status'] == 1)
921 936
 				{
922 937
 					$result=$object->valid($fuser);
@@ -928,14 +943,22 @@  discard block
 block discarded – undo
928 943
 					
929 944
 					}
930 945
 				}
931
-				if ($order['status'] == 0)  $result=$object->set_reopen($fuser);
932
-				if ($order['status'] == 3)  $result=$object->cloture($fuser);
946
+				if ($order['status'] == 0) {
947
+					$result=$object->set_reopen($fuser);
948
+				}
949
+				if ($order['status'] == 3) {
950
+					$result=$object->cloture($fuser);
951
+				}
933 952
 			}
934 953
 
935 954
 			if (isset($order['billed']))
936 955
 			{
937
-				if ($order['billed'])   $result=$object->classifyBilled($fuser);
938
-				if (! $order['billed']) $result=$object->classifyUnBilled($fuser);
956
+				if ($order['billed']) {
957
+					$result=$object->classifyBilled($fuser);
958
+				}
959
+				if (! $order['billed']) {
960
+					$result=$object->classifyUnBilled($fuser);
961
+				}
939 962
 			}
940 963
 
941 964
 			//Retreive all extrafield for object
@@ -965,8 +988,7 @@  discard block
 block discarded – undo
965 988
 					'ref'=>$object->ref,
966 989
 					'ref_ext'=>$object->ref_ext
967 990
 			);
968
-		}
969
-		elseif ($objectfound)
991
+		} elseif ($objectfound)
970 992
 		{
971 993
 			$db->rollback();
972 994
 			$error++;
Please login to merge, or discard this patch.
htdocs/webservices/server_other.php 1 patch
Braces   +16 added lines, -7 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
@@ -144,7 +146,9 @@  discard block
 block discarded – undo
144 146
 
145 147
 	dol_syslog("Function: getVersions login=".$authentication['login']);
146 148
 
147
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
149
+	if ($authentication['entity']) {
150
+		$conf->entity=$authentication['entity'];
151
+	}
148 152
 
149 153
     // Init and check authentication
150 154
     $objectresp=array();
@@ -187,7 +191,9 @@  discard block
 block discarded – undo
187 191
 
188 192
 	dol_syslog("Function: getDocument login=".$authentication['login'].' - modulepart='.$modulepart.' - file='.$file);
189 193
 
190
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
194
+	if ($authentication['entity']) {
195
+		$conf->entity=$authentication['entity'];
196
+	}
191 197
 
192 198
 	$objectresp=array();
193 199
 	$errorcode='';$errorlabel='';
@@ -203,7 +209,9 @@  discard block
 block discarded – undo
203 209
 
204 210
 	$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
205 211
 
206
-	if ($fuser->societe_id) $socid=$fuser->societe_id;
212
+	if ($fuser->societe_id) {
213
+		$socid=$fuser->societe_id;
214
+	}
207 215
 
208 216
 	// Check parameters
209 217
 	if (! $error && ( ! $file || ! $modulepart ) )
@@ -220,7 +228,9 @@  discard block
 block discarded – undo
220 228
 		$original_file = str_replace("../","/", $original_file);
221 229
 
222 230
 		// find the subdirectory name as the reference
223
-		if (empty($refname)) $refname=basename(dirname($original_file)."/");
231
+		if (empty($refname)) {
232
+			$refname=basename(dirname($original_file)."/");
233
+		}
224 234
 
225 235
 		// Security check
226 236
 		$check_access = dol_check_secure_access_document($modulepart,$original_file,$conf->entity,$fuser,$refname);
@@ -298,8 +308,7 @@  discard block
 block discarded – undo
298 308
 					'result'=>array('result_code'=>'OK', 'result_label'=>''),
299 309
 					'document'=>$objectret
300 310
 				);
301
-			}
302
-			else
311
+			} else
303 312
 			{
304 313
 				dol_syslog("File doesn't exist ".$original_file);
305 314
 				$errorcode='NOT_FOUND';
Please login to merge, or discard this patch.
htdocs/webservices/server_category.php 1 patch
Braces   +8 added lines, -6 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
@@ -192,7 +194,9 @@  discard block
 block discarded – undo
192 194
 
193 195
 	dol_syslog("Function: getCategory login=".$authentication['login']." id=".$id);
194 196
 
195
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
197
+	if ($authentication['entity']) {
198
+		$conf->entity=$authentication['entity'];
199
+	}
196 200
 
197 201
 	$objectresp=array();
198 202
 	$errorcode='';$errorlabel='';
@@ -260,14 +264,12 @@  discard block
 block discarded – undo
260 264
 					'result'=>array('result_code'=>'OK', 'result_label'=>''),
261 265
 					'categorie'=> $cat
262 266
 			   );
263
-			}
264
-			else
267
+			} else
265 268
 			{
266 269
 				$error++;
267 270
 				$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id;
268 271
 			}
269
-		}
270
-		else
272
+		} else
271 273
 		{
272 274
 			$error++;
273 275
 			$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
Please login to merge, or discard this patch.
htdocs/webservices/admin/index.php 1 patch
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
 $langs->load("admin");
31 31
 
32
-if (! $user->admin)
32
+if (! $user->admin) {
33 33
 	accessforbidden();
34
+}
34 35
 
35 36
 $actionsave=GETPOST("save");
36 37
 
@@ -47,8 +48,7 @@  discard block
 block discarded – undo
47 48
     {
48 49
         $db->commit();
49 50
         setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
50
-    }
51
-    else
51
+    } else
52 52
     {
53 53
         $db->rollback();
54 54
         setEventMessages($langs->trans("Error"), null, 'errors');
@@ -82,8 +82,9 @@  discard block
 block discarded – undo
82 82
 print '<tr class="impair">';
83 83
 print '<td class="fieldrequired">'.$langs->trans("KeyForWebServicesAccess").'</td>';
84 84
 print '<td><input type="text" class="flat" id="WEBSERVICES_KEY" name="WEBSERVICES_KEY" value="'. (GETPOST('WEBSERVICES_KEY')?GETPOST('WEBSERVICES_KEY'):(! empty($conf->global->WEBSERVICES_KEY)?$conf->global->WEBSERVICES_KEY:'')) . '" size="40">';
85
-if (! empty($conf->use_javascript_ajax))
85
+if (! empty($conf->use_javascript_ajax)) {
86 86
 	print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
87
+}
87 88
 print '</td>';
88 89
 print '<td>&nbsp;</td>';
89 90
 print '</tr>';
@@ -118,7 +119,9 @@  discard block
 block discarded – undo
118 119
 print '<u>'.$langs->trans("WSDLCanBeDownloadedHere").':</u><br>';
119 120
 foreach($webservices as $name => $right)
120 121
 {
121
-	if (!empty($right) && !verifCond($right)) continue;
122
+	if (!empty($right) && !verifCond($right)) {
123
+		continue;
124
+	}
122 125
 	$url=DOL_MAIN_URL_ROOT.'/webservices/server_'.$name.'.php?wsdl';
123 126
 	print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
124 127
 }
@@ -129,7 +132,9 @@  discard block
 block discarded – undo
129 132
 print '<u>'.$langs->trans("EndPointIs").':</u><br>';
130 133
 foreach($webservices as $name => $right)
131 134
 {
132
-	if (!empty($right) && !verifCond($right)) continue;
135
+	if (!empty($right) && !verifCond($right)) {
136
+		continue;
137
+	}
133 138
 	$url=DOL_MAIN_URL_ROOT.'/webservices/server_'.$name.'.php';
134 139
 	print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
135 140
 }
Please login to merge, or discard this patch.
htdocs/webservices/server_contact.php 1 patch
Braces   +24 added lines, -18 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
@@ -126,8 +128,7 @@  discard block
 block discarded – undo
126 128
 foreach($extrafields->attribute_label as $key=>$label)
127 129
 {
128 130
 	$type =$extrafields->attribute_type[$key];
129
-	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
130
-	else {$type='xsd:string';}
131
+	if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';}
131 132
 
132 133
 	$extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
133 134
 }
@@ -241,7 +242,9 @@  discard block
 block discarded – undo
241 242
 
242 243
     dol_syslog("Function: getContact login=".$authentication['login']." id=".$id." ref_ext=".$ref_ext);
243 244
 
244
-    if ($authentication['entity']) $conf->entity=$authentication['entity'];
245
+    if ($authentication['entity']) {
246
+    	$conf->entity=$authentication['entity'];
247
+    }
245 248
 
246 249
     // Init and check authentication
247 250
     $objectresp=array();
@@ -323,14 +326,12 @@  discard block
 block discarded – undo
323 326
 			    	'result'=>array('result_code'=>'OK', 'result_label'=>''),
324 327
 			        'contact'=>$contact_result_fields
325 328
                 );
326
-	        }
327
-	        else
329
+	        } else
328 330
 	        {
329 331
 	            $error++;
330 332
 	            $errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
331 333
 	        }
332
-         }
333
-         else
334
+         } else
334 335
          {
335 336
              $error++;
336 337
              $errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref_ext='.$ref_ext;
@@ -361,7 +362,9 @@  discard block
 block discarded – undo
361 362
 
362 363
 	dol_syslog("Function: createContact login=".$authentication['login']);
363 364
 
364
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
365
+	if ($authentication['entity']) {
366
+		$conf->entity=$authentication['entity'];
367
+	}
365 368
 
366 369
 	// Init and check authentication
367 370
 	$objectresp=array();
@@ -440,8 +443,7 @@  discard block
 block discarded – undo
440 443
 		{
441 444
 			$db->commit();
442 445
 			$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id,'ref'=>$newobject->ref);
443
-		}
444
-		else
446
+		} else
445 447
 		{
446 448
 			$db->rollback();
447 449
 			$error++;
@@ -471,7 +473,9 @@  discard block
 block discarded – undo
471 473
 
472 474
 	dol_syslog("Function: getContactsForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
473 475
 
474
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
476
+	if ($authentication['entity']) {
477
+		$conf->entity=$authentication['entity'];
478
+	}
475 479
 
476 480
 	// Init and check authentication
477 481
 	$objectresp=array();
@@ -574,8 +578,7 @@  discard block
 block discarded – undo
574 578
 			'contacts'=>$linescontact
575 579
 
576 580
 			);
577
-		}
578
-		else
581
+		} else
579 582
 		{
580 583
 			$error++;
581 584
 			$errorcode=$db->lasterrno(); $errorlabel=$db->lasterror();
@@ -606,7 +609,9 @@  discard block
 block discarded – undo
606 609
 
607 610
 	dol_syslog("Function: updateContact login=".$authentication['login']);
608 611
 
609
-	if ($authentication['entity']) $conf->entity=$authentication['entity'];
612
+	if ($authentication['entity']) {
613
+		$conf->entity=$authentication['entity'];
614
+	}
610 615
 
611 616
 	// Init and check authentication
612 617
 	$objectresp=array();
@@ -646,7 +651,9 @@  discard block
 block discarded – undo
646 651
 			$object->town=$contact['town'];
647 652
 
648 653
 			$object->country_id=$contact['country_id'];
649
-			if ($contact['country_code']) $object->country_id=getCountry($contact['country_code'],3);
654
+			if ($contact['country_code']) {
655
+				$object->country_id=getCountry($contact['country_code'],3);
656
+			}
650 657
 			$object->province_id=$contact['province_id'];
651 658
 
652 659
 
@@ -687,8 +694,7 @@  discard block
 block discarded – undo
687 694
 			'result'=>array('result_code'=>'OK', 'result_label'=>''),
688 695
 			'id'=>$object->id
689 696
 			);
690
-		}
691
-		elseif ($objectfound)
697
+		} elseif ($objectfound)
692 698
 		{
693 699
 			$db->rollback();
694 700
 			$error++;
Please login to merge, or discard this patch.
htdocs/core/actions_extrafields.inc.php 1 patch
Braces   +25 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,10 +30,18 @@  discard block
 block discarded – undo
30 30
 $type=GETPOST('type','alpha');
31 31
 $param=GETPOST('param','alpha');;
32 32
 
33
-if ($type=='double' && strpos($extrasize,',')===false) $extrasize='24,8';
34
-if ($type=='date')     $extrasize='';
35
-if ($type=='datetime') $extrasize='';
36
-if ($type=='select')   $extrasize='';
33
+if ($type=='double' && strpos($extrasize,',')===false) {
34
+	$extrasize='24,8';
35
+}
36
+if ($type=='date') {
37
+	$extrasize='';
38
+}
39
+if ($type=='datetime') {
40
+	$extrasize='';
41
+}
42
+if ($type=='select') {
43
+	$extrasize='';
44
+}
37 45
 
38 46
 
39 47
 // Add attribute
@@ -121,8 +129,7 @@  discard block
 block discarded – undo
121 129
 	    					$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
122 130
 	    					$action = 'create';
123 131
 	    				}
124
-	    			}
125
-	    			else
132
+	    			} else
126 133
 	    			{
127 134
 	    				$error++;
128 135
 	    				$langs->load("errors");
@@ -148,8 +155,7 @@  discard block
 block discarded – undo
148 155
     				{
149 156
     					$params['options'] = array($parameters=>null);
150 157
     				}
151
-    			}
152
-    			else
158
+    			} else
153 159
     			{
154 160
     				//Esle it's separated key/value and coma list
155 161
     				foreach($parameters_array as $param_ligne)
@@ -181,15 +187,13 @@  discard block
 block discarded – undo
181 187
     				setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
182 188
     				header("Location: ".$_SERVER["PHP_SELF"]);
183 189
     				exit;
184
-    			}
185
-    			else
190
+    			} else
186 191
     			{
187 192
                     $error++;
188 193
     			    $mesg=$extrafields->error;
189 194
                     setEventMessages($mesg, null, 'errors');
190 195
     			}
191
-    		}
192
-    		else
196
+    		} else
193 197
     		{
194 198
                 $error++;
195 199
     		    $langs->load("errors");
@@ -197,8 +201,7 @@  discard block
 block discarded – undo
197 201
     			setEventMessages($mesg, null, 'errors');
198 202
     			$action = 'create';
199 203
     		}
200
-	    }
201
-	    else
204
+	    } else
202 205
 	    {
203 206
 	    	setEventMessages($mesg, null, 'errors');
204 207
 	    }
@@ -283,8 +286,7 @@  discard block
 block discarded – undo
283 286
 	        				$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
284 287
 	        				$action = 'edit';
285 288
 	        			}
286
-	        		}
287
-	        		else
289
+	        		} else
288 290
 	        		{
289 291
 	        			$error++;
290 292
 	        			$langs->load("errors");
@@ -309,8 +311,7 @@  discard block
 block discarded – undo
309 311
     				{
310 312
     					$params['options'] = array($parameters=>null);
311 313
     				}
312
-    			}
313
-    			else
314
+    			} else
314 315
     			{
315 316
     				//Esle it's separated key/value and coma list
316 317
     				foreach($parameters_array as $param_ligne)
@@ -342,23 +343,20 @@  discard block
 block discarded – undo
342 343
     				setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
343 344
     				header("Location: ".$_SERVER["PHP_SELF"]);
344 345
     				exit;
345
-    			}
346
-    			else
346
+    			} else
347 347
     			{
348 348
                     $error++;
349 349
     			    $mesg=$extrafields->error;
350 350
     			    setEventMessages($mesg, null, 'errors');
351 351
     			}
352
-    		}
353
-    		else
352
+    		} else
354 353
     		{
355 354
     		    $error++;
356 355
     			$langs->load("errors");
357 356
     			$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
358 357
     			setEventMessages($mesg, null, 'errors');
359 358
     		}
360
-	    }
361
-	    else
359
+	    } else
362 360
 	    {
363 361
 	    	setEventMessages($mesg, null, 'errors');
364 362
 	    }
@@ -375,10 +373,10 @@  discard block
 block discarded – undo
375 373
         {
376 374
             header("Location: ".$_SERVER["PHP_SELF"]);
377 375
             exit;
376
+        } else {
377
+        	$mesg=$extrafields->error;
378 378
         }
379
-        else $mesg=$extrafields->error;
380
-	}
381
-	else
379
+	} else
382 380
 	{
383 381
 	    $error++;
384 382
 		$langs->load("errors");
Please login to merge, or discard this patch.
htdocs/core/ajax/extraparams.php 1 patch
Braces   +20 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,11 +20,22 @@  discard block
 block discarded – undo
20 20
  *	\brief      File to return Ajax response on set extra parameters of elements
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
26
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
27
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
23
+if (! defined('NOTOKENRENEWAL')) {
24
+	define('NOTOKENRENEWAL','1');
25
+}
26
+// Disables token renewal
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
+}
36
+if (! defined('NOREQUIRESOC')) {
37
+	define('NOREQUIRESOC','1');
38
+}
28 39
 //if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
29 40
 
30 41
 include '../../main.inc.php';
@@ -52,20 +63,13 @@  discard block
 block discarded – undo
52 63
 	$classpath = $subelement = $element;
53 64
 
54 65
 	// For compatibility
55
-	if ($element == 'order' || $element == 'commande')    { $classpath = $subelement = 'commande'; }
56
-	else if ($element == 'propal')				{ $classpath = 'comm/propal'; $subelement = 'propal'; }
57
-	else if ($element == 'facture')				{ $classpath = 'compta/facture'; $subelement = 'facture'; }
58
-	else if ($element == 'contract')			{ $classpath = $subelement = 'contrat'; }
59
-	else if ($element == 'shipping')			{ $classpath = $subelement = 'expedition'; }
60
-	else if ($element == 'deplacement')			{ $classpath = 'compta/deplacement'; $subelement = 'deplacement'; }
61
-	else if ($element == 'order_supplier')		{ $classpath = 'fourn'; $subelement = 'fournisseur.commande'; }
62
-	else if ($element == 'invoice_supplier')	{ $classpath = 'fourn'; $subelement = 'fournisseur.facture'; }
66
+	if ($element == 'order' || $element == 'commande')    { $classpath = $subelement = 'commande'; } else if ($element == 'propal')				{ $classpath = 'comm/propal'; $subelement = 'propal'; } else if ($element == 'facture')				{ $classpath = 'compta/facture'; $subelement = 'facture'; } else if ($element == 'contract')			{ $classpath = $subelement = 'contrat'; } else if ($element == 'shipping')			{ $classpath = $subelement = 'expedition'; } else if ($element == 'deplacement')			{ $classpath = 'compta/deplacement'; $subelement = 'deplacement'; } else if ($element == 'order_supplier')		{ $classpath = 'fourn'; $subelement = 'fournisseur.commande'; } else if ($element == 'invoice_supplier')	{ $classpath = 'fourn'; $subelement = 'fournisseur.facture'; }
63 67
 
64 68
 	dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php');
65 69
 
66
-	if ($element == 'order_supplier')			{ $classname = 'CommandeFournisseur'; }
67
-	else if ($element == 'invoice_supplier')	{ $classname = 'FactureFournisseur'; }
68
-	else $classname = ucfirst($subelement);
70
+	if ($element == 'order_supplier')			{ $classname = 'CommandeFournisseur'; } else if ($element == 'invoice_supplier')	{ $classname = 'FactureFournisseur'; } else {
71
+		$classname = ucfirst($subelement);
72
+	}
69 73
 
70 74
 	$object	= new $classname($db);
71 75
 	$object->fetch($id);
Please login to merge, or discard this patch.
htdocs/core/ajax/security.php 1 patch
Braces   +22 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,13 +21,28 @@
 block discarded – undo
21 21
  *                   like key to use into URL to protect them.
22 22
  */
23 23
 
24
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
25
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
26
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
27
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
28
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
29
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
30
-if (! defined('NOREQUIREHOOK'))  define('NOREQUIREHOOK','1');
24
+if (! defined('NOTOKENRENEWAL')) {
25
+	define('NOTOKENRENEWAL','1');
26
+}
27
+// Disables token renewal
28
+if (! defined('NOREQUIREMENU')) {
29
+	define('NOREQUIREMENU','1');
30
+}
31
+if (! defined('NOREQUIREHTML')) {
32
+	define('NOREQUIREHTML','1');
33
+}
34
+if (! defined('NOREQUIREAJAX')) {
35
+	define('NOREQUIREAJAX','1');
36
+}
37
+if (! defined('NOREQUIRESOC')) {
38
+	define('NOREQUIRESOC','1');
39
+}
40
+if (! defined('NOREQUIRETRAN')) {
41
+	define('NOREQUIRETRAN','1');
42
+}
43
+if (! defined('NOREQUIREHOOK')) {
44
+	define('NOREQUIREHOOK','1');
45
+}
31 46
 
32 47
 require '../../main.inc.php';
33 48
 
Please login to merge, or discard this patch.