Passed
Pull Request — master (#2)
by
unknown
26:19
created
dolibarr/htdocs/core/class/commonstickergenerator.class.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -160,8 +160,7 @@
 block discarded – undo
160 160
 		$hauteur=abs($y1-$y2);
161 161
 		if($length>$hauteur) {
162 162
 			$Pointilles=($length/$nbPointilles)/2; // taille des pointilles
163
-		}
164
-		else {
163
+		} else {
165 164
 			$Pointilles=($hauteur/$nbPointilles)/2;
166 165
 		}
167 166
 		for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/html.formsocialcontrib.class.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
             $sql.= " WHERE c.active = 1";
80 80
             $sql.= " AND c.fk_pays = ".$mysoc->country_id;
81 81
             $sql.= " ORDER BY c.libelle ASC";
82
-        }
83
-        else
82
+        } else
84 83
         {
85 84
             $sql = "SELECT c.id, c.libelle as type";
86 85
             $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."c_country as co";
@@ -99,25 +98,31 @@  discard block
 block discarded – undo
99 98
             	print '<select class="'.($morecss?$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
100 99
                 $i = 0;
101 100
 
102
-                if ($useempty) print '<option value="0">&nbsp;</option>';
101
+                if ($useempty) {
102
+                    print '<option value="0">&nbsp;</option>';
103
+                }
103 104
                 while ($i < $num)
104 105
                 {
105 106
                     $obj = $db->fetch_object($resql);
106 107
                     print '<option value="'.$obj->id.'"';
107
-                    if ($obj->id == $selected) print ' selected';
108
+                    if ($obj->id == $selected) {
109
+                        print ' selected';
110
+                    }
108 111
                     print '>'.dol_trunc($obj->type,$maxlen);
109 112
                     $i++;
110 113
                 }
111 114
                 print '</select>';
112
-                if ($user->admin && $help) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
113
-                if (! empty($conf->use_javascript_ajax)) print ajax_combobox($htmlname);
114
-            }
115
-            else
115
+                if ($user->admin && $help) {
116
+                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
117
+                }
118
+                if (! empty($conf->use_javascript_ajax)) {
119
+                    print ajax_combobox($htmlname);
120
+                }
121
+            } else
116 122
             {
117 123
                 print $langs->trans("ErrorNoSocialContributionForSellerCountry",$mysoc->country_code);
118 124
             }
119
-        }
120
-        else
125
+        } else
121 126
         {
122 127
             dol_print_error($db,$db->lasterror());
123 128
         }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/ccountry.class.php 1 patch
Braces   +34 added lines, -20 removed lines patch added patch discarded remove patch
@@ -92,10 +92,18 @@  discard block
 block discarded – undo
92 92
 		$error=0;
93 93
 
94 94
 		// Clean parameters
95
-		if (isset($this->code)) $this->code=trim($this->code);
96
-		if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso);
97
-		if (isset($this->label)) $this->label=trim($this->label);
98
-		if (isset($this->active)) $this->active=trim($this->active);
95
+		if (isset($this->code)) {
96
+		    $this->code=trim($this->code);
97
+		}
98
+		if (isset($this->code_iso)) {
99
+		    $this->code_iso=trim($this->code_iso);
100
+		}
101
+		if (isset($this->label)) {
102
+		    $this->label=trim($this->label);
103
+		}
104
+		if (isset($this->active)) {
105
+		    $this->active=trim($this->active);
106
+		}
99 107
 
100 108
 		// Check parameters
101 109
 		// Put here code to add control on parameters values
@@ -149,8 +157,7 @@  discard block
 block discarded – undo
149 157
 			}
150 158
 			$this->db->rollback();
151 159
 			return -1*$error;
152
-		}
153
-		else
160
+		} else
154 161
 		{
155 162
 			$this->db->commit();
156 163
             return $this->id;
@@ -175,8 +182,11 @@  discard block
 block discarded – undo
175 182
 		$sql.= " t.label,";
176 183
 		$sql.= " t.active";
177 184
         $sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
178
-        if ($id)   $sql.= " WHERE t.rowid = ".$id;
179
-        elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
185
+        if ($id) {
186
+            $sql.= " WHERE t.rowid = ".$id;
187
+        } elseif ($code) {
188
+            $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
189
+        }
180 190
 
181 191
     	dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
182 192
         $resql=$this->db->query($sql);
@@ -194,12 +204,10 @@  discard block
 block discarded – undo
194 204
 
195 205
                 $this->db->free($resql);
196 206
                 return 1;
197
-            }
198
-            else {
207
+            } else {
199 208
                 return 0;
200 209
             }
