Completed
Push — console-installer ( 3d54e5...e2b50d )
by Adam
69:10 queued 48:24
created
modules/ModuleBuilder/parsers/parser.label.php 3 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $deployedModule = true ;
94 94
             $basepath = "custom/modules/$moduleName/language" ;
95 95
             if($forRelationshipLabel){
96
-            	$basepath = "custom/modules/$moduleName/Ext/Language" ;
96
+                $basepath = "custom/modules/$moduleName/Ext/Language" ;
97 97
             }
98 98
             if (! is_dir ( $basepath ))
99 99
             {
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
         $filename = "$basepath/$language.lang.php" ;
106 106
         if($forRelationshipLabel){
107
-        	$filename = "$basepath/$language.lang.ext.php" ;
108
-     	}
107
+            $filename = "$basepath/$language.lang.ext.php" ;
108
+            }
109 109
 
110 110
         $dir_exists = is_dir ( $basepath ) ;
111 111
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             $deployedModule = true ;
171 171
             $basepath = "custom/modules/$moduleName/language" ;
172 172
             if($forRelationshipLabel){
173
-            	$basepath = "custom/modules/$moduleName/Ext/Language" ;
173
+                $basepath = "custom/modules/$moduleName/Ext/Language" ;
174 174
             }
175 175
             if (! is_dir ( $basepath ))
176 176
             {
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 
181 181
         $filename = "$basepath/$language.lang.php" ;
182 182
         if($forRelationshipLabel){
183
-        	$filename = "$basepath/$language.lang.ext.php" ;
184
-     	}
183
+            $filename = "$basepath/$language.lang.ext.php" ;
184
+            }
185 185
         $dir_exists = is_dir ( $basepath ) ;
186 186
 
187 187
         $mod_strings = array ( ) ;
@@ -193,47 +193,47 @@  discard block
 block discarded – undo
193 193
                 // obtain $mod_strings
194 194
                 include ($filename) ;
195 195
             }else if($forRelationshipLabel){
196
-            	$fh = fopen ($filename, 'a');
197
-            	fclose($fh);
196
+                $fh = fopen ($filename, 'a');
197
+                fclose($fh);
198 198
             }
199 199
         } else
200 200
         {
201 201
             return false ;
202 202
         }
203 203
 
204
-        	$changed = false ;
204
+            $changed = false ;
205 205
 
206 206
         //$charset = (isset($app_strings['LBL_CHARSET'])) ? $app_strings['LBL_CHARSET'] : $GLOBALS['sugar_config']['default_charset'] ;
207 207
 
208
-	        foreach ( $labels as $key => $value )
209
-	        {
208
+            foreach ( $labels as $key => $value )
209
+            {
210 210
             if (! isset ( $mod_strings [ $key ] ) || strcmp ( $value, $mod_strings [ $key ] ) != 0)
211
-	            {
211
+                {
212 212
                     $mod_strings [$key] = to_html(strip_tags(from_html($value))); // must match encoding used in view.labels.php
213
-	                $changed = true ;
214
-	            }
215
-	        }
213
+                    $changed = true ;
214
+                }
215
+            }
216 216
 
217
-	        if ($changed)
218
-	        {
217
+            if ($changed)
218
+            {
219 219
             $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: writing new mod_strings to $filename" ) ;
220
-	            $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: mod_strings=".print_r($mod_strings,true) ) ;
220
+                $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: mod_strings=".print_r($mod_strings,true) ) ;
221 221
             if (! write_array_to_file ( "mod_strings", $mod_strings, $filename ))
222
-	            {
222
+                {
223 223
                 $GLOBALS [ 'log' ]->fatal ( "Could not write $filename" ) ;
224
-	            } else
225
-	            {
226
-	                // if we have a cache to worry about, then clear it now
224
+                } else
225
+                {
226
+                    // if we have a cache to worry about, then clear it now
227 227
                 if ($deployedModule)
228
-	                {
228
+                    {
229 229
                             SugarCache::cleanOpcodes();
230
-	                    $GLOBALS [ 'log' ]->debug ( "PaserLabel->addLabels: clearing language cache" ) ;
231
-	                    $cache_key = "module_language." . $language . $moduleName ;
232
-	                    sugar_cache_clear ( $cache_key ) ;
233
-	                    LanguageManager::clearLanguageCache ( $moduleName, $language ) ;
234
-	                }
235
-	            }
236
-	        }
230
+                        $GLOBALS [ 'log' ]->debug ( "PaserLabel->addLabels: clearing language cache" ) ;
231
+                        $cache_key = "module_language." . $language . $moduleName ;
232
+                        sugar_cache_clear ( $cache_key ) ;
233
+                        LanguageManager::clearLanguageCache ( $moduleName, $language ) ;
234
+                    }
235
+                }
236
+            }
237 237
 
238 238
         // Fix for bug #51
239 239
         // when the label is recreated it defaults back to the original value (In this case its "User").
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
         {
357 357
         foreach ( $metadata as $definition )
358 358
             {
359
-        	$labels = array();
360
-        	$labels[$definition [ 'system_label' ]] = $definition [ 'display_label' ];
361
-        	self::addLabels ( $language, $labels, $definition [ 'module' ],null,true );
359
+            $labels = array();
360
+            $labels[$definition [ 'system_label' ]] = $definition [ 'display_label' ];
361
+            self::addLabels ( $language, $labels, $definition [ 'module' ],null,true );
362 362
             }
363 363
         }
364 364
 
365 365
     function addLabelsToAllLanguages($labels)
366 366
             {
367
-    	$langs = get_languages();
368
-    	foreach($langs as $lang_key => $lang_display)
367
+        $langs = get_languages();
368
+        foreach($langs as $lang_key => $lang_display)
369 369
         {
370
-    		$this->addLabels($lang_key, $labels, $this->moduleName);
370
+            $this->addLabels($lang_key, $labels, $this->moduleName);
371 371
         }
372 372
     }
