@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | include($this->mbModule->path .'/language/'.$current_language.'.lang.php'); |
145 | 145 | $this->mbModule->setModStrings($current_language,$mod_strings); |
146 | - }elseif(file_exists($this->mbModule->path. '/language/en_us.lang.php')){ |
|
146 | + } elseif(file_exists($this->mbModule->path. '/language/en_us.lang.php')){ |
|
147 | 147 | include($this->mbModule->path .'/language/en_us.lang.php'); |
148 | 148 | $this->mbModule->setModStrings('en_us',$mod_strings); |
149 | 149 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if($k != $module_name) |
170 | 170 | { |
171 | 171 | $titleLBL[$k]=translate("LBL_".strtoupper($k),'ModuleBuilder'); |
172 | - }else{ |
|
172 | + } else{ |
|
173 | 173 | $titleLBL[$k]=$k; |
174 | 174 | } |
175 | 175 | foreach($v as $field => $def) |
@@ -229,12 +229,15 @@ discard block |
||
229 | 229 | $def |
230 | 230 | ) |
231 | 231 | { |
232 | - if(!empty($def['parent_id'])) |
|
233 | - unset($def['parent_id']); |
|
234 | - if(!empty($def['parent_type'])) |
|
235 | - unset($def['parent_type']); |
|
236 | - if(!empty($def['currency_id'])) |
|
237 | - unset($def['currency_id']); |
|
232 | + if(!empty($def['parent_id'])) { |
|
233 | + unset($def['parent_id']); |
|
234 | + } |
|
235 | + if(!empty($def['parent_type'])) { |
|
236 | + unset($def['parent_type']); |
|
237 | + } |
|
238 | + if(!empty($def['currency_id'])) { |
|
239 | + unset($def['currency_id']); |
|
240 | + } |
|
238 | 241 | return $def; |
239 | 242 | } |
240 | 243 | |
@@ -245,23 +248,28 @@ discard block |
||
245 | 248 | if (isset($def['studio'])) { |
246 | 249 | if (is_array($def [ 'studio' ])) |
247 | 250 | { |
248 | - if (isset($def['studio']['editField']) && $def['studio']['editField'] == true) |
|
249 | - return true; |
|
250 | - if (isset($def['studio']['required']) && $def['studio']['required']) |
|
251 | - return true; |
|
251 | + if (isset($def['studio']['editField']) && $def['studio']['editField'] == true) { |
|
252 | + return true; |
|
253 | + } |
|
254 | + if (isset($def['studio']['required']) && $def['studio']['required']) { |
|
255 | + return true; |
|
256 | + } |
|
252 | 257 | |
253 | 258 | } else |
254 | 259 | { |
255 | - if ($def['studio'] == 'visible') |
|
256 | - return true; |
|
257 | - if ($def['studio'] == 'hidden' || $def['studio'] == 'false' || !$def['studio'] ) |
|
258 | - return false; |
|
260 | + if ($def['studio'] == 'visible') { |
|
261 | + return true; |
|
262 | + } |
|
263 | + if ($def['studio'] == 'hidden' || $def['studio'] == 'false' || !$def['studio'] ) { |
|
264 | + return false; |
|
265 | + } |
|
259 | 266 | } |
260 | 267 | } |
261 | 268 | if (empty($def ['source']) || $def ['source'] == 'db' || $def ['source'] == 'custom_fields') |
262 | 269 | { |
263 | - if ($def ['type'] != 'id' && (empty($def ['dbType']) || $def ['dbType'] != 'id')) |
|
264 | - return true; |
|
270 | + if ($def ['type'] != 'id' && (empty($def ['dbType']) || $def ['dbType'] != 'id')) { |
|
271 | + return true; |
|
272 | + } |
|
265 | 273 | } |
266 | 274 | |
267 | 275 | return false; |
@@ -66,14 +66,17 @@ discard block |
||
66 | 66 | ) |
67 | 67 | { |
68 | 68 | $fv = new FieldViewer(); |
69 | - if(empty($_REQUEST['field'])&& !empty($_REQUEST['name']))$_REQUEST['field'] = $_REQUEST['name']; |
|
69 | + if(empty($_REQUEST['field'])&& !empty($_REQUEST['name'])) { |
|
70 | + $_REQUEST['field'] = $_REQUEST['name']; |
|
71 | + } |
|
70 | 72 | $field_name = ''; |
71 | - if(!empty($this->view_object_map['field_name'])) |
|
72 | - $field_name = $this->view_object_map['field_name']; |
|
73 | - elseif(!empty($_REQUEST['field'])) |
|
74 | - $field_name = $_REQUEST['field']; |
|
75 | - else |
|
76 | - $field_name = ''; |
|
73 | + if(!empty($this->view_object_map['field_name'])) { |
|
74 | + $field_name = $this->view_object_map['field_name']; |
|
75 | + } elseif(!empty($_REQUEST['field'])) { |
|
76 | + $field_name = $_REQUEST['field']; |
|
77 | + } else { |
|
78 | + $field_name = ''; |
|
79 | + } |
|
77 | 80 | |
78 | 81 | $action = 'saveField'; // tyoung bug 17606: default action is to save as a dynamic field; but for standard OOB |
79 | 82 | // fields we override this so don't create a new dynamic field instead of updating the existing field |
@@ -81,16 +84,18 @@ discard block |
||
81 | 84 | $isClone = false; |
82 | 85 | if(!empty($this->view_object_map['is_clone']) && $this->view_object_map['is_clone'] |
83 | 86 | && (strcmp($field_name, "name") != 0) // bug #35767, do not allow cloning of name field |
84 | - ) |
|
85 | - $isClone = true; |
|
87 | + ) { |
|
88 | + $isClone = true; |
|
89 | + } |
|
86 | 90 | /* |
87 | 91 | $field_types = array('varchar'=>'YourField', 'int'=>'Integer', 'float'=>'Decimal','bool'=>'Checkbox','enum'=>'DropDown', |
88 | 92 | 'date'=>'Date', 'phone' => 'Phone', 'currency' => 'Currency', 'html' => 'HTML', 'radioenum' => 'Radio', |
89 | 93 | 'relate' => 'Relate', 'address' => 'Address', 'text' => 'TextArea', 'url' => 'Link'); |
90 | 94 | */ |
91 | 95 | $field_types = $GLOBALS['mod_strings']['fieldTypes']; |
92 | - if (isset($field_types['encrypt'])) |
|
93 | - unset($field_types['encrypt']); |
|
96 | + if (isset($field_types['encrypt'])) { |
|
97 | + unset($field_types['encrypt']); |
|
98 | + } |
|
94 | 99 | $field_name_exceptions = array( |
95 | 100 | //bug 22264: Field name must not be an SQL keyword. |
96 | 101 | //Taken from SQL Server's list of reserved keywords; http://msdn.microsoft.com/en-us/library/aa238507(SQL.80).aspx |
@@ -163,12 +168,13 @@ discard block |
||
163 | 168 | } |
164 | 169 | |
165 | 170 | if(empty($vardef['name'])){ |
166 | - if(!empty($_REQUEST['type'])) |
|
167 | - $vardef['type'] = $_REQUEST['type']; |
|
171 | + if(!empty($_REQUEST['type'])) { |
|
172 | + $vardef['type'] = $_REQUEST['type']; |
|
173 | + } |
|
168 | 174 | $fv->ss->assign('hideLevel', 0); |
169 | - }elseif(isset($vardef['custom_module'])){ |
|
175 | + } elseif(isset($vardef['custom_module'])){ |
|
170 | 176 | $fv->ss->assign('hideLevel', 2); |
171 | - }else{ |
|
177 | + } else{ |
|
172 | 178 | $action = 'saveSugarField'; // tyoung - for OOB fields we currently only support modifying the label |
173 | 179 | $fv->ss->assign('hideLevel', 3); |
174 | 180 | } |
@@ -196,10 +202,14 @@ discard block |
||
196 | 202 | } |
197 | 203 | if (!empty($def['type']) && $def['type'] == "enum" && $field != $vardef['name']) |
198 | 204 | { |
199 | - if(!empty($def['studio']) && $def['studio'] == "false") continue; //bug51866 |
|
205 | + if(!empty($def['studio']) && $def['studio'] == "false") { |
|
206 | + continue; |
|
207 | + } |
|
208 | + //bug51866 |
|
200 | 209 | $enumFields[$field] = translate($def['vname'], $moduleName); |
201 | - if (substr($enumFields[$field], -1) == ":") |
|
202 | - $enumFields[$field] = substr($enumFields[$field], 0, strlen($enumFields[$field]) - 1); |
|
210 | + if (substr($enumFields[$field], -1) == ":") { |
|
211 | + $enumFields[$field] = substr($enumFields[$field], 0, strlen($enumFields[$field]) - 1); |
|
212 | + } |
|
203 | 213 | } |
204 | 214 | } |
205 | 215 | $fv->ss->assign( 'allowAutoInc', $allowAutoInc); |
@@ -209,8 +219,9 @@ discard block |
||
209 | 219 | $fv->ss->assign('lbl_value', htmlentities(translate($vardef['vname'], $moduleName), ENT_QUOTES, 'UTF-8')); |
210 | 220 | } |
211 | 221 | $fv->ss->assign('module', $module); |
212 | - if(empty($module->mbvardefs->vardefs['fields']['parent_name']) || (isset($vardef['type']) && $vardef['type'] == 'parent')) |
|
213 | - $field_types['parent'] = $GLOBALS['mod_strings']['parent']; |
|
222 | + if(empty($module->mbvardefs->vardefs['fields']['parent_name']) || (isset($vardef['type']) && $vardef['type'] == 'parent')) { |
|
223 | + $field_types['parent'] = $GLOBALS['mod_strings']['parent']; |
|
224 | + } |
|
214 | 225 | |
215 | 226 | $edit_or_add = 'editField' ; |
216 | 227 | |
@@ -232,14 +243,16 @@ discard block |
||
232 | 243 | } |
233 | 244 | |
234 | 245 | if(empty($vardef['name'])){ |
235 | - if(!empty($_REQUEST['type']))$vardef['type'] = $_REQUEST['type']; |
|
246 | + if(!empty($_REQUEST['type'])) { |
|
247 | + $vardef['type'] = $_REQUEST['type']; |
|
248 | + } |
|
236 | 249 | $fv->ss->assign('hideLevel', 0); |
237 | - }else{ |
|
250 | + } else{ |
|
238 | 251 | if(!empty($module->mbvardefs->vardef['fields'][$vardef['name']])){ |
239 | 252 | $fv->ss->assign('hideLevel', 1); |
240 | - }elseif(isset($vardef['custom_module'])){ |
|
253 | + } elseif(isset($vardef['custom_module'])){ |
|
241 | 254 | $fv->ss->assign('hideLevel', 2); |
242 | - }else{ |
|
255 | + } else{ |
|
243 | 256 | $fv->ss->assign('hideLevel', 3); // tyoung bug 17350 - effectively mark template derived fields as readonly |
244 | 257 | } |
245 | 258 | } |
@@ -256,10 +269,12 @@ discard block |
||
256 | 269 | $fv->ss->assign('package', $package); |
257 | 270 | $fv->ss->assign('MB','1'); |
258 | 271 | |
259 | - if(isset($vardef['vname'])) |
|
260 | - $fv->ss->assign('lbl_value', htmlentities($module->getLabel('en_us',$vardef['vname']), ENT_QUOTES, 'UTF-8')); |
|
261 | - if(empty($module->mbvardefs->vardefs['fields']['parent_name']) || (isset($vardef['type']) && $vardef['type'] == 'parent')) |
|
262 | - $field_types['parent'] = $GLOBALS['mod_strings']['parent']; |
|
272 | + if(isset($vardef['vname'])) { |
|
273 | + $fv->ss->assign('lbl_value', htmlentities($module->getLabel('en_us',$vardef['vname']), ENT_QUOTES, 'UTF-8')); |
|
274 | + } |
|
275 | + if(empty($module->mbvardefs->vardefs['fields']['parent_name']) || (isset($vardef['type']) && $vardef['type'] == 'parent')) { |
|
276 | + $field_types['parent'] = $GLOBALS['mod_strings']['parent']; |
|
277 | + } |
|
263 | 278 | |
264 | 279 | $enumFields = array(); |
265 | 280 | if (!empty($module->mbvardefs->vardefs['fields'])) |
@@ -270,8 +285,9 @@ discard block |
||
270 | 285 | { |
271 | 286 | $enumFields[$field] = isset($module->mblanguage->strings[$current_language][$def['vname']]) ? |
272 | 287 | $this->mbModule->mblanguage->strings[$current_language][$def['vname']] : translate($field); |
273 | - if (substr($enumFields[$field], -1) == ":") |
|
274 | - $enumFields[$field] = substr($enumFields[$field], 0, strlen($enumFields[$field]) -1); |
|
288 | + if (substr($enumFields[$field], -1) == ":") { |
|
289 | + $enumFields[$field] = substr($enumFields[$field], 0, strlen($enumFields[$field]) -1); |
|
290 | + } |
|
275 | 291 | } |
276 | 292 | } |
277 | 293 | } |
@@ -296,9 +312,11 @@ discard block |
||
296 | 312 | } |
297 | 313 | |
298 | 314 | if((!empty($vardef['studio']) && is_array($vardef['studio']) && !empty($vardef['studio']['no_duplicate']) && $vardef['studio']['no_duplicate'] == true) |
299 | - || (strcmp($field_name, "name") == 0) || (isset($vardef['type']) && $vardef['type'] == 'name')) // bug #35767, do not allow cloning of name field |
|
315 | + || (strcmp($field_name, "name") == 0) || (isset($vardef['type']) && $vardef['type'] == 'name')) { |
|
316 | + // bug #35767, do not allow cloning of name field |
|
300 | 317 | { |
301 | 318 | $fv->ss->assign('no_duplicate', true); |
319 | + } |
|
302 | 320 | } |
303 | 321 | |
304 | 322 | $fv->ss->assign('action',$action); |
@@ -67,7 +67,9 @@ |
||
67 | 67 | $smarty->assign('assistant',$assistant); |
68 | 68 | //initialize Assistant's display property. |
69 | 69 | $userPref = $current_user->getPreference('mb_assist', 'Assistant'); |
70 | - if(!$userPref) $userPref="na"; |
|
70 | + if(!$userPref) { |
|
71 | + $userPref="na"; |
|
72 | + } |
|
71 | 73 | $smarty->assign('userPref',$userPref); |
72 | 74 | $ajax = new AjaxCompose(); |
73 | 75 | $ajax->addSection('center', $mod_strings['LBL_HOME'],$smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl')); |
@@ -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. |
@@ -60,8 +61,9 @@ discard block |
||
60 | 61 | $bean_name = get_valid_bean_name($this->module); |
61 | 62 | $dictionary = array($bean_name => array("fields" => array($field => array()))); |
62 | 63 | include("$this->base_path/sugarfield_$field.php"); |
63 | - if (!empty($dictionary[$bean_name]) && isset($dictionary[$bean_name]["fields"][$field])) |
|
64 | - $this->custom_def = $dictionary[$bean_name]["fields"][$field]; |
|
64 | + if (!empty($dictionary[$bean_name]) && isset($dictionary[$bean_name]["fields"][$field])) { |
|
65 | + $this->custom_def = $dictionary[$bean_name]["fields"][$field]; |
|
66 | + } |
|
65 | 67 | } |
66 | 68 | } |
67 | 69 | |
@@ -71,8 +73,9 @@ discard block |
||
71 | 73 | { |
72 | 74 | $dictionary = array(); |
73 | 75 | include("modules/{$this->module}/vardefs.php"); |
74 | - if (!empty($dictionary[$beanList[$this->module]]) && isset($dictionary[$beanList[$this->module]]["fields"][$field])) |
|
75 | - $this->base_def = $dictionary[$beanList[$this->module]]["fields"][$field]; |
|
76 | + if (!empty($dictionary[$beanList[$this->module]]) && isset($dictionary[$beanList[$this->module]]["fields"][$field])) { |
|
77 | + $this->base_def = $dictionary[$beanList[$this->module]]["fields"][$field]; |
|
78 | + } |
|
76 | 79 | } |
77 | 80 | } |
78 | 81 | |
@@ -86,13 +89,15 @@ discard block |
||
86 | 89 | global $dictionary, $beanList; |
87 | 90 | |
88 | 91 | |
89 | - if (empty($beanList[$this->module])) |
|
90 | - return false; |
|
92 | + if (empty($beanList[$this->module])) { |
|
93 | + return false; |
|
94 | + } |
|
91 | 95 | |
92 | 96 | $bean_name = get_valid_bean_name($this->module); |
93 | 97 | |
94 | - if (empty($dictionary[$bean_name]) || empty($dictionary[$bean_name]["fields"][$field->name])) |
|
95 | - return false; |
|
98 | + if (empty($dictionary[$bean_name]) || empty($dictionary[$bean_name]["fields"][$field->name])) { |
|
99 | + return false; |
|
100 | + } |
|
96 | 101 | |
97 | 102 | $currdef = $dictionary[$bean_name]["fields"][$field->name]; |
98 | 103 | |
@@ -120,8 +125,9 @@ discard block |
||
120 | 125 | |
121 | 126 | if ($property == "action" || $property == "label_value" || $property == "label" |
122 | 127 | || ((substr($property, 0,3) == 'ext' && strlen($property) == 4)) |
123 | - ) |
|
124 | - continue; |
|
128 | + ) { |
|
129 | + continue; |
|
130 | + } |
|
125 | 131 | |
126 | 132 | // Bug 37043 - Avoid writing out vardef defintions that are the default value. |
127 | 133 | if (isset($newDef[$property]) && |
@@ -134,26 +140,29 @@ discard block |
||
134 | 140 | } |
135 | 141 | |
136 | 142 | //Remove any orphaned entries |
137 | - if (isset($this->custom_def[$property]) && !isset($newDef[$property])) |
|
138 | - unset($this->custom_def[$property]); |
|
143 | + if (isset($this->custom_def[$property]) && !isset($newDef[$property])) { |
|
144 | + unset($this->custom_def[$property]); |
|
145 | + } |
|
139 | 146 | |
140 | 147 | //Handle overrides of out of the box definitions with empty |
141 | 148 | if (!empty($this->base_def[$property]) && !isset($newDef[$property])) |
142 | 149 | { |
143 | 150 | //Switch on type of the property to find what the correct 'empty' is. |
144 | - if(is_string($this->base_def[$property])) |
|
145 | - $this->custom_def[$property] = ""; |
|
146 | - else if(is_array($this->base_def[$property])) |
|
147 | - $this->custom_def[$property] = array(); |
|
148 | - else if(is_bool($this->base_def[$property])) |
|
149 | - $this->custom_def[$property] = false; |
|
150 | - else |
|
151 | - $this->custom_def[$property] = null; |
|
151 | + if(is_string($this->base_def[$property])) { |
|
152 | + $this->custom_def[$property] = ""; |
|
153 | + } else if(is_array($this->base_def[$property])) { |
|
154 | + $this->custom_def[$property] = array(); |
|
155 | + } else if(is_bool($this->base_def[$property])) { |
|
156 | + $this->custom_def[$property] = false; |
|
157 | + } else { |
|
158 | + $this->custom_def[$property] = null; |
|
159 | + } |
|
152 | 160 | } |
153 | 161 | } |
154 | 162 | |
155 | - if (isset($this->custom_def["duplicate_merge_dom_value"]) && !isset($this->custom_def["duplicate_merge"])) |
|
156 | - unset($this->custom_def["duplicate_merge_dom_value"]); |
|
163 | + if (isset($this->custom_def["duplicate_merge_dom_value"]) && !isset($this->custom_def["duplicate_merge"])) { |
|
164 | + unset($this->custom_def["duplicate_merge_dom_value"]); |
|
165 | + } |
|
157 | 166 | |
158 | 167 | $this->writeVardefExtension($bean_name, $field, $this->custom_def); |
159 | 168 | } |
@@ -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. |
@@ -86,9 +87,11 @@ discard block |
||
86 | 87 | function getSearchFields() |
87 | 88 | { |
88 | 89 | $searchFields = array(); |
89 | - if (!empty($this->packageName) && file_exists("custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/metadata/SearchFields.php")) //we are in Module builder |
|
90 | + if (!empty($this->packageName) && file_exists("custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/metadata/SearchFields.php")) { |
|
91 | + //we are in Module builder |
|
90 | 92 | { |
91 | - include("custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/metadata/SearchFields.php"); |
|
93 | + include("custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/metadata/SearchFields.php"); |
|
94 | + } |
|
92 | 95 | } else if(file_exists("custom/modules/{$this->moduleName}/metadata/SearchFields.php")) { |
93 | 96 | include("custom/modules/{$this->moduleName}/metadata/SearchFields.php"); |
94 | 97 | } else if(file_exists("modules/{$this->moduleName}/metadata/SearchFields.php")) { |
@@ -100,9 +103,11 @@ discard block |
||
100 | 103 | |
101 | 104 | function saveSearchFields ($searchFields) |
102 | 105 | { |
103 | - if (!empty($this->packageName)) //we are in Module builder |
|
106 | + if (!empty($this->packageName)) { |
|
107 | + //we are in Module builder |
|
104 | 108 | { |
105 | 109 | $header = file_get_contents('modules/ModuleBuilder/MB/header.php'); |
110 | + } |
|
106 | 111 | if(!file_exists("custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/metadata/SearchFields.php")) |
107 | 112 | { |
108 | 113 | mkdir_recursive("custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/metadata"); |
@@ -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. |
@@ -122,16 +124,19 @@ discard block |
||
122 | 124 | */ |
123 | 125 | function buildFieldsToLayouts () |
124 | 126 | { |
125 | - if ($this->relationship_only) |
|
126 | - return array () ; |
|
127 | + if ($this->relationship_only) { |
|
128 | + return array () ; |
|
129 | + } |
|
127 | 130 | |
128 | - if ($this->lhs_module == $this->rhs_module) // don't add in two fields on recursive relationships |
|
131 | + if ($this->lhs_module == $this->rhs_module) { |
|
132 | + // don't add in two fields on recursive relationships |
|
129 | 133 | return array ( $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") ); |
130 | - else |
|
131 | - return array ( |
|
134 | + } else { |
|
135 | + return array ( |
|
132 | 136 | $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") , |
133 | 137 | $this->rhs_module => $this->getValidDBName($this->relationship_name . "_name") |
134 | 138 | ) ; |
139 | + } |
|
135 | 140 | } |
136 | 141 | |
137 | 142 | } |
@@ -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. |
@@ -107,9 +109,10 @@ discard block |
||
107 | 109 | function __construct ($definition) |
108 | 110 | { |
109 | 111 | // set any undefined attributes to the default value |
110 | - foreach ( array ( 'readonly' , 'deleted' , 'relationship_only', 'for_activities', 'is_custom', 'from_studio' ) as $key ) |
|
111 | - if (! isset ( $definition [ $key ] )) |
|
112 | + foreach ( array ( 'readonly' , 'deleted' , 'relationship_only', 'for_activities', 'is_custom', 'from_studio' ) as $key ) { |
|
113 | + if (! isset ( $definition [ $key ] )) |
|
112 | 114 | $definition [ $key ] = false ; |
115 | + } |
|
113 | 116 | |
114 | 117 | foreach ( self::$definitionKeys as $key ) |
115 | 118 | { |
@@ -297,8 +300,9 @@ discard block |
||
297 | 300 | */ |
298 | 301 | protected function getSubpanelDefinition ($relationshipName , $sourceModule , $subpanelName, $titleKeyName = '', $source = "") |
299 | 302 | { |
300 | - if (empty($source)) |
|
301 | - $source = $this->getValidDBName($relationshipName); |
|
303 | + if (empty($source)) { |
|
304 | + $source = $this->getValidDBName($relationshipName); |
|
305 | + } |
|
302 | 306 | $subpanelDefinition = array ( ) ; |
303 | 307 | $subpanelDefinition [ 'order' ] = 100 ; |
304 | 308 | $subpanelDefinition [ 'module' ] = $sourceModule ; |
@@ -308,7 +312,7 @@ discard block |
||
308 | 312 | $subpanelDefinition [ 'sort_by' ] = 'id' ; |
309 | 313 | if(!empty($titleKeyName)){ |
310 | 314 | $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
311 | - }else{ |
|
315 | + } else{ |
|
312 | 316 | $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
313 | 317 | } |
314 | 318 | $subpanelDefinition [ 'get_subpanel_data' ] = $source ; |
@@ -338,12 +342,15 @@ discard block |
||
338 | 342 | $vardef [ 'source' ] = 'non-db' ; |
339 | 343 | $vardef [ 'module' ] = $sourceModule ; |
340 | 344 | $vardef [ 'bean_name' ] = BeanFactory::getObjectName($sourceModule) ; |
341 | - if ($right_side) |
|
342 | - $vardef [ 'side' ] = 'right' ; |
|
343 | - if (!empty($vname)) |
|
344 | - $vardef [ 'vname' ] = $vname; |
|
345 | - if (!empty($id_name)) |
|
346 | - $vardef['id_name'] = $id_name; |
|
345 | + if ($right_side) { |
|
346 | + $vardef [ 'side' ] = 'right' ; |
|
347 | + } |
|
348 | + if (!empty($vname)) { |
|
349 | + $vardef [ 'vname' ] = $vname; |
|
350 | + } |
|
351 | + if (!empty($id_name)) { |
|
352 | + $vardef['id_name'] = $id_name; |
|
353 | + } |
|
347 | 354 | |
348 | 355 | return $vardef ; |
349 | 356 | } |
@@ -365,12 +372,14 @@ discard block |
||
365 | 372 | $vardef [ 'relationship' ] = $relationshipName ; |
366 | 373 | $vardef [ 'source' ] = 'non-db' ; |
367 | 374 | $vardef ['reportable'] = false; |
368 | - if ($right_side) |
|
369 | - $vardef [ 'side' ] = 'right' ; |
|
370 | - else |
|
371 | - $vardef [ 'side' ] = 'left' ; |
|
372 | - if (!empty($vname)) |
|
373 | - $vardef [ 'vname' ] = $vname; |
|
375 | + if ($right_side) { |
|
376 | + $vardef [ 'side' ] = 'right' ; |
|
377 | + } else { |
|
378 | + $vardef [ 'side' ] = 'left' ; |
|
379 | + } |
|
380 | + if (!empty($vname)) { |
|
381 | + $vardef [ 'vname' ] = $vname; |
|
382 | + } |
|
374 | 383 | |
375 | 384 | return $vardef ; |
376 | 385 | } |
@@ -391,7 +400,7 @@ discard block |
||
391 | 400 | $vardef [ 'source' ] = 'non-db' ; |
392 | 401 | if(!empty($vnameLabel)){ |
393 | 402 | $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $vnameLabel ) . '_TITLE' ; |
394 | - }else{ |
|
403 | + } else{ |
|
395 | 404 | $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
396 | 405 | } |
397 | 406 | |
@@ -420,11 +429,10 @@ discard block |
||
420 | 429 | $module = $mb->getPackageModule ( $parsedModuleName['packageName'] , $parsedModuleName['moduleName'] ) ; |
421 | 430 | if (in_array( 'file' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
422 | 431 | $vardef [ 'rname' ] = 'document_name' ; |
423 | - }elseif(in_array ( 'person' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
|
432 | + } elseif(in_array ( 'person' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
|
424 | 433 | $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
425 | 434 | } |
426 | - } |
|
427 | - else |
|
435 | + } else |
|
428 | 436 | { |
429 | 437 | switch ( strtolower( $sourceModule ) ) |
430 | 438 | { |
@@ -452,7 +460,7 @@ discard block |
||
452 | 460 | if ( isset ( $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
453 | 461 | if(in_array ( 'file' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
454 | 462 | $vardef [ 'rname' ] = 'document_name' ; |
455 | - }elseif(in_array ( 'person' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
463 | + } elseif(in_array ( 'person' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
456 | 464 | $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
457 | 465 | } |
458 | 466 | } |
@@ -513,8 +521,9 @@ discard block |
||
513 | 521 | // but as we need to display the true cardinality in Studio and ModuleBuilder we also record the actual relationship type |
514 | 522 | // this property is only used by Studio/MB |
515 | 523 | $properties [ 'true_relationship_type' ] = $relationshipType ; |
516 | - if ($this->from_studio) |
|
517 | - $properties [ 'from_studio' ] = true; |
|
524 | + if ($this->from_studio) { |
|
525 | + $properties [ 'from_studio' ] = true; |
|
526 | + } |
|
518 | 527 | |
519 | 528 | $rel_properties [ 'join_table' ] = $this->getValidDBName ( $relationshipName."_c" ) ; |
520 | 529 | // a and b are in case the module relates to itself |
@@ -525,8 +534,9 @@ discard block |
||
525 | 534 | // set the extended properties if they exist = for now, many-to-many definitions do not have to contain a role_column even if role_column_value is set; we'll just create a likely name if missing |
526 | 535 | if (isset ( $this->definition [ 'relationship_role_column_value' ] )) |
527 | 536 | { |
528 | - if (! isset ( $this->definition [ 'relationship_role_column' ] )) |
|
529 | - $this->definition [ 'relationship_role_column' ] = 'relationship_role_column' ; |
|
537 | + if (! isset ( $this->definition [ 'relationship_role_column' ] )) { |
|
538 | + $this->definition [ 'relationship_role_column' ] = 'relationship_role_column' ; |
|
539 | + } |
|
530 | 540 | $rel_properties [ 'relationship_role_column' ] = $this->definition [ 'relationship_role_column' ] ; |
531 | 541 | $rel_properties [ 'relationship_role_column_value' ] = $this->definition [ 'relationship_role_column_value' ] ; |
532 | 542 | } |
@@ -575,8 +585,10 @@ discard block |
||
575 | 585 | $alternateKeys = array ( $rel_properties [ 'join_key_lhs' ] , $rel_properties [ 'join_key_rhs' ] ) ; |
576 | 586 | } |
577 | 587 | |
578 | - if (count($alternateKeys)>0) |
|
579 | - $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_alt' , 'type' => 'alternate_key' , 'fields' => $alternateKeys ) ; // type must be set to alternate_key for Link.php to correctly update an existing record rather than inserting a copy - it uses the fields in this array as the keys to check if a duplicate record already exists |
|
588 | + if (count($alternateKeys)>0) { |
|
589 | + $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_alt' , 'type' => 'alternate_key' , 'fields' => $alternateKeys ) ; |
|
590 | + } |
|
591 | + // type must be set to alternate_key for Link.php to correctly update an existing record rather than inserting a copy - it uses the fields in this array as the keys to check if a duplicate record already exists |
|
580 | 592 | |
581 | 593 | return $properties ; |
582 | 594 | } |
@@ -623,8 +635,9 @@ discard block |
||
623 | 635 | $canonicalTypes = array ( ) ; |
624 | 636 | foreach ( array ( MB_ONETOONE , MB_ONETOMANY , MB_MANYTOMANY , MB_MANYTOONE) as $canonicalType ) |
625 | 637 | { |
626 | - if ($type == preg_replace ( '/[^\w]+/i', '', strtolower ( $canonicalType ) )) |
|
627 | - return $canonicalType ; |
|
638 | + if ($type == preg_replace ( '/[^\w]+/i', '', strtolower ( $canonicalType ) )) { |
|
639 | + return $canonicalType ; |
|
640 | + } |
|
628 | 641 | } |
629 | 642 | // ok, we give up... |
630 | 643 | return MB_MANYTOMANY ; |
@@ -633,16 +646,18 @@ discard block |
||
633 | 646 | |
634 | 647 | function getJoinKeyLHS() |
635 | 648 | { |
636 | - if (!isset($this->joinKeyLHS)) |
|
637 | - $this->joinKeyLHS = $this->getValidDBName ( $this->relationship_name . $this->lhs_module . "_ida" , true) ; |
|
649 | + if (!isset($this->joinKeyLHS)) { |
|
650 | + $this->joinKeyLHS = $this->getValidDBName ( $this->relationship_name . $this->lhs_module . "_ida" , true) ; |
|
651 | + } |
|
638 | 652 | |
639 | 653 | return $this->joinKeyLHS; |
640 | 654 | } |
641 | 655 | |
642 | 656 | function getJoinKeyRHS() |
643 | 657 | { |
644 | - if (!isset($this->joinKeyRHS)) |
|
645 | - $this->joinKeyRHS = $this->getValidDBName ( $this->relationship_name . $this->rhs_module . "_idb" , true) ; |
|
658 | + if (!isset($this->joinKeyRHS)) { |
|
659 | + $this->joinKeyRHS = $this->getValidDBName ( $this->relationship_name . $this->rhs_module . "_idb" , true) ; |
|
660 | + } |
|
646 | 661 | |
647 | 662 | return $this->joinKeyRHS; |
648 | 663 | } |
@@ -679,7 +694,7 @@ discard block |
||
679 | 694 | if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){ |
680 | 695 | return $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key']; |
681 | 696 | } |
682 | - }else if(!$this->is_custom && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
697 | + } else if(!$this->is_custom && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
683 | 698 | include("modules/{$this->lhs_module}/metadata/subpaneldefs.php"); |
684 | 699 | if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){ |
685 | 700 | return $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key']; |
@@ -689,14 +704,14 @@ discard block |
||
689 | 704 | if($left){ |
690 | 705 | $titleKeyName = $this->getRightModuleSystemLabel(); |
691 | 706 | $sourceModule = $this->rhs_module; |
692 | - }else{ |
|
707 | + } else{ |
|
693 | 708 | $titleKeyName = $this->getLeftModuleSystemLabel(); |
694 | 709 | $sourceModule = $this->lhs_module; |
695 | 710 | } |
696 | 711 | |
697 | 712 | if(!empty($titleKeyName)){ |
698 | 713 | $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
699 | - }else{ |
|
714 | + } else{ |
|
700 | 715 | $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $sourceModule ) . '_TITLE' ; |
701 | 716 | } |
702 | 717 |
@@ -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 | /********************************************************************************* |
6 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -97,8 +98,9 @@ discard block |
||
97 | 98 | while ( list( $moduleName , $module ) = each($browser->modules) ) |
98 | 99 | { |
99 | 100 | // do not include the submodules of Activities as already have the parent... |
100 | - if (! $includeActivitiesSubmodules && in_array ( $module->module, self::$activities )) |
|
101 | - continue ; |
|
101 | + if (! $includeActivitiesSubmodules && in_array ( $module->module, self::$activities )) { |
|
102 | + continue ; |
|
103 | + } |
|
102 | 104 | $providedSubpanels = $module->getProvidedSubpanels(); |
103 | 105 | if ( $providedSubpanels !== false ) { |
104 | 106 | $relatableModules [ $module->module ] = $providedSubpanels; |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | |
112 | 114 | static function validSubpanel ($filename) |
113 | 115 | { |
114 | - if (! file_exists ( $filename )) |
|
115 | - return false ; |
|
116 | + if (! file_exists ( $filename )) { |
|
117 | + return false ; |
|
118 | + } |
|
116 | 119 | |
117 | 120 | include $filename ; |
118 | 121 | return (isset ( $subpanel_layout ) && (isset ( $subpanel_layout [ 'top_buttons' ] ) && isset ( $subpanel_layout [ 'list_fields' ] ))) ; |
@@ -127,8 +130,9 @@ discard block |
||
127 | 130 | $list = array ( ) ; |
128 | 131 | foreach ( $this->relationships as $name => $relationship ) |
129 | 132 | { |
130 | - if (! $relationship->deleted ()) |
|
131 | - $list [ $name ] = $name ; |
|
133 | + if (! $relationship->deleted ()) { |
|
134 | + $list [ $name ] = $name ; |
|
135 | + } |
|
132 | 136 | } |
133 | 137 | return $list ; |
134 | 138 | } |
@@ -172,8 +176,9 @@ discard block |
||
172 | 176 | if ($relationship = $this->get ( $_REQUEST [ 'relationship_name' ] )) |
173 | 177 | { |
174 | 178 | unset( $definition[ 'relationship_name' ] ) ; // in case the related modules have changed; this name is probably no longer appropriate |
175 | - if (! $relationship->readonly ()) |
|
176 | - $this->delete ( $_REQUEST [ 'relationship_name' ] ) ; |
|
179 | + if (! $relationship->readonly ()) { |
|
180 | + $this->delete ( $_REQUEST [ 'relationship_name' ] ) ; |
|
181 | + } |
|
177 | 182 | } |
178 | 183 | } |
179 | 184 | |
@@ -298,8 +303,7 @@ discard block |
||
298 | 303 | { |
299 | 304 | $name = $basename . '_1' ; |
300 | 305 | $suffix = 2 ; |
301 | - } |
|
302 | - else |
|
306 | + } else |
|
303 | 307 | { |
304 | 308 | $name = $basename ; |
305 | 309 | $suffix = 1 ; |
@@ -351,9 +355,11 @@ discard block |
||
351 | 355 | { |
352 | 356 | $metadata = $relationship->$buildMethod () ; |
353 | 357 | |
354 | - if (count ( $metadata ) > 0) // don't clutter up the filesystem with empty files... |
|
358 | + if (count ( $metadata ) > 0) { |
|
359 | + // don't clutter up the filesystem with empty files... |
|
355 | 360 | { |
356 | 361 | $GLOBALS [ 'log' ]->debug ( get_class ( $this ) . ": BUILD is running METHOD $saveMethod" ) ; |
362 | + } |
|
357 | 363 | $installDef = $this->$saveMethod ( $basepath, $installDefPrefix, $name, $metadata ) ; |
358 | 364 | |
359 | 365 | // some save methods (e.g., saveRelateFieldDefinition) handle the installDefs internally and so return null |
@@ -406,8 +412,9 @@ discard block |
||
406 | 412 | |
407 | 413 | $filename = "{$basepath}/language/{$definition['module']}.php" ; |
408 | 414 | |
409 | - if (file_exists ( $filename )) |
|
410 | - include ($filename); |
|
415 | + if (file_exists ( $filename )) { |
|
416 | + include ($filename); |
|
417 | + } |
|
411 | 418 | |
412 | 419 | |
413 | 420 | //Check for app strings |
@@ -415,12 +422,14 @@ discard block |
||
415 | 422 | . print_r ( $definition, true ) ) ; |
416 | 423 | if ($definition['module'] == 'application') { |
417 | 424 | $app_list_strings[$definition [ 'system_label' ]] = $definition [ 'display_label' ]; |
418 | - foreach ($app_list_strings as $key => $val) |
|
419 | - $out .= override_value_to_string_recursive2('app_list_strings', $key, $val); |
|
425 | + foreach ($app_list_strings as $key => $val) { |
|
426 | + $out .= override_value_to_string_recursive2('app_list_strings', $key, $val); |
|
427 | + } |
|
420 | 428 | } else { |
421 | 429 | $mod_strings[ $definition [ 'system_label' ]] = $definition [ 'display_label' ]; |
422 | - foreach ($mod_strings as $key => $val) |
|
423 | - $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
430 | + foreach ($mod_strings as $key => $val) { |
|
431 | + $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
432 | + } |
|
424 | 433 | } |
425 | 434 | |
426 | 435 | $fh = fopen ( $filename, 'w' ) ; |
@@ -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. |
@@ -270,8 +271,7 @@ discard block |
||
270 | 271 | $module->setAppListStrings ( 'en_us', $appStrings ) ; |
271 | 272 | $module->save () ; |
272 | 273 | |
273 | - } |
|
274 | - else |
|
274 | + } else |
|
275 | 275 | { |
276 | 276 | //Bug42170================================ |
277 | 277 | $appStrings = $module->getAppListStrings () ; |
@@ -333,8 +333,9 @@ discard block |
||
333 | 333 | $appStrings = $module->getAppListStrings () ; |
334 | 334 | foreach(getTypeDisplayList() as $key) |
335 | 335 | { |
336 | - if (isset($appStrings[$key][ $module->key_name ])) |
|
337 | - unset($appStrings[$key][ $module->key_name ]); |
|
336 | + if (isset($appStrings[$key][ $module->key_name ])) { |
|
337 | + unset($appStrings[$key][ $module->key_name ]); |
|
338 | + } |
|
338 | 339 | } |
339 | 340 | $module->setAppListStrings ( 'en_us', $appStrings ) ; |
340 | 341 | $module->save () ; |
@@ -351,8 +352,9 @@ discard block |
||
351 | 352 | { |
352 | 353 | |
353 | 354 | // many-to-many relationships don't have fields so if we have a many-to-many we can just skip this... |
354 | - if ($relationship->getType () == MB_MANYTOMANY) |
|
355 | - return false ; |
|
355 | + if ($relationship->getType () == MB_MANYTOMANY) { |
|
356 | + return false ; |
|
357 | + } |
|
356 | 358 | |
357 | 359 | $successful = true ; |
358 | 360 | $layoutAdditions = $relationship->buildFieldsToLayouts () ; |
@@ -371,8 +373,7 @@ discard block |
||
371 | 373 | if (($actionAdd) ? $parser->addField ( array ( 'name' => $fieldName ) ) : $parser->removeField ( $fieldName )) |
372 | 374 | { |
373 | 375 | $parser->handleSave ( false ) ; |
374 | - } |
|
375 | - else |
|
376 | + } else |
|
376 | 377 | { |
377 | 378 | $GLOBALS [ 'log' ]->debug ( get_class ( $this ) . ": couldn't " . (($actionAdd) ? "add" : "remove") . " $fieldName on $view layout for undeployed module $deployedModuleName" ) ; |
378 | 379 | $successful = false ; |