201
-        }
202
-        else
210
+        } else
203 211
         {
204 212
       	    $this->error="Error ".$this->db->lasterror();
205 213
             return -1;
@@ -220,10 +228,18 @@  discard block
 block discarded – undo
220 228
 		$error=0;
221 229
 
222 230
 		// Clean parameters
223
-		if (isset($this->code)) $this->code=trim($this->code);
224
-		if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso);
225
-		if (isset($this->label)) $this->label=trim($this->label);
226
-		if (isset($this->active)) $this->active=trim($this->active);
231
+		if (isset($this->code)) {
232
+		    $this->code=trim($this->code);
233
+		}
234
+		if (isset($this->code_iso)) {
235
+		    $this->code_iso=trim($this->code_iso);
236
+		}
237
+		if (isset($this->label)) {
238
+		    $this->label=trim($this->label);
239
+		}
240
+		if (isset($this->active)) {
241
+		    $this->active=trim($this->active);
242
+		}
227 243
 
228 244
 
229 245
 		// Check parameters
@@ -269,8 +285,7 @@  discard block
 block discarded – undo
269 285
 			}
270 286
 			$this->db->rollback();
271 287
 			return -1*$error;
272
-		}
273
-		else
288
+		} else
274 289
 		{
275 290
 			$this->db->commit();
276 291
 			return 1;
@@ -325,8 +340,7 @@  discard block
 block discarded – undo
325 340
 			}
326 341
 			$this->db->rollback();
327 342
 			return -1*$error;
328
-		}
329
-		else
343
+		} else
330 344
 		{
331 345
 			$this->db->commit();
332 346
 			return 1;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/commondocgenerator.class.php 1 patch
Braces   +48 added lines, -34 removed lines patch added patch discarded remove patch
@@ -229,8 +229,7 @@  discard block
 block discarded – undo
229 229
         		if($extrafields->attribute_type[$key] == 'price')
230 230
         		{
231 231
         			$object->array_options['options_'.$key] = price($object->array_options['options_'.$key],0,$outputlangs,0,0,-1,$conf->currency);
232
-        		}
233
-        		else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
232
+        		} else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
234 233
         		{
235 234
         			$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
236 235
         		}
@@ -303,8 +302,7 @@  discard block
 block discarded – undo
303 302
 			if ($extrafields->attribute_type[$key] == 'price')
304 303
 			{
305 304
 				$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
306
-			}
307
-			elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
305
+			} elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
308 306
 			{
309 307
 				$object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]];
310 308
 			}
@@ -343,8 +341,11 @@  discard block
 block discarded – undo
343 341
 
344 342
     	foreach($conf->global as $key => $val)
345 343
     	{
346
-    		if (preg_match('/(_pass|password|secret|_key|key$)/i', $key)) $newval = '*****forbidden*****';
347
-    		else $newval = $val;
344
+    		if (preg_match('/(_pass|password|secret|_key|key$)/i', $key)) {
345
+    		    $newval = '*****forbidden*****';
346
+    		} else {
347
+    		    $newval = $val;
348
+    		}
348 349
     		$array_other['__['.$key.']__'] = $newval;
349 350
     	}
350 351
 
@@ -475,12 +476,16 @@  discard block
 block discarded – undo
475 476
 			foreach ($object->lines as $line)
476 477
 			{
477 478
 			    // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
478
-				if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
479
+				if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) {
480
+				    $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
481
+				}
479 482
 				$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
480 483
 				$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
481 484
 			    // $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
482 485
 				$vatformated=vatrate($line->tva_tx);
483
-				if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
486
+				if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) {
487
+				    $resarray[$array_key.'_total_vat_'.$vatformated]=0;
488
+				}
484 489
 				$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
485 490
 				$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
486 491
 			}
@@ -572,8 +577,9 @@  discard block
 block discarded – undo
572 577
 		{
573 578
 			$tmpproduct = new Product($this->db);
574 579
 			$result = $tmpproduct->fetch($line->fk_product);
575
-			foreach($tmpproduct->array_options as $key=>$label)
576
-				$resarray["line_product_".$key] = $label;
580
+			foreach($tmpproduct->array_options as $key=>$label) {
581
+							$resarray["line_product_".$key] = $label;
582
+			}
577 583
 		}
578 584
 
579 585
 		return $resarray;
@@ -623,7 +629,9 @@  discard block
 block discarded – undo
623 629
     	// Add vat by rates