373 373
 }
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-    die ( 'Not A Valid Entry Point' ) ;
2
+if (!defined('sugarEntry') || !sugarEntry)
3
+    die ('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
6 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,24 +40,24 @@  discard block
 block discarded – undo
40 40
  ********************************************************************************/
41 41
 
42 42
 
43
-require_once ('modules/ModuleBuilder/parsers/ModuleBuilderParser.php') ;
43
+require_once ('modules/ModuleBuilder/parsers/ModuleBuilderParser.php');
44 44
 
45 45
 class ParserLabel //extends ModuleBuilderParser
46 46
 {
47 47
 
48
-    public function __construct ($moduleName, $packageName = '' )
48
+    public function __construct($moduleName, $packageName = '')
49 49
     {
50 50
         $this->moduleName = $moduleName;
51 51
         if (!empty($packageName))
52
-            $this->packageName = $packageName ;
52
+            $this->packageName = $packageName;
53 53
     }
54 54
 
55 55
     /**
56 56
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
57 57
      */
58
-    public function ParserLabel($moduleName, $packageName = '' ){
58
+    public function ParserLabel($moduleName, $packageName = '') {
59 59
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
60
-        if(isset($GLOBALS['log'])) {
60
+        if (isset($GLOBALS['log'])) {
61 61
             $GLOBALS['log']->deprecated($deprecatedMessage);
62 62
         }
63 63
         else {
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
      * @param REQUEST $params       Labels as "label_".System label => Display label pairs
73 73
      * @param string $language      Language key, for example 'en_us'
74 74
      */
75
-    function handleSave ($params , $language)
75
+    function handleSave($params, $language)
76 76
     {
77
-        $labels = array ( ) ;
78
-        foreach ( $params as $key => $value )
77
+        $labels = array( );
78
+        foreach ($params as $key => $value)
79 79
         {
80
-            if (preg_match ( '/^label_/', $key ) && strcmp ( $value, 'no_change' ) != 0)
80
+            if (preg_match('/^label_/', $key) && strcmp($value, 'no_change') != 0)
81 81
             {
82
-                $labels [ strtoupper(substr ( $key, 6 )) ] = SugarCleaner::cleanHtml(from_html($value),false);
82
+                $labels [strtoupper(substr($key, 6))] = SugarCleaner::cleanHtml(from_html($value), false);
83 83
             }
84 84
         }
85 85
         if (!empty($this->packageName)) //we are in Module builder
86 86
         {
87
-            return self::addLabels ( $language, $labels, $this->moduleName, "custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/language" ) ;
87
+            return self::addLabels($language, $labels, $this->moduleName, "custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/language");
88 88
         } else
89 89
         {
90
-            return self::addLabels ( $language, $labels, $this->moduleName ) ;
90
+            return self::addLabels($language, $labels, $this->moduleName);
91 91
         }
92 92
     }
93 93
 
@@ -101,68 +101,68 @@  discard block
 block discarded – undo
101 101
      * @param string $forRelationshipLabel      whether this is a relationship label
102 102
      */
103 103
     static function removeLabel($language, $label, $labelvalue, $moduleName, $basepath = null, $forRelationshipLabel = false) {
104
-        $GLOBALS [ 'log' ]->debug ( "ParserLabel->removeLabels($language, \$label, \$labelvalue, $moduleName, $basepath );" ) ;
105
-        if (is_null ( $basepath ))
104
+        $GLOBALS ['log']->debug("ParserLabel->removeLabels($language, \$label, \$labelvalue, $moduleName, $basepath );");
105
+        if (is_null($basepath))
106 106
         {
107
-            $deployedModule = true ;
108
-            $basepath = "custom/modules/$moduleName/language" ;
109
-            if($forRelationshipLabel){
110
-            	$basepath = "custom/modules/$moduleName/Ext/Language" ;
107
+            $deployedModule = true;
108
+            $basepath = "custom/modules/$moduleName/language";
109
+            if ($forRelationshipLabel) {
110
+            	$basepath = "custom/modules/$moduleName/Ext/Language";
111 111
             }
112
-            if (! is_dir ( $basepath ))
112
+            if (!is_dir($basepath))
113 113
             {
114 114
                 $GLOBALS ['log']->debug("$basepath is not a directory.");
115 115
                 return false;
116 116
             }
117 117
         }
118 118
 
119
-        $filename = "$basepath/$language.lang.php" ;
120
-        if($forRelationshipLabel){
121
-        	$filename = "$basepath/$language.lang.ext.php" ;
119
+        $filename = "$basepath/$language.lang.php";
120
+        if ($forRelationshipLabel) {
121
+        	$filename = "$basepath/$language.lang.ext.php";
122 122
      	}
123 123
 
124
-        $dir_exists = is_dir ( $basepath ) ;
124
+        $dir_exists = is_dir($basepath);
125 125
 
126
-        $mod_strings = array ( ) ;
126
+        $mod_strings = array( );
127 127
 
128 128
         if ($dir_exists)
129 129
         {
130
-            if (file_exists ($filename))
130
+            if (file_exists($filename))
131 131
             {
132 132
                 // obtain $mod_strings
133
-                include ($filename) ;
133
+                include ($filename);
134 134
             } else {
135 135
                 $GLOBALS ['log']->debug("file $filename does not exist.");
136 136
                 return false;
137 137
             }
138 138
         } else {
139 139
             $GLOBALS ['log']->debug("directory $basepath does not exist.");
140
-            return false ;
140
+            return false;
141 141
         }
142 142
 
143
-        $changed = false ;
143
+        $changed = false;
144 144
 
145
-        if (isset($mod_strings[$label]) && $mod_strings[$label]==$labelvalue) {
145
+        if (isset($mod_strings[$label]) && $mod_strings[$label] == $labelvalue) {
146 146
             unset($mod_strings[$label]);
147 147
             $changed = true;
148 148
         }
149 149
 
150 150
         if ($changed)
151 151
         {
152
-            if (! write_array_to_file ( "mod_strings", $mod_strings, $filename )) {
153
-                $GLOBALS [ 'log' ]->fatal ( "Could not write $filename" ) ;
152
+            if (!write_array_to_file("mod_strings", $mod_strings, $filename)) {
153
+                $GLOBALS ['log']->fatal("Could not write $filename");
154 154
             } else {
155 155
                 // if we have a cache to worry about, then clear it now
156 156
                 if ($deployedModule) {
157
-                    $GLOBALS ['log']->debug ( "PaserLabel->addLabels: clearing language cache" ) ;
158
-                    $cache_key = "module_language." . $language . $moduleName ;
159
-                    sugar_cache_clear ( $cache_key ) ;
160
-                    LanguageManager::clearLanguageCache ( $moduleName, $language ) ;
157
+                    $GLOBALS ['log']->debug("PaserLabel->addLabels: clearing language cache");
158
+                    $cache_key = "module_language.".$language.$moduleName;
159
+                    sugar_cache_clear($cache_key);
160
+                    LanguageManager::clearLanguageCache($moduleName, $language);
161 161
                 }
162 162
             }
163 163
         }
164 164
 
165
-        return true ;
165
+        return true;
166 166
     }
167 167
 
168 168
     /*
@@ -172,79 +172,79 @@  discard block
 block discarded – undo
172 172
      * @param string $moduleName    Name of the module to which to add these labels
173 173
      * @param string $packageName   If module is undeployed, name of the package to which it belongs
174 174
      */
175
-    static function addLabels ($language , $labels , $moduleName , $basepath = null, $forRelationshipLabel = false)
175
+    static function addLabels($language, $labels, $moduleName, $basepath = null, $forRelationshipLabel = false)
176 176
     {
177 177
 
178
-        $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels($language, \$labels, $moduleName, $basepath );" ) ;
179
-        $GLOBALS [ 'log' ]->debug ( "\$labels:" . print_r ( $labels, true ) ) ;
178
+        $GLOBALS ['log']->debug("ParserLabel->addLabels($language, \$labels, $moduleName, $basepath );");
179
+        $GLOBALS ['log']->debug("\$labels:".print_r($labels, true));
180 180
 
181
-        $deployedModule = false ;
182
-        if (is_null ( $basepath ))
181
+        $deployedModule = false;
182
+        if (is_null($basepath))
183 183
         {
184
-            $deployedModule = true ;
185
-            $basepath = "custom/modules/$moduleName/language" ;
186
-            if($forRelationshipLabel){
187
-            	$basepath = "custom/modules/$moduleName/Ext/Language" ;
184
+            $deployedModule = true;
185
+            $basepath = "custom/modules/$moduleName/language";
186
+            if ($forRelationshipLabel) {
187
+            	$basepath = "custom/modules/$moduleName/Ext/Language";
188 188
             }
189
-            if (! is_dir ( $basepath ))
189
+            if (!is_dir($basepath))
190 190
             {
191 191
                 mkdir_recursive($basepath);
192 192
             }
193 193
         }
194 194
 
195
-        $filename = "$basepath/$language.lang.php" ;
196
-        if($forRelationshipLabel){
197
-        	$filename = "$basepath/$language.lang.ext.php" ;
195
+        $filename = "$basepath/$language.lang.php";
196
+        if ($forRelationshipLabel) {
197
+        	$filename = "$basepath/$language.lang.ext.php";
198 198
      	}
199
-        $dir_exists = is_dir ( $basepath ) ;
199
+        $dir_exists = is_dir($basepath);
200 200
 
201
-        $mod_strings = array ( ) ;
201
+        $mod_strings = array( );
202 202
 
203 203
         if ($dir_exists)
204 204
         {
205
-            if (file_exists ( $filename ))
205
+            if (file_exists($filename))
206 206
             {
207 207
                 // obtain $mod_strings
208
-                include ($filename) ;
209
-            }else if($forRelationshipLabel){
210
-            	$fh = fopen ($filename, 'a');
208
+                include ($filename);
209
+            } else if ($forRelationshipLabel) {
210
+            	$fh = fopen($filename, 'a');
211 211
             	fclose($fh);
212 212
             }
213 213
         } else
214 214
         {
215
-            return false ;
215
+            return false;
216 216
         }
217 217
 
218
-        	$changed = false ;
218
+        	$changed = false;
219 219
 
220 220
         //$charset = (isset($app_strings['LBL_CHARSET'])) ? $app_strings['LBL_CHARSET'] : $GLOBALS['sugar_config']['default_charset'] ;
221 221
 
222
-	        foreach ( $labels as $key => $value )
222
+	        foreach ($labels as $key => $value)
223 223
 	        {
224
-            if (! isset ( $mod_strings [ $key ] ) || strcmp ( $value, $mod_strings [ $key ] ) != 0)
224
+            if (!isset ($mod_strings [$key]) || strcmp($value, $mod_strings [$key]) != 0)
225 225
 	            {
226 226
                     $mod_strings [$key] = to_html(strip_tags(from_html($value))); // must match encoding used in view.labels.php
227
-	                $changed = true ;
227
+	                $changed = true;
228 228
 	            }
229 229
 	        }
230 230
 
231 231
 	        if ($changed)
232 232
 	        {
233
-            $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: writing new mod_strings to $filename" ) ;
234
-	            $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: mod_strings=".print_r($mod_strings,true) ) ;
235
-            if (! write_array_to_file ( "mod_strings", $mod_strings, $filename ))
233
+            $GLOBALS ['log']->debug("ParserLabel->addLabels: writing new mod_strings to $filename");
234
+	            $GLOBALS ['log']->debug("ParserLabel->addLabels: mod_strings=".print_r($mod_strings, true));
235
+            if (!write_array_to_file("mod_strings", $mod_strings, $filename))
236 236
 	            {
237
-                $GLOBALS [ 'log' ]->fatal ( "Could not write $filename" ) ;
237
+                $GLOBALS ['log']->fatal("Could not write $filename");
238 238
 	            } else
239 239
 	            {
240 240
 	                // if we have a cache to worry about, then clear it now
241 241
                 if ($deployedModule)
242 242
 	                {
243 243
                             SugarCache::cleanOpcodes();
244
-	                    $GLOBALS [ 'log' ]->debug ( "PaserLabel->addLabels: clearing language cache" ) ;
245
-	                    $cache_key = "module_language." . $language . $moduleName ;
246
-	                    sugar_cache_clear ( $cache_key ) ;
247
-	                    LanguageManager::clearLanguageCache ( $moduleName, $language ) ;
244
+	                    $GLOBALS ['log']->debug("PaserLabel->addLabels: clearing language cache");
245
+	                    $cache_key = "module_language.".$language.$moduleName;
246
+	                    sugar_cache_clear($cache_key);
247
+	                    LanguageManager::clearLanguageCache($moduleName, $language);
248 248
 	                }
249 249
 	            }
250 250
 	        }
@@ -258,16 +258,16 @@  discard block
 block discarded – undo
258 258
         // The changes from custom/Extension/modules/{ModuleName}/Ext/Language
259 259
         // will overwrite stuff in custom/modules/{ModuleName}/Ext/Language/en_us.lang.ext.php after
260 260
         //  Quick Repair and Rebuild is applied.
261
-        if($forRelationshipLabel) {
262
-            if(!empty($_POST[view_module]) && !empty($_POST[relationship_name]) && !empty($_POST[rhs_label]) && !empty($_POST[lhs_module])) {
261
+        if ($forRelationshipLabel) {
262
+            if (!empty($_POST[view_module]) && !empty($_POST[relationship_name]) && !empty($_POST[rhs_label]) && !empty($_POST[lhs_module])) {
263 263
                 // 1. Overwrite custom/Extension/modules/{ModuleName}/Ext/Language
264
-                $extension_basepath = "custom/Extension/modules/" . $_POST[view_module] . "/Ext/Language";
264
+                $extension_basepath = "custom/Extension/modules/".$_POST[view_module]."/Ext/Language";
265 265
                 mkdir_recursive($extension_basepath);
266 266
 
267 267
                 $headerString = "<?php\n//THIS FILE IS AUTO GENERATED, DO NOT MODIFY\n";
268 268
                 $out = $headerString;
269 269
 
270
-                $extension_filename = "$extension_basepath/$language.custom" . $_POST[relationship_name] . ".php";
270
+                $extension_filename = "$extension_basepath/$language.custom".$_POST[relationship_name].".php";
271 271
 
272 272
                 $mod_strings = array();
273 273
                 if (file_exists($extension_filename)) {
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
                     $file_contents = fopen($extension_filename, 'w');
294 294
                     fputs($file_contents, $out, strlen($out));
295 295
                     fclose($file_contents);
296
-                } catch (Exception $e) {
296
+                }catch (Exception $e) {
297 297
                     $GLOBALS ['log']->fatal("Could not write $filename");
298
-                    $GLOBALS ['log']->fatal("Exception " . $e->getMessage());
298
+                    $GLOBALS ['log']->fatal("Exception ".$e->getMessage());
299 299
                     $failed_to_write = true;
300 300
                 }
301 301
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                 $headerString = "<?php\n//THIS FILE IS AUTO GENERATED, DO NOT MODIFY\n";
310 310
                 $out = $headerString;
311 311
 
312
-                $relationships_filename = "$relationships_basepath/" . $_POST[lhs_module] . ".php";
312
+                $relationships_filename = "$relationships_basepath/".$_POST[lhs_module].".php";
313 313
 
314 314
 
315 315
                 $mod_strings = array();
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
                     $file_contents = fopen($relationships_filename, 'w');
337 337
                     fputs($file_contents, $out, strlen($out));
338 338
                     fclose($file_contents);
339
-                } catch (Exception $e) {
339
+                }catch (Exception $e) {
340 340
                     $GLOBALS ['log']->fatal("Could not write $filename");
341
-                    $GLOBALS ['log']->fatal("Exception " . $e->getMessage());
341
+                    $GLOBALS ['log']->fatal("Exception ".$e->getMessage());
342 342
                     $failed_to_write = true;
343 343
                 }
344 344
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                         if ($deployedModule) {
349 349
                             SugarCache::cleanOpcodes();
350 350
                             $GLOBALS ['log']->debug("PaserLabel->addLabels: clearing language cache");
351
-                            $cache_key = "module_language." . $language . $moduleName;
351
+                            $cache_key = "module_language.".$language.$moduleName;
352 352
                             sugar_cache_clear($cache_key);
353 353
                             LanguageManager::clearLanguageCache($moduleName, $language);
354 354
                         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             }
358 358
         }
359 359
 
360
-        return true ;
360
+        return true;
361 361
     }
362 362
 
363 363
     /**
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
      * @param $metadata
367 367
      * @param string $language      Language key, for example 'en_us'
368 368
      */
369
-    function handleSaveRelationshipLabels ($metadata , $language)
369
+    function handleSaveRelationshipLabels($metadata, $language)
370 370
         {
371
-        foreach ( $metadata as $definition )
371
+        foreach ($metadata as $definition)
372 372
             {
373 373
         	$labels = array();
374
-        	$labels[$definition [ 'system_label' ]] = $definition [ 'display_label' ];
375
-        	self::addLabels ( $language, $labels, $definition [ 'module' ],null,true );
374
+        	$labels[$definition ['system_label']] = $definition ['display_label'];
375
+        	self::addLabels($language, $labels, $definition ['module'], null, true);
376 376
             }
377 377
         }
378 378
 
379 379
     function addLabelsToAllLanguages($labels)
380 380
             {
381 381
     	$langs = get_languages();
382
-    	foreach($langs as $lang_key => $lang_display)
382
+    	foreach ($langs as $lang_key => $lang_display)
383 383
         {
384 384
     		$this->addLabels($lang_key, $labels, $this->moduleName);
385 385
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
2
+if (! defined ( 'sugarEntry' ) || ! sugarEntry) {
3 3
     die ( 'Not A Valid Entry Point' ) ;
4
+}
4 5
 /*********************************************************************************
5 6
  * SugarCRM Community Edition is a customer relationship management program developed by
6 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
     public function __construct ($moduleName, $packageName = '' )
49 50
     {
50 51
         $this->moduleName = $moduleName;
51
-        if (!empty($packageName))
52
-            $this->packageName = $packageName ;
52
+        if (!empty($packageName)) {
53
+                    $this->packageName = $packageName ;
54
+        }
53 55
     }
54 56
 
55 57
     /**
@@ -59,8 +61,7 @@  discard block
 block discarded – undo
59 61
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
60 62
         if(isset($GLOBALS['log'])) {
61 63
             $GLOBALS['log']->deprecated($deprecatedMessage);
62
-        }
63
-        else {
64
+        } else {
64 65
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
65 66
         }
66 67
         self::__construct($moduleName, $packageName);
@@ -82,9 +83,11 @@  discard block
 block discarded – undo
82 83
                 $labels [ strtoupper(substr ( $key, 6 )) ] = SugarCleaner::cleanHtml(from_html($value),false);
83 84
             }
84 85
         }
85
-        if (!empty($this->packageName)) //we are in Module builder
86
+        if (!empty($this->packageName)) {
87
+            //we are in Module builder
86 88
         {
87 89
             return self::addLabels ( $language, $labels, $this->moduleName, "custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/language" ) ;
90
+        }
88 91
         } else
89 92
         {
90 93
             return self::addLabels ( $language, $labels, $this->moduleName ) ;
@@ -206,7 +209,7 @@  discard block
 block discarded – undo
206 209
             {
207 210
                 // obtain $mod_strings
208 211
                 include ($filename) ;
209
-            }else if($forRelationshipLabel){
212
+            } else if($forRelationshipLabel){
210 213
             	$fh = fopen ($filename, 'a');
211 214
             	fclose($fh);
212 215
             }
@@ -285,8 +288,9 @@  discard block
 block discarded – undo
285 288
                     }
286 289
                 }
287 290
 
288
-                foreach ($mod_strings as $key => $val)
289
-                    $out .= override_value_to_string_recursive2('mod_strings', $key, $val);
291
+                foreach ($mod_strings as $key => $val) {
292
+                                    $out .= override_value_to_string_recursive2('mod_strings', $key, $val);
293
+                }
290 294
 
291 295
                 $failed_to_write = false;
292 296
                 try {
@@ -328,8 +332,9 @@  discard block
 block discarded – undo
328 332
                     }
329 333
                 }
330 334
 
331
-                foreach ($mod_strings as $key => $val)
332
-                    $out .= override_value_to_string_recursive2('mod_strings', $key, $val);
335
+                foreach ($mod_strings as $key => $val) {
336
+                                    $out .= override_value_to_string_recursive2('mod_strings', $key, $val);
337
+                }
333 338
 
334 339
                 $failed_to_write = false;
335 340
                 try {
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/parser.dropdown.php 3 patches
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 require_once('modules/ModuleBuilder/parsers/ModuleBuilderParser.php');
43 43
 
44
- class ParserDropDown extends ModuleBuilderParser {
44
+    class ParserDropDown extends ModuleBuilderParser {
45 45
 
46 46
     /**
47 47
      * Takes in the request params from a save request and processes
@@ -51,19 +51,19 @@  discard block
 block discarded – undo
51 51
      */
52 52
     function saveDropDown($params){
53 53
         require_once('modules/Administration/Common.php');
54
-		$emptyMarker = translate('LBL_BLANK');
55
-		$selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']);
56
-		$type = $_REQUEST['view_package'];
57
-		$dir = '';
58
-		$dropdown_name = $params['dropdown_name'];
59
-		$json = getJSONobj();
54
+        $emptyMarker = translate('LBL_BLANK');
55
+        $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']);
56
+        $type = $_REQUEST['view_package'];
57
+        $dir = '';
58
+        $dropdown_name = $params['dropdown_name'];
59
+        $json = getJSONobj();
60 60
 
61
-		$list_value = str_replace('&quot;&quot;:&quot;&quot;', '&quot;__empty__&quot;:&quot;&quot;', $params['list_value']);
62
-		//Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
63
-		$temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) );
64
-		$dropdown = array () ;
65
-		// dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order
66
-		// we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered
61
+        $list_value = str_replace('&quot;&quot;:&quot;&quot;', '&quot;__empty__&quot;:&quot;&quot;', $params['list_value']);
62
+        //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
63
+        $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) );
64
+        $dropdown = array () ;
65
+        // dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order
66
+        // we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered
67 67
         if(is_array($temp))
68 68
         {
69 69
             foreach ( $temp as $item )
@@ -71,146 +71,146 @@  discard block
 block discarded – undo
71 71
                 $dropdown[ SugarCleaner::stripTags(from_html($item [ 0 ]), false) ] = SugarCleaner::stripTags(from_html($item [ 1 ]), false) ;
72 72
             }
73 73
         }
74
-		if(array_key_exists($emptyMarker, $dropdown)){
74
+        if(array_key_exists($emptyMarker, $dropdown)){
75 75
             $output=array();
76 76
             foreach($dropdown as $key => $value){
77 77
                 if($emptyMarker===$key)
78 78
                     $output['']='';
79 79
                 else
80 80
                     $output[$key]=$value;
81
-		}
81
+        }
82 82
             $dropdown=$output;
83
-		}
83
+        }
84 84
 
85
-		if($type != 'studio'){
86
-			$mb = new ModuleBuilder();
87
-			$module = $mb->getPackageModule($params['view_package'], $params['view_module']);
88
-			$this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
89
-			//Can't use synch on selected lang as we want to overwrite values, not just keys
90
-			$module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown;
91
-			$module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of
92
-		}else{
93
-			$contents = return_custom_app_list_strings_file_contents($selected_lang);
94
-			$my_list_strings = return_app_list_strings_language($selected_lang);
95
-			if($selected_lang == $GLOBALS['current_language']){
96
-	           $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
97
-	        }
98
-			//write to contents
99
-			$contents = str_replace("?>", '', $contents);
100
-			if(empty($contents))$contents = "<?php";
101
-	        //add new drop down to the bottom
102
-	        if(!empty($params['use_push'])){
103
-	        	//this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
104
-	        	foreach($dropdown as $key=>$value){
105
-	        		//only if the value has changed or does not exist do we want to add it this way
106
-	        		if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){
107
-		        		//clear out the old value
108
-		        		$pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism';
109
-		        		$contents = preg_replace($pattern_match, "\n", $contents);
110
-		        		//add the new ones
111
-		        		$contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";";
112
-	        		}
113
-	        	}
114
-	        }else{
115
-	        	//Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
116
-	        	$this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
117
-	        	$contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
118
-	        }
119
-		    if(!empty($dir) && !is_dir($dir))
120
-		    {
121
-		     	$continue = mkdir_recursive($dir);
122
-		    }
123
-			save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
124
-		}
125
-		sugar_cache_reset();
126
-		clearAllJsAndJsLangFilesWithoutOutput();
85
+        if($type != 'studio'){
86
+            $mb = new ModuleBuilder();
87
+            $module = $mb->getPackageModule($params['view_package'], $params['view_module']);
88
+            $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
89
+            //Can't use synch on selected lang as we want to overwrite values, not just keys
90
+            $module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown;
91
+            $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of
92
+        }else{
93
+            $contents = return_custom_app_list_strings_file_contents($selected_lang);
94
+            $my_list_strings = return_app_list_strings_language($selected_lang);
95
+            if($selected_lang == $GLOBALS['current_language']){
96
+                $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
97
+            }
98
+            //write to contents
99
+            $contents = str_replace("?>", '', $contents);
100
+            if(empty($contents))$contents = "<?php";
101
+            //add new drop down to the bottom
102
+            if(!empty($params['use_push'])){
103
+                //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
104
+                foreach($dropdown as $key=>$value){
105
+                    //only if the value has changed or does not exist do we want to add it this way
106
+                    if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){
107
+                        //clear out the old value
108
+                        $pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism';
109
+                        $contents = preg_replace($pattern_match, "\n", $contents);
110
+                        //add the new ones
111
+                        $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";";
112
+                    }
113
+                }
114
+            }else{
115
+                //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
116
+                $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
117
+                $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
118
+            }
119
+            if(!empty($dir) && !is_dir($dir))
120
+            {
121
+                    $continue = mkdir_recursive($dir);
122
+            }
123
+            save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
124
+        }
125
+        sugar_cache_reset();
126
+        clearAllJsAndJsLangFilesWithoutOutput();
127 127
     }
128 128
 
129 129
     /**
130
-	 * function synchDropDown
131
-	 * 	Ensures that the set of dropdown keys is consistant accross all languages.
132
-	 *
133
-	 * @param $dropdown_name The name of the dropdown to be synched
134
-	 * @param $dropdown array The dropdown currently being saved
135
-	 * @param $selected_lang String the language currently selected in Studio/MB
136
-	 * @param $saveLov String the path to the directory to save the new lang file in.
137
-	 */
130
+     * function synchDropDown
131
+     * 	Ensures that the set of dropdown keys is consistant accross all languages.
132
+     *
133
+     * @param $dropdown_name The name of the dropdown to be synched
134
+     * @param $dropdown array The dropdown currently being saved
135
+     * @param $selected_lang String the language currently selected in Studio/MB
136
+     * @param $saveLov String the path to the directory to save the new lang file in.
137
+     */
138 138
     function synchDropDown($dropdown_name, $dropdown, $selected_lang, $saveLoc) {
139
-   		$allLanguages =  get_languages();
139
+            $allLanguages =  get_languages();
140 140
         foreach ($allLanguages as $lang => $langName) {
141
-        	if ($lang != $selected_lang) {
142
-        		$listStrings = return_app_list_strings_language($lang);
143
-        		$langDropDown = array();
144
-        		if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
145
-        		{
146
-        		 	$langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
147
-        		} else
148
-        		{
149
-        			//if the dropdown does not exist in the language, justt use what we have.
150
-        			$langDropDown = $dropdown;
151
-        		}
152
-        		$contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang);
153
-        		save_custom_app_list_strings_contents($contents, $lang, $saveLoc);
154
-        	}
141
+            if ($lang != $selected_lang) {
142
+                $listStrings = return_app_list_strings_language($lang);
143
+                $langDropDown = array();
144
+                if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
145
+                {
146
+                        $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
147
+                } else
148
+                {
149
+                    //if the dropdown does not exist in the language, justt use what we have.
150
+                    $langDropDown = $dropdown;
151
+                }
152
+                $contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang);
153
+                save_custom_app_list_strings_contents($contents, $lang, $saveLoc);
154
+            }
155 155
         }
156 156
     }
157 157
 
158 158
     /**
159
-	 * function synchMBDropDown
160
-	 * 	Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module
161
-	 *
162
-	 * @param $dropdown_name The name of the dropdown to be synched
163
-	 * @param $dropdown array The dropdown currently being saved
164
-	 * @param $selected_lang String the language currently selected in Studio/MB
165
-	 * @param $module MBModule the module to update the languages in
166
-	 */
159
+     * function synchMBDropDown
160
+     * 	Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module
161
+     *
162
+     * @param $dropdown_name The name of the dropdown to be synched
163
+     * @param $dropdown array The dropdown currently being saved
164
+     * @param $selected_lang String the language currently selected in Studio/MB
165
+     * @param $module MBModule the module to update the languages in
166
+     */
167 167
     function synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module) {
168
-    	$selected_lang	= $selected_lang . '.lang.php';
169
-		foreach($module->mblanguage->appListStrings as $lang => $listStrings) {
170
-			if ($lang != $selected_lang)
171
-			{
172
-				$langDropDown = array();
173
-				if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
174
-				{
175
-					$langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
176
-				} else
177
-        		{
178
-        			$langDropDown = $dropdown;
179
-        		}
180
-        		$module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown;
181
-				$module->mblanguage->save($module->key_name);
182
-			}
183
-		}
168
+        $selected_lang	= $selected_lang . '.lang.php';
169
+        foreach($module->mblanguage->appListStrings as $lang => $listStrings) {
170
+            if ($lang != $selected_lang)
171
+            {
172
+                $langDropDown = array();
173
+                if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
174
+                {
175
+                    $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
176
+                } else
177
+                {
178
+                    $langDropDown = $dropdown;
179
+                }
180
+                $module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown;
181
+                $module->mblanguage->save($module->key_name);
182
+            }
183
+        }
184 184
     }
185 185
 
186 186
     private function synchDDKeys($dom, $sub) {
187
-    	//check for extra keys
187
+        //check for extra keys
188 188
         foreach($sub as $key=>$value) {
189
-        	if (!isset($dom[$key])) {
190
-        		unset ($sub[$key]);
191
-        	}
189
+            if (!isset($dom[$key])) {
190
+                unset ($sub[$key]);
191
+            }
192 192
         }
193 193
         //check for missing keys
194 194
         foreach($dom as $key=>$value) {
195
-        	if (!isset($sub[$key])) {
196
-        		$sub[$key] = $value;
197
-        	}
195
+            if (!isset($sub[$key])) {
196
+                $sub[$key] = $value;
197
+            }
198 198
         }
199 199
         return $sub;
200 200
     }
201 201
 
202 202
     function getPatternMatch($dropdown_name) {
203
-    	return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\''
204
-    		 . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism';
203
+        return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\''
204
+                . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism';
205 205
     }
206 206
 
207 207
     function getNewCustomContents($dropdown_name, $dropdown, $lang) {
208
-    	$contents = return_custom_app_list_strings_file_contents($lang);
208
+        $contents = return_custom_app_list_strings_file_contents($lang);
209 209
         $contents = str_replace("?>", '', $contents);
210
-		if(empty($contents))$contents = "<?php";
211
-    	$contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents);
212
-	    $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";";
213
-	    return $contents;
210
+        if(empty($contents))$contents = "<?php";
211
+        $contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents);
212
+        $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";";
213
+        return $contents;
214 214
     }
215 215
 }
216 216
 ?>
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @param REQUEST params  $params
51 51
      */
52
-    function saveDropDown($params){
52
+    function saveDropDown($params) {
53 53
         require_once('modules/Administration/Common.php');
54 54
 		$emptyMarker = translate('LBL_BLANK');
55
-		$selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']);
55
+		$selected_lang = (!empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language']);
56 56
 		$type = $_REQUEST['view_package'];
57 57
 		$dir = '';
58 58
 		$dropdown_name = $params['dropdown_name'];
@@ -60,63 +60,63 @@  discard block
 block discarded – undo
60 60
 
61 61
 		$list_value = str_replace('&quot;&quot;:&quot;&quot;', '&quot;__empty__&quot;:&quot;&quot;', $params['list_value']);
62 62
 		//Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
63
-		$temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) );
64
-		$dropdown = array () ;
63
+		$temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES));
64
+		$dropdown = array();
65 65
 		// dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order
66 66
 		// we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered
67
-        if(is_array($temp))
67
+        if (is_array($temp))
68 68
         {
69
-            foreach ( $temp as $item )
69
+            foreach ($temp as $item)
70 70
             {
71
-                $dropdown[ SugarCleaner::stripTags(from_html($item [ 0 ]), false) ] = SugarCleaner::stripTags(from_html($item [ 1 ]), false) ;
71
+                $dropdown[SugarCleaner::stripTags(from_html($item [0]), false)] = SugarCleaner::stripTags(from_html($item [1]), false);
72 72
             }
73 73
         }
74
-		if(array_key_exists($emptyMarker, $dropdown)){
75
-            $output=array();
76
-            foreach($dropdown as $key => $value){
77
-                if($emptyMarker===$key)
78
-                    $output['']='';
74
+		if (array_key_exists($emptyMarker, $dropdown)) {
75
+            $output = array();
76
+            foreach ($dropdown as $key => $value) {
77
+                if ($emptyMarker === $key)
78
+                    $output[''] = '';
79 79
                 else
80
-                    $output[$key]=$value;
80
+                    $output[$key] = $value;
81 81
 		}
82
-            $dropdown=$output;
82
+            $dropdown = $output;
83 83
 		}
84 84
 
85
-		if($type != 'studio'){
85
+		if ($type != 'studio') {
86 86
 			$mb = new ModuleBuilder();
87 87
 			$module = $mb->getPackageModule($params['view_package'], $params['view_module']);
88 88
 			$this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
89 89
 			//Can't use synch on selected lang as we want to overwrite values, not just keys
90 90
 			$module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown;
91 91
 			$module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of
92
-		}else{
92
+		} else {
93 93
 			$contents = return_custom_app_list_strings_file_contents($selected_lang);
94 94
 			$my_list_strings = return_app_list_strings_language($selected_lang);
95
-			if($selected_lang == $GLOBALS['current_language']){
95
+			if ($selected_lang == $GLOBALS['current_language']) {
96 96
 	           $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
97 97
 	        }
98 98
 			//write to contents
99 99
 			$contents = str_replace("?>", '', $contents);
100
-			if(empty($contents))$contents = "<?php";
100
+			if (empty($contents))$contents = "<?php";
101 101
 	        //add new drop down to the bottom
102
-	        if(!empty($params['use_push'])){
102
+	        if (!empty($params['use_push'])) {
103 103
 	        	//this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
104
-	        	foreach($dropdown as $key=>$value){
104
+	        	foreach ($dropdown as $key=>$value) {
105 105
 	        		//only if the value has changed or does not exist do we want to add it this way
106
-	        		if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){
106
+	        		if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) {
107 107
 		        		//clear out the old value
108 108
 		        		$pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism';
109 109
 		        		$contents = preg_replace($pattern_match, "\n", $contents);
110 110
 		        		//add the new ones
111
-		        		$contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";";
111
+		        		$contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=".var_export_helper($value).";";
112 112
 	        		}
113 113
 	        	}
114
-	        }else{
114
+	        } else {
115 115
 	        	//Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
116 116
 	        	$this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
117 117
 	        	$contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
118 118
 	        }
119
-		    if(!empty($dir) && !is_dir($dir))
119
+		    if (!empty($dir) && !is_dir($dir))
120 120
 		    {
121 121
 		     	$continue = mkdir_recursive($dir);
122 122
 		    }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @param $saveLov String the path to the directory to save the new lang file in.
137 137
 	 */
138 138
     function synchDropDown($dropdown_name, $dropdown, $selected_lang, $saveLoc) {
139
-   		$allLanguages =  get_languages();
139
+   		$allLanguages = get_languages();
140 140
         foreach ($allLanguages as $lang => $langName) {
141 141
         	if ($lang != $selected_lang) {
142 142
         		$listStrings = return_app_list_strings_language($lang);
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	 * @param $module MBModule the module to update the languages in
166 166
 	 */
167 167
     function synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module) {
168
-    	$selected_lang	= $selected_lang . '.lang.php';
169
-		foreach($module->mblanguage->appListStrings as $lang => $listStrings) {
168
+    	$selected_lang = $selected_lang.'.lang.php';
169
+		foreach ($module->mblanguage->appListStrings as $lang => $listStrings) {
170 170
 			if ($lang != $selected_lang)
171 171
 			{
172 172
 				$langDropDown = array();
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 
186 186
     private function synchDDKeys($dom, $sub) {
187 187
     	//check for extra keys
188
-        foreach($sub as $key=>$value) {
188
+        foreach ($sub as $key=>$value) {
189 189
         	if (!isset($dom[$key])) {
190 190
         		unset ($sub[$key]);
191 191
         	}
192 192
         }
193 193
         //check for missing keys
194
-        foreach($dom as $key=>$value) {
194
+        foreach ($dom as $key=>$value) {
195 195
         	if (!isset($sub[$key])) {
196 196
         		$sub[$key] = $value;
197 197
         	}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
     function getNewCustomContents($dropdown_name, $dropdown, $lang) {
208 208
     	$contents = return_custom_app_list_strings_file_contents($lang);
209 209
         $contents = str_replace("?>", '', $contents);
210
-		if(empty($contents))$contents = "<?php";
210
+		if (empty($contents))$contents = "<?php";
211 211
     	$contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents);
212
-	    $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";";
212
+	    $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=".var_export_helper($dropdown).";";
213 213
 	    return $contents;
214 214
     }
215 215
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -74,10 +76,11 @@  discard block
 block discarded – undo
74 76
 		if(array_key_exists($emptyMarker, $dropdown)){
75 77
             $output=array();
76 78
             foreach($dropdown as $key => $value){
77
-                if($emptyMarker===$key)
78
-                    $output['']='';
79
-                else
80
-                    $output[$key]=$value;
79
+                if($emptyMarker===$key) {
80
+                                    $output['']='';
81
+                } else {
82
+                                    $output[$key]=$value;
83
+                }
81 84
 		}
82 85
             $dropdown=$output;
83 86
 		}
@@ -89,7 +92,7 @@  discard block
 block discarded – undo
89 92
 			//Can't use synch on selected lang as we want to overwrite values, not just keys
90 93
 			$module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown;
91 94
 			$module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of
92
-		}else{
95
+		} else{
93 96
 			$contents = return_custom_app_list_strings_file_contents($selected_lang);
94 97
 			$my_list_strings = return_app_list_strings_language($selected_lang);
95 98
 			if($selected_lang == $GLOBALS['current_language']){
@@ -97,7 +100,9 @@  discard block
 block discarded – undo
97 100
 	        }
98 101
 			//write to contents
99 102
 			$contents = str_replace("?>", '', $contents);
100
-			if(empty($contents))$contents = "<?php";
103
+			if(empty($contents)) {
104
+			    $contents = "<?php";
105
+			}
101 106
 	        //add new drop down to the bottom
102 107
 	        if(!empty($params['use_push'])){
103 108
 	        	//this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
@@ -111,7 +116,7 @@  discard block
 block discarded – undo
111 116
 		        		$contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";";
112 117
 	        		}
113 118
 	        	}
114
-	        }else{
119
+	        } else{
115 120
 	        	//Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
116 121
 	        	$this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
117 122
 	        	$contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
@@ -207,7 +212,9 @@  discard block
 block discarded – undo
207 212
     function getNewCustomContents($dropdown_name, $dropdown, $lang) {
208 213
     	$contents = return_custom_app_list_strings_file_contents($lang);
209 214
         $contents = str_replace("?>", '', $contents);
210
-		if(empty($contents))$contents = "<?php";
215
+		if(empty($contents)) {
216
+		    $contents = "<?php";
217
+		}
211 218
     	$contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents);
212 219
 	    $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";";
213 220
 	    return $contents;
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/parser.modifysubpanel.php 2 patches
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-    die ( 'Not A Valid Entry Point' ) ;
2
+if (!defined('sugarEntry') || !sugarEntry)
3
+    die ('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
6 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -50,141 +50,141 @@  discard block
 block discarded – undo
50 50
  * There are two relevant modules for every subpanel - the module whose detailview this subpanel will appear in ($module_name), and the module that is the source of the data for the subpanel ($subPanelParentModule)
51 51
  */
52 52
 
53
-require_once ('modules/ModuleBuilder/parsers/parser.modifylistview.php') ;
53
+require_once ('modules/ModuleBuilder/parsers/parser.modifylistview.php');
54 54
 
55 55
 class ParserModifySubPanel extends ParserModifyListView
56 56
 {
57 57
     
58
-    var $listViewDefs = false ;
59
-    var $defaults = array ( ) ;
60
-    var $additional = array ( ) ;
61
-    var $available = array ( ) ;
62
-    var $columns = array ( 'LBL_DEFAULT' => 'getDefaultFields' , 'LBL_HIDDEN' => 'getAvailableFields' ) ;
58
+    var $listViewDefs = false;
59
+    var $defaults = array( );
60
+    var $additional = array( );
61
+    var $available = array( );
62
+    var $columns = array('LBL_DEFAULT' => 'getDefaultFields', 'LBL_HIDDEN' => 'getAvailableFields');
63 63
     
64
-    function init ($module_name , $subPanelName)
64
+    function init($module_name, $subPanelName)
65 65
     {
66
-        $GLOBALS [ 'log' ]->debug ( "in ParserModifySubPanel: module_name={$module_name} child_module={$subPanelName}" ) ;
67
-        $this->moduleName = $module_name ;
68
-        $this->subPanelName = $subPanelName ;
69
-        global $beanList, $beanFiles ;
66
+        $GLOBALS ['log']->debug("in ParserModifySubPanel: module_name={$module_name} child_module={$subPanelName}");
67
+        $this->moduleName = $module_name;
68
+        $this->subPanelName = $subPanelName;
69
+        global $beanList, $beanFiles;
70 70
         
71 71
         // Sometimes we receive a module name which is not in the correct CamelCase, so shift to lower case for all beanList lookups
72
-        $beanListLower = array_change_key_case ( $beanList ) ;
72
+        $beanListLower = array_change_key_case($beanList);
73 73
         
74 74
         // Retrieve the definitions for all the available subpanels for this module
75
-        $class = $beanListLower [ strtolower ( $this->moduleName ) ] ;
76
-        require_once ($beanFiles [ $class ]) ;
77
-        $module = new $class ( ) ;
78
-        require_once ('include/SubPanel/SubPanelDefinitions.php') ;
79
-        $spd = new SubPanelDefinitions ( $module ) ;
75
+        $class = $beanListLower [strtolower($this->moduleName)];
76
+        require_once ($beanFiles [$class]);
77
+        $module = new $class( );
78
+        require_once ('include/SubPanel/SubPanelDefinitions.php');
79
+        $spd = new SubPanelDefinitions($module);
80 80
         
81 81
         // Get the lists of fields already in the subpanel and those that can be added in
82 82
         // Get the fields lists from an aSubPanel object describing this subpanel from the SubPanelDefinitions object
83
-        $this->originalListViewDefs = array ( ) ;
84
-        if (array_key_exists ( strtolower ( $this->subPanelName ), $spd->layout_defs [ 'subpanel_setup' ] ))
83
+        $this->originalListViewDefs = array( );
84
+        if (array_key_exists(strtolower($this->subPanelName), $spd->layout_defs ['subpanel_setup']))
85 85
         {
86
-            $originalPanel = $spd->load_subpanel ( $this->subPanelName, true ) ;
87
-            $this->originalListViewDefs = $originalPanel->get_list_fields () ;
88
-            $this->panel = $spd->load_subpanel ( $subPanelName, false ) ;
89
-            $this->listViewDefs = $this->panel->get_list_fields () ;
86
+            $originalPanel = $spd->load_subpanel($this->subPanelName, true);
87
+            $this->originalListViewDefs = $originalPanel->get_list_fields();
88
+            $this->panel = $spd->load_subpanel($subPanelName, false);
89
+            $this->listViewDefs = $this->panel->get_list_fields();
90 90
             
91 91
             // Retrieve a copy of the bean for the parent module of this subpanel - so we can find additional fields for the layout
92
-            $subPanelParentModuleName = $this->panel->get_module_name () ;
93
-            $this->subPanelParentModule = null ;
92
+            $subPanelParentModuleName = $this->panel->get_module_name();
93
+            $this->subPanelParentModule = null;
94 94
 
95
-            if (! empty ( $subPanelParentModuleName ) && isset($beanListLower[strtolower($subPanelParentModuleName)]))
95
+            if (!empty ($subPanelParentModuleName) && isset($beanListLower[strtolower($subPanelParentModuleName)]))
96 96
             {
97 97
                 $class = $beanListLower[strtolower($subPanelParentModuleName)];
98
-                if (isset($beanFiles [ $class ]))
98
+                if (isset($beanFiles [$class]))
99 99
                 {
100
-                    require_once ($beanFiles [ $class ]) ;
101
-                    $this->subPanelParentModule = new $class ( ) ;
100
+                    require_once ($beanFiles [$class]);
101
+                    $this->subPanelParentModule = new $class( );
102 102
                 }
103 103
             }
104 104
         }
105 105
         
106
-        $this->language_module = $this->panel->template_instance->module_dir ;
106
+        $this->language_module = $this->panel->template_instance->module_dir;
107 107
     }
108 108
     
109 109
     /**
110 110
      * Return a list of the fields that will be displayed in the subpanel
111 111
      */
112
-    function getDefaultFields ()
112
+    function getDefaultFields()
113 113
     {
114
-        $this->defaults = array ( ) ;
115
-        foreach ( $this->listViewDefs as $key => $def )
114
+        $this->defaults = array( );
115
+        foreach ($this->listViewDefs as $key => $def)
116 116
         {
117
-            if (! empty ( $def [ 'usage' ] ) && strcmp ( $def [ 'usage' ], 'query_only' ) == 0)
118
-                continue ;
119
-            if (! empty ( $def [ 'vname' ] ))
120
-                $def [ 'label' ] = $def [ 'vname' ] ;
121
-            $this->defaults [ $key ] = $def ;
117
+            if (!empty ($def ['usage']) && strcmp($def ['usage'], 'query_only') == 0)
118
+                continue;
119
+            if (!empty ($def ['vname']))
120
+                $def ['label'] = $def ['vname'];
121
+            $this->defaults [$key] = $def;
122 122
         }
123
-        return $this->defaults ;
123
+        return $this->defaults;
124 124
     }
125 125
     
126 126
     /**
127 127
      * Return a list of fields that are not currently included in the subpanel but that are available for use
128 128
      */
129
-    function getAvailableFields ()
129
+    function getAvailableFields()
130 130
     {
131
-        $this->availableFields = array ( ) ;
131
+        $this->availableFields = array( );
132 132
         if ($this->subPanelParentModule != null)
133 133
         {
134
-            $lowerFieldList = array_change_key_case ( $this->listViewDefs ) ;
135
-            foreach ( $this->originalListViewDefs as $key => $def )
134
+            $lowerFieldList = array_change_key_case($this->listViewDefs);
135
+            foreach ($this->originalListViewDefs as $key => $def)
136 136
             {
137
-                $key = strtolower ( $key ) ;
138
-                if (! isset ( $lowerFieldList [ $key ] ))
137
+                $key = strtolower($key);
138
+                if (!isset ($lowerFieldList [$key]))
139 139
                 {
140
-                    $this->availableFields [ $key ] = $def ;
140
+                    $this->availableFields [$key] = $def;
141 141
                 }
142 142
             }
143
-            $GLOBALS [ 'log' ]->debug ( 'parser.modifylistview.php->getAvailableFields(): field_defs=' . print_r ( $this->availableFields, true ) ) ;
144
-            foreach ( $this->subPanelParentModule->field_defs as $key => $fieldDefinition )
143
+            $GLOBALS ['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields, true));
144
+            foreach ($this->subPanelParentModule->field_defs as $key => $fieldDefinition)
145 145
             {
146
-                $fieldName = strtolower ( $key ) ;
147
-                if (! isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
146
+                $fieldName = strtolower($key);
147
+                if (!isset ($lowerFieldList [$fieldName])) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
148 148
                 {
149
-                    if ((empty ( $fieldDefinition [ 'source' ] ) || $fieldDefinition [ 'source' ] == 'db' || $fieldDefinition [ 'source' ] == 'custom_fields') && $fieldDefinition [ 'type' ] != 'id' && strcmp ( $fieldName, 'deleted' ) != 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) != false) || ! empty ( $def [ 'custom_type' ] ) && (empty ( $fieldDefinition [ 'dbType' ] ) || $fieldDefinition [ 'dbType' ] != 'id') && (empty ( $fieldDefinition [ 'dbtype' ] ) || $fieldDefinition [ 'dbtype' ] != 'id') || (! empty ( $fieldDefinition [ 'studio' ] ) && $fieldDefinition [ 'studio' ] == 'visible'))
149
+                    if ((empty ($fieldDefinition ['source']) || $fieldDefinition ['source'] == 'db' || $fieldDefinition ['source'] == 'custom_fields') && $fieldDefinition ['type'] != 'id' && strcmp($fieldName, 'deleted') != 0 || (isset ($def ['name']) && strpos($def ['name'], "_name") != false) || !empty ($def ['custom_type']) && (empty ($fieldDefinition ['dbType']) || $fieldDefinition ['dbType'] != 'id') && (empty ($fieldDefinition ['dbtype']) || $fieldDefinition ['dbtype'] != 'id') || (!empty ($fieldDefinition ['studio']) && $fieldDefinition ['studio'] == 'visible'))
150 150
                     {
151
-                        $label = (isset ( $fieldDefinition [ 'vname' ] )) ? $fieldDefinition [ 'vname' ] : (isset ( $fieldDefinition [ 'label' ] ) ? $fieldDefinition [ 'label' ] : $fieldDefinition [ 'name' ]) ;
152
-                        $this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
151
+                        $label = (isset ($fieldDefinition ['vname'])) ? $fieldDefinition ['vname'] : (isset ($fieldDefinition ['label']) ? $fieldDefinition ['label'] : $fieldDefinition ['name']);
152
+                        $this->availableFields [$fieldName] = array('width' => '10', 'label' => $label);
153 153
                     }
154 154
                 }
155 155
             }
156 156
         }
157 157
         
158
-        return $this->availableFields ;
158
+        return $this->availableFields;
159 159
     }
160 160
     
161
-    function getField ($fieldName)
161
+    function getField($fieldName)
162 162
     {
163
-        foreach ( $this->listViewDefs as $key => $def )
163
+        foreach ($this->listViewDefs as $key => $def)
164 164
         {
165
-            $key = strtolower ( $key ) ;
165
+            $key = strtolower($key);
166 166
             if ($key == $fieldName)
167 167
             {
168
-                return $def ;
168
+                return $def;
169 169
             }
170 170
         }
171
-        foreach ( $this->originalListViewDefs as $key => $def )
171
+        foreach ($this->originalListViewDefs as $key => $def)
172 172
         {
173
-            $key = strtolower ( $key ) ;
173
+            $key = strtolower($key);
174 174
             if ($key == $fieldName)
175 175
             {
176
-                return $def ;
176
+                return $def;
177 177
             }
178 178
         }
179
-        foreach ( $this->panel->template_instance->field_defs as $key => $def )
179
+        foreach ($this->panel->template_instance->field_defs as $key => $def)
180 180
         {
181
-            $key = strtolower ( $key ) ;
181
+            $key = strtolower($key);
182 182
             if ($key == $fieldName)
183 183
             {
184
-                return $def ;
184
+                return $def;
185 185
             }
186 186
         }
187
-        return array ( ) ;
187
+        return array( );
188 188
     }
189 189
     
190 190
     /*
@@ -192,67 +192,67 @@  discard block
 block discarded – undo
192 192
      * Obtains the field definitions from a _REQUEST array, and merges them with the other fields from the original definitions
193 193
      * Uses the subpanel override mechanism from SubPanel to save them 
194 194
      */
195
-    function handleSave ()
195
+    function handleSave()
196 196
     {
197
-        $GLOBALS [ 'log' ]->debug ( "in ParserModifySubPanel->handleSave()" ) ;
198
-        require_once ('include/SubPanel/SubPanel.php') ;
199
-        $subpanel = new SubPanel ( $this->moduleName, 'fab4', $this->subPanelName, $this->panel ) ;
197
+        $GLOBALS ['log']->debug("in ParserModifySubPanel->handleSave()");
198
+        require_once ('include/SubPanel/SubPanel.php');
199
+        $subpanel = new SubPanel($this->moduleName, 'fab4', $this->subPanelName, $this->panel);
200 200
         
201
-        $newFields = array ( ) ;
202
-        foreach ( $this->listViewDefs as $name => $field )
201
+        $newFields = array( );
202
+        foreach ($this->listViewDefs as $name => $field)
203 203
         {
204
-            if (! isset ( $field [ 'usage' ] ) || $field [ 'usage' ] != 'query_only')
204
+            if (!isset ($field ['usage']) || $field ['usage'] != 'query_only')
205 205
             {
206
-                $existingFields [ $name ] = $field ;
206
+                $existingFields [$name] = $field;
207 207
             
208 208
             } else
209 209
             {
210
-                $newFields [ $name ] = $field ;
210
+                $newFields [$name] = $field;
211 211
             }
212 212
         }
213 213
         
214 214
         // Loop through all of the fields defined in the 'Default' group of the ListView data in $_REQUEST
215 215
         // Replace the field specification in the originalListViewDef with this new updated specification
216
-        foreach ( $_REQUEST [ 'group_0' ] as $field )
216
+        foreach ($_REQUEST ['group_0'] as $field)
217 217
         {
218
-            if (! empty ( $this->originalListViewDefs [ $field ] ))
218
+            if (!empty ($this->originalListViewDefs [$field]))
219 219
             {
220
-                $newFields [ $field ] = $this->originalListViewDefs [ $field ] ;
220
+                $newFields [$field] = $this->originalListViewDefs [$field];
221 221
             } else
222 222
             {
223 223
                 
224
-                $vname = '' ;
225
-                if (isset ( $this->panel->template_instance->field_defs [ $field ] ))
224
+                $vname = '';
225
+                if (isset ($this->panel->template_instance->field_defs [$field]))
226 226
                 {
227
-                    $vname = $this->panel->template_instance->field_defs [ $field ] [ 'vname' ] ;
227
+                    $vname = $this->panel->template_instance->field_defs [$field] ['vname'];
228 228
                 }
229
-                if (($this->subPanelParentModule != null) && (isset ( $this->subPanelParentModule->field_name_map [ $field ] ) && ($this->subPanelParentModule->field_name_map [ $field ] [ 'type' ] == 'bool' || (isset ( $this->subPanelParentModule->field_name_map [ $field ] [ 'custom_type' ] ) && $this->subPanelParentModule->field_name_map [ $field ] [ 'custom_type' ] == 'bool'))))
229
+                if (($this->subPanelParentModule != null) && (isset ($this->subPanelParentModule->field_name_map [$field]) && ($this->subPanelParentModule->field_name_map [$field] ['type'] == 'bool' || (isset ($this->subPanelParentModule->field_name_map [$field] ['custom_type']) && $this->subPanelParentModule->field_name_map [$field] ['custom_type'] == 'bool'))))
230 230
                 {
231
-                    $newFields [ $field ] = array ( 'name' => $field , 'vname' => $vname , 'widget_type' => 'checkbox' ) ;
231
+                    $newFields [$field] = array('name' => $field, 'vname' => $vname, 'widget_type' => 'checkbox');
232 232
                 } else
233 233
                 {
234
-                    $newFields [ $field ] = array ( 'name' => $field , 'vname' => $vname ) ;
234
+                    $newFields [$field] = array('name' => $field, 'vname' => $vname);
235 235
                 }
236 236
             }
237 237
             
238 238
             // Now set the field width if specified in the $_REQUEST data
239
-            if (isset ( $_REQUEST [ strtolower ( $field ) . 'width' ] ))
239
+            if (isset ($_REQUEST [strtolower($field).'width']))
240 240
             {
241
-                $width = substr ( $_REQUEST [ strtolower ( $field ) . 'width' ], 6, 3 ) ;
242
-                if (strpos ( $width, "%" ) != false)
241
+                $width = substr($_REQUEST [strtolower($field).'width'], 6, 3);
242
+                if (strpos($width, "%") != false)
243 243
                 {
244
-                    $width = substr ( $width, 0, 2 ) ;
244
+                    $width = substr($width, 0, 2);
245 245
                 }
246 246
                 if ($width < 101 && $width > 0)
247 247
                 {
248
-                    $newFields [ $field ] [ 'width' ] = $width ;
248
+                    $newFields [$field] ['width'] = $width;
249 249
                 }
250
-            } else if (isset ( $this->listViewDefs [ $field ] [ 'width' ] ))
250
+            } else if (isset ($this->listViewDefs [$field] ['width']))
251 251
             {
252
-                $newFields [ $field ] [ 'width' ] = $this->listViewDefs [ $field ] [ 'width' ] ;
252
+                $newFields [$field] ['width'] = $this->listViewDefs [$field] ['width'];
253 253
             }
254 254
         }
255
-        $subpanel->saveSubPanelDefOverride ( $this->panel, 'list_fields', $newFields ) ;
255
+        $subpanel->saveSubPanelDefOverride($this->panel, 'list_fields', $newFields);
256 256
     
257 257
     }
258 258
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
2
+if (! defined ( 'sugarEntry' ) || ! sugarEntry) {
3 3
     die ( 'Not A Valid Entry Point' ) ;
4
+}
4 5
 /*********************************************************************************
5 6
  * SugarCRM Community Edition is a customer relationship management program developed by
6 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -114,10 +115,12 @@  discard block
 block discarded – undo
114 115
         $this->defaults = array ( ) ;
115 116
         foreach ( $this->listViewDefs as $key => $def )
116 117
         {
117
-            if (! empty ( $def [ 'usage' ] ) && strcmp ( $def [ 'usage' ], 'query_only' ) == 0)
118
-                continue ;
119
-            if (! empty ( $def [ 'vname' ] ))
120
-                $def [ 'label' ] = $def [ 'vname' ] ;
118
+            if (! empty ( $def [ 'usage' ] ) && strcmp ( $def [ 'usage' ], 'query_only' ) == 0) {
119
+                            continue ;
120
+            }
121
+            if (! empty ( $def [ 'vname' ] )) {
122
+                            $def [ 'label' ] = $def [ 'vname' ] ;
123
+            }
121 124
             $this->defaults [ $key ] = $def ;
122 125
         }
123 126
         return $this->defaults ;
@@ -144,11 +147,13 @@  discard block
 block discarded – undo
144 147
             foreach ( $this->subPanelParentModule->field_defs as $key => $fieldDefinition )
145 148
             {
146 149
                 $fieldName = strtolower ( $key ) ;
147
-                if (! isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
150
+                if (! isset ( $lowerFieldList [ $fieldName ] )) {
151
+                    // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
148 152
                 {
149 153
                     if ((empty ( $fieldDefinition [ 'source' ] ) || $fieldDefinition [ 'source' ] == 'db' || $fieldDefinition [ 'source' ] == 'custom_fields') && $fieldDefinition [ 'type' ] != 'id' && strcmp ( $fieldName, 'deleted' ) != 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) != false) || ! empty ( $def [ 'custom_type' ] ) && (empty ( $fieldDefinition [ 'dbType' ] ) || $fieldDefinition [ 'dbType' ] != 'id') && (empty ( $fieldDefinition [ 'dbtype' ] ) || $fieldDefinition [ 'dbtype' ] != 'id') || (! empty ( $fieldDefinition [ 'studio' ] ) && $fieldDefinition [ 'studio' ] == 'visible'))
150 154
                     {
151 155
                         $label = (isset ( $fieldDefinition [ 'vname' ] )) ? $fieldDefinition [ 'vname' ] : (isset ( $fieldDefinition [ 'label' ] ) ? $fieldDefinition [ 'label' ] : $fieldDefinition [ 'name' ]) ;
156
+                }
152 157
                         $this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
153 158
                     }
154 159
                 }
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/parser.modifylayoutview.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -169,12 +169,12 @@
 block discarded – undo
169 169
         include_once('include/TemplateHandler/TemplateHandler.php');
170 170
         if (strtolower($this->_view) == 'quickcreate')
171 171
         {
172
-        	TemplateHandler::clearCache($this->_module,"form_SubPanelQuickCreate_{$this->_module}.tpl");
173
-        	TemplateHandler::clearCache($this->_module,"form_DCQuickCreate_{$this->_module}.tpl");
172
+            TemplateHandler::clearCache($this->_module,"form_SubPanelQuickCreate_{$this->_module}.tpl");
173
+            TemplateHandler::clearCache($this->_module,"form_DCQuickCreate_{$this->_module}.tpl");
174 174
         } 
175 175
         else 
176 176
         {
177
-        	TemplateHandler::clearCache($this->_module,"{$this->_view}.tpl");
177
+            TemplateHandler::clearCache($this->_module,"{$this->_view}.tpl");
178 178
         }
179 179
 
180 180
     }
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined('sugarEntry') || ! sugarEntry)
2
+if (!defined('sugarEntry') || !sugarEntry)
3 3
 die('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * Constructor
64 64
      */
65
-    function init ($module, $view, $submittedLayout = false)
65
+    function init($module, $view, $submittedLayout = false)
66 66
     {
67 67
         $this->_view = ucfirst($view);
68 68
         $this->_module = $module;
69 69
         $this->language_module = $module;
70 70
 
71 71
         $this->_baseDirectory = "modules/{$module}/metadata/";
72
-        $file =  $this->_baseDirectory . strtolower($view) . "defs.php";
73
-        $this->_customFile = "custom/" . $file;
74
-        $this->_workingFile = "custom/working/" . $file;
72
+        $file = $this->_baseDirectory.strtolower($view)."defs.php";
73
+        $this->_customFile = "custom/".$file;
74
+        $this->_workingFile = "custom/working/".$file;
75 75
 
76 76
         $this->_sourceView = $this->_view;
77
-        $this->_originalFile = $file ;
77
+        $this->_originalFile = $file;
78 78
         $this->_sourceFile = $file;
79 79
         if (is_file($this->_workingFile))
80 80
         {
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
         {
86 86
             $this->_sourceFile = $this->_customFile;
87 87
         }
88
-        else if (! is_file($this->_sourceFile))
88
+        else if (!is_file($this->_sourceFile))
89 89
         {
90 90
             // if we don't have ANY defined metadata then improvise as best we can
91 91
             if (strtolower($this->_view) == 'quickcreate')
92 92
             {
93 93
                 // special handling for quickcreates - base the quickcreate on the editview if no quickcreatedef exists
94 94
                 $this->_sourceFile = $this->_baseDirectory."editviewdefs.php";
95
-                if (is_file("custom/" . $this->_sourceFile))
95
+                if (is_file("custom/".$this->_sourceFile))
96 96
                 {
97
-                    $this->_sourceFile = "custom/" . $this->_sourceFile;
97
+                    $this->_sourceFile = "custom/".$this->_sourceFile;
98 98
                 }
99 99
                 $this->_sourceView = 'EditView';
100 100
             }
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 
127 127
     }
128 128
 
129
-    function getAvailableFields ()
129
+    function getAvailableFields()
130 130
     {
131 131
         // Available fields are those that are in the Model and the original layout definition, but not already shown in the View
132 132
         // So, because the formats of the two are different we brute force loop through View and unset the fields we find in a copy of Model
133 133
         $availableFields = $this->_getModelFields();
134
-        $GLOBALS['log']->debug( get_class($this)."->getAvailableFields(): _getModelFields returns: ".implode(",",array_keys($availableFields)));
135
-        if (! empty($this->_viewdefs))
134
+        $GLOBALS['log']->debug(get_class($this)."->getAvailableFields(): _getModelFields returns: ".implode(",", array_keys($availableFields)));
135
+        if (!empty($this->_viewdefs))
136 136
         {
137 137
             foreach ($this->_viewdefs ['panels'] as $panel)
138 138
             {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         if (isset($fieldArray ['name']))
144 144
                         {
145 145
                             unset($availableFields [$fieldArray ['name']]);
146
-                            $GLOBALS['log']->debug( get_class($this)."->getAvailableFields(): removing ".$fieldArray ['name'] );
146
+                            $GLOBALS['log']->debug(get_class($this)."->getAvailableFields(): removing ".$fieldArray ['name']);
147 147
                         }
148 148
                     }
149 149
                 }
@@ -152,39 +152,39 @@  discard block
 block discarded – undo
152 152
         return $availableFields;
153 153
     }
154 154
 
155
-    function getLayout ()
155
+    function getLayout()
156 156
     {
157 157
         return $this->_viewdefs ['panels'];
158 158
     }
159 159
 
160
-    function writeWorkingFile ()
160
+    function writeWorkingFile()
161 161
     {
162
-        $this->_writeToFile($this->_workingFile,$this->_view,$this->_module,$this->_viewdefs,$this->_variables);
162
+        $this->_writeToFile($this->_workingFile, $this->_view, $this->_module, $this->_viewdefs, $this->_variables);
163 163
     }
164 164
 
165
-    function handleSave ()
165
+    function handleSave()
166 166
     {
167
-        $this->_writeToFile($this->_customFile,$this->_view,$this->_module,$this->_viewdefs,$this->_variables);
167
+        $this->_writeToFile($this->_customFile, $this->_view, $this->_module, $this->_viewdefs, $this->_variables);
168 168
         // now clear the cache so that the results are immediately visible
169 169
         include_once('include/TemplateHandler/TemplateHandler.php');
170 170
         if (strtolower($this->_view) == 'quickcreate')
171 171
         {
172
-        	TemplateHandler::clearCache($this->_module,"form_SubPanelQuickCreate_{$this->_module}.tpl");
173
-        	TemplateHandler::clearCache($this->_module,"form_DCQuickCreate_{$this->_module}.tpl");
172
+        	TemplateHandler::clearCache($this->_module, "form_SubPanelQuickCreate_{$this->_module}.tpl");
173
+        	TemplateHandler::clearCache($this->_module, "form_DCQuickCreate_{$this->_module}.tpl");
174 174
         } 
175 175
         else 
176 176
         {
177
-        	TemplateHandler::clearCache($this->_module,"{$this->_view}.tpl");
177
+        	TemplateHandler::clearCache($this->_module, "{$this->_view}.tpl");
178 178
         }
179 179
 
180 180
     }
181 181
 
182
-    function loadModule ($module, $view)
182
+    function loadModule($module, $view)
183 183
     {
184 184
         $this->_viewdefs = array();
185 185
         $viewdefs = null;
186 186
 
187
-        $loaded = $this->_loadFromFile($view,$this->_sourceFile,$module);
187
+        $loaded = $this->_loadFromFile($view, $this->_sourceFile, $module);
188 188
         $this->_viewdefs = $loaded['viewdefs'][$module][$view];
189 189
         $this->_variables = $loaded['variables'];
190 190
     }
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
      * Load the canonical panel layout from the submitted form
194 194
      *
195 195
      */
196
-    function _loadLayoutFromRequest ()
196
+    function _loadLayoutFromRequest()
197 197
     {
198 198
 
199 199
         $i = 1;
200 200
         // set up the map of panel# (as provided in the _REQUEST) to panel ID (as used in $this->_viewdefs['panels'])
201 201
         foreach ($this->_viewdefs ['panels'] as $panelID => $panel)
202 202
         {
203
-            $panelMap [$i ++] = $panelID;
203
+            $panelMap [$i++] = $panelID;
204 204
         }
205 205
         // replace any old values with new panel labels from the request
206 206
         foreach ($_REQUEST as $key => $value)
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
         if ($this->maxColumns < 1)
222 222
         {
223
-            $this->_fatalError("EditDetailViewParser:invalid maxColumns=" . $this->maxColumns);
223
+            $this->_fatalError("EditDetailViewParser:invalid maxColumns=".$this->maxColumns);
224 224
         }
225 225
 
226 226
         foreach ($_REQUEST as $slot => $value)
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                         // if a leading (empty) then remove (by noting that remaining fields need to be shuffled along)
268 268
                         if ($startOfRow)
269 269
                         {
270
-                            $offset ++;
270
+                            $offset++;
271 271
                         }
272 272
                         unset($row [$colID]);
273 273
                     } else
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
         //          _pp($this->_viewdefs);
288 288
     }
289 289
 
290
-    function _padFields ()
290
+    function _padFields()
291 291
     {
292
-        if (! empty($this->_viewdefs))
292
+        if (!empty($this->_viewdefs))
293 293
         {
294 294
             foreach ($this->_viewdefs ['panels'] as $panelID => $panel)
295 295
             {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                     // pad between fields on a row
300 300
                     foreach ($row as $colID => $col)
301 301
                     {
302
-                        for ($i = $column + 1 ; $i < $colID ; $i ++ )
302
+                        for ($i = $column + 1; $i < $colID; $i++)
303 303
                         {
304 304
                             $row [$i] = array('name' => '(empty)', 'label' => '(empty)');
305 305
                         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
                     // now pad out to the end of the row
309 309
                     if (($column + 1) < $this->maxColumns)
310 310
                     { // last column is maxColumns-1
311
-                        for ($i = $column + 1 ; $i < $this->maxColumns ; $i ++ )
311
+                        for ($i = $column + 1; $i < $this->maxColumns; $i++)
312 312
                         {
313 313
                             $row [$i] = array('name' => '(empty)', 'label' => '(empty)');
314 314
                         }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
     // add a new field to the end of a panel
325 325
     // don't write out (caller should call handleSave() when ready)
326
-    function _addField ($properties, $panelID = FALSE)
326
+    function _addField($properties, $panelID = FALSE)
327 327
     {
328 328
 
329 329
         // if a panelID was not passed, use the first available panel in the list
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             //          print "lastrow=$lastrow lastcol=$lastcol";
358 358
             if ($lastcol >= $this->maxColumns)
359 359
             {
360
-                $lastrow ++;
360
+                $lastrow++;
361 361
                 $this->_viewdefs ['panels'] [$panelID] [$lastrow] = array();
362 362
                 $lastcol = 0;
363 363
             }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     }
368 368
 
369 369
     /* getModelFields returns an array of all fields stored in the database for this module plus those fields in the original layout definition (so we get fields such as Team ID)*/
370
-    function _getModelFields ()
370
+    function _getModelFields()
371 371
     {
372 372
         $modelFields = array();
373 373
         $origViewDefs = $this->_getOrigFieldViewDefs();
@@ -376,13 +376,13 @@  discard block
 block discarded – undo
376 376
         {
377 377
             if (!empty($field))
378 378
             {
379
-                if (! is_array($def)) {
379
+                if (!is_array($def)) {
380 380
                     $def = array('name' => $field);
381 381
                 }
382 382
                 // get this field's label - if it has not been explicitly provided, see if the fieldDefs has a label for this field, and if not fallback to the field name
383
-                if (! isset($def ['label']))
383
+                if (!isset($def ['label']))
384 384
                         {
385
-                            if (! empty($this->_fieldDefs [$field] ['vname']))
385
+                            if (!empty($this->_fieldDefs [$field] ['vname']))
386 386
                             {
387 387
                                 $def ['label'] = $this->_fieldDefs [$field] ['vname'];
388 388
                             } else
@@ -393,25 +393,25 @@  discard block
 block discarded – undo
393 393
                 $modelFields[$field] = array('name' => $field, 'label' => $def ['label']);
394 394
             }
395 395
         }
396
-        $GLOBALS['log']->debug(print_r($modelFields,true));
396
+        $GLOBALS['log']->debug(print_r($modelFields, true));
397 397
         foreach ($this->_fieldDefs as $field => $def)
398 398
         {
399 399
             if ((!empty($def['studio']) && $def['studio'] == 'visible')
400
-            || (empty($def['studio']) &&  (empty($def ['source']) || $def ['source'] == 'db' || $def ['source'] == 'custom_fields') && $def ['type'] != 'id' && strcmp($field, 'deleted') != 0 && (empty($def ['dbType']) || $def ['dbType'] != 'id') && (empty($def ['dbtype']) || $def ['dbtype'] != 'id')))
400
+            || (empty($def['studio']) && (empty($def ['source']) || $def ['source'] == 'db' || $def ['source'] == 'custom_fields') && $def ['type'] != 'id' && strcmp($field, 'deleted') != 0 && (empty($def ['dbType']) || $def ['dbType'] != 'id') && (empty($def ['dbtype']) || $def ['dbtype'] != 'id')))
401 401
             {
402 402
                 $label = isset($def['vname']) ? $def['vname'] : $def['name'];
403 403
                 $modelFields [$field] = array('name' => $field, 'label' => $label);
404 404
             }
405 405
             else
406 406
             {
407
-                $GLOBALS['log']->debug( get_class($this)."->_getModelFields(): skipping $field from modelFields as it fails the test for inclusion");
407
+                $GLOBALS['log']->debug(get_class($this)."->_getModelFields(): skipping $field from modelFields as it fails the test for inclusion");
408 408
             }
409 409
         }
410
-        $GLOBALS['log']->debug( get_class($this)."->_getModelFields(): remaining entries in modelFields are: ".implode(",",array_keys($modelFields)));
410
+        $GLOBALS['log']->debug(get_class($this)."->_getModelFields(): remaining entries in modelFields are: ".implode(",", array_keys($modelFields)));
411 411
         return $modelFields;
412 412
     }
413 413
 
414
-    function _parseData ($panels)
414
+    function _parseData($panels)
415 415
     {
416 416
         $fields = array();
417 417
         if (empty($panels))
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
         // Fix for a flexibility in the format of the panel sections - if only one panel, then we don't have a panel level defined, it goes straight into rows
421 421
         // See EditView2 for similar treatment
422
-        if (! empty($panels) && count($panels) > 0)
422
+        if (!empty($panels) && count($panels) > 0)
423 423
         {
424 424
             $keys = array_keys($panels);
425 425
             if (is_numeric($keys [0]))
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
                 {
439 439
                     $properties = array();
440 440
 
441
-                    if (! empty($col))
441
+                    if (!empty($col))
442 442
                     {
443 443
                         if (is_string($col))
444 444
                         {
445 445
                             $properties ['name'] = $col;
446
-                        } else if (! empty($col ['name']))
446
+                        } else if (!empty($col ['name']))
447 447
                         {
448 448
                             $properties = $col;
449 449
                         }
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
                         $properties ['name'] = translate('LBL_FILLER');
453 453
                     }
454 454
 
455
-                    if (! empty($properties ['name']))
455
+                    if (!empty($properties ['name']))
456 456
                     {
457 457
 
458 458
                         // get this field's label - if it has not been explicity provided, see if the fieldDefs has a label for this field, and if not fallback to the field name
459
-                        if (! isset($properties ['label']))
459
+                        if (!isset($properties ['label']))
460 460
                         {
461
-                            if (! empty($this->_fieldDefs [$properties ['name']] ['vname']))
461
+                            if (!empty($this->_fieldDefs [$properties ['name']] ['vname']))
462 462
                             {
463 463
                                 $properties ['label'] = $this->_fieldDefs [$properties ['name']] ['vname'];
464 464
                             } else
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         return $displayData;
477 477
     }
478 478
 
479
-    function _getOrigFieldViewDefs ()
479
+    function _getOrigFieldViewDefs()
480 480
     {
481 481
         $origFieldDefs = array();
482 482
         $GLOBALS['log']->debug("Original File = ".$this->_originalFile);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 //          $GLOBALS['log']->debug($origdefs);
488 488
             // Fix for a flexibility in the format of the panel sections - if only one panel, then we don't have a panel level defined, it goes straight into rows
489 489
             // See EditView2 for similar treatment
490
-            if (! empty($origdefs) && count($origdefs) > 0)
490
+            if (!empty($origdefs) && count($origdefs) > 0)
491 491
             {
492 492
                 $keys = array_keys($origdefs);
493 493
                 if (is_numeric($keys [0]))
Please login to merge, or discard this patch.
Braces   +14 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined('sugarEntry') || ! sugarEntry)
3
-die('Not A Valid Entry Point');
2
+if (! defined('sugarEntry') || ! sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
4 5
 /*********************************************************************************
5 6
  * SugarCRM Community Edition is a customer relationship management program developed by
6 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -80,12 +81,10 @@  discard block
 block discarded – undo
80 81
         {
81 82
             $this->_sourceFile = $this->_workingFile;
82 83
             $this->usingWorkingFile = true;
83
-        }
84
-        else if (is_file($this->_customFile))
84
+        } else if (is_file($this->_customFile))
85 85
         {
86 86
             $this->_sourceFile = $this->_customFile;
87
-        }
88
-        else if (! is_file($this->_sourceFile))
87
+        } else if (! is_file($this->_sourceFile))
89 88
         {
90 89
             // if we don't have ANY defined metadata then improvise as best we can
91 90
             if (strtolower($this->_view) == 'quickcreate')
@@ -97,8 +96,7 @@  discard block
 block discarded – undo
97 96
                     $this->_sourceFile = "custom/" . $this->_sourceFile;
98 97
                 }
99 98
                 $this->_sourceView = 'EditView';
100
-            }
101
-            else
99
+            } else
102 100
             {
103 101
                 $this->_fatalError('parser.modifylayout.php->init(): no metadata for '.$this->_module.' '.$this->_view);
104 102
             }
@@ -171,8 +169,7 @@  discard block
 block discarded – undo
171 169
         {
172 170
         	TemplateHandler::clearCache($this->_module,"form_SubPanelQuickCreate_{$this->_module}.tpl");
173 171
         	TemplateHandler::clearCache($this->_module,"form_DCQuickCreate_{$this->_module}.tpl");
174
-        } 
175
-        else 
172
+        } else 
176 173
         {
177 174
         	TemplateHandler::clearCache($this->_module,"{$this->_view}.tpl");
178 175
         }
@@ -236,8 +233,7 @@  discard block
 block discarded – undo
236 233
                 if ($slotComponents ['3'] == 'name' && isset($origFieldDefs [$value]) && is_array($origFieldDefs [$value]))
237 234
                 {
238 235
                     $this->_viewdefs ['panels'] [$panelID] [$rowID] [$colID] = $origFieldDefs [$value];
239
-                }
240
-                else
236
+                } else
241 237
                 {
242 238
                     $property = $slotComponents ['3'];
243 239
                     if ($value == '(filler)')
@@ -341,8 +337,7 @@  discard block
 block discarded – undo
341 337
                     foreach ($row as $col_id => $col) {
342 338
                         if ($col['name'] == '(filler)') {
343 339
                             $this->_viewdefs['panels'][$loop_panelID][$row_id][$col_id] = NULL;
344
-                        }
345
-                        elseif ($col['name'] == '(empty)') {
340
+                        } elseif ($col['name'] == '(empty)') {
346 341
                             unset($this->_viewdefs['panels'][$loop_panelID][$row_id][$col_id]);
347 342
                         }
348 343
                     }
@@ -401,8 +396,7 @@  discard block
 block discarded – undo
401 396
             {
402 397
                 $label = isset($def['vname']) ? $def['vname'] : $def['name'];
403 398
                 $modelFields [$field] = array('name' => $field, 'label' => $label);
404
-            }
405
-            else
399
+            } else
406 400
             {
407 401
                 $GLOBALS['log']->debug( get_class($this)."->_getModelFields(): skipping $field from modelFields as it fails the test for inclusion");
408 402
             }
@@ -414,8 +408,9 @@  discard block
 block discarded – undo
414 408
     function _parseData ($panels)
415 409
     {
416 410
         $fields = array();
417
-        if (empty($panels))
418
-        return;
411
+        if (empty($panels)) {
412
+                return;
413
+        }
419 414
 
420 415
         // Fix for a flexibility in the format of the panel sections - if only one panel, then we don't have a panel level defined, it goes straight into rows
421 416
         // See EditView2 for similar treatment
@@ -506,8 +501,7 @@  discard block
 block discarded – undo
506 501
                         if (is_array($fieldDef))
507 502
                         {
508 503
                             $fieldName = $fieldDef ['name'];
509
-                        }
510
-                        else
504
+                        } else
511 505
                         {
512 506
                             $fieldName = $fieldDef;
513 507
                         }
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/ParserFactory.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     public static function getParser ( $view , $moduleName , $packageName = null , $subpanelName = null )
59 59
     {
60 60
         $GLOBALS [ 'log' ]->info ( "ParserFactory->getParser($view,$moduleName,$packageName,$subpanelName )" ) ;
61
-		$sm = null;
61
+        $sm = null;
62 62
         $lView = strtolower ( $view );
63 63
         if ( empty ( $packageName ) || ( $packageName == 'studio' ) )
64 64
         {
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-    die ( 'Not A Valid Entry Point' ) ;
2
+if (!defined('sugarEntry') || !sugarEntry)
3
+    die ('Not A Valid Entry Point');
4 4
 
5 5
 /*********************************************************************************
6 6
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  ********************************************************************************/
42 42
 
43 43
 
44
-require_once 'modules/ModuleBuilder/parsers/constants.php' ;
44
+require_once 'modules/ModuleBuilder/parsers/constants.php';
45 45
 
46 46
 class ParserFactory
47 47
 {
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
      * @return AbstractMetaDataParser
56 56
      */
57 57
 
58
-    public static function getParser ( $view , $moduleName , $packageName = null , $subpanelName = null )
58
+    public static function getParser($view, $moduleName, $packageName = null, $subpanelName = null)
59 59
     {
60
-        $GLOBALS [ 'log' ]->info ( "ParserFactory->getParser($view,$moduleName,$packageName,$subpanelName )" ) ;
60
+        $GLOBALS ['log']->info("ParserFactory->getParser($view,$moduleName,$packageName,$subpanelName )");
61 61
 		$sm = null;
62
-        $lView = strtolower ( $view );
63
-        if ( empty ( $packageName ) || ( $packageName == 'studio' ) )
62
+        $lView = strtolower($view);
63
+        if (empty ($packageName) || ($packageName == 'studio'))
64 64
         {
65
-            $packageName = null ;
65
+            $packageName = null;
66 66
             //For studio modules, check for view parser overrides
67 67
             $parser = self::checkForStudioParserOverride($view, $moduleName, $packageName);
68 68
             if ($parser) return $parser;
69 69
             $sm = StudioModuleFactory::getStudioModule($moduleName);
70 70
             //If we didn't find a specofic parser, see if there is a view to type mapping
71
-            foreach($sm->sources as $file => $def)
71
+            foreach ($sm->sources as $file => $def)
72 72
             {
73 73
                 if (!empty($def['view']) && $def['view'] == $view && !empty($def['type']))
74 74
                 {
@@ -78,41 +78,41 @@  discard block
 block discarded – undo
78 78
             }
79 79
         }
80 80
 
81
-        switch ( $lView)
81
+        switch ($lView)
82 82
         {
83 83
             case MB_EDITVIEW :
84 84
             case MB_DETAILVIEW :
85 85
             case MB_QUICKCREATE :
86
-                require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php' ;
87
-                return new GridLayoutMetaDataParser ( $view, $moduleName, $packageName ) ;
86
+                require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php';
87
+                return new GridLayoutMetaDataParser($view, $moduleName, $packageName);
88 88
             case MB_BASICSEARCH :
89 89
             case MB_ADVANCEDSEARCH :
90
-                require_once 'modules/ModuleBuilder/parsers/views/SearchViewMetaDataParser.php' ;
91
-                return new SearchViewMetaDataParser ( $view, $moduleName, $packageName ) ;
90
+                require_once 'modules/ModuleBuilder/parsers/views/SearchViewMetaDataParser.php';
91
+                return new SearchViewMetaDataParser($view, $moduleName, $packageName);
92 92
             case MB_LISTVIEW :
93 93
                 if ($subpanelName == null)
94 94
                 {
95
-                    require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php' ;
96
-                    return new ListLayoutMetaDataParser ( MB_LISTVIEW, $moduleName, $packageName ) ;
95
+                    require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php';
96
+                    return new ListLayoutMetaDataParser(MB_LISTVIEW, $moduleName, $packageName);
97 97
                 } else
98 98
                 {
99
-                    require_once 'modules/ModuleBuilder/parsers/views/SubpanelMetaDataParser.php' ;
100
-                    return new SubpanelMetaDataParser ( $subpanelName, $moduleName, $packageName ) ;
99
+                    require_once 'modules/ModuleBuilder/parsers/views/SubpanelMetaDataParser.php';
100
+                    return new SubpanelMetaDataParser($subpanelName, $moduleName, $packageName);
101 101
                 }
102 102
             case MB_DASHLET :
103 103
             case MB_DASHLETSEARCH :
104
-                require_once 'modules/ModuleBuilder/parsers/views/DashletMetaDataParser.php' ;
105
-                return new DashletMetaDataParser($view, $moduleName, $packageName  );
104
+                require_once 'modules/ModuleBuilder/parsers/views/DashletMetaDataParser.php';
105
+                return new DashletMetaDataParser($view, $moduleName, $packageName);
106 106
             case MB_POPUPLIST :
107 107
             case MB_POPUPSEARCH :
108
-                require_once 'modules/ModuleBuilder/parsers/views/PopupMetaDataParser.php' ;
109
-                return new PopupMetaDataParser($view, $moduleName, $packageName  );
108
+                require_once 'modules/ModuleBuilder/parsers/views/PopupMetaDataParser.php';
109
+                return new PopupMetaDataParser($view, $moduleName, $packageName);
110 110
             case MB_LABEL :
111
-                require_once 'modules/ModuleBuilder/parsers/parser.label.php' ;
112
-                return new ParserLabel ( $moduleName, $packageName ) ;
111
+                require_once 'modules/ModuleBuilder/parsers/parser.label.php';
112
+                return new ParserLabel($moduleName, $packageName);
113 113
             case MB_VISIBILITY :
114
-                require_once 'modules/ModuleBuilder/parsers/parser.visibility.php' ;
115
-                return new ParserVisibility ( $moduleName, $packageName ) ;
114
+                require_once 'modules/ModuleBuilder/parsers/parser.visibility.php';
115
+                return new ParserVisibility($moduleName, $packageName);
116 116
             default :
117 117
                 $parser = self::checkForParserClass($view, $moduleName, $packageName);
118 118
                 if ($parser)
@@ -120,33 +120,33 @@  discard block
 block discarded – undo
120 120
 
121 121
         }
122 122
 
123
-        $GLOBALS [ 'log' ]->fatal ("ParserFactory: cannot create ModuleBuilder Parser $view" ) ;
123
+        $GLOBALS ['log']->fatal("ParserFactory: cannot create ModuleBuilder Parser $view");
124 124
 
125 125
     }
126 126
 
127 127
     protected static function checkForParserClass($view, $moduleName, $packageName, $nameOverride = false)
128 128
     {
129 129
         $prefix = '';
130
-        if(!is_null ( $packageName )){
131
-            $prefix = empty($packageName) ? 'build' :'modify';
130
+        if (!is_null($packageName)) {
131
+            $prefix = empty($packageName) ? 'build' : 'modify';
132 132
         }
133 133
         $fileNames = array(
134
-            "custom/modules/$moduleName/parsers/parser." . strtolower ( $prefix . $view ) . ".php",
135
-            "modules/$moduleName/parsers/parser." . strtolower ( $prefix . $view ) . ".php",
136
-            "custom/modules/ModuleBuilder/parsers/parser." . strtolower ( $prefix . $view ) . ".php",
137
-            "modules/ModuleBuilder/parsers/parser." . strtolower ( $prefix . $view ) . ".php",
134
+            "custom/modules/$moduleName/parsers/parser.".strtolower($prefix.$view).".php",
135
+            "modules/$moduleName/parsers/parser.".strtolower($prefix.$view).".php",
136
+            "custom/modules/ModuleBuilder/parsers/parser.".strtolower($prefix.$view).".php",
137
+            "modules/ModuleBuilder/parsers/parser.".strtolower($prefix.$view).".php",
138 138
         );
139
-        foreach($fileNames as $fileName)
139
+        foreach ($fileNames as $fileName)
140 140
         {
141
-            if (file_exists ( $fileName ))
141
+            if (file_exists($fileName))
142 142
             {
143
-                require_once $fileName ;
144
-                $class = 'Parser' . $prefix . ucfirst ( $view ) ;
145
-                if (class_exists ( $class ))
143
+                require_once $fileName;
144
+                $class = 'Parser'.$prefix.ucfirst($view);
145
+                if (class_exists($class))
146 146
                 {
147
-                    $GLOBALS [ 'log' ]->debug ( 'Using ModuleBuilder Parser ' . $fileName ) ;
148
-                    $parser = new $class ( ) ;
149
-                    return $parser ;
147
+                    $GLOBALS ['log']->debug('Using ModuleBuilder Parser '.$fileName);
148
+                    $parser = new $class( );
149
+                    return $parser;
150 150
                 }
151 151
             }
152 152
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         require_once('modules/ModuleBuilder/Module/StudioModuleFactory.php');
159 159
         $sm = StudioModuleFactory::getStudioModule($moduleName);
160
-        foreach($sm->sources as $file => $def)
160
+        foreach ($sm->sources as $file => $def)
161 161
         {
162 162
             if (!empty($def['view']) && $def['view'] == strtolower($view) && !empty($def['parser']))
163 163
             {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                     require_once("custom/$path");
168 168
                 else if (file_exists($path))
169 169
                     require_once($path);
170
-                if (class_exists ( $pName ))
170
+                if (class_exists($pName))
171 171
                     return new $pName($view, $moduleName, $packageName);
172 172
                 //If it wasn't defined directly, check for a generic parser name for the view
173 173
                 $parser = self::checkForParserClass($view, $moduleName, $packageName);
Please login to merge, or discard this patch.
Braces   +19 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
2
+if (! defined ( 'sugarEntry' ) || ! sugarEntry) {
3 3
     die ( 'Not A Valid Entry Point' ) ;
4
+}
4 5
 
5 6
 /*********************************************************************************
6 7
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -65,7 +66,9 @@  discard block
 block discarded – undo
65 66
             $packageName = null ;
66 67
             //For studio modules, check for view parser overrides
67 68
             $parser = self::checkForStudioParserOverride($view, $moduleName, $packageName);
68
-            if ($parser) return $parser;
69
+            if ($parser) {
70
+                return $parser;
71
+            }
69 72
             $sm = StudioModuleFactory::getStudioModule($moduleName);
70 73
             //If we didn't find a specofic parser, see if there is a view to type mapping
71 74
             foreach($sm->sources as $file => $def)
@@ -115,8 +118,9 @@  discard block
 block discarded – undo
115 118
                 return new ParserVisibility ( $moduleName, $packageName ) ;
116 119
             default :
117 120
                 $parser = self::checkForParserClass($view, $moduleName, $packageName);
118
-                if ($parser)
119
-                    return $parser;
121
+                if ($parser) {
122
+                                    return $parser;
123
+                }
120 124
 
121 125
         }
122 126
 
@@ -163,16 +167,19 @@  discard block
 block discarded – undo
163 167
             {
164 168
                 $pName = $def['parser'];
165 169
                 $path = "modules/ModuleBuilder/parsers/views/{$pName}.php";
166
-                if (file_exists("custom/$path"))
167
-                    require_once("custom/$path");
168
-                else if (file_exists($path))
169
-                    require_once($path);
170
-                if (class_exists ( $pName ))
171
-                    return new $pName($view, $moduleName, $packageName);
170
+                if (file_exists("custom/$path")) {
171
+                                    require_once("custom/$path");
172
+                } else if (file_exists($path)) {
173
+                                    require_once($path);
174
+                }
175
+                if (class_exists ( $pName )) {
176
+                                    return new $pName($view, $moduleName, $packageName);
177
+                }
172 178
                 //If it wasn't defined directly, check for a generic parser name for the view
173 179
                 $parser = self::checkForParserClass($view, $moduleName, $packageName);
174
-                if ($parser)
175
-                    return $parser;
180
+                if ($parser) {
181
+                                    return $parser;
182
+                }
176 183
             }
177 184
         }
178 185
         return false;
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/parser.modifylistview.php 3 patches
Indentation   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -43,144 +43,144 @@  discard block
 block discarded – undo
43 43
 require_once ('modules/ModuleBuilder/parsers/ModuleBuilderParser.php') ;
44 44
 class ParserModifyListView extends ModuleBuilderParser
45 45
 {
46
-	var $listViewDefs = false ;
47
-	var $defaults = array ( ) ;
48
-	var $additional = array ( ) ;
49
-	var $available = array ( ) ;
50
-	var $reserved = array(); // fields marked by 'studio'=>false in the listviewdefs; need to be preserved
51
-	//	var $language_module = '';
52
-	var $columns = array ( 'LBL_DEFAULT' => 'getDefaultFields' , 'LBL_AVAILABLE' => 'getAdditionalFields' , 'LBL_HIDDEN' => 'getAvailableFields' ) ;
53
-	function init ( $module_name , $submodule = '' )
54
-	{
55
-		global $app_list_strings ;
56
-		$this->module_name = $module_name ;
57
-		$mod_strings = return_module_language ( $GLOBALS [ 'current_language' ], $this->module_name ) ; // needed solely so that listviewdefs that reference this can be included without error
58
-		$class = $GLOBALS [ 'beanList' ] [ $this->module_name ] ;
59
-		require_once ($GLOBALS [ 'beanFiles' ] [ $class ]) ;
60
-		$this->module = new $class ( ) ;
46
+    var $listViewDefs = false ;
47
+    var $defaults = array ( ) ;
48
+    var $additional = array ( ) ;
49
+    var $available = array ( ) ;
50
+    var $reserved = array(); // fields marked by 'studio'=>false in the listviewdefs; need to be preserved
51
+    //	var $language_module = '';
52
+    var $columns = array ( 'LBL_DEFAULT' => 'getDefaultFields' , 'LBL_AVAILABLE' => 'getAdditionalFields' , 'LBL_HIDDEN' => 'getAvailableFields' ) ;
53
+    function init ( $module_name , $submodule = '' )
54
+    {
55
+        global $app_list_strings ;
56
+        $this->module_name = $module_name ;
57
+        $mod_strings = return_module_language ( $GLOBALS [ 'current_language' ], $this->module_name ) ; // needed solely so that listviewdefs that reference this can be included without error
58
+        $class = $GLOBALS [ 'beanList' ] [ $this->module_name ] ;
59
+        require_once ($GLOBALS [ 'beanFiles' ] [ $class ]) ;
60
+        $this->module = new $class ( ) ;
61 61
 
62
-		$loaded = $this->_loadFromFile('ListView','modules/' . $this->module_name . '/metadata/listviewdefs.php',$this->module_name);
63
-		$this->originalListViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
64
-		$this->_variables = $loaded['variables'];
65
-		//		_pp($loaded);
66
-		$this->customFile = 'custom/modules/' . $this->module_name . '/metadata/listviewdefs.php' ;
67
-		if (file_exists ( $this->customFile ))
68
-		{
69
-			$loaded = $this->_loadFromFile('ListView',$this->customFile,$this->module_name);
70
-			$this->listViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
71
-			$this->_variables = $loaded['variables'];
72
-		} else
73
-		{
74
-			$this->listViewDefs = & $this->originalListViewDefs ;
75
-		}
62
+        $loaded = $this->_loadFromFile('ListView','modules/' . $this->module_name . '/metadata/listviewdefs.php',$this->module_name);
63
+        $this->originalListViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
64
+        $this->_variables = $loaded['variables'];
65
+        //		_pp($loaded);
66
+        $this->customFile = 'custom/modules/' . $this->module_name . '/metadata/listviewdefs.php' ;
67
+        if (file_exists ( $this->customFile ))
68
+        {
69
+            $loaded = $this->_loadFromFile('ListView',$this->customFile,$this->module_name);
70
+            $this->listViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
71
+            $this->_variables = $loaded['variables'];
72
+        } else
73
+        {
74
+            $this->listViewDefs = & $this->originalListViewDefs ;
75
+        }
76 76
 
77
-		$this->fixKeys ( $this->originalListViewDefs ) ;
78
-		$this->fixKeys ( $this->listViewDefs ) ;
79
-		$this->language_module = $this->module_name ;
80
-	}
77
+        $this->fixKeys ( $this->originalListViewDefs ) ;
78
+        $this->fixKeys ( $this->listViewDefs ) ;
79
+        $this->language_module = $this->module_name ;
80
+    }
81 81
 	
82
-	function getLanguage()
83
-	{
84
-	    return $this->language_module;
85
-	}
86
-	// re-key array so that every entry has a key=name and all keys are lowercase - makes it easier in handleSave() later...
87
-	function fixKeys ( &$defs )
88
-	{
89
-		$temp = array ( ) ;
90
-		foreach ( $defs as $key => $value )
91
-		{
92
-			if (! is_array ( $value ))
93
-			{
94
-				$key = $value ;
95
-				$def = array ( ) ;
96
-				$def [ 'name' ] = (isset ( $this->module->field_defs [ $key ] )) ? $this->module->field_defs [ $key ] [ 'name' ] : $key ;
97
-				$value = $def ;
98
-			}
99
-			if (isset ( $value [ 'name' ] ))
100
-			{
101
-				$key = $value [ 'name' ] ; // override key with name, needed when the entry lacks a key
102
-			}
103
-			$temp [ strtolower ( $key ) ] = $value ;
104
-		}
105
-		$defs = $temp ;
106
-	}
82
+    function getLanguage()
83
+    {
84
+        return $this->language_module;
85
+    }
86
+    // re-key array so that every entry has a key=name and all keys are lowercase - makes it easier in handleSave() later...
87
+    function fixKeys ( &$defs )
88
+    {
89
+        $temp = array ( ) ;
90
+        foreach ( $defs as $key => $value )
91
+        {
92
+            if (! is_array ( $value ))
93
+            {
94
+                $key = $value ;
95
+                $def = array ( ) ;
96
+                $def [ 'name' ] = (isset ( $this->module->field_defs [ $key ] )) ? $this->module->field_defs [ $key ] [ 'name' ] : $key ;
97
+                $value = $def ;
98
+            }
99
+            if (isset ( $value [ 'name' ] ))
100
+            {
101
+                $key = $value [ 'name' ] ; // override key with name, needed when the entry lacks a key
102
+            }
103
+            $temp [ strtolower ( $key ) ] = $value ;
104
+        }
105
+        $defs = $temp ;
106
+    }
107 107
 	
108
-	/**
109
-	 * returns the default fields for a listview
110
-	 * Called only when displaying the listview for editing; not called when saving
111
-	 */
112
-	function getDefaultFields ()
113
-	{
114
-		$this->defaults = array ( ) ;
115
-		foreach ( $this->listViewDefs as $key => $def )
116
-		{
117
-		    // add in the default fields from the listviewdefs, stripping out any field with 'studio' set to a value other than true
118
-		    // Important: the 'studio' fields must be added back into the layout on save, as they're not editable rather than hidden
119
-			if (! empty ( $def [ 'default' ] ))
120
-			{
121
-			    if (! isset($def['studio']) || $def['studio'] === true)
122
-			    {
123
-			        $this->defaults [ $key ] = $def ;
124
-			    }
125
-			    else
126
-			    // anything which doesn't go into the defaults is a reserved field - this makes sure we don't miss anything
127
-			    {
128
-			        $this->reserved [ $key ] = $def;
129
-			    }
130
-			}
131
-		}
132
-		return $this->defaults ;
133
-	}
134
-	/**
135
-	 * returns additional fields available for users to create fields
136
-	 */
137
-	function getAdditionalFields ()
138
-	{
139
-		$this->additional = array ( ) ;
140
-		foreach ( $this->listViewDefs as $key => $def )
141
-		{
142
-			if (empty ( $def [ 'default' ] ))
143
-			{
144
-				$key = strtolower ( $key ) ;
145
-				$this->additional [ $key ] = $def ;
146
-			}
147
-		}
148
-		return $this->additional ;
149
-	}
150
-	/**
151
-	 * returns unused fields that are available for using in either default or additional list views
152
-	 */
153
-	function getAvailableFields ()
154
-	{
155
-		$this->availableFields = array ( ) ;
156
-		$lowerFieldList = array_change_key_case ( $this->listViewDefs ) ;
157
-		foreach ( $this->originalListViewDefs as $key => $def )
158
-		{
159
-			$key = strtolower ( $key ) ;
160
-			if (! isset ( $lowerFieldList [ $key ] ))
161
-			{
162
-				$this->availableFields [ $key ] = $def ;
163
-			}
164
-		}
165
-		$GLOBALS['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields,true));
166
-		$modFields = !empty($this->module->field_name_map) ? $this->module->field_name_map : $this->module->field_defs;
167
-		foreach ( $modFields as $key => $def )
168
-		{
169
-			$fieldName = strtolower ( $key ) ;
108
+    /**
109
+     * returns the default fields for a listview
110
+     * Called only when displaying the listview for editing; not called when saving
111
+     */
112
+    function getDefaultFields ()
113
+    {
114
+        $this->defaults = array ( ) ;
115
+        foreach ( $this->listViewDefs as $key => $def )
116
+        {
117
+            // add in the default fields from the listviewdefs, stripping out any field with 'studio' set to a value other than true
118
+            // Important: the 'studio' fields must be added back into the layout on save, as they're not editable rather than hidden
119
+            if (! empty ( $def [ 'default' ] ))
120
+            {
121
+                if (! isset($def['studio']) || $def['studio'] === true)
122
+                {
123
+                    $this->defaults [ $key ] = $def ;
124
+                }
125
+                else
126
+                // anything which doesn't go into the defaults is a reserved field - this makes sure we don't miss anything
127
+                {
128
+                    $this->reserved [ $key ] = $def;
129
+                }
130
+            }
131
+        }
132
+        return $this->defaults ;
133
+    }
134
+    /**
135
+     * returns additional fields available for users to create fields
136
+     */
137
+    function getAdditionalFields ()
138
+    {
139
+        $this->additional = array ( ) ;
140
+        foreach ( $this->listViewDefs as $key => $def )
141
+        {
142
+            if (empty ( $def [ 'default' ] ))
143
+            {
144
+                $key = strtolower ( $key ) ;
145
+                $this->additional [ $key ] = $def ;
146
+            }
147
+        }
148
+        return $this->additional ;
149
+    }
150
+    /**
151
+     * returns unused fields that are available for using in either default or additional list views
152
+     */
153
+    function getAvailableFields ()
154
+    {
155
+        $this->availableFields = array ( ) ;
156
+        $lowerFieldList = array_change_key_case ( $this->listViewDefs ) ;
157
+        foreach ( $this->originalListViewDefs as $key => $def )
158
+        {
159
+            $key = strtolower ( $key ) ;
160
+            if (! isset ( $lowerFieldList [ $key ] ))
161
+            {
162
+                $this->availableFields [ $key ] = $def ;
163
+            }
164
+        }
165
+        $GLOBALS['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields,true));
166
+        $modFields = !empty($this->module->field_name_map) ? $this->module->field_name_map : $this->module->field_defs;
167
+        foreach ( $modFields as $key => $def )
168
+        {
169
+            $fieldName = strtolower ( $key ) ;
170 170
             if ($fieldName == 'currency_id')
171 171
                 continue;
172
-			if (!isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
173
-			{
172
+            if (!isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
173
+            {
174 174
             // bug 19656: this test changed after 5.0.0b - we now remove all ID type fields - whether set as type, or dbtype, from the fielddefs
175 175
             if ($this->isValidField($key, $def)){
176
-					$label = (isset ( $def [ 'vname' ] )) ? $def [ 'vname' ] : (isset($def [ 'label' ]) ? $def['label'] : $def['name']) ;
177
-					$this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
178
-				}
179
-			}
180
-		}
176
+                    $label = (isset ( $def [ 'vname' ] )) ? $def [ 'vname' ] : (isset($def [ 'label' ]) ? $def['label'] : $def['name']) ;
177
+                    $this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
178
+                }
179
+            }
180
+        }
181 181
 
182
-		return $this->availableFields ;
183
-	}
182
+        return $this->availableFields ;
183
+    }
184 184
 
185 185
     function getFieldDefs()
186 186
     {
@@ -188,146 +188,146 @@  discard block
 block discarded – undo
188 188
     }
189 189
 
190 190
 	
191
-	function isValidField($key, $def) {
192
-	    //Allow fields that are studio visible  
193
-		if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible')
194
-		  return true;
191
+    function isValidField($key, $def) {
192
+        //Allow fields that are studio visible  
193
+        if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible')
194
+            return true;
195 195
 		  
196
-		//No ID fields
197
-		if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id'))
198
-		  return false;
196
+        //No ID fields
197
+        if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id'))
198
+            return false;
199 199
 		  
200
-		//only allow DB and custom fields (if a source is specified)
201
-	    if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields')
202
-		  return false;
200
+        //only allow DB and custom fields (if a source is specified)
201
+        if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields')
202
+            return false;
203 203
 
204
-		//Dont ever show the "deleted" fields or "_name" fields
205
-		if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false))
206
-	       return false;
204
+        //Dont ever show the "deleted" fields or "_name" fields
205
+        if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false))
206
+            return false;
207 207
 
208
-	    //If none of the "ifs" are true, the field is valid
209
-	    return true;
210
-	}
208
+        //If none of the "ifs" are true, the field is valid
209
+        return true;
210
+    }
211 211
 	
212 212
 	
213
-	function getField ( $fieldName )
214
-	{
215
-		$fieldName = strtolower ( $fieldName ) ;
216
-		foreach ( $this->listViewDefs as $key => $def )
217
-		{
218
-			$key = strtolower ( $key ) ;
219
-			if ($key == $fieldName)
220
-			{
221
-				return $def ;
222
-			}
223
-		}
224
-		foreach ( $this->module->field_defs as $key => $def )
225
-		{
226
-			$key = strtolower ( $key ) ;
227
-			if ($key == $fieldName)
228
-			{
229
-				return $def ;
230
-			}
231
-		}
232
-		return array ( ) ;
233
-	}
234
-	function addRelateData($fieldname, $listfielddef) {
235
-		$modFieldDef = $this->module->field_defs [ strtolower ( $fieldname ) ];
236
-		if (!empty($modFieldDef['module']) && !empty($modFieldDef['id_name'])) {
237
-			$listfielddef['module'] = $modFieldDef['module'];
238
-			$listfielddef['id'] = strtoupper($modFieldDef['id_name']);
239
-			$listfielddef['link'] = true;
240
-			$listfielddef['related_fields'] = array (strtolower($modFieldDef['id_name']));
241
-		}
242
-		return $listfielddef;
243
-	}
244
-	function _loadLayoutFromRequest ()
245
-	{
246
-	    $GLOBALS['log']->debug("ParserModifyListView->_loadLayoutFromRequest()");
247
-		$fields = array ( ) ;
248
-		$rejectTypes = array ( 'html' , 'enum' , 'text' ) ;
249
-		for ( $i = 0 ; isset ( $_POST [ 'group_' . $i ] ) && $i < 2 ; $i ++ )
250
-		{
251
-			//echo "\n***group-$i Size:".sizeof($_POST['group_' . $i])."\n";
252
-			foreach ( $_POST [ 'group_' . $i ] as $field )
253
-			{
254
-				$fieldname = strtoupper ( $field ) ;
255
-				//originalListViewDefs are all lower case
256
-				$lowerFieldName = strtolower ( $field ) ;
257
-				if (isset ( $this->originalListViewDefs [ $lowerFieldName ] ))
258
-				{
259
-					$fields [ $fieldname ] = $this->originalListViewDefs [ $lowerFieldName ] ;
260
-				} else
261
-				{
262
-					//check if we have the case wrong for custom fields
263
-					if (! isset ( $this->module->field_defs [ $fieldname ] ))
264
-					{
265
-						foreach ( $this->module->field_defs as $key => $value )
266
-						{
267
-							if (strtoupper ( $key ) == $fieldname)
268
-							{
269
-								$fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $key ] [ 'vname' ] ) ;
270
-								break ;
271
-							}
272
-						}
273
-					} else
274
-					{
275
-						$fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $fieldname ] [ 'vname' ] ) ;
276
-					}
277
-					// sorting fields of certain types will cause a database engine problems
278
-					// we only check this for custom fields, as we assume that OOB fields have been independently confirmed as ok
279
-					if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] ) && (in_array ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ], $rejectTypes ) || isset($this->module->field_defs [ strtolower ( $fieldname ) ]['custom_module'])))
280
-					{
281
-						$fields [ $fieldname ] [ 'sortable' ] = false ;
282
-					}
283
-					// Bug 23728 - Make adding a currency type field default to setting the 'currency_format' to true
284
-					if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type ' ] ) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'currency') 
285
-					{
286
-						$fields [ $fieldname ] [ 'currency_format' ] = true;
287
-					}
288
-				}
289
-				if (isset ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ] ))
290
-				{
291
-					$width = substr ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ], 6, 3 ) ;
292
-					if (strpos ( $width, "%" ) !== false)
293
-					{
294
-						$width = substr ( $width, 0, 2 ) ;
295
-					}
296
-					if ($width < 101 && $width > 0)
297
-					{
298
-						$fields [ $fieldname ] [ 'width' ] = $width ;
299
-					}
300
-				} else if (isset ( $this->listViewDefs [ $fieldname ] [ 'width' ] ))
301
-				{
302
-					$fields [ $fieldname ] [ 'width' ] = $this->listViewDefs [ $fieldname ] [ 'width' ] ;
303
-				}
304
-				//Get additional Data for relate fields
305
-				if (isset($this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ]) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'relate') {
306
-					$fields [ $fieldname ] = $this->addRelateData($field, $fields [ $fieldname ]);
307
-				}
308
-				$fields [ $fieldname ] [ 'default' ] = ($i == 0) ;
309
-			}
310
-		}
311
-		// Add the reserved fields back in to the end of the default fields in the layout
312
-		// ASSUMPTION: reserved fields go back at the end
313
-		// First, load the reserved fields - we cannot assume that getDefaultFields has been called earlier when saving
314
-		$this->getDefaultFields();
315
-		foreach ( $this->reserved as $key => $def)
316
-		{
317
-		    $fields[ $key ] = $def;
318
-		}
213
+    function getField ( $fieldName )
214
+    {
215
+        $fieldName = strtolower ( $fieldName ) ;
216
+        foreach ( $this->listViewDefs as $key => $def )
217
+        {
218
+            $key = strtolower ( $key ) ;
219
+            if ($key == $fieldName)
220
+            {
221
+                return $def ;
222
+            }
223
+        }
224
+        foreach ( $this->module->field_defs as $key => $def )
225
+        {
226
+            $key = strtolower ( $key ) ;
227
+            if ($key == $fieldName)
228
+            {
229
+                return $def ;
230
+            }
231
+        }
232
+        return array ( ) ;
233
+    }
234
+    function addRelateData($fieldname, $listfielddef) {
235
+        $modFieldDef = $this->module->field_defs [ strtolower ( $fieldname ) ];
236
+        if (!empty($modFieldDef['module']) && !empty($modFieldDef['id_name'])) {
237
+            $listfielddef['module'] = $modFieldDef['module'];
238
+            $listfielddef['id'] = strtoupper($modFieldDef['id_name']);
239
+            $listfielddef['link'] = true;
240
+            $listfielddef['related_fields'] = array (strtolower($modFieldDef['id_name']));
241
+        }
242
+        return $listfielddef;
243
+    }
244
+    function _loadLayoutFromRequest ()
245
+    {
246
+        $GLOBALS['log']->debug("ParserModifyListView->_loadLayoutFromRequest()");
247
+        $fields = array ( ) ;
248
+        $rejectTypes = array ( 'html' , 'enum' , 'text' ) ;
249
+        for ( $i = 0 ; isset ( $_POST [ 'group_' . $i ] ) && $i < 2 ; $i ++ )
250
+        {
251
+            //echo "\n***group-$i Size:".sizeof($_POST['group_' . $i])."\n";
252
+            foreach ( $_POST [ 'group_' . $i ] as $field )
253
+            {
254
+                $fieldname = strtoupper ( $field ) ;
255
+                //originalListViewDefs are all lower case
256
+                $lowerFieldName = strtolower ( $field ) ;
257
+                if (isset ( $this->originalListViewDefs [ $lowerFieldName ] ))
258
+                {
259
+                    $fields [ $fieldname ] = $this->originalListViewDefs [ $lowerFieldName ] ;
260
+                } else
261
+                {
262
+                    //check if we have the case wrong for custom fields
263
+                    if (! isset ( $this->module->field_defs [ $fieldname ] ))
264
+                    {
265
+                        foreach ( $this->module->field_defs as $key => $value )
266
+                        {
267
+                            if (strtoupper ( $key ) == $fieldname)
268
+                            {
269
+                                $fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $key ] [ 'vname' ] ) ;
270
+                                break ;
271
+                            }
272
+                        }
273
+                    } else
274
+                    {
275
+                        $fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $fieldname ] [ 'vname' ] ) ;
276
+                    }
277
+                    // sorting fields of certain types will cause a database engine problems
278
+                    // we only check this for custom fields, as we assume that OOB fields have been independently confirmed as ok
279
+                    if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] ) && (in_array ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ], $rejectTypes ) || isset($this->module->field_defs [ strtolower ( $fieldname ) ]['custom_module'])))
280
+                    {
281
+                        $fields [ $fieldname ] [ 'sortable' ] = false ;
282
+                    }
283
+                    // Bug 23728 - Make adding a currency type field default to setting the 'currency_format' to true
284
+                    if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type ' ] ) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'currency') 
285
+                    {
286
+                        $fields [ $fieldname ] [ 'currency_format' ] = true;
287
+                    }
288
+                }
289
+                if (isset ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ] ))
290
+                {
291
+                    $width = substr ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ], 6, 3 ) ;
292
+                    if (strpos ( $width, "%" ) !== false)
293
+                    {
294
+                        $width = substr ( $width, 0, 2 ) ;
295
+                    }
296
+                    if ($width < 101 && $width > 0)
297
+                    {
298
+                        $fields [ $fieldname ] [ 'width' ] = $width ;
299
+                    }
300
+                } else if (isset ( $this->listViewDefs [ $fieldname ] [ 'width' ] ))
301
+                {
302
+                    $fields [ $fieldname ] [ 'width' ] = $this->listViewDefs [ $fieldname ] [ 'width' ] ;
303
+                }
304
+                //Get additional Data for relate fields
305
+                if (isset($this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ]) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'relate') {
306
+                    $fields [ $fieldname ] = $this->addRelateData($field, $fields [ $fieldname ]);
307
+                }
308
+                $fields [ $fieldname ] [ 'default' ] = ($i == 0) ;
309
+            }
310
+        }
311
+        // Add the reserved fields back in to the end of the default fields in the layout
312
+        // ASSUMPTION: reserved fields go back at the end
313
+        // First, load the reserved fields - we cannot assume that getDefaultFields has been called earlier when saving
314
+        $this->getDefaultFields();
315
+        foreach ( $this->reserved as $key => $def)
316
+        {
317
+            $fields[ $key ] = $def;
318
+        }
319 319
 		
320
-		return $fields ;
321
-	}
322
-	function handleSave ()
323
-	{
324
-		$fields = $this->_loadLayoutFromRequest();
325
-		$this->_writeToFile($this->customFile,'ListView',$this->module_name,$fields,$this->_variables);
320
+        return $fields ;
321
+    }
322
+    function handleSave ()
323
+    {
324
+        $fields = $this->_loadLayoutFromRequest();
325
+        $this->_writeToFile($this->customFile,'ListView',$this->module_name,$fields,$this->_variables);
326 326
 
327
-		$GLOBALS [ "listViewDefs" ] [ $this->module_name ] = $fields ;
328
-		// now clear the cache so that the results are immediately visible
329
-		include_once ('include/TemplateHandler/TemplateHandler.php') ;
330
-		TemplateHandler::clearCache ( $this->module_name, "ListView.tpl" ) ; // not currently cached, but here for the future
331
-	}
327
+        $GLOBALS [ "listViewDefs" ] [ $this->module_name ] = $fields ;
328
+        // now clear the cache so that the results are immediately visible
329
+        include_once ('include/TemplateHandler/TemplateHandler.php') ;
330
+        TemplateHandler::clearCache ( $this->module_name, "ListView.tpl" ) ; // not currently cached, but here for the future
331
+    }
332 332
 }
333 333
 ?>
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-die ( 'Not A Valid Entry Point' ) ;
2
+if (!defined('sugarEntry') || !sugarEntry)
3
+die ('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
6 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,43 +40,43 @@  discard block
 block discarded – undo
40 40
  ********************************************************************************/
41 41
 
42 42
 
43
-require_once ('modules/ModuleBuilder/parsers/ModuleBuilderParser.php') ;
43
+require_once ('modules/ModuleBuilder/parsers/ModuleBuilderParser.php');
44 44
 class ParserModifyListView extends ModuleBuilderParser
45 45
 {
46
-	var $listViewDefs = false ;
47
-	var $defaults = array ( ) ;
48
-	var $additional = array ( ) ;
49
-	var $available = array ( ) ;
46
+	var $listViewDefs = false;
47
+	var $defaults = array( );
48
+	var $additional = array( );
49
+	var $available = array( );
50 50
 	var $reserved = array(); // fields marked by 'studio'=>false in the listviewdefs; need to be preserved
51 51
 	//	var $language_module = '';
52
-	var $columns = array ( 'LBL_DEFAULT' => 'getDefaultFields' , 'LBL_AVAILABLE' => 'getAdditionalFields' , 'LBL_HIDDEN' => 'getAvailableFields' ) ;
53
-	function init ( $module_name , $submodule = '' )
52
+	var $columns = array('LBL_DEFAULT' => 'getDefaultFields', 'LBL_AVAILABLE' => 'getAdditionalFields', 'LBL_HIDDEN' => 'getAvailableFields');
53
+	function init($module_name, $submodule = '')
54 54
 	{
55
-		global $app_list_strings ;
56
-		$this->module_name = $module_name ;
57
-		$mod_strings = return_module_language ( $GLOBALS [ 'current_language' ], $this->module_name ) ; // needed solely so that listviewdefs that reference this can be included without error
58
-		$class = $GLOBALS [ 'beanList' ] [ $this->module_name ] ;
59
-		require_once ($GLOBALS [ 'beanFiles' ] [ $class ]) ;
60
-		$this->module = new $class ( ) ;
55
+		global $app_list_strings;
56
+		$this->module_name = $module_name;
57
+		$mod_strings = return_module_language($GLOBALS ['current_language'], $this->module_name); // needed solely so that listviewdefs that reference this can be included without error
58
+		$class = $GLOBALS ['beanList'] [$this->module_name];
59
+		require_once ($GLOBALS ['beanFiles'] [$class]);
60
+		$this->module = new $class( );
61 61
 
62
-		$loaded = $this->_loadFromFile('ListView','modules/' . $this->module_name . '/metadata/listviewdefs.php',$this->module_name);
63
-		$this->originalListViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
62
+		$loaded = $this->_loadFromFile('ListView', 'modules/'.$this->module_name.'/metadata/listviewdefs.php', $this->module_name);
63
+		$this->originalListViewDefs = $loaded['viewdefs'] [$this->module_name];
64 64
 		$this->_variables = $loaded['variables'];
65 65
 		//		_pp($loaded);
66
-		$this->customFile = 'custom/modules/' . $this->module_name . '/metadata/listviewdefs.php' ;
67
-		if (file_exists ( $this->customFile ))
66
+		$this->customFile = 'custom/modules/'.$this->module_name.'/metadata/listviewdefs.php';
67
+		if (file_exists($this->customFile))
68 68
 		{
69
-			$loaded = $this->_loadFromFile('ListView',$this->customFile,$this->module_name);
70
-			$this->listViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
69
+			$loaded = $this->_loadFromFile('ListView', $this->customFile, $this->module_name);
70
+			$this->listViewDefs = $loaded['viewdefs'] [$this->module_name];
71 71
 			$this->_variables = $loaded['variables'];
72 72
 		} else
73 73
 		{
74
-			$this->listViewDefs = & $this->originalListViewDefs ;
74
+			$this->listViewDefs = & $this->originalListViewDefs;
75 75
 		}
76 76
 
77
-		$this->fixKeys ( $this->originalListViewDefs ) ;
78
-		$this->fixKeys ( $this->listViewDefs ) ;
79
-		$this->language_module = $this->module_name ;
77
+		$this->fixKeys($this->originalListViewDefs);
78
+		$this->fixKeys($this->listViewDefs);
79
+		$this->language_module = $this->module_name;
80 80
 	}
81 81
 	
82 82
 	function getLanguage()
@@ -84,102 +84,102 @@  discard block
 block discarded – undo
84 84
 	    return $this->language_module;
85 85
 	}
86 86
 	// re-key array so that every entry has a key=name and all keys are lowercase - makes it easier in handleSave() later...
87
-	function fixKeys ( &$defs )
87
+	function fixKeys(&$defs)
88 88
 	{
89
-		$temp = array ( ) ;
90
-		foreach ( $defs as $key => $value )
89
+		$temp = array( );
90
+		foreach ($defs as $key => $value)
91 91
 		{
92
-			if (! is_array ( $value ))
92
+			if (!is_array($value))
93 93
 			{
94
-				$key = $value ;
95
-				$def = array ( ) ;
96
-				$def [ 'name' ] = (isset ( $this->module->field_defs [ $key ] )) ? $this->module->field_defs [ $key ] [ 'name' ] : $key ;
97
-				$value = $def ;
94
+				$key = $value;
95
+				$def = array( );
96
+				$def ['name'] = (isset ($this->module->field_defs [$key])) ? $this->module->field_defs [$key] ['name'] : $key;
97
+				$value = $def;
98 98
 			}
99
-			if (isset ( $value [ 'name' ] ))
99
+			if (isset ($value ['name']))
100 100
 			{
101
-				$key = $value [ 'name' ] ; // override key with name, needed when the entry lacks a key
101
+				$key = $value ['name']; // override key with name, needed when the entry lacks a key
102 102
 			}
103
-			$temp [ strtolower ( $key ) ] = $value ;
103
+			$temp [strtolower($key)] = $value;
104 104
 		}
105
-		$defs = $temp ;
105
+		$defs = $temp;
106 106
 	}
107 107
 	
108 108
 	/**
109 109
 	 * returns the default fields for a listview
110 110
 	 * Called only when displaying the listview for editing; not called when saving
111 111
 	 */
112
-	function getDefaultFields ()
112
+	function getDefaultFields()
113 113
 	{
114
-		$this->defaults = array ( ) ;
115
-		foreach ( $this->listViewDefs as $key => $def )
114
+		$this->defaults = array( );
115
+		foreach ($this->listViewDefs as $key => $def)
116 116
 		{
117 117
 		    // add in the default fields from the listviewdefs, stripping out any field with 'studio' set to a value other than true
118 118
 		    // Important: the 'studio' fields must be added back into the layout on save, as they're not editable rather than hidden
119
-			if (! empty ( $def [ 'default' ] ))
119
+			if (!empty ($def ['default']))
120 120
 			{
121
-			    if (! isset($def['studio']) || $def['studio'] === true)
121
+			    if (!isset($def['studio']) || $def['studio'] === true)
122 122
 			    {
123
-			        $this->defaults [ $key ] = $def ;
123
+			        $this->defaults [$key] = $def;
124 124
 			    }
125 125
 			    else
126 126
 			    // anything which doesn't go into the defaults is a reserved field - this makes sure we don't miss anything
127 127
 			    {
128
-			        $this->reserved [ $key ] = $def;
128
+			        $this->reserved [$key] = $def;
129 129
 			    }
130 130
 			}
131 131
 		}
132
-		return $this->defaults ;
132
+		return $this->defaults;
133 133
 	}
134 134
 	/**
135 135
 	 * returns additional fields available for users to create fields
136 136
 	 */
137
-	function getAdditionalFields ()
137
+	function getAdditionalFields()
138 138
 	{
139
-		$this->additional = array ( ) ;
140
-		foreach ( $this->listViewDefs as $key => $def )
139
+		$this->additional = array( );
140
+		foreach ($this->listViewDefs as $key => $def)
141 141
 		{
142
-			if (empty ( $def [ 'default' ] ))
142
+			if (empty ($def ['default']))
143 143
 			{
144
-				$key = strtolower ( $key ) ;
145
-				$this->additional [ $key ] = $def ;
144
+				$key = strtolower($key);
145
+				$this->additional [$key] = $def;
146 146
 			}
147 147
 		}
148
-		return $this->additional ;
148
+		return $this->additional;
149 149
 	}
150 150
 	/**
151 151
 	 * returns unused fields that are available for using in either default or additional list views
152 152
 	 */
153
-	function getAvailableFields ()
153
+	function getAvailableFields()
154 154
 	{
155
-		$this->availableFields = array ( ) ;
156
-		$lowerFieldList = array_change_key_case ( $this->listViewDefs ) ;
157
-		foreach ( $this->originalListViewDefs as $key => $def )
155
+		$this->availableFields = array( );
156
+		$lowerFieldList = array_change_key_case($this->listViewDefs);
157
+		foreach ($this->originalListViewDefs as $key => $def)
158 158
 		{
159
-			$key = strtolower ( $key ) ;
160
-			if (! isset ( $lowerFieldList [ $key ] ))
159
+			$key = strtolower($key);
160
+			if (!isset ($lowerFieldList [$key]))
161 161
 			{
162
-				$this->availableFields [ $key ] = $def ;
162
+				$this->availableFields [$key] = $def;
163 163
 			}
164 164
 		}
165
-		$GLOBALS['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields,true));
165
+		$GLOBALS['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields, true));
166 166
 		$modFields = !empty($this->module->field_name_map) ? $this->module->field_name_map : $this->module->field_defs;
167
-		foreach ( $modFields as $key => $def )
167
+		foreach ($modFields as $key => $def)
168 168
 		{
169
-			$fieldName = strtolower ( $key ) ;
169
+			$fieldName = strtolower($key);
170 170
             if ($fieldName == 'currency_id')
171 171
                 continue;
172
-			if (!isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
172
+			if (!isset ($lowerFieldList [$fieldName])) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
173 173
 			{
174 174
             // bug 19656: this test changed after 5.0.0b - we now remove all ID type fields - whether set as type, or dbtype, from the fielddefs
175
-            if ($this->isValidField($key, $def)){
176
-					$label = (isset ( $def [ 'vname' ] )) ? $def [ 'vname' ] : (isset($def [ 'label' ]) ? $def['label'] : $def['name']) ;
177
-					$this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
175
+            if ($this->isValidField($key, $def)) {
176
+					$label = (isset ($def ['vname'])) ? $def ['vname'] : (isset($def ['label']) ? $def['label'] : $def['name']);
177
+					$this->availableFields [$fieldName] = array('width' => '10', 'label' => $label);
178 178
 				}
179 179
 			}
180 180
 		}
181 181
 
182
-		return $this->availableFields ;
182
+		return $this->availableFields;
183 183
 	}
184 184
 
185 185
     function getFieldDefs()
@@ -190,19 +190,19 @@  discard block
 block discarded – undo
190 190
 	
191 191
 	function isValidField($key, $def) {
192 192
 	    //Allow fields that are studio visible  
193
-		if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible')
193
+		if (!empty ($def ['studio']) && $def ['studio'] == 'visible')
194 194
 		  return true;
195 195
 		  
196 196
 		//No ID fields
197
-		if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id'))
197
+		if ((!empty ($def ['dbType']) && $def ['dbType'] == 'id') || (!empty ($def ['type']) && $def ['type'] == 'id'))
198 198
 		  return false;
199 199
 		  
200 200
 		//only allow DB and custom fields (if a source is specified)
201
-	    if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields')
201
+	    if (!empty($def ['source']) && $def ['source'] != 'db' && $def ['source'] != 'custom_fields')
202 202
 		  return false;
203 203
 
204 204
 		//Dont ever show the "deleted" fields or "_name" fields
205
-		if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false))
205
+		if (strcmp($key, 'deleted') == 0 || (isset ($def ['name']) && strpos($def ['name'], "_name") !== false))
206 206
 	       return false;
207 207
 
208 208
 	    //If none of the "ifs" are true, the field is valid
@@ -210,124 +210,124 @@  discard block
 block discarded – undo
210 210
 	}
211 211
 	
212 212
 	
213
-	function getField ( $fieldName )
213
+	function getField($fieldName)
214 214
 	{
215
-		$fieldName = strtolower ( $fieldName ) ;
216
-		foreach ( $this->listViewDefs as $key => $def )
215
+		$fieldName = strtolower($fieldName);
216
+		foreach ($this->listViewDefs as $key => $def)
217 217
 		{
218
-			$key = strtolower ( $key ) ;
218
+			$key = strtolower($key);
219 219
 			if ($key == $fieldName)
220 220
 			{
221
-				return $def ;
221
+				return $def;
222 222
 			}
223 223
 		}
224
-		foreach ( $this->module->field_defs as $key => $def )
224
+		foreach ($this->module->field_defs as $key => $def)
225 225
 		{
226
-			$key = strtolower ( $key ) ;
226
+			$key = strtolower($key);
227 227
 			if ($key == $fieldName)
228 228
 			{
229
-				return $def ;
229
+				return $def;
230 230
 			}
231 231
 		}
232
-		return array ( ) ;
232
+		return array( );
233 233
 	}
234 234
 	function addRelateData($fieldname, $listfielddef) {
235
-		$modFieldDef = $this->module->field_defs [ strtolower ( $fieldname ) ];
235
+		$modFieldDef = $this->module->field_defs [strtolower($fieldname)];
236 236
 		if (!empty($modFieldDef['module']) && !empty($modFieldDef['id_name'])) {
237 237
 			$listfielddef['module'] = $modFieldDef['module'];
238 238
 			$listfielddef['id'] = strtoupper($modFieldDef['id_name']);
239 239
 			$listfielddef['link'] = true;
240
-			$listfielddef['related_fields'] = array (strtolower($modFieldDef['id_name']));
240
+			$listfielddef['related_fields'] = array(strtolower($modFieldDef['id_name']));
241 241
 		}
242 242
 		return $listfielddef;
243 243
 	}
244
-	function _loadLayoutFromRequest ()
244
+	function _loadLayoutFromRequest()
245 245
 	{
246 246
 	    $GLOBALS['log']->debug("ParserModifyListView->_loadLayoutFromRequest()");
247
-		$fields = array ( ) ;
248
-		$rejectTypes = array ( 'html' , 'enum' , 'text' ) ;
249
-		for ( $i = 0 ; isset ( $_POST [ 'group_' . $i ] ) && $i < 2 ; $i ++ )
247
+		$fields = array( );
248
+		$rejectTypes = array('html', 'enum', 'text');
249
+		for ($i = 0; isset ($_POST ['group_'.$i]) && $i < 2; $i++)
250 250
 		{
251 251
 			//echo "\n***group-$i Size:".sizeof($_POST['group_' . $i])."\n";
252
-			foreach ( $_POST [ 'group_' . $i ] as $field )
252
+			foreach ($_POST ['group_'.$i] as $field)
253 253
 			{
254
-				$fieldname = strtoupper ( $field ) ;
254
+				$fieldname = strtoupper($field);
255 255
 				//originalListViewDefs are all lower case
256
-				$lowerFieldName = strtolower ( $field ) ;
257
-				if (isset ( $this->originalListViewDefs [ $lowerFieldName ] ))
256
+				$lowerFieldName = strtolower($field);
257
+				if (isset ($this->originalListViewDefs [$lowerFieldName]))
258 258
 				{
259
-					$fields [ $fieldname ] = $this->originalListViewDefs [ $lowerFieldName ] ;
259
+					$fields [$fieldname] = $this->originalListViewDefs [$lowerFieldName];
260 260
 				} else
261 261
 				{
262 262
 					//check if we have the case wrong for custom fields
263
-					if (! isset ( $this->module->field_defs [ $fieldname ] ))
263
+					if (!isset ($this->module->field_defs [$fieldname]))
264 264
 					{
265
-						foreach ( $this->module->field_defs as $key => $value )
265
+						foreach ($this->module->field_defs as $key => $value)
266 266
 						{
267
-							if (strtoupper ( $key ) == $fieldname)
267
+							if (strtoupper($key) == $fieldname)
268 268
 							{
269
-								$fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $key ] [ 'vname' ] ) ;
270
-								break ;
269
+								$fields [$fieldname] = array('width' => 10, 'label' => $this->module->field_defs [$key] ['vname']);
270
+								break;
271 271
 							}
272 272
 						}
273 273
 					} else
274 274
 					{
275
-						$fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $fieldname ] [ 'vname' ] ) ;
275
+						$fields [$fieldname] = array('width' => 10, 'label' => $this->module->field_defs [$fieldname] ['vname']);
276 276
 					}
277 277
 					// sorting fields of certain types will cause a database engine problems
278 278
 					// we only check this for custom fields, as we assume that OOB fields have been independently confirmed as ok
279
-					if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] ) && (in_array ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ], $rejectTypes ) || isset($this->module->field_defs [ strtolower ( $fieldname ) ]['custom_module'])))
279
+					if (isset ($this->module->field_defs [strtolower($fieldname)]) && (in_array($this->module->field_defs [strtolower($fieldname)] ['type'], $rejectTypes) || isset($this->module->field_defs [strtolower($fieldname)]['custom_module'])))
280 280
 					{
281
-						$fields [ $fieldname ] [ 'sortable' ] = false ;
281
+						$fields [$fieldname] ['sortable'] = false;
282 282
 					}
283 283
 					// Bug 23728 - Make adding a currency type field default to setting the 'currency_format' to true
284
-					if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type ' ] ) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'currency') 
284
+					if (isset ($this->module->field_defs [strtolower($fieldname)] ['type ']) && $this->module->field_defs [strtolower($fieldname)] ['type'] == 'currency') 
285 285
 					{
286
-						$fields [ $fieldname ] [ 'currency_format' ] = true;
286
+						$fields [$fieldname] ['currency_format'] = true;
287 287
 					}
288 288
 				}
289
-				if (isset ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ] ))
289
+				if (isset ($_REQUEST [strtolower($fieldname).'width']))
290 290
 				{
291
-					$width = substr ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ], 6, 3 ) ;
292
-					if (strpos ( $width, "%" ) !== false)
291
+					$width = substr($_REQUEST [strtolower($fieldname).'width'], 6, 3);
292
+					if (strpos($width, "%") !== false)
293 293
 					{
294
-						$width = substr ( $width, 0, 2 ) ;
294
+						$width = substr($width, 0, 2);
295 295
 					}
