@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -51,8 +53,9 @@ discard block |
||
51 | 53 | static function newRelationship ($definition = array()) |
52 | 54 | { |
53 | 55 | // handle the case where a relationship_type is not provided - set it to Many-To-Many as this was the usual type in ModuleBuilder |
54 | - if (! isset ( $definition [ 'relationship_type' ] )) |
|
55 | - $definition [ 'relationship_type' ] = MB_MANYTOMANY ; |
|
56 | + if (! isset ( $definition [ 'relationship_type' ] )) { |
|
57 | + $definition [ 'relationship_type' ] = MB_MANYTOMANY ; |
|
58 | + } |
|
56 | 59 | |
57 | 60 | if (!empty ($definition['for_activities']) && $definition['for_activities'] == true) { |
58 | 61 | require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php'; |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -93,8 +95,9 @@ discard block |
||
93 | 95 | */ |
94 | 96 | function buildSubpanelDefinitions () |
95 | 97 | { |
96 | - if ($this->relationship_only) |
|
97 | - return array () ; |
|
98 | + if ($this->relationship_only) { |
|
99 | + return array () ; |
|
100 | + } |
|
98 | 101 | |
99 | 102 | $source = ""; |
100 | 103 | if ($this->rhs_module == $this->lhs_module) |
@@ -142,8 +145,9 @@ discard block |
||
142 | 145 | */ |
143 | 146 | function buildFieldsToLayouts () |
144 | 147 | { |
145 | - if ($this->relationship_only) |
|
146 | - return array () ; |
|
148 | + if ($this->relationship_only) { |
|
149 | + return array () ; |
|
150 | + } |
|
147 | 151 | |
148 | 152 | return array( $this->rhs_module =>$this->getValidDBName($this->relationship_name . "_name")); // this must match the name of the relate field from buildVardefs |
149 | 153 | } |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -113,8 +115,9 @@ discard block |
||
113 | 115 | */ |
114 | 116 | function buildFieldsToLayouts () |
115 | 117 | { |
116 | - if ($this->relationship_only) |
|
117 | - return array () ; |
|
118 | + if ($this->relationship_only) { |
|
119 | + return array () ; |
|
120 | + } |
|
118 | 121 | |
119 | 122 | return array( $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") ) ; // this must match the name of the relate field from buildVardefs |
120 | 123 | } |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -173,16 +175,18 @@ discard block |
||
173 | 175 | */ |
174 | 176 | function buildFieldsToLayouts () |
175 | 177 | { |
176 | - if ($this->relationship_only) |
|
177 | - return array () ; |
|
178 | + if ($this->relationship_only) { |
|
179 | + return array () ; |
|
180 | + } |
|
178 | 181 | |
179 | 182 | return array( $this->rhs_module => $this->relationship_name . "_name" ) ; // this must match the name of the relate field from buildVardefs |
180 | 183 | } |
181 | 184 | |
182 | 185 | function buildSubpanelDefinitions () |
183 | 186 | { |
184 | - if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module])) |
|
185 | - return array () ; |
|
187 | + if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module])) { |
|
188 | + return array () ; |
|
189 | + } |
|
186 | 190 | |
187 | 191 | ActivitiesRelationship::$subpanelsAdded[$this->lhs_module] = true; |
188 | 192 | $relationshipName = substr($this->relationship_name, 0, strrpos($this->relationship_name, '_')); |
@@ -1,6 +1,7 @@ discard block |
||
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 |
||
48 | 49 | function ParserLabel ($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 | /** |
@@ -68,9 +70,11 @@ discard block |
||
68 | 70 | $labels [ strtoupper(substr ( $key, 6 )) ] = SugarCleaner::cleanHtml(from_html($value),false); |
69 | 71 | } |
70 | 72 | } |
71 | - if (!empty($this->packageName)) //we are in Module builder |
|
73 | + if (!empty($this->packageName)) { |
|
74 | + //we are in Module builder |
|
72 | 75 | { |
73 | 76 | return self::addLabels ( $language, $labels, $this->moduleName, "custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/language" ) ; |
77 | + } |
|
74 | 78 | } else |
75 | 79 | { |
76 | 80 | return self::addLabels ( $language, $labels, $this->moduleName ) ; |
@@ -192,7 +196,7 @@ discard block |
||
192 | 196 | { |
193 | 197 | // obtain $mod_strings |
194 | 198 | include ($filename) ; |
195 | - }else if($forRelationshipLabel){ |
|
199 | + } else if($forRelationshipLabel){ |
|
196 | 200 | $fh = fopen ($filename, 'a'); |
197 | 201 | fclose($fh); |
198 | 202 | } |
@@ -271,8 +275,9 @@ discard block |
||
271 | 275 | } |
272 | 276 | } |
273 | 277 | |
274 | - foreach ($mod_strings as $key => $val) |
|
275 | - $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
278 | + foreach ($mod_strings as $key => $val) { |
|
279 | + $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
280 | + } |
|
276 | 281 | |
277 | 282 | $failed_to_write = false; |
278 | 283 | try { |
@@ -314,8 +319,9 @@ discard block |
||
314 | 319 | } |
315 | 320 | } |
316 | 321 | |
317 | - foreach ($mod_strings as $key => $val) |
|
318 | - $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
322 | + foreach ($mod_strings as $key => $val) { |
|
323 | + $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
324 | + } |
|
319 | 325 | |
320 | 326 | $failed_to_write = false; |
321 | 327 | try { |
@@ -1,5 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -1,6 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -1,6 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -116,8 +118,9 @@ discard block |
||
116 | 118 | */ |
117 | 119 | function _writeToFile ($file,$view,$moduleName,$defs,$variables) |
118 | 120 | { |
119 | - if(file_exists($file)) |
|
120 | - unlink($file); |
|
121 | + if(file_exists($file)) { |
|
122 | + unlink($file); |
|
123 | + } |
|
121 | 124 | |
122 | 125 | mkdir_recursive ( dirname ( $file ) ) ; |
123 | 126 | $GLOBALS['log']->debug("ModuleBuilderParser->_writeFile(): file=".$file); |
@@ -159,8 +162,7 @@ discard block |
||
159 | 162 | // $GLOBALS['log']->debug("parser.modifylayout.php->_writeFile(): out=".print_r($out,true)); |
160 | 163 | fputs( $fh, $out); |
161 | 164 | fclose( $fh ); |
162 | - } |
|
163 | - else |
|
165 | + } else |
|
164 | 166 | { |
165 | 167 | $GLOBALS['log']->fatal("ModuleBuilderParser->_writeFile() Could not write new viewdef file ".$file); |
166 | 168 | } |