624 630
     	foreach ($object->lines as $line)
625 631
     	{
626
-    		if (empty($array_shipment[$array_key.'_total_vat_'.$line->tva_tx])) $array_shipment[$array_key.'_total_vat_'.$line->tva_tx]=0;
632
+    		if (empty($array_shipment[$array_key.'_total_vat_'.$line->tva_tx])) {
633
+    		    $array_shipment[$array_key.'_total_vat_'.$line->tva_tx]=0;
634
+    		}
627 635
     		$array_shipment[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
628 636
     	}
629 637
 
@@ -742,12 +750,10 @@  discard block
 block discarded – undo
742 750
 				$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key],0,$outputlangs,0,0,-1,$conf->currency);
743 751
 				//Add value to store price with currency
744 752
 				$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
745
-			}
746
-			else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
753
+			} else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
747 754
 			{
748 755
 				$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
749
-			}
750
-			else if($extrafields->attribute_type[$key] == 'date')
756
+			} else if($extrafields->attribute_type[$key] == 'date')
751 757
 			{
752 758
 				if (strlen($object->array_options['options_'.$key])>0)
753 759
 				{
@@ -755,8 +761,7 @@  discard block
 block discarded – undo
755 761
 					$object->array_options['options_'.$key] = dol_print_date($date,'day');                                       // using company output language
756 762
 					$object->array_options['options_'.$key.'_locale'] = dol_print_date($date,'day','tzserver',$outputlangs);     // using output language format
757 763
 					$object->array_options['options_'.$key.'_rfc'] = dol_print_date($date,'dayrfc');                             // international format
758
-				}
759
-				else
764
+				} else
760 765
 				{
761 766
 					$object->array_options['options_'.$key] = '';
762 767
 					$object->array_options['options_'.$key.'_locale'] = '';
@@ -764,8 +769,7 @@  discard block
 block discarded – undo
764 769
 				}
765 770
 				$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
766 771
 				$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
767
-			}
768
-			else if($extrafields->attribute_type[$key] == 'datetime')
772
+			} else if($extrafields->attribute_type[$key] == 'datetime')
769 773
 			{
770 774
 				$datetime = $object->array_options['options_'.$key];
771 775
 				$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):'');                            // using company output language
@@ -773,8 +777,7 @@  discard block
 block discarded – undo
773 777
 				$object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhourrfc'):'');                             // international format
774 778
 				$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
775 779
 				$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