296 296
 					if ($width < 101 && $width > 0)
297 297
 					{
298
-						$fields [ $fieldname ] [ 'width' ] = $width ;
298
+						$fields [$fieldname] ['width'] = $width;
299 299
 					}
300
-				} else if (isset ( $this->listViewDefs [ $fieldname ] [ 'width' ] ))
300
+				} else if (isset ($this->listViewDefs [$fieldname] ['width']))
301 301
 				{
302
-					$fields [ $fieldname ] [ 'width' ] = $this->listViewDefs [ $fieldname ] [ 'width' ] ;
302
+					$fields [$fieldname] ['width'] = $this->listViewDefs [$fieldname] ['width'];
303 303
 				}
304 304
 				//Get additional Data for relate fields
305
-				if (isset($this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ]) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'relate') {
306
-					$fields [ $fieldname ] = $this->addRelateData($field, $fields [ $fieldname ]);
305
+				if (isset($this->module->field_defs [strtolower($fieldname)] ['type']) && $this->module->field_defs [strtolower($fieldname)] ['type'] == 'relate') {
306
+					$fields [$fieldname] = $this->addRelateData($field, $fields [$fieldname]);
307 307
 				}
308
-				$fields [ $fieldname ] [ 'default' ] = ($i == 0) ;
308
+				$fields [$fieldname] ['default'] = ($i == 0);
309 309
 			}
