@@ -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. |
@@ -115,8 +116,9 @@ discard block |
||
115 | 116 | MB_LISTVIEW => 'LBL_LISTVIEW' , |
116 | 117 | ) ; |
117 | 118 | $translatedViewType = '' ; |
118 | - if ( isset ( $labels [ strtolower ( $this->editLayout ) ] ) ) |
|
119 | - $translatedViewType = translate ( $labels [ strtolower( $this->editLayout ) ] , 'ModuleBuilder' ) ; |
|
119 | + if ( isset ( $labels [ strtolower ( $this->editLayout ) ] ) ) { |
|
120 | + $translatedViewType = translate ( $labels [ strtolower( $this->editLayout ) ] , 'ModuleBuilder' ) ; |
|
121 | + } |
|
120 | 122 | $this->translatedViewType = $translatedViewType; |
121 | 123 | |
122 | 124 | if ($this->fromModuleBuilder) |
@@ -131,8 +133,9 @@ discard block |
||
131 | 133 | { |
132 | 134 | $subpanelLabel = $this->subpanelLabel; |
133 | 135 | // If the subpanel title has changed, use that for the label instead |
134 | - if( !empty($_REQUEST['subpanel_title'] ) && $_REQUEST['subpanelLabel'] != $_REQUEST['subpanel_title'] ) |
|
135 | - $subpanelLabel = $_REQUEST['subpanel_title']; |
|
136 | + if( !empty($_REQUEST['subpanel_title'] ) && $_REQUEST['subpanelLabel'] != $_REQUEST['subpanel_title'] ) { |
|
137 | + $subpanelLabel = $_REQUEST['subpanel_title']; |
|
138 | + } |
|
136 | 139 | |
137 | 140 | $ajax->addCrumb( $subpanelLabel, '' ); |
138 | 141 | $this->translatedViewType = $subpanelLabel . " " . translate("LBL_SUBPANEL", "ModuleBuilder"); |
@@ -158,8 +161,9 @@ discard block |
||
158 | 161 | { |
159 | 162 | $subpanelLabel = $this->subpanelLabel; |
160 | 163 | // If the subpanel title has changed, use that for the label instead |
161 | - if( !empty($_REQUEST['subpanel_title'] ) && $_REQUEST['subpanelLabel'] != $_REQUEST['subpanel_title'] ) |
|
162 | - $subpanelLabel = $_REQUEST['subpanel_title']; |
|
164 | + if( !empty($_REQUEST['subpanel_title'] ) && $_REQUEST['subpanelLabel'] != $_REQUEST['subpanel_title'] ) { |
|
165 | + $subpanelLabel = $_REQUEST['subpanel_title']; |
|
166 | + } |
|
163 | 167 | |
164 | 168 | $ajax->addCrumb( $subpanelLabel, '' ); |
165 | 169 | $this->translatedViewType = $subpanelLabel . " " . translate("LBL_SUBPANEL", "ModuleBuilder"); |
@@ -241,12 +245,14 @@ discard block |
||
241 | 245 | $history = $parser->getHistory () ; |
242 | 246 | |
243 | 247 | $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")" ; |
244 | - if ($this->subpanel) |
|
245 | - $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->subpanel}\")" ; |
|
248 | + if ($this->subpanel) { |
|
249 | + $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->subpanel}\")" ; |
|
250 | + } |
|
246 | 251 | |
247 | 252 | $restoreAction = "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'"; |
248 | - if ($this->subpanel) |
|
249 | - $restoreAction = "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"{$this->subpanel}\")'"; |
|
253 | + if ($this->subpanel) { |
|
254 | + $restoreAction = "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"{$this->subpanel}\")'"; |
|
255 | + } |
|
250 | 256 | |
251 | 257 | $buttons = array ( ) ; |
252 | 258 | $buttons [] = array ( 'id' =>'savebtn', 'name' => 'savebtn' , 'image' => $imageSave , 'text' => (! $this->fromModuleBuilder)?$GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVEPUBLISH' ]: $GLOBALS [ 'mod_strings' ] [ 'LBL_BTN_SAVE' ], 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");if (countListFields()==0) ModuleBuilder.layoutValidation.popup() ; else ModuleBuilder.handleSave(\"edittabs\" )'" ) ; |
@@ -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. |
@@ -52,10 +53,11 @@ discard block |
||
52 | 53 | { |
53 | 54 | $this->editModule = $_REQUEST [ 'view_module' ] ; |
54 | 55 | $this->editLayout = $_REQUEST [ 'view' ] ; |
55 | - if(isset ( $_REQUEST [ 'view_package' ] ) && ! empty ( $_REQUEST [ 'view_package' ] )) |
|
56 | - $this->editPackage = $_REQUEST [ 'view_package' ]; |
|
57 | - else |
|
58 | - $this->editPackage = null; |
|
56 | + if(isset ( $_REQUEST [ 'view_package' ] ) && ! empty ( $_REQUEST [ 'view_package' ] )) { |
|
57 | + $this->editPackage = $_REQUEST [ 'view_package' ]; |
|
58 | + } else { |
|
59 | + $this->editPackage = null; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | $this->fromModuleBuilder = isset ( $_REQUEST [ 'MB' ] ) || (isset($_REQUEST['view_package']) && $_REQUEST['view_package'] && $_REQUEST['view_package'] != 'studio') ; |
61 | 63 | |
@@ -121,7 +123,7 @@ discard block |
||
121 | 123 | |
122 | 124 | $ViewLabel = ($this->editLayout == MB_DASHLET) ? 'LBL_DASHLETLISTVIEW' : 'LBL_DASHLETSEARCHVIEW'; |
123 | 125 | $ajax->addCrumb ( translate ($ViewLabel, 'ModuleBuilder' ), '' ) ; |
124 | - }else{ |
|
126 | + } else{ |
|
125 | 127 | $ajax->addCrumb ( translate($this->editModule), 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_module=' . $this->editModule . '")' ) ; |
126 | 128 | $ajax->addCrumb ( translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&layouts=1&view_module=' . $this->editModule . '")'); |
127 | 129 | $ajax->addCrumb ( translate('LBL_DASHLET', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=dashlet&view_module=' . $this->editModule . '")' ); |
@@ -182,8 +184,9 @@ discard block |
||
182 | 184 | |
183 | 185 | |
184 | 186 | $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")" ; |
185 | - if (isset($this->searchlayout)) |
|
186 | - $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->searchlayout}\")" ; |
|
187 | + if (isset($this->searchlayout)) { |
|
188 | + $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->searchlayout}\")" ; |
|
189 | + } |
|
187 | 190 | |
188 | 191 | $buttons = array ( ) ; |
189 | 192 | if (! $this->fromModuleBuilder) |
@@ -221,10 +224,11 @@ discard block |
||
221 | 224 | { |
222 | 225 | global $app_list_strings ; |
223 | 226 | |
224 | - if ($this->fromModuleBuilder) |
|
225 | - $title = $this->editModule ; |
|
226 | - else |
|
227 | - $title = $app_list_strings [ 'moduleList' ] [ $this->editModule ] ; |
|
227 | + if ($this->fromModuleBuilder) { |
|
228 | + $title = $this->editModule ; |
|
229 | + } else { |
|
230 | + $title = $app_list_strings [ 'moduleList' ] [ $this->editModule ] ; |
|
231 | + } |
|
228 | 232 | |
229 | 233 | return $GLOBALS [ 'mod_strings' ] [ 'LBL_LISTVIEW_EDIT' ] . ': ' . $title ; |
230 | 234 | } |
@@ -103,8 +103,9 @@ discard block |
||
103 | 103 | { |
104 | 104 | $dbDate = $timedate->fromTimestamp($ts)->asDb(); |
105 | 105 | $displayTS = $timedate->to_display_date_time ( $dbDate ) ; |
106 | - if ($page * $this->pageSize + $i + 1 == $count) |
|
107 | - $displayTS = translate("LBL_MB_DEFAULT_LAYOUT"); |
|
106 | + if ($page * $this->pageSize + $i + 1 == $count) { |
|
107 | + $displayTS = translate("LBL_MB_DEFAULT_LAYOUT"); |
|
108 | + } |
|
108 | 109 | $snapshots [ $ts ] = $displayTS ; |
109 | 110 | $ts = $this->history->getNext () ; |
110 | 111 | } |
@@ -151,7 +152,7 @@ discard block |
||
151 | 152 | { |
152 | 153 | require_once ("modules/ModuleBuilder/views/view.dashlet.php") ; |
153 | 154 | $view = new ViewDashlet ( ) ; |
154 | - } else if ($this->layout == 'popuplist' || $this->layout == 'popupsearch') |
|
155 | + } else if ($this->layout == 'popuplist' || $this->layout == 'popupsearch') |
|
155 | 156 | { |
156 | 157 | require_once ("modules/ModuleBuilder/views/view.popupview.php") ; |
157 | 158 | $view = new ViewPopupview ( ) ; |
@@ -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,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 |