776
-			}
777
-			else if($extrafields->attribute_type[$key] == 'link')
780
+			} else if($extrafields->attribute_type[$key] == 'link')
778 781
 			{
779 782
 				$id = $object->array_options['options_'.$key];
780 783
 				if ($id != "")
@@ -819,9 +822,13 @@  discard block
 block discarded – undo
819 822
 	 */
820 823
     function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
821 824
     {
822
-        if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
825
+        if (empty($hidetop) || $hidetop==-1) {
826
+            $pdf->line($x, $y, $x+$l, $y);
827
+        }
823 828
         $pdf->line($x+$l, $y, $x+$l, $y+$h);
824
-        if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
829
+        if (empty($hidebottom)) {
830
+            $pdf->line($x+$l, $y+$h, $x, $y+$h);
831
+        }
825 832
         $pdf->line($x, $y+$h, $x, $y);
826 833
     }
827 834
 
@@ -874,7 +881,10 @@  discard block
 block discarded – undo
874 881
         $countFlexCol = 0;
875 882
         foreach ($this->cols as $colKey =>& $colDef)
876 883
         {
877
-            if(!$this->getColumnStatus($colKey)) continue; // continue if desable
884
+            if(!$this->getColumnStatus($colKey)) {
885
+                continue;
886
+            }
887
+            // continue if desable
878 888
 
879 889
             if(!empty($colDef['scale'])){
880 890
                 // In case of column widht is defined by percentage
@@ -883,8 +893,7 @@  discard block
 block discarded – undo
883 893
 
884 894
             if(empty($colDef['width'])){
885 895
                 $countFlexCol++;
886
-            }
887
-            else{
896
+            } else{
888 897
                 $totalDefinedColWidth += $colDef['width'];
889 898
             }
890 899
         }
@@ -894,16 +903,14 @@  discard block
 block discarded – undo
894 903
             // setting empty conf with default
895 904
             if(!empty($colDef['title'])){
896 905
                 $colDef['title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef['title']);
897
-            }
898
-            else{
906
+            } else{
899 907
                 $colDef['title'] = $this->defaultTitlesFieldsStyle;
900 908
             }
901 909
 
902 910
             // setting empty conf with default
903 911
             if(!empty($colDef['content'])){
904 912
                 $colDef['content'] = array_replace($this->defaultContentsFieldsStyle, $colDef['content']);
905
-            }
906
-            else{
913
+            } else{
907 914
                 $colDef['content'] = $this->defaultContentsFieldsStyle;
908 915
             }
909 916
 
@@ -956,7 +963,9 @@  discard block
 block discarded – undo
956 963
      */
957 964
     function getColumnRank($colKey)
958 965
     {
959
-        if(!isset($this->cols[$colKey]['rank'])) return -1;
966
+        if(!isset($this->cols[$colKey]['rank'])) {
967
+            return -1;
968
+        }
960 969
         return  $this->cols[$colKey]['rank'];
961 970
     }
962 971
 
@@ -1022,10 +1031,14 @@  discard block
 block discarded – undo
1022 1031
             'colKey' => $colKey
1023 1032
         );
1024 1033
         $reshook=$hookmanager->executeHooks('printStdColumnContent',$parameters,$this);    // Note that $action and $object may have been modified by hook
1025
-        if ($reshook < 0) setEventMessages($hookmanager->error,$hookmanager->errors,'errors');
1034
+        if ($reshook < 0) {
1035
+            setEventMessages($hookmanager->error,$hookmanager->errors,'errors');
1036
+        }
1026 1037
         if (!$reshook)
1027 1038
         {
1028
-            if(empty($columnText)) return;
1039
+            if(empty($columnText)) {
1040
+                return;
1041
+            }
1029 1042
             $pdf->SetXY($this->getColumnContentXStart($colKey),$curY); // Set curent position
1030 1043
             $colDef = $this->cols[$colKey];
1031 1044
             $pdf->writeHTMLCell( $this->getColumnContentWidth($colKey),2,$this->getColumnContentXStart($colKey),$curY, $columnText,0,0,0,true,$colDef['content']['align']);
@@ -1043,7 +1056,8 @@  discard block
 block discarded – undo
1043 1056
     {
1044 1057
         if( !empty($this->cols[$colKey]['status'])){
1045 1058
             return true;
1059
+        } else {
1060
+            return  false;
1046 1061
         }
1047
-        else  return  false;
1048 1062
     }
1049 1063
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/canvas.class.php 1 patch
Braces   +20 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,9 +76,15 @@  discard block
 block discarded – undo
76 76
 	private function _cleanaction($action)
77 77
 	{
78 78
 	    $newaction = $action;
79
-	    if ($newaction == 'add')    $newaction='create';
80
-	    if ($newaction == 'update') $newaction='edit';
81
-	    if (empty($newaction) || $newaction == 'delete' || $newaction == 'create_user' || $newaction == 'presend' || $newaction == 'send') $newaction='view';
79
+	    if ($newaction == 'add') {
80
+	        $newaction='create';
81
+	    }
82
+	    if ($newaction == 'update') {
83
+	        $newaction='edit';
84
+	    }
85
+	    if (empty($newaction) || $newaction == 'delete' || $newaction == 'create_user' || $newaction == 'presend' || $newaction == 'send') {
86
+	        $newaction='view';
87
+	    }
82 88
 	    return $newaction;
83 89
 	}
84 90
 
@@ -145,7 +151,9 @@  discard block
 block discarded – undo
145 151
 	function assign_values(&$action='view', $id=0, $ref='')
146 152
 	{
147 153
         // phpcs:enable
148
-		if (method_exists($this->control,'assign_values')) $this->control->assign_values($action, $id, $ref);
154
+		if (method_exists($this->control,'assign_values')) {
155
+		    $this->control->assign_values($action, $id, $ref);
156
+		}
149 157
 	}
150 158
 
151 159
     /**
@@ -156,10 +164,15 @@  discard block
 block discarded – undo
156 164
      */
157 165
     function displayCanvasExists($action)
158 166
     {
159
-        if (empty($this->template_dir)) return 0;
167
+        if (empty($this->template_dir)) {
168
+            return 0;
169
+        }
160 170
 
161
-        if (file_exists($this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
162
-        else return 0;
171
+        if (file_exists($this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) {
172
+            return 1;
173
+        } else {
174
+            return 0;
175
+        }
163 176
     }
164 177
 
165 178
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/coreobject.class.php 1 patch
Braces   +62 added lines, -45 removed lines patch added patch discarded remove patch
@@ -59,19 +59,24 @@  discard block
 block discarded – undo
59 59
 		{
60 60
 			foreach ($this->fields as $field=>$info)
61 61
 			{
62
-		        if ($this->isDate($info)) $this->{$field} = time();
63
-		        elseif ($this->isArray($info)) $this->{$field} = array();
64
-		        elseif ($this->isInt($info)) $this->{$field} = (int) 0;
65
-		        elseif ($this->isFloat($info)) $this->{$field} = (double) 0;
66
-				else $this->{$field} = '';
62
+		        if ($this->isDate($info)) {
63
+		            $this->{$field} = time();
64
+		        } elseif ($this->isArray($info)) {
65
+		            $this->{$field} = array();
66
+		        } elseif ($this->isInt($info)) {
67
+		            $this->{$field} = (int) 0;
68
+		        } elseif ($this->isFloat($info)) {
69
+		            $this->{$field} = (double) 0;
70
+		        } else {
71
+				    $this->{$field} = '';
72
+				}
67 73
 		    }
68 74
 
69 75
             $this->to_delete=false;
70 76
             $this->is_clone=false;
71 77
 
72 78
 			return true;
73
-		}
74
-		else
79
+		} else
75 80
         {
76 81
 			return false;
77 82
 		}
@@ -89,8 +94,7 @@  discard block
 block discarded – undo
89 94
 		if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type))
90 95
 		{
91 96
 			return $this->{'is_'.$type}($this->fields[$field]);
92
-		}
93
-		else
97
+		} else
94 98
         {
95 99
             return false;
96 100
         }
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
     {
108 112
     	$res = $this->fetchCommon($id);
109 113
     	if($res>0) {
110
-    		if ($loadChild) $this->fetchChild();
114
+    		if ($loadChild) {
115
+    		    $this->fetchChild();
116
+    		}
111 117
     	}
112 118
 
113 119
     	return $res;
@@ -129,7 +135,9 @@  discard block
 block discarded – undo
129 135
 		{
130 136
 			foreach($this->{$tabName} as $k=>&$object)
131 137
 			{
132
-				if($object->{$key} === $id) return $k;
138
+				if($object->{$key} === $id) {
139
+				    return $k;
140
+				}
133 141
 			}
134 142
 		}
135 143
 
@@ -195,8 +203,7 @@  discard block
 block discarded – undo
195 203
 
196 204
                         $this->{$className}[] = $o;
197 205
                     }
198
-                }
199
-                else
206
+                } else
200 207
                 {
201 208
                     $this->errors[] = $this->db->lasterror();
202 209
                 }