310 310
 		}
311 311
 		// Add the reserved fields back in to the end of the default fields in the layout
312 312
 		// ASSUMPTION: reserved fields go back at the end
313 313
 		// First, load the reserved fields - we cannot assume that getDefaultFields has been called earlier when saving
314 314
 		$this->getDefaultFields();
315
-		foreach ( $this->reserved as $key => $def)
315
+		foreach ($this->reserved as $key => $def)
316 316
 		{
317
-		    $fields[ $key ] = $def;
317
+		    $fields[$key] = $def;
318 318
 		}
319 319
 		
320
-		return $fields ;
320
+		return $fields;
321 321
 	}
322
-	function handleSave ()
322
+	function handleSave()
323 323
 	{
324 324
 		$fields = $this->_loadLayoutFromRequest();
325
-		$this->_writeToFile($this->customFile,'ListView',$this->module_name,$fields,$this->_variables);
325
+		$this->_writeToFile($this->customFile, 'ListView', $this->module_name, $fields, $this->_variables);
326 326
 
327
-		$GLOBALS [ "listViewDefs" ] [ $this->module_name ] = $fields ;
327
+		$GLOBALS ["listViewDefs"] [$this->module_name] = $fields;
328 328
 		// now clear the cache so that the results are immediately visible
329
-		include_once ('include/TemplateHandler/TemplateHandler.php') ;
330
-		TemplateHandler::clearCache ( $this->module_name, "ListView.tpl" ) ; // not currently cached, but here for the future
329
+		include_once ('include/TemplateHandler/TemplateHandler.php');
330
+		TemplateHandler::clearCache($this->module_name, "ListView.tpl"); // not currently cached, but here for the future
331 331
 	}