@@ -224,7 +231,9 @@  discard block
 block discarded – undo
224 231
 						$object->{$this->fk_element} = $this->id;
225 232
 
226 233
 						$object->update($user);
227
-						if($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete==true) unset($this->{$className}[$i]);
234
+						if($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete==true) {
235
+						    unset($this->{$className}[$i]);
236
+						}
228 237
 					}
229 238
 				}
230 239
 			}
@@ -240,8 +249,13 @@  discard block
 block discarded – undo
240 249
      */
241 250
     public function update(User &$user)
242 251
     {
243
-		if (empty($this->id)) return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed
244
-        elseif (isset($this->to_delete) && $this->to_delete==true) return $this->delete($user);
252
+		if (empty($this->id)) {
253
+		    return $this->create($user);
254
+		}
255
+		// To test, with that, no need to test on high level object, the core decide it, update just needed
256
+        elseif (isset($this->to_delete) && $this->to_delete==true) {
257
+            return $this->delete($user);
258
+        }
245 259
 
246 260
         $error = 0;
247 261
         $this->db->begin();
@@ -250,10 +264,12 @@  discard block
 block discarded – undo
250 264
         if ($res)
251 265
         {
252 266
             $result = $this->call_trigger(strtoupper($this->element). '_UPDATE', $user);
253
-            if ($result < 0) $error++;
254
-            else $this->saveChild($user);
255
-        }
256
-        else
267
+            if ($result < 0) {
268
+                $error++;
269
+            } else {
270
+                $this->saveChild($user);
271
+            }
272
+        } else
257 273
         {
258 274
             $error++;
259 275
             $this->error = $this->db->lasterror();
@@ -264,8 +280,7 @@  discard block
 block discarded – undo
264 280
         {
265 281
             $this->db->commit();
266 282
             return $this->id;
267
-        }
268
-        else
283
+        } else
269 284
         {
270 285
             $this->db->rollback();
271 286
             return -1;
@@ -280,7 +295,9 @@  discard block
 block discarded – undo
280 295
      */
281 296
     public function create(User &$user)
282 297
     {
283
-		if($this->id > 0) return $this->update($user);
298
+		if($this->id > 0) {
299
+		    return $this->update($user);
300
+		}
284 301
 
285 302
         $error = 0;
286 303
         $this->db->begin();
@@ -291,10 +308,12 @@  discard block
 block discarded – undo
291 308
 			$this->id = $this->db->last_insert_id($this->table_element);
292 309
 
293 310
 			$result = $this->call_trigger(strtoupper($this->element). '_CREATE', $user);
294
-            if ($result < 0) $error++;
295
-            else $this->saveChild($user);
296
-		}
297
-		else
311
+            if ($result < 0) {
312
+                $error++;
313
+            } else {
314
+                $this->saveChild($user);
315
+            }
316
+		} else
298 317
         {
299 318
             $error++;
300 319
             $this->error = $this->db->lasterror();
@@ -305,8 +324,7 @@  discard block
 block discarded – undo
305 324
         {
306 325
             $this->db->commit();
307 326
             return $this->id;
308
-        }
309
-        else
327
+        } else
310 328
         {
311 329
             $this->db->rollback();
312 330
             return -1;
@@ -321,13 +339,17 @@  discard block
 block discarded – undo
321 339
      */
322 340
 	public function delete(User &$user)
323 341
     {
324
-		if ($this->id <= 0) return 0;
342
+		if ($this->id <= 0) {
343
+		    return 0;
344
+		}
325 345
 
326 346
         $error = 0;
327 347
         $this->db->begin();
328 348
 
329 349
         $result = $this->call_trigger(strtoupper($this->element). '_DELETE', $user);
330
-        if ($result < 0) $error++;
350
+        if ($result < 0) {
351
+            $error++;
352
+        }
331 353
 
332 354
         if (!$error)
333 355
         {
@@ -352,8 +374,7 @@  discard block
 block discarded – undo
352 374
         {
353 375
             $this->db->commit();
354 376
             return 1;
355
-        }
356
-        else
377
+        } else
357 378
         {
358 379
             $this->error = $this->db->lasterror();
359 380
             $this->errors[] = $this->error;
@@ -372,8 +393,9 @@  discard block
 block discarded – undo
372 393
      */
373 394
     public function getDate($field, $format='')
374 395
     {
375
-		if(empty($this->{$field})) return '';
376
-		else
396
+		if(empty($this->{$field})) {
397
+		    return '';
398
+		} else
377 399
         {
378 400
 			return dol_print_date($this->{$field}, $format);
379 401
 		}
@@ -391,8 +413,7 @@  discard block
 block discarded – undo
391 413
 	  	if (empty($date))
392 414
 	  	{
393 415
 	  		$this->{$field} = 0;
394
-	  	}
395
-		else
416
+	  	} else
396 417
         {
397 418
 			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
398 419
 			$this->{$field} = dol_stringtotime($date);
@@ -415,19 +436,15 @@  discard block
 block discarded – undo
415 436
 			if($this->checkFieldType($key, 'date'))
416 437
 			{
417 438
 				$this->setDate($key, $value);
418
-			}
419
-			else if( $this->checkFieldType($key, 'array'))
439
+			} else if( $this->checkFieldType($key, 'array'))
420 440
 			{
421 441
 				$this->{$key} = $value;
422
-			}
423
-			else if( $this->checkFieldType($key, 'float') )
442
+			} else if( $this->checkFieldType($key, 'float') )
424 443
 			{
425 444
 				$this->{$key} = (double) price2num($value);
426
-			}
427
-			else if( $this->checkFieldType($key, 'int') ) {
445
+			} else if( $this->checkFieldType($key, 'int') ) {
428 446
 				$this->{$key} = (int) price2num($value);
429
-			}
430
-			else
447
+			} else
431 448
             {
432 449
 				$this->{$key} = $value;
433 450
 			}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/cstate.class.php 1 patch
Braces   +27 added lines, -16 removed lines patch added patch discarded remove patch
@@ -98,9 +98,15 @@  discard block
 block discarded – undo
98 98
 		$error=0;
99 99
 
100 100
 		// Clean parameters
101
-		if (isset($this->code_departement)) $this->code_departement=trim($this->code_departement);
102
-		if (isset($this->nom)) $this->nom=trim($this->nom);
103
-		if (isset($this->active)) $this->active=trim($this->active);
101
+		if (isset($this->code_departement)) {
102
+		    $this->code_departement=trim($this->code_departement);
103
+		}
104
+		if (isset($this->nom)) {
105
+		    $this->nom=trim($this->nom);
106
+		}
107
+		if (isset($this->active)) {
108
+		    $this->active=trim($this->active);
109
+		}
104 110
 
105 111
 		// Check parameters
106 112
 		// Put here code to add control on parameters values
@@ -152,8 +158,7 @@  discard block
 block discarded – undo
152 158
 			}
153 159
 			$this->db->rollback();
154 160
 			return -1*$error;
155
-		}
156
-		else
161
+		} else
157 162
 		{
158 163
 			$this->db->commit();
159 164
             return $this->id;
@@ -177,8 +182,11 @@  discard block
 block discarded – undo
177 182
 		$sql.= " t.nom,";
178 183
 		$sql.= " t.active";
179 184
         $sql.= " FROM ".MAIN_DB_PREFIX."c_departements as t";
180
-        if ($id)   $sql.= " WHERE t.rowid = ".$id;
181
-        elseif ($code) $sql.= " WHERE t.code_departement = '".$this->db->escape($code)."'";
185
+        if ($id) {
186
+            $sql.= " WHERE t.rowid = ".$id;
187
+        } elseif ($code) {
188
+            $sql.= " WHERE t.code_departement = '".$this->db->escape($code)."'";
189
+        }
182 190
 
183 191
     	dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
184 192
         $resql=$this->db->query($sql);
@@ -196,8 +204,7 @@  discard block
 block discarded – undo
196 204
             $this->db->free($resql);
197 205
 
198 206
             return 1;
199
-        }
200
-        else
207
+        } else
201 208
         {
202 209
       	    $this->error="Error ".$this->db->lasterror();
203 210
             return -1;
@@ -218,9 +225,15 @@  discard block
 block discarded – undo
218 225
 		$error=0;
219 226
 
220 227
 		// Clean parameters
221
-		if (isset($this->code_departement)) $this->code_departement=trim($this->code_departement);
222
-		if (isset($this->nom)) $this->nom=trim($this->nom);
223
-		if (isset($this->active)) $this->active=trim($this->active);
228
+		if (isset($this->code_departement)) {
229
+		    $this->code_departement=trim($this->code_departement);
230
+		}
231
+		if (isset($this->nom)) {
232
+		    $this->nom=trim($this->nom);
233
+		}
234
+		if (isset($this->active)) {
235
+		    $this->active=trim($this->active);
236
+		}
224 237
 
225 238
 
226 239
 		// Check parameters
@@ -265,8 +278,7 @@  discard block
 block discarded – undo
265 278
 			}