332 332
 }
333 333
 ?>
Please login to merge, or discard this patch.
Braces   +22 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-die ( 'Not A Valid Entry Point' ) ;
2
+if (! defined ( 'sugarEntry' ) || ! sugarEntry) {
3
+    die ( 'Not A Valid Entry Point' ) ;
4
+}
4 5
 /*********************************************************************************
5 6
  * SugarCRM Community Edition is a customer relationship management program developed by
6 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -121,8 +122,7 @@  discard block
 block discarded – undo
121 122
 			    if (! isset($def['studio']) || $def['studio'] === true)
122 123
 			    {
123 124
 			        $this->defaults [ $key ] = $def ;
124
-			    }
125
-			    else
125
+			    } else
126 126
 			    // anything which doesn't go into the defaults is a reserved field - this makes sure we don't miss anything
127 127
 			    {
128 128
 			        $this->reserved [ $key ] = $def;
@@ -167,13 +167,16 @@  discard block
 block discarded – undo
167 167
 		foreach ( $modFields as $key => $def )
168 168
 		{
169 169
 			$fieldName = strtolower ( $key ) ;
170
-            if ($fieldName == 'currency_id')
171
-                continue;
172
-			if (!isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
170
+            if ($fieldName == 'currency_id') {
171
+                            continue;
172
+            }
173
+			if (!isset ( $lowerFieldList [ $fieldName ] )) {
174
+			    // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
173 175
 			{
174 176
             // bug 19656: this test changed after 5.0.0b - we now remove all ID type fields - whether set as type, or dbtype, from the fielddefs
175 177
             if ($this->isValidField($key, $def)){
176 178
 					$label = (isset ( $def [ 'vname' ] )) ? $def [ 'vname' ] : (isset($def [ 'label' ]) ? $def['label'] : $def['name']) ;
179
+			}
177 180
 					$this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
178 181
 				}
179 182
 			}
@@ -190,20 +193,24 @@  discard block
 block discarded – undo
190 193
 	
191 194
 	function isValidField($key, $def) {
192 195
 	    //Allow fields that are studio visible  
193
-		if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible')
194
-		  return true;
196
+		if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible') {
197
+				  return true;
198
+		}
195 199
 		  
196 200
 		//No ID fields
197
-		if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id'))
198
-		  return false;
201
+		if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id')) {
202
+				  return false;
203
+		}
199 204
 		  
200 205
 		//only allow DB and custom fields (if a source is specified)
201
-	    if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields')
202
-		  return false;
206
+	    if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields') {
207
+	    		  return false;
208
+	    }
203 209
 
204 210
 		//Dont ever show the "deleted" fields or "_name" fields
205
-		if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false))
206
-	       return false;
211
+		if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false)) {
212
+			       return false;
213
+		}
207 214
 
208 215
 	    //If none of the "ifs" are true, the field is valid
209 216
 	    return true;
Please login to merge, or discard this patch.
modules/AOR_Fields/vardefs.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	'table'=>'aor_fields',
27 27
 	'audited'=>false,
28 28
 	'duplicate_merge'=>true,
29
-	'fields'=>array (
29
+	'fields'=>array(
30 30
         'aor_report_id' =>
31
-        array (
31
+        array(
32 32
             'required' => false,
33 33
             'name' => 'aor_report_id',
34 34
             'vname' => 'LBL_AOR_REPORT_ID',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             'size' => '20',
48 48
         ),
49 49
         'field_order' =>
50
-        array (
50
+        array(
51 51
             'required' => false,
52 52
             'name' => 'field_order',
53 53
             'vname' => 'LBL_ORDER',
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
             'disable_num_format' => '',
69 69
         ),
70 70
         'module_path' =>
71
-        array (
71
+        array(
72 72
             'name' => 'module_path',
73 73
             'type' => 'longtext',
74 74
             'vname' => 'LBL_MODULE_PATH',
75 75
             'isnull' => true,
76 76
         ),
77 77
         'field' =>
78
-        array (
78
+        array(
79 79
             'required' => false,
80 80
             'name' => 'field',
81 81
             'vname' => 'LBL_FIELD',
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             'dependency' => false,
98 98
         ),
99 99
         'display' =>
100
-        array (
100
+        array(
101 101
             'required' => false,
102 102
             'name' => 'display',
103 103
             'vname' => 'LBL_DISPLAY',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'studio' => 'visible',
116 116
         ),
117 117
         'link' =>
118
-        array (
118
+        array(
119 119
             'required' => false,
120 120
             'name' => 'link',
121 121
             'vname' => 'LBL_LINK',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             'studio' => 'visible',
134 134
         ),
135 135
         'label' =>
136
-        array (
136
+        array(
137 137
             'required' => false,
138 138
             'name' => 'label',
139 139
             'vname' => 'LBL_LABEL',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             'size' => '20',
153 153
         ),
154 154
         'field_function' =>
155
-        array (
155
+        array(
156 156
             'required' => false,
157 157
             'name' => 'field_function',
158 158
             'vname' => 'LBL_FUNCTION',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             'dependency' => false,
175 175
         ),
176 176
         'sort_by' =>
177
-        array (
177
+        array(
178 178
             'required' => false,
179 179
             'name' => 'sort_by',
180 180
             'vname' => 'LBL_SORT',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             'dependency' => false,
197 197
         ),
198 198
         'format' =>
199
-            array (
199
+            array(
200 200
                 'required' => false,
201 201
                 'name' => 'format',
202 202
                 'vname' => 'LBL_FORMAT',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 'dependency' => false,
219 219
             ),
220 220
         'total' =>
221
-            array (
221
+            array(
222 222
                 'required' => false,
223 223
                 'name' => 'total',
224 224
                 'vname' => 'LBL_TOTAL',
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                 'dependency' => false,
241 241
             ),
242 242
         'sort_order' =>
243
-        array (
243
+        array(
244 244
             'required' => false,
245 245
             'name' => 'sort_order',
246 246
             'vname' => 'LBL_SORT_ORDER',
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             'dependency' => false,
263 263
         ),
264 264
         'group_by' =>
265
-        array (
265
+        array(
266 266
             'required' => false,
267 267
             'name' => 'group_by',
268 268
             'vname' => 'LBL_GROUP',
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             'studio' => 'visible',
281 281
         ),
282 282
         'group_order' =>
283
-        array (
283
+        array(
284 284
             'required' => false,
285 285
             'name' => 'group_order',
286 286
             'vname' => 'LBL_GROUP_ORDER',
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             'dependency' => false,
303 303
         ),
304 304
         'group_display' =>
305
-        array (
305
+        array(
306 306
             'required' => false,
307 307
             'name' => 'group_display',
308 308
             'vname' => 'LBL_GROUP_DISPLAY',
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             'studio' => 'visible',
321 321
         ),
322 322
         'aor_reports' =>
323
-        array (
323
+        array(
324 324
             'name' => 'aor_reports',
325 325
             'type' => 'link',
326 326
             'relationship' => 'aor_report_aor_fields',
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             'source'=>'non-db',
330 330
         ),
331 331
     ),
332
-    'relationships'=>array (
332
+    'relationships'=>array(
333 333
     ),
334 334
     'indices' => array(
335 335
         array(
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	'optimistic_locking'=>true,
342 342
 		'unified_search'=>true,
343 343
 );
344
-if (!class_exists('VardefManager')){
344
+if (!class_exists('VardefManager')) {
345 345
         require_once('include/SugarObjects/VardefManager.php');
346 346
 }
347
-VardefManager::createVardef('AOR_Fields','AOR_Field', array('basic'));
347
+VardefManager::createVardef('AOR_Fields', 'AOR_Field', array('basic'));
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 $dictionary['AOR_Field'] = array(
26
-	'table'=>'aor_fields',
27
-	'audited'=>false,
28
-	'duplicate_merge'=>true,
29
-	'fields'=>array (
26
+    'table'=>'aor_fields',
27
+    'audited'=>false,
28
+    'duplicate_merge'=>true,
29
+    'fields'=>array (
30 30
         'aor_report_id' =>
31 31
         array (
32 32
             'required' => false,
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
             'fields' => array('aor_report_id'),
339 339
         ),
340 340
     ),
341
-	'optimistic_locking'=>true,
342
-		'unified_search'=>true,
341
+    'optimistic_locking'=>true,
342
+        'unified_search'=>true,
343 343
 );
344 344
 if (!class_exists('VardefManager')){
345 345
         require_once('include/SugarObjects/VardefManager.php');
Please login to merge, or discard this patch.
modules/Reminders_Invitees/Reminder_Invitee.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
         parent::Basic();
61 61
     }
62 62
 
63
-    public function bean_implements($interface){
64
-        switch($interface){
63
+    public function bean_implements($interface) {
64
+        switch ($interface) {
65 65
             case 'ACL': return true;
66 66
         }
67 67
         return false;
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
     public static function saveRemindersInviteesData($reminderId, $inviteesData) {
77 77
         $savedInviteeIds = array();
78
-        foreach($inviteesData as $k => $inviteeData) {
79
-            if(isset($_POST['isDuplicate']) && $_POST['isDuplicate']) $inviteeData->id = '';
78
+        foreach ($inviteesData as $k => $inviteeData) {
79
+            if (isset($_POST['isDuplicate']) && $_POST['isDuplicate']) $inviteeData->id = '';
80 80
             $reminderInviteeBean = BeanFactory::getBean('Reminders_Invitees', $inviteeData->id);
81 81
             $reminderInviteeBean->reminder_id = $reminderId;
82 82
             $reminderInviteeBean->related_invitee_module = $inviteeData->module;
83 83
             $reminderInviteeBean->related_invitee_module_id = $inviteeData->module_id;
84
-            if(!$inviteeData->id) {
84
+            if (!$inviteeData->id) {
85 85
                 $reminderInviteeBean->save();
86 86
                 $savedInviteeIds[] = $reminderInviteeBean->id;
87 87
             }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$ret = array();
109 109
 		$reminderInviteeBeen = new Reminder_Invitee();
110 110
 		$reminderInvitees = $reminderInviteeBeen->get_full_list("reminders_invitees.date_entered", "reminders_invitees.reminder_id = '$reminderId'");
111
-        if($reminderInvitees) {
111
+        if ($reminderInvitees) {
112 112
             foreach ($reminderInvitees as $reminderInvitee) {
113 113
                 $ret[] = array(
114 114
                     'id' => $isDuplicate ? null : $reminderInvitee->id,
@@ -125,21 +125,21 @@  discard block
 block discarded – undo
125 125
         $retValue = "unknown";
126 126
 
127 127
         $bean = BeanFactory::getBean($module, $moduleId);
128
-        switch($module) {
128
+        switch ($module) {
129 129
             case 'Users':
130 130
             case 'Contacts':
131 131
             case 'Leads':
132 132
             default:
133
-                if(isset($bean->first_name) && isset($bean->last_name)) {
133
+                if (isset($bean->first_name) && isset($bean->last_name)) {
134 134
                     $retValue = "{$bean->first_name} {$bean->last_name}";
135 135
                 }
136
-                else if(isset($bean->name)) {
136
+                else if (isset($bean->name)) {
137 137
                     $retValue = $bean->name;
138 138
                 }
139
-                else if(isset($bean->email)) {
139
+                else if (isset($bean->email)) {
140 140
                     $retValue = $bean->email;
141 141
                 }
142
-                if(!$retValue) {
142
+                if (!$retValue) {
143 143
                     $retValue = "$module ($moduleId)";
144 144
                 }
145 145
                 break;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
     public static function deleteRemindersInviteesMultiple($reminderId, $inviteeIds = array()) {
157 157
         $invitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list("", "reminders_invitees.reminder_id = '$reminderId'");
158
-        if($invitees) {
158
+        if ($invitees) {
159 159
             foreach ($invitees as $invitee) {
160 160
                 if (!in_array($invitee->id, $inviteeIds)) {
161 161
                     $invitee->mark_deleted($invitee->id);
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,7 +76,9 @@  discard block
 block discarded – undo
76 76
     public static function saveRemindersInviteesData($reminderId, $inviteesData) {
77 77
         $savedInviteeIds = array();
78 78
         foreach($inviteesData as $k => $inviteeData) {
79
-            if(isset($_POST['isDuplicate']) && $_POST['isDuplicate']) $inviteeData->id = '';
79
+            if(isset($_POST['isDuplicate']) && $_POST['isDuplicate']) {
80
+                $inviteeData->id = '';
81
+            }
80 82
             $reminderInviteeBean = BeanFactory::getBean('Reminders_Invitees', $inviteeData->id);
81 83
             $reminderInviteeBean->reminder_id = $reminderId;
82 84
             $reminderInviteeBean->related_invitee_module = $inviteeData->module;
@@ -84,8 +86,7 @@  discard block
 block discarded – undo
84 86
             if(!$inviteeData->id) {
85 87
                 $reminderInviteeBean->save();
86 88
                 $savedInviteeIds[] = $reminderInviteeBean->id;
87
-            }
88
-            else {
89
+            } else {
89 90
                 $addedInvitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list("", "reminders_invitees.id != '{$inviteeData->id}' AND reminders_invitees.reminder_id = '{$reminderInviteeBean->reminder_id}' AND reminders_invitees.related_invitee_module = '{$reminderInviteeBean->related_invitee_module}' AND reminders_invitees.related_invitee_module_id = '{$reminderInviteeBean->related_invitee_module_id}'");
90 91
                 if (!$addedInvitees) {
91 92
                     $reminderInviteeBean->save();
@@ -132,11 +133,9 @@  discard block
 block discarded – undo
132 133
             default:
133 134
                 if(isset($bean->first_name) && isset($bean->last_name)) {
134 135
                     $retValue = "{$bean->first_name} {$bean->last_name}";
135
-                }
136
-                else if(isset($bean->name)) {
136
+                } else if(isset($bean->name)) {
137 137
                     $retValue = $bean->name;
138
-                }
139
-                else if(isset($bean->email)) {
138
+                } else if(isset($bean->email)) {
140 139
                     $retValue = $bean->email;
141 140
                 }
142 141
                 if(!$retValue) {
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
         return false;
68 68
     }
69 69
 
70
-	/**
71
-	 * Save multiple reminders invitees data.
72
-	 *
73
-	 * @param string $reminderId Related Reminder GUID
74
-	 * @param array $inviteesData Invitees Data
75
-	 */
70
+    /**
71
+     * Save multiple reminders invitees data.
72
+     *
73
+     * @param string $reminderId Related Reminder GUID
74
+     * @param array $inviteesData Invitees Data
75
+     */
76 76
     public static function saveRemindersInviteesData($reminderId, $inviteesData) {
77 77
         $savedInviteeIds = array();
78 78
         foreach($inviteesData as $k => $inviteeData) {
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
         self::deleteRemindersInviteesMultiple($reminderId, $savedInviteeIds);
99 99
     }
100 100
 
101
-	/**
102
-	 * Load reminders invitees data.
103
-	 *
104
-	 * @param string $reminderId Related Reminder GUID
105
-	 * @return array Invitees data
106
-	 */
107
-	public static function loadRemindersInviteesData($reminderId, $isDuplicate = false) {
108
-		$ret = array();
109
-		$reminderInviteeBeen = new Reminder_Invitee();
110
-		$reminderInvitees = $reminderInviteeBeen->get_full_list("reminders_invitees.date_entered", "reminders_invitees.reminder_id = '$reminderId'");
101
+    /**
102
+     * Load reminders invitees data.
103
+     *
104
+     * @param string $reminderId Related Reminder GUID
105
+     * @return array Invitees data
106
+     */
107
+    public static function loadRemindersInviteesData($reminderId, $isDuplicate = false) {
108
+        $ret = array();
109
+        $reminderInviteeBeen = new Reminder_Invitee();
110
+        $reminderInvitees = $reminderInviteeBeen->get_full_list("reminders_invitees.date_entered", "reminders_invitees.reminder_id = '$reminderId'");
111 111
         if($reminderInvitees) {
112 112
             foreach ($reminderInvitees as $reminderInvitee) {
113 113
                 $ret[] = array(
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
                 );
119 119
             }
120 120
         }
121
-		return $ret;
122
-	}
121
+        return $ret;
122
+    }
123 123
 
124 124
     private static function getInviteeName($module, $moduleId) {
125 125
         $retValue = "unknown";
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
         return $retValue;
148 148
     }
149 149
 
150
-	/**
151
-	 * Delete reminders invitees multiple.
152
-	 *
153
-	 * @param string $reminderId Related Reminder GUID
154
-	 * @param array $inviteeIds (optional) Exluded Invitees GUIDs, the invitee will not deleted if this argument contains that. Default is empty array.
155
-	 */
150
+    /**
151
+     * Delete reminders invitees multiple.
152
+     *
153
+     * @param string $reminderId Related Reminder GUID
154
+     * @param array $inviteeIds (optional) Exluded Invitees GUIDs, the invitee will not deleted if this argument contains that. Default is empty array.
155
+     */
156 156
     public static function deleteRemindersInviteesMultiple($reminderId, $inviteeIds = array()) {
157 157
         $invitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list("", "reminders_invitees.reminder_id = '$reminderId'");
158 158
         if($invitees) {
Please login to merge, or discard this patch.
modules/AOP_Case_Updates/Case_Updates.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $bDate = $b->fetched_row['date_entered'];
160 160
         if($aDate < $bDate){
161 161
             return -1;
162
-        }elseif($aDate > $bDate){
162
+        } elseif($aDate > $bDate){
163 163
             return 1;
164 164
         }
165 165
         return 0;
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
     global $mod_strings;
196 196
     if($update->contact_id){
197 197
         $name = $update->getUpdateContact()->name;
198
-    }elseif($update->assigned_user_id){
198
+    } elseif($update->assigned_user_id){
199 199
         $name = $update->getUpdateUser()->name;
200
-    }else{
200
+    } else{
201 201
         $name = "Unknown";
202 202
     }
203 203
     $html = "<a href='' onclick='toggleCaseUpdate(\"".$update->id."\");return false;'>";
@@ -281,7 +281,9 @@  discard block
 block discarded – undo
281 281
     global $action;
282 282
 
283 283
     //on DetailView only
284
-    if($action != 'DetailView') return;
284
+    if($action != 'DetailView') {
285
+        return;
286
+    }
285 287
 
286 288
     //current record id
287 289
     $record = $_GET['record'];
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 
26
-function display_updates($focus, $field, $value, $view){
26
+function display_updates($focus, $field, $value, $view) {
27 27
     global $mod_strings;
28 28
 
29 29
     $hideImage = SugarThemeRegistry::current()->getImageURL('basic_search.gif');
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 </script>
128 128
 A;
129 129
 
130
-    $updates = $focus->get_linked_beans('aop_case_updates',"AOP_Case_Updates");
131
-    if(!$updates || is_null($focus->id)){
130
+    $updates = $focus->get_linked_beans('aop_case_updates', "AOP_Case_Updates");
131
+    if (!$updates || is_null($focus->id)) {
132 132
         $html .= quick_edit_case_updates($focus);
133 133
         return $html;
134 134
         //return $mod_strings['LBL_NO_CASE_UPDATES'];
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 EOD;
155 155
 
156 156
 
157
-    usort($updates,function($a,$b){
157
+    usort($updates, function($a, $b) {
158 158
         $aDate = $a->fetched_row['date_entered'];
159 159
         $bDate = $b->fetched_row['date_entered'];
160
-        if($aDate < $bDate){
160
+        if ($aDate < $bDate) {
161 161
             return -1;
162
-        }elseif($aDate > $bDate){
162
+        }elseif ($aDate > $bDate) {
163 163
             return 1;
164 164
         }
165 165
         return 0;
166 166
     });
167 167
 
168
-    foreach($updates as $update){
168
+    foreach ($updates as $update) {
169 169
         $html .= display_single_update($update, $hideImage);
170 170
     }
171 171
     $html .= "</div>";
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 /**
179 179
  * @return mixed|string|void
180 180
  */
181
-function display_update_form(){
181
+function display_update_form() {
182 182
     global $mod_strings, $app_strings;
183
-    $sugar_smarty	= new Sugar_Smarty();
183
+    $sugar_smarty = new Sugar_Smarty();
184 184
     $sugar_smarty->assign('MOD', $mod_strings);
185 185
     $sugar_smarty->assign('APP', $app_strings);
186 186
     return $sugar_smarty->fetch('modules/AOP_Case_Updates/tpl/caseUpdateForm.tpl');
@@ -191,23 +191,23 @@  discard block
 block discarded – undo
191 191
  * @param SugarBean $update
192 192
  * @return string - html to be displayed
193 193
  */
194
-function getUpdateDisplayHead(SugarBean $update){
194
+function getUpdateDisplayHead(SugarBean $update) {
195 195
     global $mod_strings;
196
-    if($update->contact_id){
196
+    if ($update->contact_id) {
197 197
         $name = $update->getUpdateContact()->name;
198
-    }elseif($update->assigned_user_id){
198
+    }elseif ($update->assigned_user_id) {
199 199
         $name = $update->getUpdateUser()->name;
200
-    }else{
200
+    } else {
201 201
         $name = "Unknown";
202 202
     }
203 203
     $html = "<a href='' onclick='toggleCaseUpdate(\"".$update->id."\");return false;'>";
204 204
     $html .= "<img  id='caseUpdate".$update->id."Image' class='caseUpdateImage' src='".SugarThemeRegistry::current()->getImageURL('basic_search.gif')."'>";
205 205
     $html .= "</a>";
206
-    $html .= "<span>".($update->internal ? "<strong>" . $mod_strings['LBL_INTERNAL'] . "</strong> " : '') .$name . " ".$update->date_entered."</span><br>";
207
-    $notes = $update->get_linked_beans('notes','Notes');
208
-    if($notes){
209
-        $html.= $mod_strings['LBL_AOP_CASE_ATTACHMENTS'];
210
-        foreach($notes as $note){
206
+    $html .= "<span>".($update->internal ? "<strong>".$mod_strings['LBL_INTERNAL']."</strong> " : '').$name." ".$update->date_entered."</span><br>";
207
+    $notes = $update->get_linked_beans('notes', 'Notes');
208
+    if ($notes) {
209
+        $html .= $mod_strings['LBL_AOP_CASE_ATTACHMENTS'];
210
+        foreach ($notes as $note) {
211 211
             $html .= "<a href='index.php?module=Notes&action=DetailView&record={$note->id}'>{$note->filename}</a>&nbsp;";
212 212
         }
213 213
     }
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
  * @param AOP_Case_Updates $update
221 221
  * @return string - the html for the update
222 222
  */
223
-function display_single_update(AOP_Case_Updates $update){
223
+function display_single_update(AOP_Case_Updates $update) {
224 224
 
225 225
     /*if assigned user*/
226
-    if($update->assigned_user_id){
226
+    if ($update->assigned_user_id) {
227 227
         /*if internal update*/
228
-        if ($update->internal){
228
+        if ($update->internal) {
229 229
             $html = "<div id='caseStyleInternal'>".getUpdateDisplayHead($update);
230 230
             $html .= "<div id='caseUpdate".$update->id."' class='caseUpdate'>";
231 231
             $html .= nl2br(html_entity_decode($update->description));
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     }
244 244
 
245 245
     /*if contact user*/
246
-    if($update->contact_id){
246
+    if ($update->contact_id) {
247 247
         $html = "<div id='extramargin'><div id='caseStyleContact'>".getUpdateDisplayHead($update);
248 248
         $html .= "<div id='caseUpdate".$update->id."' class='caseUpdate'>";
249 249
         $html .= nl2br(html_entity_decode($update->description));
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
  * @param $case
260 260
  * @return string - html link
261 261
  */
262
-function display_case_attachments($case){
262
+function display_case_attachments($case) {
263 263
     $html = '';
264
-    $notes = $case->get_linked_beans('notes','Notes');
265
-    if($notes){
266
-        foreach($notes as $note){
264
+    $notes = $case->get_linked_beans('notes', 'Notes');
265
+    if ($notes) {
266
+        foreach ($notes as $note) {
267 267
             $html .= "<a href='index.php?module=Notes&action=DetailView&record={$note->id}'>{$note->filename}</a>&nbsp;";
268 268
         }
269 269
     }
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return string - the html to be displayed and javascript
279 279
  */
280
-function quick_edit_case_updates($case){
280
+function quick_edit_case_updates($case) {
281 281
     global $action;
282 282
 
283 283
     //on DetailView only
284
-    if($action != 'DetailView') return;
284
+    if ($action != 'DetailView') return;
285 285
 
286 286
     //current record id
287 287
     $record = $_GET['record'];
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
     $roles = $acl->getUserRoles($id);
295 295
 
296 296
     //Return if user cannot edit cases
297
-    if(in_array( "no edit cases", $roles) || $roles === "no edit cases"){
297
+    if (in_array("no edit cases", $roles) || $roles === "no edit cases") {
298 298
 
299 299
         return;
300 300
     }
301 301
     $internalChecked = '';
302
-    if($case->internal){
302
+    if ($case->internal) {
303 303
         $internalChecked = "checked='checked'";
304 304
     }
305 305
     $html = <<< EOD
Please login to merge, or discard this patch.