266 279
 			$this->db->rollback();
267 280
 			return -1*$error;
268
-		}
269
-		else
281
+		} else
270 282
 		{
271 283
 			$this->db->commit();
272 284
 			return 1;
@@ -321,8 +333,7 @@  discard block
 block discarded – undo
321 333
 			}
322 334
 			$this->db->rollback();
323 335
 			return -1*$error;
324
-		}
325
-		else
336
+		} else
326 337
 		{
327 338
 			$this->db->commit();
328 339
 			return 1;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/html.formticket.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -147,7 +147,9 @@  discard block
 block discarded – undo
147 147
 
148 148
         print "\n<!-- Begin form TICKETSUP -->\n";
149 149
 
150
-        if ($withdolfichehead) dol_fiche_head(null, 'card', '', 0, '');
150
+        if ($withdolfichehead) {
151
+            dol_fiche_head(null, 'card', '', 0, '');
152
+        }
151 153
 
152 154
         print '<form method="POST" '.($withdolfichehead?'':'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">';
153 155
         print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
@@ -403,7 +405,9 @@  discard block
 block discarded – undo
403 405
 
404 406
         print '</table>';
405 407
 
406
-        if ($withdolfichehead) dol_fiche_end();
408
+        if ($withdolfichehead) {
409
+            dol_fiche_end();
410
+        }
407 411
 
408 412
         print '<center>';
409 413
         print '<input class="button" type="submit" name="add_ticket" value="' . $langs->trans(($this->withthreadid > 0 ? "SendResponse" : "NewTicket")) . '" />';
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/link.class.php 1 patch
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -112,7 +112,9 @@  discard block
 block discarded – undo
112 112
             if ($this->id > 0) {
113 113
                 // Call trigger
114 114
                 $result=$this->call_trigger('LINK_CREATE',$user);
115
-                if ($result < 0) $error++;
115
+                if ($result < 0) {
116
+                    $error++;
117
+                }
116 118
                 // End call triggers
117 119
             } else {
118 120
                 $error++;
@@ -123,23 +125,20 @@  discard block
 block discarded – undo
123 125
                 dol_syslog(get_class($this)."::Create success id=" . $this->id);
124 126
                 $this->db->commit();
125 127
                 return $this->id;
126
-            }
127
-            else
128
+            } else
128 129
             {
129 130
                 dol_syslog(get_class($this)."::Create echec update " . $this->error, LOG_ERR);
130 131
                 $this->db->rollback();
131 132
                 return -3;
132 133
             }
133
-        }
134
-        else
134
+        } else
135 135
         {
136 136
             if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
137 137
             {
138 138
 
139 139
                 $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name);
140 140
                 $result=-1;
141
-            }
142
-            else
141
+            } else
143 142
             {
144 143
                 $this->error=$this->db->lasterror();
145 144
                 $result=-2;
@@ -175,7 +174,9 @@  discard block
 block discarded – undo
175 174
 
176 175
         // Clean parameters
177 176
         $this->url       = clean_url($this->url,1);
178
-        if (empty($this->label)) $this->label = basename($this->url);
177
+        if (empty($this->label)) {
178
+            $this->label = basename($this->url);
179
+        }
179 180
         $this->label     = trim($this->label);
180 181
 
181 182
 
@@ -198,7 +199,9 @@  discard block
 block discarded – undo
198 199
             {
199 200
                 // Call trigger
200 201
                 $result=$this->call_trigger('LINK_MODIFY',$user);
201
-                if ($result < 0) $error++;
202
+                if ($result < 0) {
203
+                    $error++;
204
+                }
202 205
                 // End call triggers
203 206
             }
204 207
 
@@ -212,16 +215,14 @@  discard block
 block discarded – undo
212 215
                 $this->db->rollback();
213 216
                 return -1;
214 217
             }
215
-        }
216
-        else
218
+        } else
217 219
         {
218 220
             if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
219 221
             {
220 222
                 // Doublon
221 223
                 $this->error = $langs->trans("ErrorDuplicateField");
222 224
                 $result =  -1;
223
-            }
224
-            else
225
+            } else
225 226
             {
226 227
                 $this->error = $langs->trans("Error sql = " . $sql);
227 228
                 $result =  -2;
@@ -247,7 +248,9 @@  discard block
 block discarded – undo
247 248
 
248 249
         $sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
249 250
         $sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
250
-        if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
251
+        if ($conf->entity != 0) {
252
+            $sql .= " AND entity = " . $conf->entity;
253
+        }
251 254
         if ($sortfield) {
252 255
             if (empty($sortorder)) {
253 256
                 $sortorder = "ASC";
@@ -298,13 +301,17 @@  discard block
 block discarded – undo
298 301
 
299 302
         $sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "links";
300 303
         $sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
301
-        if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
304
+        if ($conf->entity != 0) {
305
+            $sql .= " AND entity = " . $conf->entity;
306
+        }
302 307
 
303 308
         $resql = $db->query($sql);
304 309
         if ($resql)
305 310
         {
306 311
             $obj = $db->fetch_object($resql);
307
-            if ($obj) return $obj->nb;
312
+            if ($obj) {
313
+                return $obj->nb;
314
+            }
308 315
         }
309 316
         return -1;
310 317
     }
@@ -325,7 +332,9 @@  discard block
 block discarded – undo
325 332
 
326 333
         $sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
327 334
         $sql .= " WHERE rowid = " . $rowid;
328
-        if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
335
+        if($conf->entity != 0) {
336
+            $sql .= " AND entity = " . $conf->entity;
337
+        }
329 338
 
330 339
         dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
331 340
         $resql = $this->db->query($sql);
@@ -341,8 +350,7 @@  discard block
 block discarded – undo
341 350
                 $this->objecttype = $obj->objecttype;
342 351
                 $this->objectid = $obj->objectid;
343 352
                 return 1;
344
-            }
345
-            else
353
+            } else
346 354
 			{
347 355
                 return 0;
348 356
             }
@@ -366,7 +374,9 @@  discard block
 block discarded – undo
366 374
 
367 375
         // Call trigger
368 376
         $result=$this->call_trigger('LINK_DELETE',$user);
369
-        if ($result < 0) return -1;
377
+        if ($result < 0) {
378
+            return -1;
379
+        }
370 380
         // End call triggers
371 381
 
372 382
         $this->db->begin();
Please login to merge, or discard this patch.