@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | |
105 | 105 | |
106 | 106 | if (! empty ( $dictionary ) && ! empty ( $dictionary [ $name ] ) ) { |
107 | - if (! empty ( $dictionary [ $name ] [ 'true_relationship_type' ] )) { |
|
108 | - $definition [ 'relationship_type' ] = $dictionary [ $name ] [ 'true_relationship_type' ] ; |
|
109 | - } |
|
107 | + if (! empty ( $dictionary [ $name ] [ 'true_relationship_type' ] )) { |
|
108 | + $definition [ 'relationship_type' ] = $dictionary [ $name ] [ 'true_relationship_type' ] ; |
|
109 | + } |
|
110 | 110 | if (! empty ( $dictionary [ $name ] [ 'from_studio' ] )) { |
111 | 111 | $definition [ 'from_studio' ] = $dictionary [ $name ] [ 'from_studio' ] ; |
112 | 112 | } |
113 | - $definition [ 'is_custom' ] = true; |
|
113 | + $definition [ 'is_custom' ] = true; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -155,23 +155,23 @@ discard block |
||
155 | 155 | */ |
156 | 156 | function delete ($rel_name) |
157 | 157 | { |
158 | - //Remove any fields from layouts |
|
158 | + //Remove any fields from layouts |
|
159 | 159 | $rel = $this->get($rel_name); |
160 | 160 | if (!empty($rel)) |
161 | 161 | { |
162 | 162 | $this->removeFieldsFromDeployedLayout($rel); |
163 | 163 | } |
164 | 164 | require_once("ModuleInstall/ModuleInstaller.php"); |
165 | - require_once ('modules/Administration/QuickRepairAndRebuild.php') ; |
|
166 | - $mi = new ModuleInstaller(); |
|
167 | - $mi->silent = true; |
|
165 | + require_once ('modules/Administration/QuickRepairAndRebuild.php') ; |
|
166 | + $mi = new ModuleInstaller(); |
|
167 | + $mi->silent = true; |
|
168 | 168 | $mi->id_name = 'custom' . $rel_name; // provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key... |
169 | - $mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php"); |
|
169 | + $mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php"); |
|
170 | 170 | $mi->uninstallLabels('custom/Extension/modules/relationships/language/',$rel->buildLabels()); |
171 | 171 | $mi->uninstallExtLabels($rel->buildLabels()); |
172 | 172 | |
173 | - // now clear all caches so that our changes are visible |
|
174 | - Relationship::delete_cache(); |
|
173 | + // now clear all caches so that our changes are visible |
|
174 | + Relationship::delete_cache(); |
|
175 | 175 | $mi->rebuild_tabledictionary(); |
176 | 176 | |
177 | 177 | $MBmodStrings = $GLOBALS [ 'mod_strings' ]; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | foreach ( $this->relationships as $name => $relationship ) |
314 | 314 | { |
315 | 315 | $relationship->setFromStudio(); |
316 | - $GLOBALS [ 'mod_strings' ] = $MBModStrings ; |
|
316 | + $GLOBALS [ 'mod_strings' ] = $MBModStrings ; |
|
317 | 317 | $installDefs = parent::build ( $basepath, "<basepath>", array ($name => $relationship ) ) ; |
318 | 318 | |
319 | 319 | // and mark as built so that the next time we come through we'll know and won't build again |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @param $relationship The relationship that is getting deleted |
408 | 408 | * return null |
409 | 409 | */ |
410 | - private function removeFieldsFromDeployedLayout ($relationship) |
|
410 | + private function removeFieldsFromDeployedLayout ($relationship) |
|
411 | 411 | { |
412 | 412 | |
413 | 413 | // many-to-many relationships don't have fields so if we have a many-to-many we can just skip this... |
@@ -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. |
@@ -243,8 +244,9 @@ discard block |
||
243 | 244 | |
244 | 245 | foreach ( $module->field_defs as $field ) |
245 | 246 | { |
246 | - if ($field [ 'type' ] == 'relate' && isset ( $field [ 'module' ] ) && $field [ 'module' ] == $sourceModuleName) |
|
247 | - return $field [ 'name' ] ; |
|
247 | + if ($field [ 'type' ] == 'relate' && isset ( $field [ 'module' ] ) && $field [ 'module' ] == $sourceModuleName) { |
|
248 | + return $field [ 'name' ] ; |
|
249 | + } |
|
248 | 250 | } |
249 | 251 | return null ; |
250 | 252 | } |
@@ -389,10 +391,11 @@ discard block |
||
389 | 391 | |
390 | 392 | foreach ( $layoutAdditions as $deployedModuleName => $fieldName ) |
391 | 393 | { |
392 | - if (! in_array ( strtolower ( $deployedModuleName ), $invalidModules )) |
|
393 | - foreach ( array ( MB_EDITVIEW , MB_DETAILVIEW ) as $view ) |
|
394 | + if (! in_array ( strtolower ( $deployedModuleName ), $invalidModules )) { |
|
395 | + foreach ( array ( MB_EDITVIEW , MB_DETAILVIEW ) as $view ) |
|
394 | 396 | { |
395 | 397 | $GLOBALS [ 'log' ]->info ( get_class ( $this ) . ": adding $fieldName to $view layout for module $deployedModuleName" ) ; |
398 | + } |
|
396 | 399 | $parser = new GridLayoutMetaDataParser ( $view, $deployedModuleName ) ; |
397 | 400 | $parser->addField ( array ( 'name' => $fieldName ) ) ; |
398 | 401 | $parser->handleSave ( false ) ; |
@@ -411,8 +414,9 @@ discard block |
||
411 | 414 | { |
412 | 415 | |
413 | 416 | // many-to-many relationships don't have fields so if we have a many-to-many we can just skip this... |
414 | - if ($relationship->getType () == MB_MANYTOMANY) |
|
415 | - return false ; |
|
417 | + if ($relationship->getType () == MB_MANYTOMANY) { |
|
418 | + return false ; |
|
419 | + } |
|
416 | 420 | |
417 | 421 | $successful = true ; |
418 | 422 | $layoutAdditions = $relationship->buildFieldsToLayouts () ; |
@@ -1,6 +1,6 @@ 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 | * SugarCRM Community Edition is a customer relationship management program developed by |
6 | 6 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | ********************************************************************************/ |
41 | 41 | |
42 | 42 | |
43 | -require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationships.php' ; |
|
44 | -require_once 'modules/ModuleBuilder/parsers/relationships/RelationshipsInterface.php' ; |
|
45 | -require_once 'modules/ModuleBuilder/parsers/relationships/RelationshipFactory.php' ; |
|
43 | +require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationships.php'; |
|
44 | +require_once 'modules/ModuleBuilder/parsers/relationships/RelationshipsInterface.php'; |
|
45 | +require_once 'modules/ModuleBuilder/parsers/relationships/RelationshipFactory.php'; |
|
46 | 46 | |
47 | 47 | |
48 | 48 | class DeployedRelationships extends AbstractRelationships implements RelationshipsInterface |
49 | 49 | { |
50 | 50 | |
51 | - function __construct ($moduleName) |
|
51 | + function __construct($moduleName) |
|
52 | 52 | { |
53 | - $this->moduleName = $moduleName ; |
|
54 | - $this->load () ; |
|
53 | + $this->moduleName = $moduleName; |
|
54 | + $this->load(); |
|
55 | 55 | } |
56 | 56 | |
57 | - static function findRelatableModules ($includeActivitiesSubmodules = true) |
|
57 | + static function findRelatableModules($includeActivitiesSubmodules = true) |
|
58 | 58 | { |
59 | - return parent::findRelatableModules ( true ) ; |
|
59 | + return parent::findRelatableModules(true); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /* |
@@ -71,50 +71,50 @@ discard block |
||
71 | 71 | * Instead we must obtain the true cardinality from a property we added to the relationship metadata when we created the relationship |
72 | 72 | * This relationship metadata is accessed through the Table Dictionary |
73 | 73 | */ |
74 | - function load () |
|
74 | + function load() |
|
75 | 75 | { |
76 | 76 | |
77 | - $relationships = $this->getDeployedRelationships () ; |
|
77 | + $relationships = $this->getDeployedRelationships(); |
|
78 | 78 | |
79 | - if (! empty ( $relationships )) |
|
79 | + if (!empty ($relationships)) |
|
80 | 80 | { |
81 | 81 | // load the relationship definitions for all installed custom relationships into $dictionary |
82 | - $dictionary = array ( ) ; |
|
83 | - if (file_exists ( 'custom/application/Ext/TableDictionary/tabledictionary.ext.php' )) |
|
82 | + $dictionary = array( ); |
|
83 | + if (file_exists('custom/application/Ext/TableDictionary/tabledictionary.ext.php')) |
|
84 | 84 | { |
85 | - include ('custom/application/Ext/TableDictionary/tabledictionary.ext.php') ; |
|
85 | + include ('custom/application/Ext/TableDictionary/tabledictionary.ext.php'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $invalidModules = array(); |
89 | - $validModules = array_keys ( self::findRelatableModules () ) ; |
|
89 | + $validModules = array_keys(self::findRelatableModules()); |
|
90 | 90 | |
91 | 91 | // now convert the relationships array into an array of AbstractRelationship objects |
92 | - foreach ( $relationships as $name => $definition ) |
|
92 | + foreach ($relationships as $name => $definition) |
|
93 | 93 | { |
94 | - if (($definition [ 'lhs_module' ] == $this->moduleName) || ($definition [ 'rhs_module' ] == $this->moduleName)) |
|
94 | + if (($definition ['lhs_module'] == $this->moduleName) || ($definition ['rhs_module'] == $this->moduleName)) |
|
95 | 95 | { |
96 | - if (in_array ( $definition [ 'lhs_module' ], $validModules ) && in_array ( $definition [ 'rhs_module' ], $validModules ) |
|
97 | - && ! in_array ( $definition [ 'lhs_module' ], $invalidModules ) && ! in_array ( $definition [ 'rhs_module' ], $invalidModules )) |
|
96 | + if (in_array($definition ['lhs_module'], $validModules) && in_array($definition ['rhs_module'], $validModules) |
|
97 | + && !in_array($definition ['lhs_module'], $invalidModules) && !in_array($definition ['rhs_module'], $invalidModules)) |
|
98 | 98 | { |
99 | 99 | // identify the subpanels for this relationship - TODO: optimize this - currently does m x n scans through the subpanel list... |
100 | - $definition [ 'rhs_subpanel' ] = self::identifySubpanel ( $definition [ 'lhs_module' ], $definition [ 'rhs_module' ] ) ; |
|
101 | - $definition [ 'lhs_subpanel' ] = self::identifySubpanel ( $definition [ 'rhs_module' ], $definition [ 'lhs_module' ] ) ; |
|
100 | + $definition ['rhs_subpanel'] = self::identifySubpanel($definition ['lhs_module'], $definition ['rhs_module']); |
|
101 | + $definition ['lhs_subpanel'] = self::identifySubpanel($definition ['rhs_module'], $definition ['lhs_module']); |
|
102 | 102 | |
103 | 103 | // now adjust the cardinality with the true cardinality found in the relationships metadata (see method comment above) |
104 | 104 | |
105 | 105 | |
106 | - if (! empty ( $dictionary ) && ! empty ( $dictionary [ $name ] ) ) { |
|
107 | - if (! empty ( $dictionary [ $name ] [ 'true_relationship_type' ] )) { |
|
108 | - $definition [ 'relationship_type' ] = $dictionary [ $name ] [ 'true_relationship_type' ] ; |
|
106 | + if (!empty ($dictionary) && !empty ($dictionary [$name])) { |
|
107 | + if (!empty ($dictionary [$name] ['true_relationship_type'])) { |
|
108 | + $definition ['relationship_type'] = $dictionary [$name] ['true_relationship_type']; |
|
109 | 109 | } |
110 | - if (! empty ( $dictionary [ $name ] [ 'from_studio' ] )) { |
|
111 | - $definition [ 'from_studio' ] = $dictionary [ $name ] [ 'from_studio' ] ; |
|
110 | + if (!empty ($dictionary [$name] ['from_studio'])) { |
|
111 | + $definition ['from_studio'] = $dictionary [$name] ['from_studio']; |
|
112 | 112 | } |
113 | - $definition [ 'is_custom' ] = true; |
|
113 | + $definition ['is_custom'] = true; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | - $this->relationships [ $name ] = RelationshipFactory::newRelationship ( $definition ) ; |
|
117 | + $this->relationships [$name] = RelationshipFactory::newRelationship($definition); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | /* |
135 | 135 | * Save this modules relationship definitions out to a working file |
136 | 136 | */ |
137 | - function save () |
|
137 | + function save() |
|
138 | 138 | { |
139 | - parent::_save ( $this->relationships, "custom/working/modules/{$this->moduleName}" ) ; |
|
139 | + parent::_save($this->relationships, "custom/working/modules/{$this->moduleName}"); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /* |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | * @param array definition The 5.0 relationship definition |
146 | 146 | * @return array The definition updated to 5.1 format |
147 | 147 | */ |
148 | - protected function _updateRelationshipDefinition ($definition) |
|
148 | + protected function _updateRelationshipDefinition($definition) |
|
149 | 149 | { |
150 | - return $definition ; |
|
150 | + return $definition; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /* |
154 | 154 | * Use the module Loader to delete the relationship from the instance. |
155 | 155 | */ |
156 | - function delete ($rel_name) |
|
156 | + function delete($rel_name) |
|
157 | 157 | { |
158 | 158 | //Remove any fields from layouts |
159 | 159 | $rel = $this->get($rel_name); |
@@ -162,23 +162,23 @@ discard block |
||
162 | 162 | $this->removeFieldsFromDeployedLayout($rel); |
163 | 163 | } |
164 | 164 | require_once("ModuleInstall/ModuleInstaller.php"); |
165 | - require_once ('modules/Administration/QuickRepairAndRebuild.php') ; |
|
165 | + require_once ('modules/Administration/QuickRepairAndRebuild.php'); |
|
166 | 166 | $mi = new ModuleInstaller(); |
167 | 167 | $mi->silent = true; |
168 | - $mi->id_name = 'custom' . $rel_name; // provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key... |
|
168 | + $mi->id_name = 'custom'.$rel_name; // provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key... |
|
169 | 169 | $mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php"); |
170 | - $mi->uninstallLabels('custom/Extension/modules/relationships/language/',$rel->buildLabels()); |
|
170 | + $mi->uninstallLabels('custom/Extension/modules/relationships/language/', $rel->buildLabels()); |
|
171 | 171 | $mi->uninstallExtLabels($rel->buildLabels()); |
172 | 172 | |
173 | 173 | // now clear all caches so that our changes are visible |
174 | 174 | Relationship::delete_cache(); |
175 | 175 | $mi->rebuild_tabledictionary(); |
176 | 176 | |
177 | - $MBmodStrings = $GLOBALS [ 'mod_strings' ]; |
|
178 | - $GLOBALS [ 'mod_strings' ] = return_module_language ( '', 'Administration' ) ; |
|
179 | - $rac = new RepairAndClear ( ) ; |
|
180 | - $rac->repairAndClearAll ( array ( 'clearAll', 'rebuildExtensions', ), array ( $GLOBALS [ 'mod_strings' ] [ 'LBL_ALL_MODULES' ] ), true, false ) ; |
|
181 | - $GLOBALS [ 'mod_strings' ] = $MBmodStrings; |
|
177 | + $MBmodStrings = $GLOBALS ['mod_strings']; |
|
178 | + $GLOBALS ['mod_strings'] = return_module_language('', 'Administration'); |
|
179 | + $rac = new RepairAndClear( ); |
|
180 | + $rac->repairAndClearAll(array('clearAll', 'rebuildExtensions',), array($GLOBALS ['mod_strings'] ['LBL_ALL_MODULES']), true, false); |
|
181 | + $GLOBALS ['mod_strings'] = $MBmodStrings; |
|
182 | 182 | |
183 | 183 | //Bug 41070, supercedes the previous 40941 fix in this section |
184 | 184 | if (isset($this->relationships[$rel_name])) |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | * The set is made up of the relationships held in this class, plus all those already deployed in the application |
193 | 193 | * @return array Set of all relevant relationships |
194 | 194 | */ |
195 | - protected function getAllRelationships () |
|
195 | + protected function getAllRelationships() |
|
196 | 196 | { |
197 | - return array_merge ( $this->relationships, parent::getDeployedRelationships () ) ; |
|
197 | + return array_merge($this->relationships, parent::getDeployedRelationships()); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /* |
@@ -204,28 +204,28 @@ discard block |
||
204 | 204 | * @param string $sourceModuleName Name of the primary module |
205 | 205 | * @return string Name of the subpanel if found; null otherwise |
206 | 206 | */ |
207 | - static private function identifySubpanel ($thisModuleName , $sourceModuleName) |
|
207 | + static private function identifySubpanel($thisModuleName, $sourceModuleName) |
|
208 | 208 | { |
209 | - $module = get_module_info ( $thisModuleName ) ; |
|
210 | - require_once ('include/SubPanel/SubPanelDefinitions.php') ; |
|
211 | - $spd = new SubPanelDefinitions ( $module ) ; |
|
212 | - $subpanelNames = $spd->get_available_tabs () ; // actually these are the displayed subpanels |
|
209 | + $module = get_module_info($thisModuleName); |
|
210 | + require_once ('include/SubPanel/SubPanelDefinitions.php'); |
|
211 | + $spd = new SubPanelDefinitions($module); |
|
212 | + $subpanelNames = $spd->get_available_tabs(); // actually these are the displayed subpanels |
|
213 | 213 | |
214 | - foreach ( $subpanelNames as $key => $name ) |
|
214 | + foreach ($subpanelNames as $key => $name) |
|
215 | 215 | { |
216 | - $GLOBALS [ 'log' ]->debug ( $thisModuleName . " " . $name ) ; |
|
216 | + $GLOBALS ['log']->debug($thisModuleName." ".$name); |
|
217 | 217 | |
218 | - $subPanel = $spd->load_subpanel ( $name ) ; |
|
219 | - if ($subPanel && ! isset ( $subPanel->_instance_properties [ 'collection_list' ] )) |
|
218 | + $subPanel = $spd->load_subpanel($name); |
|
219 | + if ($subPanel && !isset ($subPanel->_instance_properties ['collection_list'])) |
|
220 | 220 | { |
221 | - if ($sourceModuleName == $subPanel->_instance_properties [ 'module' ]) |
|
221 | + if ($sourceModuleName == $subPanel->_instance_properties ['module']) |
|
222 | 222 | { |
223 | - return $subPanel->_instance_properties [ 'subpanel_name' ] ; |
|
223 | + return $subPanel->_instance_properties ['subpanel_name']; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - return null ; |
|
228 | + return null; |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | |
@@ -237,16 +237,16 @@ discard block |
||
237 | 237 | * @return string Name of the relate field, if found; null otherwise |
238 | 238 | */ |
239 | 239 | |
240 | - static private function identifyRelateField ($thisModuleName , $sourceModuleName) |
|
240 | + static private function identifyRelateField($thisModuleName, $sourceModuleName) |
|
241 | 241 | { |
242 | - $module = get_module_info ( $thisModuleName ) ; |
|
242 | + $module = get_module_info($thisModuleName); |
|
243 | 243 | |
244 | - foreach ( $module->field_defs as $field ) |
|
244 | + foreach ($module->field_defs as $field) |
|
245 | 245 | { |
246 | - if ($field [ 'type' ] == 'relate' && isset ( $field [ 'module' ] ) && $field [ 'module' ] == $sourceModuleName) |
|
247 | - return $field [ 'name' ] ; |
|
246 | + if ($field ['type'] == 'relate' && isset ($field ['module']) && $field ['module'] == $sourceModuleName) |
|
247 | + return $field ['name']; |
|
248 | 248 | } |
249 | - return null ; |
|
249 | + return null; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /* |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | * We can assume that both sides of the relationship are deployed modules as this is only called within the context of DeployedRelationships |
257 | 257 | * @param AbstractRelationship $relationship The relationship to be enforced |
258 | 258 | */ |
259 | - public function enforceRelationshipOnly ($relationship) |
|
259 | + public function enforceRelationshipOnly($relationship) |
|
260 | 260 | { |
261 | - $lhs = $relationship->lhs_module ; |
|
262 | - $rhs = $relationship->rhs_module ; |
|
261 | + $lhs = $relationship->lhs_module; |
|
262 | + $rhs = $relationship->rhs_module; |
|
263 | 263 | // if the lhs_module already has a subpanel or relate field sourced from the rhs_module, |
264 | 264 | // or the rhs_module already has a subpanel or relate field sourced from the lhs_module, |
265 | 265 | // then set "relationship_only" in the relationship |
@@ -279,46 +279,46 @@ discard block |
||
279 | 279 | * We use the Extension mechanism to do this for DeployedRelationships |
280 | 280 | * All metadata is placed in the modules Ext directory, and then Rebuild is called to activate them |
281 | 281 | */ |
282 | - function build ($basepath = null, $installDefPrefix = null, $relationships = null) |
|
282 | + function build($basepath = null, $installDefPrefix = null, $relationships = null) |
|
283 | 283 | { |
284 | - $basepath = "custom/Extension/modules" ; |
|
284 | + $basepath = "custom/Extension/modules"; |
|
285 | 285 | |
286 | - $this->activitiesToAdd = false ; |
|
286 | + $this->activitiesToAdd = false; |
|
287 | 287 | |
288 | 288 | // and mark all as built so that the next time we come through we'll know and won't build again |
289 | - foreach ( $this->relationships as $name => $relationship ) |
|
289 | + foreach ($this->relationships as $name => $relationship) |
|
290 | 290 | { |
291 | - $definition = $relationship->getDefinition () ; |
|
291 | + $definition = $relationship->getDefinition(); |
|
292 | 292 | // activities will always appear on the rhs only - lhs will be always be this module in MB |
293 | - if (strtolower ( $definition [ 'rhs_module' ] ) == 'activities') |
|
293 | + if (strtolower($definition ['rhs_module']) == 'activities') |
|
294 | 294 | { |
295 | - $this->activitiesToAdd = true ; |
|
296 | - $relationshipName = $definition [ 'relationship_name' ] ; |
|
297 | - foreach ( self::$activities as $activitiesSubModuleLower => $activitiesSubModuleName ) |
|
295 | + $this->activitiesToAdd = true; |
|
296 | + $relationshipName = $definition ['relationship_name']; |
|
297 | + foreach (self::$activities as $activitiesSubModuleLower => $activitiesSubModuleName) |
|
298 | 298 | { |
299 | - $definition [ 'rhs_module' ] = $activitiesSubModuleName ; |
|
300 | - $definition [ 'for_activities' ] = true ; |
|
301 | - $definition [ 'relationship_name' ] = $relationshipName . '_' . $activitiesSubModuleLower ; |
|
302 | - $this->relationships [ $definition [ 'relationship_name' ] ] = RelationshipFactory::newRelationship ( $definition ) ; |
|
299 | + $definition ['rhs_module'] = $activitiesSubModuleName; |
|
300 | + $definition ['for_activities'] = true; |
|
301 | + $definition ['relationship_name'] = $relationshipName.'_'.$activitiesSubModuleLower; |
|
302 | + $this->relationships [$definition ['relationship_name']] = RelationshipFactory::newRelationship($definition); |
|
303 | 303 | } |
304 | - unset ( $this->relationships [ $name ] ) ; |
|
304 | + unset ($this->relationships [$name]); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | - $GLOBALS [ 'log' ]->info ( get_class ( $this ) . "->build(): installing relationships" ) ; |
|
308 | + $GLOBALS ['log']->info(get_class($this)."->build(): installing relationships"); |
|
309 | 309 | |
310 | - $MBModStrings = $GLOBALS [ 'mod_strings' ] ; |
|
311 | - $adminModStrings = return_module_language ( '', 'Administration' ) ; // required by ModuleInstaller |
|
310 | + $MBModStrings = $GLOBALS ['mod_strings']; |
|
311 | + $adminModStrings = return_module_language('', 'Administration'); // required by ModuleInstaller |
|
312 | 312 | |
313 | - foreach ( $this->relationships as $name => $relationship ) |
|
313 | + foreach ($this->relationships as $name => $relationship) |
|
314 | 314 | { |
315 | 315 | $relationship->setFromStudio(); |
316 | - $GLOBALS [ 'mod_strings' ] = $MBModStrings ; |
|
317 | - $installDefs = parent::build ( $basepath, "<basepath>", array ($name => $relationship ) ) ; |
|
316 | + $GLOBALS ['mod_strings'] = $MBModStrings; |
|
317 | + $installDefs = parent::build($basepath, "<basepath>", array($name => $relationship)); |
|
318 | 318 | |
319 | 319 | // and mark as built so that the next time we come through we'll know and won't build again |
320 | - $relationship->setReadonly () ; |
|
321 | - $this->relationships [ $name ] = $relationship ; |
|
320 | + $relationship->setReadonly(); |
|
321 | + $this->relationships [$name] = $relationship; |
|
322 | 322 | |
323 | 323 | // now install the relationship - ModuleInstaller normally only does this as part of a package load where it installs the relationships defined in the manifest. However, we don't have a manifest or a package, so... |
324 | 324 | |
@@ -332,43 +332,43 @@ discard block |
||
332 | 332 | // and rather than building a full manifest file to carry them, we manually add these installDefs to the ModuleInstaller, and then |
333 | 333 | // individually call the appropriate ModuleInstaller->install_...() methods to take our relationship out of our staging area and expand it out to the individual module Ext areas |
334 | 334 | |
335 | - $GLOBALS [ 'mod_strings' ] = $adminModStrings ; |
|
336 | - require_once 'ModuleInstall/ModuleInstaller.php' ; |
|
337 | - $mi = new ModuleInstaller ( ) ; |
|
335 | + $GLOBALS ['mod_strings'] = $adminModStrings; |
|
336 | + require_once 'ModuleInstall/ModuleInstaller.php'; |
|
337 | + $mi = new ModuleInstaller( ); |
|
338 | 338 | |
339 | - $mi->id_name = 'custom' . $name ; // provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key... |
|
340 | - $mi->installdefs = $installDefs ; |
|
341 | - $mi->base_dir = $basepath ; |
|
342 | - $mi->silent = true ; |
|
339 | + $mi->id_name = 'custom'.$name; // provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key... |
|
340 | + $mi->installdefs = $installDefs; |
|
341 | + $mi->base_dir = $basepath; |
|
342 | + $mi->silent = true; |
|
343 | 343 | |
344 | 344 | |
345 | - VardefManager::clearVardef () ; |
|
345 | + VardefManager::clearVardef(); |
|
346 | 346 | |
347 | - $mi->install_relationships () ; |
|
348 | - $mi->install_languages () ; |
|
349 | - $mi->install_vardefs () ; |
|
350 | - $mi->install_layoutdefs () ; |
|
347 | + $mi->install_relationships(); |
|
348 | + $mi->install_languages(); |
|
349 | + $mi->install_vardefs(); |
|
350 | + $mi->install_layoutdefs(); |
|
351 | 351 | $mi->install_extensions(); |
352 | 352 | |
353 | 353 | } |
354 | 354 | |
355 | 355 | // Run through the module installer to rebuild the relationships once after everything is done. |
356 | - require_once 'ModuleInstall/ModuleInstaller.php' ; |
|
357 | - $mi = new ModuleInstaller ( ) ; |
|
356 | + require_once 'ModuleInstall/ModuleInstaller.php'; |
|
357 | + $mi = new ModuleInstaller( ); |
|
358 | 358 | $mi->silent = true; |
359 | 359 | $mi->rebuild_relationships(); |
360 | 360 | |
361 | 361 | // now clear all caches so that our changes are visible |
362 | - require_once ('modules/Administration/QuickRepairAndRebuild.php') ; |
|
363 | - $rac = new RepairAndClear ( ) ; |
|
364 | - $rac->repairAndClearAll ( array ( 'clearAll' ), array ( $GLOBALS [ 'mod_strings' ] [ 'LBL_ALL_MODULES' ] ), true, false ) ; |
|
362 | + require_once ('modules/Administration/QuickRepairAndRebuild.php'); |
|
363 | + $rac = new RepairAndClear( ); |
|
364 | + $rac->repairAndClearAll(array('clearAll'), array($GLOBALS ['mod_strings'] ['LBL_ALL_MODULES']), true, false); |
|
365 | 365 | |
366 | - $GLOBALS [ 'mod_strings' ] = $MBModStrings ; // finally, restore the ModuleBuilder mod_strings |
|
366 | + $GLOBALS ['mod_strings'] = $MBModStrings; // finally, restore the ModuleBuilder mod_strings |
|
367 | 367 | |
368 | 368 | // save out the updated definitions so that we keep track of the change in built status |
369 | - $this->save () ; |
|
369 | + $this->save(); |
|
370 | 370 | |
371 | - $GLOBALS [ 'log' ]->info ( get_class ( $this ) . "->build(): finished relationship installation" ) ; |
|
371 | + $GLOBALS ['log']->info(get_class($this)."->build(): finished relationship installation"); |
|
372 | 372 | |
373 | 373 | } |
374 | 374 | |
@@ -379,23 +379,23 @@ discard block |
||
379 | 379 | * @param array $layoutAdditions An array of module => fieldname |
380 | 380 | * return null |
381 | 381 | */ |
382 | - protected function saveFieldsToLayouts ($basepath , $dummy , $relationshipName , $layoutAdditions) |
|
382 | + protected function saveFieldsToLayouts($basepath, $dummy, $relationshipName, $layoutAdditions) |
|
383 | 383 | { |
384 | - require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php' ; |
|
384 | + require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php'; |
|
385 | 385 | |
386 | 386 | // these modules either lack editviews/detailviews or use custom mechanisms for the editview/detailview. In either case, we don't want to attempt to add a relate field to them |
387 | 387 | // would be better if GridLayoutMetaDataParser could handle this gracefully, so we don't have to maintain this list here |
388 | - $invalidModules = array ( 'emails' , 'kbdocuments' ) ; |
|
388 | + $invalidModules = array('emails', 'kbdocuments'); |
|
389 | 389 | |
390 | - foreach ( $layoutAdditions as $deployedModuleName => $fieldName ) |
|
390 | + foreach ($layoutAdditions as $deployedModuleName => $fieldName) |
|
391 | 391 | { |
392 | - if (! in_array ( strtolower ( $deployedModuleName ), $invalidModules )) |
|
393 | - foreach ( array ( MB_EDITVIEW , MB_DETAILVIEW ) as $view ) |
|
392 | + if (!in_array(strtolower($deployedModuleName), $invalidModules)) |
|
393 | + foreach (array(MB_EDITVIEW, MB_DETAILVIEW) as $view) |
|
394 | 394 | { |
395 | - $GLOBALS [ 'log' ]->info ( get_class ( $this ) . ": adding $fieldName to $view layout for module $deployedModuleName" ) ; |
|
396 | - $parser = new GridLayoutMetaDataParser ( $view, $deployedModuleName ) ; |
|
397 | - $parser->addField ( array ( 'name' => $fieldName ) ) ; |
|
398 | - $parser->handleSave ( false ) ; |
|
395 | + $GLOBALS ['log']->info(get_class($this).": adding $fieldName to $view layout for module $deployedModuleName"); |
|
396 | + $parser = new GridLayoutMetaDataParser($view, $deployedModuleName); |
|
397 | + $parser->addField(array('name' => $fieldName)); |
|
398 | + $parser->handleSave(false); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | } |
@@ -407,29 +407,29 @@ discard block |
||
407 | 407 | * @param $relationship The relationship that is getting deleted |
408 | 408 | * return null |
409 | 409 | */ |
410 | - private function removeFieldsFromDeployedLayout ($relationship) |
|
410 | + private function removeFieldsFromDeployedLayout($relationship) |
|
411 | 411 | { |
412 | 412 | |
413 | 413 | // many-to-many relationships don't have fields so if we have a many-to-many we can just skip this... |
414 | - if ($relationship->getType () == MB_MANYTOMANY) |
|
415 | - return false ; |
|
414 | + if ($relationship->getType() == MB_MANYTOMANY) |
|
415 | + return false; |
|
416 | 416 | |
417 | - $successful = true ; |
|
418 | - $layoutAdditions = $relationship->buildFieldsToLayouts () ; |
|
417 | + $successful = true; |
|
418 | + $layoutAdditions = $relationship->buildFieldsToLayouts(); |
|
419 | 419 | |
420 | - require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php' ; |
|
421 | - foreach ( $layoutAdditions as $deployedModuleName => $fieldName ) |
|
420 | + require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php'; |
|
421 | + foreach ($layoutAdditions as $deployedModuleName => $fieldName) |
|
422 | 422 | { |
423 | - foreach ( array ( MB_EDITVIEW , MB_DETAILVIEW ) as $view ) |
|
423 | + foreach (array(MB_EDITVIEW, MB_DETAILVIEW) as $view) |
|
424 | 424 | { |
425 | - $parser = new GridLayoutMetaDataParser ( $view, $deployedModuleName ) ; |
|
426 | - $parser->removeField ( $fieldName ); |
|
427 | - $parser->handleSave ( false ) ; |
|
425 | + $parser = new GridLayoutMetaDataParser($view, $deployedModuleName); |
|
426 | + $parser->removeField($fieldName); |
|
427 | + $parser->handleSave(false); |
|
428 | 428 | |
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | - return $successful ; |
|
432 | + return $successful; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | interface RelationshipsInterface |
43 | 43 | { |
44 | 44 | |
45 | - static public function findRelatableModules () ; |
|
45 | + static public function findRelatableModules(); |
|
46 | 46 | |
47 | - public function load () ; |
|
47 | + public function load(); |
|
48 | 48 | |
49 | 49 | // public function build () ; |
50 | 50 | |
51 | - public function getRelationshipList (); |
|
51 | + public function getRelationshipList(); |
|
52 | 52 | |
53 | - public function get ($relationshipName) ; |
|
53 | + public function get($relationshipName); |
|
54 | 54 | |
55 | - public function add ($relationship) ; |
|
55 | + public function add($relationship); |
|
56 | 56 | |
57 | 57 | // public function delete ($relationshipName) ; |
58 | 58 |
@@ -1,5 +1,7 @@ |
||
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. |
@@ -54,9 +54,9 @@ |
||
54 | 54 | if (! isset ( $definition [ 'relationship_type' ] )) |
55 | 55 | $definition [ 'relationship_type' ] = MB_MANYTOMANY ; |
56 | 56 | |
57 | - if (!empty ($definition['for_activities']) && $definition['for_activities'] == true) { |
|
58 | - require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php'; |
|
59 | - return new ActivitiesRelationship ($definition); |
|
57 | + if (!empty ($definition['for_activities']) && $definition['for_activities'] == true) { |
|
58 | + require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php'; |
|
59 | + return new ActivitiesRelationship ($definition); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | switch ( strtolower ( $definition [ 'relationship_type' ] )) |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | |
42 | -require_once 'modules/ModuleBuilder/parsers/constants.php' ; |
|
42 | +require_once 'modules/ModuleBuilder/parsers/constants.php'; |
|
43 | 43 | |
44 | 44 | class RelationshipFactory |
45 | 45 | { |
@@ -48,36 +48,36 @@ discard block |
||
48 | 48 | * Construct a new relationship of type as provided by the $definition |
49 | 49 | * @param array $definition Complete definition of the relationship, as specified by AbstractRelationship::keys |
50 | 50 | */ |
51 | - static function newRelationship ($definition = array()) |
|
51 | + static function newRelationship($definition = array()) |
|
52 | 52 | { |
53 | 53 | // 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 ; |
|
54 | + if (!isset ($definition ['relationship_type'])) |
|
55 | + $definition ['relationship_type'] = MB_MANYTOMANY; |
|
56 | 56 | |
57 | 57 | if (!empty ($definition['for_activities']) && $definition['for_activities'] == true) { |
58 | 58 | require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php'; |
59 | - return new ActivitiesRelationship ($definition); |
|
59 | + return new ActivitiesRelationship($definition); |
|
60 | 60 | } |
61 | 61 | |
62 | - switch ( strtolower ( $definition [ 'relationship_type' ] )) |
|
62 | + switch (strtolower($definition ['relationship_type'])) |
|
63 | 63 | { |
64 | - case strtolower ( MB_ONETOONE ) : |
|
65 | - require_once 'modules/ModuleBuilder/parsers/relationships/OneToOneRelationship.php' ; |
|
66 | - return new OneToOneRelationship ( $definition ) ; |
|
64 | + case strtolower(MB_ONETOONE) : |
|
65 | + require_once 'modules/ModuleBuilder/parsers/relationships/OneToOneRelationship.php'; |
|
66 | + return new OneToOneRelationship($definition); |
|
67 | 67 | |
68 | - case strtolower ( MB_ONETOMANY ) : |
|
69 | - require_once 'modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php' ; |
|
70 | - return new OneToManyRelationship ( $definition ) ; |
|
68 | + case strtolower(MB_ONETOMANY) : |
|
69 | + require_once 'modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php'; |
|
70 | + return new OneToManyRelationship($definition); |
|
71 | 71 | |
72 | - case strtolower ( MB_MANYTOONE ) : |
|
73 | - require_once 'modules/ModuleBuilder/parsers/relationships/ManyToOneRelationship.php' ; |
|
74 | - return new ManyToOneRelationship ( $definition ) ; |
|
72 | + case strtolower(MB_MANYTOONE) : |
|
73 | + require_once 'modules/ModuleBuilder/parsers/relationships/ManyToOneRelationship.php'; |
|
74 | + return new ManyToOneRelationship($definition); |
|
75 | 75 | |
76 | 76 | // default case is Many-To-Many as this was the only type ModuleBuilder could create and so much of the MB code assumes Many-To-Many |
77 | 77 | default : |
78 | - $definition [ 'relationship_type' ] = MB_MANYTOMANY ; |
|
79 | - require_once 'modules/ModuleBuilder/parsers/relationships/ManyToManyRelationship.php' ; |
|
80 | - return new ManyToManyRelationship ( $definition ) ; |
|
78 | + $definition ['relationship_type'] = MB_MANYTOMANY; |
|
79 | + require_once 'modules/ModuleBuilder/parsers/relationships/ManyToManyRelationship.php'; |
|
80 | + return new ManyToManyRelationship($definition); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | } |
@@ -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'; |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | $source = ""; |
100 | 100 | if ($this->rhs_module == $this->lhs_module) |
101 | 101 | { |
102 | - $source = $this->getJoinKeyLHS(); |
|
102 | + $source = $this->getJoinKeyLHS(); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return array( |
106 | - $this->lhs_module => $this->getSubpanelDefinition ( |
|
107 | - $this->relationship_name, $this->rhs_module, $this->rhs_subpanel , $this->getRightModuleSystemLabel() , $source |
|
108 | - ) |
|
106 | + $this->lhs_module => $this->getSubpanelDefinition ( |
|
107 | + $this->relationship_name, $this->rhs_module, $this->rhs_subpanel , $this->getRightModuleSystemLabel() , $source |
|
108 | + ) |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /* |
114 | 114 | * @return array An array of field definitions, ready for the vardefs, keyed by module |
115 | 115 | */ |
116 | - function buildVardefs ( ) |
|
116 | + function buildVardefs ( ) |
|
117 | 117 | { |
118 | 118 | $vardefs = array ( ) ; |
119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ) ; |
124 | 124 | if ($this->rhs_module != $this->lhs_module ) |
125 | 125 | { |
126 | - $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, true, |
|
126 | + $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, true, |
|
127 | 127 | 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel() ) . '_TITLE'); |
128 | 128 | } |
129 | 129 | if (! $this->relationship_only) |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | |
42 | -require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php' ; |
|
42 | +require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php'; |
|
43 | 43 | |
44 | 44 | /* |
45 | 45 | * Class to manage the metadata for a One-To-Many Relationship |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * @param array $definition Parameters passed in as array defined in parent::$definitionKeys |
78 | 78 | * The lhs_module value is for the One side; the rhs_module value is for the Many |
79 | 79 | */ |
80 | - function __construct ($definition) |
|
80 | + function __construct($definition) |
|
81 | 81 | { |
82 | - parent::__construct ( $definition ) ; |
|
82 | + parent::__construct($definition); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /* |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * The format is that of TO_MODULE => relationship, FROM_MODULE, FROM_MODULES_SUBPANEL, mimicking the format in the layoutdefs.php |
92 | 92 | * @return array An array of subpanel definitions, keyed by the module |
93 | 93 | */ |
94 | - function buildSubpanelDefinitions () |
|
94 | + function buildSubpanelDefinitions() |
|
95 | 95 | { |
96 | 96 | if ($this->relationship_only) |
97 | - return array () ; |
|
97 | + return array(); |
|
98 | 98 | |
99 | 99 | $source = ""; |
100 | 100 | if ($this->rhs_module == $this->lhs_module) |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | return array( |
106 | - $this->lhs_module => $this->getSubpanelDefinition ( |
|
107 | - $this->relationship_name, $this->rhs_module, $this->rhs_subpanel , $this->getRightModuleSystemLabel() , $source |
|
106 | + $this->lhs_module => $this->getSubpanelDefinition( |
|
107 | + $this->relationship_name, $this->rhs_module, $this->rhs_subpanel, $this->getRightModuleSystemLabel(), $source |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | } |
@@ -113,47 +113,47 @@ discard block |
||
113 | 113 | /* |
114 | 114 | * @return array An array of field definitions, ready for the vardefs, keyed by module |
115 | 115 | */ |
116 | - function buildVardefs ( ) |
|
116 | + function buildVardefs( ) |
|
117 | 117 | { |
118 | - $vardefs = array ( ) ; |
|
118 | + $vardefs = array( ); |
|
119 | 119 | |
120 | - $vardefs [ $this->rhs_module ] [] = $this->getLinkFieldDefinition ( $this->lhs_module, $this->relationship_name, false, |
|
121 | - 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel() ) . '_TITLE', |
|
122 | - $this->relationship_only ? false : $this->getIDName( $this->lhs_module ) |
|
123 | - ) ; |
|
124 | - if ($this->rhs_module != $this->lhs_module ) |
|
120 | + $vardefs [$this->rhs_module] [] = $this->getLinkFieldDefinition($this->lhs_module, $this->relationship_name, false, |
|
121 | + 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getLeftModuleSystemLabel()).'_TITLE', |
|
122 | + $this->relationship_only ? false : $this->getIDName($this->lhs_module) |
|
123 | + ); |
|
124 | + if ($this->rhs_module != $this->lhs_module) |
|
125 | 125 | { |
126 | - $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, true, |
|
127 | - 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel() ) . '_TITLE'); |
|
126 | + $vardefs [$this->lhs_module] [] = $this->getLinkFieldDefinition($this->rhs_module, $this->relationship_name, true, |
|
127 | + 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getRightModuleSystemLabel()).'_TITLE'); |
|
128 | 128 | } |
129 | - if (! $this->relationship_only) |
|
129 | + if (!$this->relationship_only) |
|
130 | 130 | { |
131 | - $vardefs [ $this->rhs_module ] [] = $this->getRelateFieldDefinition ( $this->lhs_module, $this->relationship_name, $this->getLeftModuleSystemLabel() ) ; |
|
132 | - $vardefs [ $this->rhs_module ] [] = $this->getLink2FieldDefinition ( $this->lhs_module, $this->relationship_name, true, |
|
133 | - 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel() ) . '_TITLE'); |
|
131 | + $vardefs [$this->rhs_module] [] = $this->getRelateFieldDefinition($this->lhs_module, $this->relationship_name, $this->getLeftModuleSystemLabel()); |
|
132 | + $vardefs [$this->rhs_module] [] = $this->getLink2FieldDefinition($this->lhs_module, $this->relationship_name, true, |
|
133 | + 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getRightModuleSystemLabel()).'_TITLE'); |
|
134 | 134 | } |
135 | 135 | |
136 | - return $vardefs ; |
|
136 | + return $vardefs; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /* |
140 | 140 | * Define what fields to add to which modules layouts |
141 | 141 | * @return array An array of module => fieldname |
142 | 142 | */ |
143 | - function buildFieldsToLayouts () |
|
143 | + function buildFieldsToLayouts() |
|
144 | 144 | { |
145 | 145 | if ($this->relationship_only) |
146 | - return array () ; |
|
146 | + return array(); |
|
147 | 147 | |
148 | - return array( $this->rhs_module =>$this->getValidDBName($this->relationship_name . "_name")); // this must match the name of the relate field from buildVardefs |
|
148 | + return array($this->rhs_module =>$this->getValidDBName($this->relationship_name."_name")); // this must match the name of the relate field from buildVardefs |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /* |
152 | 152 | * @return array An array of relationship metadata definitions |
153 | 153 | */ |
154 | - function buildRelationshipMetaData () |
|
154 | + function buildRelationshipMetaData() |
|
155 | 155 | { |
156 | - return array( $this->lhs_module => $this->getRelationshipMetaData ( MB_ONETOMANY ) ) ; |
|
156 | + return array($this->lhs_module => $this->getRelationshipMetaData(MB_ONETOMANY)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | } |
@@ -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 | } |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | function __construct ($definition) |
61 | 61 | { |
62 | 62 | |
63 | - parent::__construct ( $definition ) ; |
|
64 | - $onetomanyDef = array_merge($definition, array( |
|
65 | - 'rhs_label' => isset($definition['lhs_label']) ? $definition['lhs_label'] : null, |
|
66 | - 'lhs_label' => isset($definition['rhs_label']) ? $definition['rhs_label'] : null, |
|
67 | - 'lhs_subpanel' => isset($definition['rhs_subpanel']) ? $definition['rhs_subpanel'] : null, |
|
68 | - 'rhs_subpanel' => isset($definition['lhs_subpanel']) ? $definition['lhs_subpanel'] : null, |
|
69 | - 'lhs_module' => isset($definition['rhs_module']) ? $definition['rhs_module'] : null, |
|
70 | - 'lhs_table' => isset($definition['rhs_table']) ? $definition['rhs_table'] : null, |
|
71 | - 'lhs_key' => isset($definition['rhs_key']) ? $definition['rhs_key'] : null, |
|
72 | - 'rhs_module' => isset($definition['lhs_module']) ? $definition['lhs_module'] : null, |
|
73 | - 'rhs_table' => isset($definition['lhs_table']) ? $definition['lhs_table'] : null, |
|
74 | - 'rhs_key' => isset($definition['lhs_key']) ? $definition['lhs_key'] : null, |
|
75 | - 'join_key_lhs' => isset($definition['join_key_rhs']) ? $definition['join_key_rhs'] : null, |
|
76 | - 'join_key_rhs' => isset($definition['join_key_lhs']) ? $definition['join_key_lhs'] : null, |
|
77 | - 'relationship_type' => MB_ONETOMANY, |
|
63 | + parent::__construct ( $definition ) ; |
|
64 | + $onetomanyDef = array_merge($definition, array( |
|
65 | + 'rhs_label' => isset($definition['lhs_label']) ? $definition['lhs_label'] : null, |
|
66 | + 'lhs_label' => isset($definition['rhs_label']) ? $definition['rhs_label'] : null, |
|
67 | + 'lhs_subpanel' => isset($definition['rhs_subpanel']) ? $definition['rhs_subpanel'] : null, |
|
68 | + 'rhs_subpanel' => isset($definition['lhs_subpanel']) ? $definition['lhs_subpanel'] : null, |
|
69 | + 'lhs_module' => isset($definition['rhs_module']) ? $definition['rhs_module'] : null, |
|
70 | + 'lhs_table' => isset($definition['rhs_table']) ? $definition['rhs_table'] : null, |
|
71 | + 'lhs_key' => isset($definition['rhs_key']) ? $definition['rhs_key'] : null, |
|
72 | + 'rhs_module' => isset($definition['lhs_module']) ? $definition['lhs_module'] : null, |
|
73 | + 'rhs_table' => isset($definition['lhs_table']) ? $definition['lhs_table'] : null, |
|
74 | + 'rhs_key' => isset($definition['lhs_key']) ? $definition['lhs_key'] : null, |
|
75 | + 'join_key_lhs' => isset($definition['join_key_rhs']) ? $definition['join_key_rhs'] : null, |
|
76 | + 'join_key_rhs' => isset($definition['join_key_lhs']) ? $definition['join_key_lhs'] : null, |
|
77 | + 'relationship_type' => MB_ONETOMANY, |
|
78 | 78 | )); |
79 | 79 | $this->one_to_many = new OneToManyRelationship($onetomanyDef); |
80 | 80 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * BUILD methods called during the build |
84 | 84 | */ |
85 | 85 | |
86 | - function buildLabels () |
|
86 | + function buildLabels () |
|
87 | 87 | { |
88 | 88 | return $this->one_to_many->buildLabels(); |
89 | 89 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function buildVardefs ( ) |
106 | 106 | { |
107 | - return $this->one_to_many->buildVardefs(); |
|
107 | + return $this->one_to_many->buildVardefs(); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /* |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | public function setName ($relationshipName) |
131 | 131 | { |
132 | 132 | parent::setName($relationshipName); |
133 | - $this->one_to_many->setname($relationshipName); |
|
133 | + $this->one_to_many->setname($relationshipName); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | public function setReadonly () |
137 | 137 | { |
138 | 138 | parent::setReadonly(); |
139 | - $this->one_to_many->setReadonly(); |
|
139 | + $this->one_to_many->setReadonly(); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | public function delete () |
143 | 143 | { |
144 | 144 | parent::delete(); |
145 | - $this->one_to_many->delete(); |
|
145 | + $this->one_to_many->delete(); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | public function setRelationship_only () |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | |
42 | -require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php' ; |
|
43 | -require_once 'modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php' ; |
|
44 | -require_once 'modules/ModuleBuilder/parsers/constants.php' ; |
|
42 | +require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php'; |
|
43 | +require_once 'modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php'; |
|
44 | +require_once 'modules/ModuleBuilder/parsers/constants.php'; |
|
45 | 45 | |
46 | 46 | /* |
47 | 47 | * Class to manage the metadata for a many-To-one Relationship |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | * @param array $definition Parameters passed in as array defined in parent::$definitionKeys |
58 | 58 | * The lhs_module value is for the One side; the rhs_module value is for the Many |
59 | 59 | */ |
60 | - function __construct ($definition) |
|
60 | + function __construct($definition) |
|
61 | 61 | { |
62 | 62 | |
63 | - parent::__construct ( $definition ) ; |
|
63 | + parent::__construct($definition); |
|
64 | 64 | $onetomanyDef = array_merge($definition, array( |
65 | - 'rhs_label' => isset($definition['lhs_label']) ? $definition['lhs_label'] : null, |
|
66 | - 'lhs_label' => isset($definition['rhs_label']) ? $definition['rhs_label'] : null, |
|
65 | + 'rhs_label' => isset($definition['lhs_label']) ? $definition['lhs_label'] : null, |
|
66 | + 'lhs_label' => isset($definition['rhs_label']) ? $definition['rhs_label'] : null, |
|
67 | 67 | 'lhs_subpanel' => isset($definition['rhs_subpanel']) ? $definition['rhs_subpanel'] : null, |
68 | 68 | 'rhs_subpanel' => isset($definition['lhs_subpanel']) ? $definition['lhs_subpanel'] : null, |
69 | - 'lhs_module' => isset($definition['rhs_module']) ? $definition['rhs_module'] : null, |
|
70 | - 'lhs_table' => isset($definition['rhs_table']) ? $definition['rhs_table'] : null, |
|
71 | - 'lhs_key' => isset($definition['rhs_key']) ? $definition['rhs_key'] : null, |
|
72 | - 'rhs_module' => isset($definition['lhs_module']) ? $definition['lhs_module'] : null, |
|
73 | - 'rhs_table' => isset($definition['lhs_table']) ? $definition['lhs_table'] : null, |
|
74 | - 'rhs_key' => isset($definition['lhs_key']) ? $definition['lhs_key'] : null, |
|
69 | + 'lhs_module' => isset($definition['rhs_module']) ? $definition['rhs_module'] : null, |
|
70 | + 'lhs_table' => isset($definition['rhs_table']) ? $definition['rhs_table'] : null, |
|
71 | + 'lhs_key' => isset($definition['rhs_key']) ? $definition['rhs_key'] : null, |
|
72 | + 'rhs_module' => isset($definition['lhs_module']) ? $definition['lhs_module'] : null, |
|
73 | + 'rhs_table' => isset($definition['lhs_table']) ? $definition['lhs_table'] : null, |
|
74 | + 'rhs_key' => isset($definition['lhs_key']) ? $definition['lhs_key'] : null, |
|
75 | 75 | 'join_key_lhs' => isset($definition['join_key_rhs']) ? $definition['join_key_rhs'] : null, |
76 | 76 | 'join_key_rhs' => isset($definition['join_key_lhs']) ? $definition['join_key_lhs'] : null, |
77 | 77 | 'relationship_type' => MB_ONETOMANY, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * BUILD methods called during the build |
84 | 84 | */ |
85 | 85 | |
86 | - function buildLabels () |
|
86 | + function buildLabels() |
|
87 | 87 | { |
88 | 88 | return $this->one_to_many->buildLabels(); |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * The format is that of TO_MODULE => relationship, FROM_MODULE, FROM_MODULES_SUBPANEL, mimicking the format in the layoutdefs.php |
94 | 94 | * @return array An array of subpanel definitions, keyed by the module |
95 | 95 | */ |
96 | - function buildSubpanelDefinitions () |
|
96 | + function buildSubpanelDefinitions() |
|
97 | 97 | { |
98 | 98 | return $this->one_to_many->buildSubpanelDefinitions(); |
99 | 99 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /* |
103 | 103 | * @return array An array of field definitions, ready for the vardefs, keyed by module |
104 | 104 | */ |
105 | - function buildVardefs ( ) |
|
105 | + function buildVardefs( ) |
|
106 | 106 | { |
107 | 107 | return $this->one_to_many->buildVardefs(); |
108 | 108 | } |
@@ -111,41 +111,41 @@ discard block |
||
111 | 111 | * Define what fields to add to which modules layouts |
112 | 112 | * @return array An array of module => fieldname |
113 | 113 | */ |
114 | - function buildFieldsToLayouts () |
|
114 | + function buildFieldsToLayouts() |
|
115 | 115 | { |
116 | 116 | if ($this->relationship_only) |
117 | - return array () ; |
|
117 | + return array(); |
|
118 | 118 | |
119 | - return array( $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") ) ; // this must match the name of the relate field from buildVardefs |
|
119 | + return array($this->lhs_module => $this->getValidDBName($this->relationship_name."_name")); // this must match the name of the relate field from buildVardefs |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /* |
123 | 123 | * @return array An array of relationship metadata definitions |
124 | 124 | */ |
125 | - function buildRelationshipMetaData () |
|
125 | + function buildRelationshipMetaData() |
|
126 | 126 | { |
127 | 127 | return $this->one_to_many->buildRelationshipMetaData(); |
128 | 128 | } |
129 | 129 | |
130 | - public function setName ($relationshipName) |
|
130 | + public function setName($relationshipName) |
|
131 | 131 | { |
132 | 132 | parent::setName($relationshipName); |
133 | 133 | $this->one_to_many->setname($relationshipName); |
134 | 134 | } |
135 | 135 | |
136 | - public function setReadonly () |
|
136 | + public function setReadonly() |
|
137 | 137 | { |
138 | 138 | parent::setReadonly(); |
139 | 139 | $this->one_to_many->setReadonly(); |
140 | 140 | } |
141 | 141 | |
142 | - public function delete () |
|
142 | + public function delete() |
|
143 | 143 | { |
144 | 144 | parent::delete(); |
145 | 145 | $this->one_to_many->delete(); |
146 | 146 | } |
147 | 147 | |
148 | - public function setRelationship_only () |
|
148 | + public function setRelationship_only() |
|
149 | 149 | { |
150 | 150 | parent::setRelationship_only(); |
151 | 151 | $this->one_to_many->setRelationship_only(); |
@@ -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 | } |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | class ActivitiesRelationship extends OneToManyRelationship |
73 | 73 | { |
74 | 74 | |
75 | - protected static $subpanelsAdded = array(); |
|
76 | - protected static $labelsAdded = array(); |
|
75 | + protected static $subpanelsAdded = array(); |
|
76 | + protected static $labelsAdded = array(); |
|
77 | 77 | |
78 | - /* |
|
78 | + /* |
|
79 | 79 | * Constructor |
80 | 80 | * @param array $definition Parameters passed in as array defined in parent::$definitionKeys |
81 | 81 | * The lhs_module value is for the One side; the rhs_module value is for the Many |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * BUILD methods called during the build |
90 | 90 | */ |
91 | 91 | |
92 | - /* |
|
92 | + /* |
|
93 | 93 | * Define the labels to be added to the module for the new relationships |
94 | 94 | * @return array An array of system value => display value |
95 | 95 | */ |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - /* |
|
143 | + /* |
|
144 | 144 | * @return array An array of field definitions, ready for the vardefs, keyed by module |
145 | 145 | */ |
146 | 146 | function buildVardefs ( ) |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return $vardefs ; |
155 | 155 | } |
156 | 156 | |
157 | - protected function getLinkFieldDefinition ($sourceModule , $relationshipName) |
|
157 | + protected function getLinkFieldDefinition ($sourceModule , $relationshipName) |
|
158 | 158 | { |
159 | 159 | $vardef = array ( ) ; |
160 | 160 | $vardef [ 'name' ] = $relationshipName; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return array( $this->rhs_module => $this->relationship_name . "_name" ) ; // this must match the name of the relate field from buildVardefs |
180 | 180 | } |
181 | 181 | |
182 | - function buildSubpanelDefinitions () |
|
182 | + function buildSubpanelDefinitions () |
|
183 | 183 | { |
184 | 184 | if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module])) |
185 | 185 | return array () ; |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | ActivitiesRelationship::$subpanelsAdded[$this->lhs_module] = true; |
188 | 188 | $relationshipName = substr($this->relationship_name, 0, strrpos($this->relationship_name, '_')); |
189 | 189 | return array( $this->lhs_module => array ( |
190 | - 'activities' => $this->buildActivitiesSubpanelDefinition ( $relationshipName ), |
|
191 | - 'history' => $this->buildHistorySubpanelDefinition ( $relationshipName ) , |
|
192 | - )); |
|
190 | + 'activities' => $this->buildActivitiesSubpanelDefinition ( $relationshipName ), |
|
191 | + 'history' => $this->buildHistorySubpanelDefinition ( $relationshipName ) , |
|
192 | + )); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /* |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | $relMetadata ['relationship_role_column'] = 'parent_type'; |
210 | 210 | $relMetadata ['relationship_role_column_value'] = $this->definition [ 'lhs_module' ] ; |
211 | 211 | |
212 | - return array( $this->lhs_module => array( |
|
213 | - 'relationships' => array ($relationshipName => $relMetadata), |
|
214 | - 'fields' => '', 'indices' => '', 'table' => '') |
|
215 | - ) ; |
|
212 | + return array( $this->lhs_module => array( |
|
213 | + 'relationships' => array ($relationshipName => $relMetadata), |
|
214 | + 'fields' => '', 'indices' => '', 'table' => '') |
|
215 | + ) ; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /* |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function buildActivitiesSubpanelDefinition ( $relationshipName ) |
223 | 223 | { |
224 | - return array ( |
|
224 | + return array ( |
|
225 | 225 | 'order' => 10 , |
226 | 226 | 'sort_order' => 'desc' , |
227 | 227 | 'sort_by' => 'date_start' , |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'module' => 'History' , |
266 | 266 | 'top_buttons' => array ( |
267 | 267 | array ( 'widget_class' => 'SubPanelTopCreateNoteButton' ) , |
268 | - array ( 'widget_class' => 'SubPanelTopArchiveEmailButton'), |
|
268 | + array ( 'widget_class' => 'SubPanelTopArchiveEmailButton'), |
|
269 | 269 | array ( 'widget_class' => 'SubPanelTopSummaryButton' ) ) , |
270 | 270 | 'collection_list' => array ( |
271 | 271 | 'meetings' => array ( |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | |
42 | -require_once 'modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php' ; |
|
42 | +require_once 'modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php'; |
|
43 | 43 | |
44 | 44 | /* |
45 | 45 | * Class to manage the metadata for a One-To-Many Relationship |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @param array $definition Parameters passed in as array defined in parent::$definitionKeys |
81 | 81 | * The lhs_module value is for the One side; the rhs_module value is for the Many |
82 | 82 | */ |
83 | - function __construct ($definition) |
|
83 | + function __construct($definition) |
|
84 | 84 | { |
85 | - parent::__construct ( $definition ) ; |
|
85 | + parent::__construct($definition); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /* |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | * Define the labels to be added to the module for the new relationships |
94 | 94 | * @return array An array of system value => display value |
95 | 95 | */ |
96 | - function buildLabels () |
|
96 | + function buildLabels() |
|
97 | 97 | { |
98 | - $labelDefinitions = array ( ) ; |
|
99 | - if (!$this->relationship_only ) |
|
98 | + $labelDefinitions = array( ); |
|
99 | + if (!$this->relationship_only) |
|
100 | 100 | { |
101 | 101 | if (!isset(ActivitiesRelationship::$labelsAdded[$this->lhs_module])) { |
102 | - foreach(getTypeDisplayList() as $typeDisplay) |
|
102 | + foreach (getTypeDisplayList() as $typeDisplay) |
|
103 | 103 | { |
104 | - $labelDefinitions [] = array ( |
|
104 | + $labelDefinitions [] = array( |
|
105 | 105 | 'module' => 'application', |
106 | 106 | 'system_label' => $typeDisplay, |
107 | 107 | 'display_label' => array( |
@@ -113,180 +113,180 @@ discard block |
||
113 | 113 | |
114 | 114 | $rhs_display_label = ''; |
115 | 115 | if (!empty($this->rhs_label)) { |
116 | - $rhs_display_label .= $this->rhs_label . ':'; |
|
116 | + $rhs_display_label .= $this->rhs_label.':'; |
|
117 | 117 | } |
118 | 118 | $rhs_display_label .= translate($this->rhs_module); |
119 | 119 | |
120 | 120 | $lhs_display_label = ''; |
121 | 121 | if (!empty($this->rhs_label)) { |
122 | - $lhs_display_label .= $this->rhs_label . ':'; |
|
122 | + $lhs_display_label .= $this->rhs_label.':'; |
|
123 | 123 | } |
124 | 124 | $lhs_display_label .= translate($this->lhs_module); |
125 | 125 | |
126 | - $labelDefinitions[] = array ( |
|
127 | - 'module' => $this->lhs_module , |
|
128 | - 'system_label' => 'LBL_' . strtoupper($this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel()) . '_TITLE', |
|
126 | + $labelDefinitions[] = array( |
|
127 | + 'module' => $this->lhs_module, |
|
128 | + 'system_label' => 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getRightModuleSystemLabel()).'_TITLE', |
|
129 | 129 | 'display_label' => $rhs_display_label |
130 | 130 | ); |
131 | 131 | $labelDefinitions[] = array( |
132 | 132 | 'module' => $this->rhs_module, |
133 | - 'system_label' => 'LBL_' . strtoupper($this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel()) . '_TITLE', |
|
133 | + 'system_label' => 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getLeftModuleSystemLabel()).'_TITLE', |
|
134 | 134 | 'display_label' => $lhs_display_label |
135 | 135 | ); |
136 | 136 | |
137 | 137 | ActivitiesRelationship::$labelsAdded[$this->lhs_module] = true; |
138 | 138 | } |
139 | - return $labelDefinitions ; |
|
139 | + return $labelDefinitions; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | /* |
144 | 144 | * @return array An array of field definitions, ready for the vardefs, keyed by module |
145 | 145 | */ |
146 | - function buildVardefs ( ) |
|
146 | + function buildVardefs( ) |
|
147 | 147 | { |
148 | - $vardefs = array ( ) ; |
|
148 | + $vardefs = array( ); |
|
149 | 149 | |
150 | - $vardefs [ $this->rhs_module ] [] = $this->getLinkFieldDefinition ( $this->lhs_module, $this->relationship_name ) ; |
|
151 | - $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name ) ; |
|
150 | + $vardefs [$this->rhs_module] [] = $this->getLinkFieldDefinition($this->lhs_module, $this->relationship_name); |
|
151 | + $vardefs [$this->lhs_module] [] = $this->getLinkFieldDefinition($this->rhs_module, $this->relationship_name); |
|
152 | 152 | |
153 | 153 | |
154 | - return $vardefs ; |
|
154 | + return $vardefs; |
|
155 | 155 | } |
156 | 156 | |
157 | - protected function getLinkFieldDefinition ($sourceModule , $relationshipName) |
|
157 | + protected function getLinkFieldDefinition($sourceModule, $relationshipName) |
|
158 | 158 | { |
159 | - $vardef = array ( ) ; |
|
160 | - $vardef [ 'name' ] = $relationshipName; |
|
161 | - $vardef [ 'type' ] = 'link' ; |
|
162 | - $vardef [ 'relationship' ] = $relationshipName ; |
|
163 | - $vardef [ 'source' ] = 'non-db' ; |
|
164 | - $vardef [ 'module' ] = $sourceModule ; |
|
165 | - $vardef [ 'bean_name' ] = BeanFactory::getObjectName($sourceModule) ; |
|
166 | - $vardef [ 'vname' ] = strtoupper("LBL_{$relationshipName}_FROM_{$sourceModule}_TITLE"); |
|
167 | - return $vardef ; |
|
159 | + $vardef = array( ); |
|
160 | + $vardef ['name'] = $relationshipName; |
|
161 | + $vardef ['type'] = 'link'; |
|
162 | + $vardef ['relationship'] = $relationshipName; |
|
163 | + $vardef ['source'] = 'non-db'; |
|
164 | + $vardef ['module'] = $sourceModule; |
|
165 | + $vardef ['bean_name'] = BeanFactory::getObjectName($sourceModule); |
|
166 | + $vardef ['vname'] = strtoupper("LBL_{$relationshipName}_FROM_{$sourceModule}_TITLE"); |
|
167 | + return $vardef; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /* |
171 | 171 | * Define what fields to add to which modules layouts |
172 | 172 | * @return array An array of module => fieldname |
173 | 173 | */ |
174 | - function buildFieldsToLayouts () |
|
174 | + function buildFieldsToLayouts() |
|
175 | 175 | { |
176 | 176 | if ($this->relationship_only) |
177 | - return array () ; |
|
177 | + return array(); |
|
178 | 178 | |
179 | - return array( $this->rhs_module => $this->relationship_name . "_name" ) ; // this must match the name of the relate field from buildVardefs |
|
179 | + return array($this->rhs_module => $this->relationship_name."_name"); // this must match the name of the relate field from buildVardefs |
|
180 | 180 | } |
181 | 181 | |
182 | - function buildSubpanelDefinitions () |
|
182 | + function buildSubpanelDefinitions() |
|
183 | 183 | { |
184 | 184 | if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module])) |
185 | - return array () ; |
|
185 | + return array(); |
|
186 | 186 | |
187 | 187 | ActivitiesRelationship::$subpanelsAdded[$this->lhs_module] = true; |
188 | 188 | $relationshipName = substr($this->relationship_name, 0, strrpos($this->relationship_name, '_')); |
189 | - return array( $this->lhs_module => array ( |
|
190 | - 'activities' => $this->buildActivitiesSubpanelDefinition ( $relationshipName ), |
|
191 | - 'history' => $this->buildHistorySubpanelDefinition ( $relationshipName ) , |
|
189 | + return array($this->lhs_module => array( |
|
190 | + 'activities' => $this->buildActivitiesSubpanelDefinition($relationshipName), |
|
191 | + 'history' => $this->buildHistorySubpanelDefinition($relationshipName), |
|
192 | 192 | )); |
193 | 193 | } |
194 | 194 | |
195 | 195 | /* |
196 | 196 | * @return array An array of relationship metadata definitions |
197 | 197 | */ |
198 | - function buildRelationshipMetaData () |
|
198 | + function buildRelationshipMetaData() |
|
199 | 199 | { |
200 | - $relationshipName = $this->definition [ 'relationship_name' ]; |
|
201 | - $relMetadata = array ( ) ; |
|
202 | - $relMetadata [ 'lhs_module' ] = $this->definition [ 'lhs_module' ] ; |
|
203 | - $relMetadata [ 'lhs_table' ] = $this->getTablename($this->definition [ 'lhs_module' ]) ; |
|
204 | - $relMetadata [ 'lhs_key' ] = 'id' ; |
|
205 | - $relMetadata [ 'rhs_module' ] = $this->definition [ 'rhs_module' ] ; |
|
206 | - $relMetadata [ 'rhs_table' ] = $this->getTablename($this->definition [ 'rhs_module' ]) ; |
|
200 | + $relationshipName = $this->definition ['relationship_name']; |
|
201 | + $relMetadata = array( ); |
|
202 | + $relMetadata ['lhs_module'] = $this->definition ['lhs_module']; |
|
203 | + $relMetadata ['lhs_table'] = $this->getTablename($this->definition ['lhs_module']); |
|
204 | + $relMetadata ['lhs_key'] = 'id'; |
|
205 | + $relMetadata ['rhs_module'] = $this->definition ['rhs_module']; |
|
206 | + $relMetadata ['rhs_table'] = $this->getTablename($this->definition ['rhs_module']); |
|
207 | 207 | $relMetadata ['rhs_key'] = 'parent_id'; |
208 | 208 | $relMetadata ['relationship_type'] = 'one-to-many'; |
209 | 209 | $relMetadata ['relationship_role_column'] = 'parent_type'; |
210 | - $relMetadata ['relationship_role_column_value'] = $this->definition [ 'lhs_module' ] ; |
|
210 | + $relMetadata ['relationship_role_column_value'] = $this->definition ['lhs_module']; |
|
211 | 211 | |
212 | - return array( $this->lhs_module => array( |
|
213 | - 'relationships' => array ($relationshipName => $relMetadata), |
|
212 | + return array($this->lhs_module => array( |
|
213 | + 'relationships' => array($relationshipName => $relMetadata), |
|
214 | 214 | 'fields' => '', 'indices' => '', 'table' => '') |
215 | - ) ; |
|
215 | + ); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /* |
219 | 219 | * Shortcut to construct an Activities collection subpanel |
220 | 220 | * @param AbstractRelationship $relationship Source relationship to Activities module |
221 | 221 | */ |
222 | - protected function buildActivitiesSubpanelDefinition ( $relationshipName ) |
|
222 | + protected function buildActivitiesSubpanelDefinition($relationshipName) |
|
223 | 223 | { |
224 | - return array ( |
|
225 | - 'order' => 10 , |
|
226 | - 'sort_order' => 'desc' , |
|
227 | - 'sort_by' => 'date_start' , |
|
228 | - 'title_key' => 'LBL_ACTIVITIES_SUBPANEL_TITLE' , |
|
229 | - 'type' => 'collection' , |
|
230 | - 'subpanel_name' => 'activities' , //this value is not associated with a physical file |
|
231 | - 'module' => 'Activities' , |
|
232 | - 'top_buttons' => array ( |
|
233 | - array ( 'widget_class' => 'SubPanelTopCreateTaskButton' ) , |
|
234 | - array ( 'widget_class' => 'SubPanelTopScheduleMeetingButton' ) , |
|
235 | - array ( 'widget_class' => 'SubPanelTopScheduleCallButton' ) , |
|
236 | - array ( 'widget_class' => 'SubPanelTopComposeEmailButton' ) ) , |
|
237 | - 'collection_list' => array ( |
|
238 | - 'meetings' => array ( |
|
239 | - 'module' => 'Meetings' , |
|
240 | - 'subpanel_name' => 'ForActivities' , |
|
241 | - 'get_subpanel_data' => $relationshipName. '_meetings' ) , |
|
242 | - 'tasks' => array ( |
|
243 | - 'module' => 'Tasks' , |
|
244 | - 'subpanel_name' => 'ForActivities' , |
|
245 | - 'get_subpanel_data' => $relationshipName. '_tasks' ) , |
|
246 | - 'calls' => array ( |
|
247 | - 'module' => 'Calls' , |
|
248 | - 'subpanel_name' => 'ForActivities' , |
|
249 | - 'get_subpanel_data' => $relationshipName. '_calls' ) ) ) ; |
|
224 | + return array( |
|
225 | + 'order' => 10, |
|
226 | + 'sort_order' => 'desc', |
|
227 | + 'sort_by' => 'date_start', |
|
228 | + 'title_key' => 'LBL_ACTIVITIES_SUBPANEL_TITLE', |
|
229 | + 'type' => 'collection', |
|
230 | + 'subpanel_name' => 'activities', //this value is not associated with a physical file |
|
231 | + 'module' => 'Activities', |
|
232 | + 'top_buttons' => array( |
|
233 | + array('widget_class' => 'SubPanelTopCreateTaskButton'), |
|
234 | + array('widget_class' => 'SubPanelTopScheduleMeetingButton'), |
|
235 | + array('widget_class' => 'SubPanelTopScheduleCallButton'), |
|
236 | + array('widget_class' => 'SubPanelTopComposeEmailButton') ), |
|
237 | + 'collection_list' => array( |
|
238 | + 'meetings' => array( |
|
239 | + 'module' => 'Meetings', |
|
240 | + 'subpanel_name' => 'ForActivities', |
|
241 | + 'get_subpanel_data' => $relationshipName.'_meetings' ), |
|
242 | + 'tasks' => array( |
|
243 | + 'module' => 'Tasks', |
|
244 | + 'subpanel_name' => 'ForActivities', |
|
245 | + 'get_subpanel_data' => $relationshipName.'_tasks' ), |
|
246 | + 'calls' => array( |
|
247 | + 'module' => 'Calls', |
|
248 | + 'subpanel_name' => 'ForActivities', |
|
249 | + 'get_subpanel_data' => $relationshipName.'_calls' ) ) ); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /* |
253 | 253 | * Shortcut to construct a History collection subpanel |
254 | 254 | * @param AbstractRelationship $relationship Source relationship to Activities module |
255 | 255 | */ |
256 | - protected function buildHistorySubpanelDefinition ( $relationshipName ) |
|
256 | + protected function buildHistorySubpanelDefinition($relationshipName) |
|
257 | 257 | { |
258 | - return array ( |
|
259 | - 'order' => 20 , |
|
260 | - 'sort_order' => 'desc' , |
|
261 | - 'sort_by' => 'date_modified' , |
|
262 | - 'title_key' => 'LBL_HISTORY' , |
|
263 | - 'type' => 'collection' , |
|
264 | - 'subpanel_name' => 'history' , //this values is not associated with a physical file. |
|
265 | - 'module' => 'History' , |
|
266 | - 'top_buttons' => array ( |
|
267 | - array ( 'widget_class' => 'SubPanelTopCreateNoteButton' ) , |
|
268 | - array ( 'widget_class' => 'SubPanelTopArchiveEmailButton'), |
|
269 | - array ( 'widget_class' => 'SubPanelTopSummaryButton' ) ) , |
|
270 | - 'collection_list' => array ( |
|
271 | - 'meetings' => array ( |
|
272 | - 'module' => 'Meetings' , |
|
273 | - 'subpanel_name' => 'ForHistory' , |
|
274 | - 'get_subpanel_data' => $relationshipName. '_meetings' ) , |
|
275 | - 'tasks' => array ( |
|
276 | - 'module' => 'Tasks' , |
|
277 | - 'subpanel_name' => 'ForHistory' , |
|
278 | - 'get_subpanel_data' => $relationshipName. '_tasks' ) , |
|
279 | - 'calls' => array ( |
|
280 | - 'module' => 'Calls' , |
|
281 | - 'subpanel_name' => 'ForHistory' , |
|
282 | - 'get_subpanel_data' => $relationshipName. '_calls' ) , |
|
283 | - 'notes' => array ( |
|
284 | - 'module' => 'Notes' , |
|
285 | - 'subpanel_name' => 'ForHistory' , |
|
286 | - 'get_subpanel_data' => $relationshipName. '_notes' ) , |
|
287 | - 'emails' => array ( |
|
288 | - 'module' => 'Emails' , |
|
289 | - 'subpanel_name' => 'ForHistory' , |
|
290 | - 'get_subpanel_data' => $relationshipName. '_emails' ) ) ) ; |
|
258 | + return array( |
|
259 | + 'order' => 20, |
|
260 | + 'sort_order' => 'desc', |
|
261 | + 'sort_by' => 'date_modified', |
|
262 | + 'title_key' => 'LBL_HISTORY', |
|
263 | + 'type' => 'collection', |
|
264 | + 'subpanel_name' => 'history', //this values is not associated with a physical file. |
|
265 | + 'module' => 'History', |
|
266 | + 'top_buttons' => array( |
|
267 | + array('widget_class' => 'SubPanelTopCreateNoteButton'), |
|
268 | + array('widget_class' => 'SubPanelTopArchiveEmailButton'), |
|
269 | + array('widget_class' => 'SubPanelTopSummaryButton') ), |
|
270 | + 'collection_list' => array( |
|
271 | + 'meetings' => array( |
|
272 | + 'module' => 'Meetings', |
|
273 | + 'subpanel_name' => 'ForHistory', |
|
274 | + 'get_subpanel_data' => $relationshipName.'_meetings' ), |
|
275 | + 'tasks' => array( |
|
276 | + 'module' => 'Tasks', |
|
277 | + 'subpanel_name' => 'ForHistory', |
|
278 | + 'get_subpanel_data' => $relationshipName.'_tasks' ), |
|
279 | + 'calls' => array( |
|
280 | + 'module' => 'Calls', |
|
281 | + 'subpanel_name' => 'ForHistory', |
|
282 | + 'get_subpanel_data' => $relationshipName.'_calls' ), |
|
283 | + 'notes' => array( |
|
284 | + 'module' => 'Notes', |
|
285 | + 'subpanel_name' => 'ForHistory', |
|
286 | + 'get_subpanel_data' => $relationshipName.'_notes' ), |
|
287 | + 'emails' => array( |
|
288 | + 'module' => 'Emails', |
|
289 | + 'subpanel_name' => 'ForHistory', |
|
290 | + 'get_subpanel_data' => $relationshipName.'_emails' ) ) ); |
|
291 | 291 | } |
292 | 292 | } |
@@ -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, '_')); |
@@ -67,6 +67,6 @@ |
||
67 | 67 | |
68 | 68 | class MBConstants |
69 | 69 | { |
70 | - static $EMPTY = array ( 'name' => '(empty)' , 'label' => '(empty)' ) ; |
|
71 | - static $FILLER = array ( 'name' => '(filler)' , 'label' => 'LBL_FILLER' ) ; // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants |
|
70 | + static $EMPTY = array ( 'name' => '(empty)' , 'label' => '(empty)' ) ; |
|
71 | + static $FILLER = array ( 'name' => '(filler)' , 'label' => 'LBL_FILLER' ) ; // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants |
|
72 | 72 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -39,34 +39,34 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | |
42 | -define('MB_BASEMETADATALOCATION','base'); |
|
43 | -define('MB_CUSTOMMETADATALOCATION','custom'); |
|
44 | -define('MB_WORKINGMETADATALOCATION','working'); |
|
45 | -define('MB_HISTORYMETADATALOCATION','history'); |
|
46 | -define('MB_GRIDLAYOUTMETADATA','gridLayoutMetaData'); |
|
47 | -define('MB_LISTLAYOUTMETADATA','listLayoutMetaData'); |
|
48 | -define('MB_LISTVIEW','listview'); |
|
49 | -define('MB_SEARCHVIEW','searchview'); |
|
50 | -define('MB_BASICSEARCH','basic_search' ); |
|
51 | -define('MB_ADVANCEDSEARCH','advanced_search' ); |
|
52 | -define('MB_DASHLET','dashlet'); |
|
53 | -define('MB_DASHLETSEARCH','dashletsearch'); |
|
54 | -define('MB_EDITVIEW','editview'); |
|
55 | -define('MB_DETAILVIEW','detailview'); |
|
56 | -define('MB_QUICKCREATE','quickcreate'); |
|
57 | -define('MB_POPUPLIST','popuplist'); |
|
58 | -define('MB_POPUPSEARCH','popupsearch'); |
|
59 | -define('MB_LABEL','label'); |
|
42 | +define('MB_BASEMETADATALOCATION', 'base'); |
|
43 | +define('MB_CUSTOMMETADATALOCATION', 'custom'); |
|
44 | +define('MB_WORKINGMETADATALOCATION', 'working'); |
|
45 | +define('MB_HISTORYMETADATALOCATION', 'history'); |
|
46 | +define('MB_GRIDLAYOUTMETADATA', 'gridLayoutMetaData'); |
|
47 | +define('MB_LISTLAYOUTMETADATA', 'listLayoutMetaData'); |
|
48 | +define('MB_LISTVIEW', 'listview'); |
|
49 | +define('MB_SEARCHVIEW', 'searchview'); |
|
50 | +define('MB_BASICSEARCH', 'basic_search'); |
|
51 | +define('MB_ADVANCEDSEARCH', 'advanced_search'); |
|
52 | +define('MB_DASHLET', 'dashlet'); |
|
53 | +define('MB_DASHLETSEARCH', 'dashletsearch'); |
|
54 | +define('MB_EDITVIEW', 'editview'); |
|
55 | +define('MB_DETAILVIEW', 'detailview'); |
|
56 | +define('MB_QUICKCREATE', 'quickcreate'); |
|
57 | +define('MB_POPUPLIST', 'popuplist'); |
|
58 | +define('MB_POPUPSEARCH', 'popupsearch'); |
|
59 | +define('MB_LABEL', 'label'); |
|
60 | 60 | define('MB_ONETOONE', 'one-to-one'); |
61 | 61 | define('MB_ONETOMANY', 'one-to-many'); |
62 | 62 | define('MB_MANYTOONE', 'many-to-one'); |
63 | 63 | define('MB_MANYTOMANY', 'many-to-many'); |
64 | -define('MB_MAXDBIDENTIFIERLENGTH',30); // maximum length of any identifier in our supported databases |
|
65 | -define('MB_EXPORTPREPEND','project_'); |
|
66 | -define('MB_VISIBILITY','visibility'); |
|
64 | +define('MB_MAXDBIDENTIFIERLENGTH', 30); // maximum length of any identifier in our supported databases |
|
65 | +define('MB_EXPORTPREPEND', 'project_'); |
|
66 | +define('MB_VISIBILITY', 'visibility'); |
|
67 | 67 | |
68 | 68 | class MBConstants |
69 | 69 | { |
70 | - static $EMPTY = array ( 'name' => '(empty)' , 'label' => '(empty)' ) ; |
|
71 | - static $FILLER = array ( 'name' => '(filler)' , 'label' => 'LBL_FILLER' ) ; // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants |
|
70 | + static $EMPTY = array('name' => '(empty)', 'label' => '(empty)'); |
|
71 | + static $FILLER = array('name' => '(filler)', 'label' => 'LBL_FILLER'); // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants |
|
72 | 72 | } |
@@ -1,5 +1,7 @@ |
||
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. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | require_once('modules/ModuleBuilder/parsers/ModuleBuilderParser.php'); |
43 | 43 | |
44 | - class ParserDropDown extends ModuleBuilderParser { |
|
44 | + class ParserDropDown extends ModuleBuilderParser { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Takes in the request params from a save request and processes |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function saveDropDown($params){ |
53 | 53 | require_once('modules/Administration/Common.php'); |
54 | - $emptyMarker = translate('LBL_BLANK'); |
|
55 | - $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']); |
|
56 | - $type = $_REQUEST['view_package']; |
|
57 | - $dir = ''; |
|
58 | - $dropdown_name = $params['dropdown_name']; |
|
59 | - $json = getJSONobj(); |
|
54 | + $emptyMarker = translate('LBL_BLANK'); |
|
55 | + $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']); |
|
56 | + $type = $_REQUEST['view_package']; |
|
57 | + $dir = ''; |
|
58 | + $dropdown_name = $params['dropdown_name']; |
|
59 | + $json = getJSONobj(); |
|
60 | 60 | |
61 | - $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']); |
|
62 | - //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes. |
|
63 | - $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) ); |
|
64 | - $dropdown = array () ; |
|
65 | - // dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order |
|
66 | - // we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered |
|
61 | + $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']); |
|
62 | + //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes. |
|
63 | + $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) ); |
|
64 | + $dropdown = array () ; |
|
65 | + // dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order |
|
66 | + // we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered |
|
67 | 67 | if(is_array($temp)) |
68 | 68 | { |
69 | 69 | foreach ( $temp as $item ) |
@@ -71,146 +71,146 @@ discard block |
||
71 | 71 | $dropdown[ SugarCleaner::stripTags(from_html($item [ 0 ]), false) ] = SugarCleaner::stripTags(from_html($item [ 1 ]), false) ; |
72 | 72 | } |
73 | 73 | } |
74 | - if(array_key_exists($emptyMarker, $dropdown)){ |
|
74 | + if(array_key_exists($emptyMarker, $dropdown)){ |
|
75 | 75 | $output=array(); |
76 | 76 | foreach($dropdown as $key => $value){ |
77 | 77 | if($emptyMarker===$key) |
78 | 78 | $output['']=''; |
79 | 79 | else |
80 | 80 | $output[$key]=$value; |
81 | - } |
|
81 | + } |
|
82 | 82 | $dropdown=$output; |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - if($type != 'studio'){ |
|
86 | - $mb = new ModuleBuilder(); |
|
87 | - $module = $mb->getPackageModule($params['view_package'], $params['view_module']); |
|
88 | - $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module); |
|
89 | - //Can't use synch on selected lang as we want to overwrite values, not just keys |
|
90 | - $module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown; |
|
91 | - $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of |
|
92 | - }else{ |
|
93 | - $contents = return_custom_app_list_strings_file_contents($selected_lang); |
|
94 | - $my_list_strings = return_app_list_strings_language($selected_lang); |
|
95 | - if($selected_lang == $GLOBALS['current_language']){ |
|
96 | - $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown; |
|
97 | - } |
|
98 | - //write to contents |
|
99 | - $contents = str_replace("?>", '', $contents); |
|
100 | - if(empty($contents))$contents = "<?php"; |
|
101 | - //add new drop down to the bottom |
|
102 | - if(!empty($params['use_push'])){ |
|
103 | - //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed |
|
104 | - foreach($dropdown as $key=>$value){ |
|
105 | - //only if the value has changed or does not exist do we want to add it this way |
|
106 | - if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){ |
|
107 | - //clear out the old value |
|
108 | - $pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism'; |
|
109 | - $contents = preg_replace($pattern_match, "\n", $contents); |
|
110 | - //add the new ones |
|
111 | - $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";"; |
|
112 | - } |
|
113 | - } |
|
114 | - }else{ |
|
115 | - //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs. |
|
116 | - $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir); |
|
117 | - $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang); |
|
118 | - } |
|
119 | - if(!empty($dir) && !is_dir($dir)) |
|
120 | - { |
|
121 | - $continue = mkdir_recursive($dir); |
|
122 | - } |
|
123 | - save_custom_app_list_strings_contents($contents, $selected_lang, $dir); |
|
124 | - } |
|
125 | - sugar_cache_reset(); |
|
126 | - clearAllJsAndJsLangFilesWithoutOutput(); |
|
85 | + if($type != 'studio'){ |
|
86 | + $mb = new ModuleBuilder(); |
|
87 | + $module = $mb->getPackageModule($params['view_package'], $params['view_module']); |
|
88 | + $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module); |
|
89 | + //Can't use synch on selected lang as we want to overwrite values, not just keys |
|
90 | + $module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown; |
|
91 | + $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of |
|
92 | + }else{ |
|
93 | + $contents = return_custom_app_list_strings_file_contents($selected_lang); |
|
94 | + $my_list_strings = return_app_list_strings_language($selected_lang); |
|
95 | + if($selected_lang == $GLOBALS['current_language']){ |
|
96 | + $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown; |
|
97 | + } |
|
98 | + //write to contents |
|
99 | + $contents = str_replace("?>", '', $contents); |
|
100 | + if(empty($contents))$contents = "<?php"; |
|
101 | + //add new drop down to the bottom |
|
102 | + if(!empty($params['use_push'])){ |
|
103 | + //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed |
|
104 | + foreach($dropdown as $key=>$value){ |
|
105 | + //only if the value has changed or does not exist do we want to add it this way |
|
106 | + if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){ |
|
107 | + //clear out the old value |
|
108 | + $pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism'; |
|
109 | + $contents = preg_replace($pattern_match, "\n", $contents); |
|
110 | + //add the new ones |
|
111 | + $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";"; |
|
112 | + } |
|
113 | + } |
|
114 | + }else{ |
|
115 | + //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs. |
|
116 | + $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir); |
|
117 | + $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang); |
|
118 | + } |
|
119 | + if(!empty($dir) && !is_dir($dir)) |
|
120 | + { |
|
121 | + $continue = mkdir_recursive($dir); |
|
122 | + } |
|
123 | + save_custom_app_list_strings_contents($contents, $selected_lang, $dir); |
|
124 | + } |
|
125 | + sugar_cache_reset(); |
|
126 | + clearAllJsAndJsLangFilesWithoutOutput(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
130 | - * function synchDropDown |
|
131 | - * Ensures that the set of dropdown keys is consistant accross all languages. |
|
132 | - * |
|
133 | - * @param $dropdown_name The name of the dropdown to be synched |
|
134 | - * @param $dropdown array The dropdown currently being saved |
|
135 | - * @param $selected_lang String the language currently selected in Studio/MB |
|
136 | - * @param $saveLov String the path to the directory to save the new lang file in. |
|
137 | - */ |
|
130 | + * function synchDropDown |
|
131 | + * Ensures that the set of dropdown keys is consistant accross all languages. |
|
132 | + * |
|
133 | + * @param $dropdown_name The name of the dropdown to be synched |
|
134 | + * @param $dropdown array The dropdown currently being saved |
|
135 | + * @param $selected_lang String the language currently selected in Studio/MB |
|
136 | + * @param $saveLov String the path to the directory to save the new lang file in. |
|
137 | + */ |
|
138 | 138 | function synchDropDown($dropdown_name, $dropdown, $selected_lang, $saveLoc) { |
139 | - $allLanguages = get_languages(); |
|
139 | + $allLanguages = get_languages(); |
|
140 | 140 | foreach ($allLanguages as $lang => $langName) { |
141 | - if ($lang != $selected_lang) { |
|
142 | - $listStrings = return_app_list_strings_language($lang); |
|
143 | - $langDropDown = array(); |
|
144 | - if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
145 | - { |
|
146 | - $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
147 | - } else |
|
148 | - { |
|
149 | - //if the dropdown does not exist in the language, justt use what we have. |
|
150 | - $langDropDown = $dropdown; |
|
151 | - } |
|
152 | - $contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang); |
|
153 | - save_custom_app_list_strings_contents($contents, $lang, $saveLoc); |
|
154 | - } |
|
141 | + if ($lang != $selected_lang) { |
|
142 | + $listStrings = return_app_list_strings_language($lang); |
|
143 | + $langDropDown = array(); |
|
144 | + if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
145 | + { |
|
146 | + $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
147 | + } else |
|
148 | + { |
|
149 | + //if the dropdown does not exist in the language, justt use what we have. |
|
150 | + $langDropDown = $dropdown; |
|
151 | + } |
|
152 | + $contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang); |
|
153 | + save_custom_app_list_strings_contents($contents, $lang, $saveLoc); |
|
154 | + } |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | - * function synchMBDropDown |
|
160 | - * Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module |
|
161 | - * |
|
162 | - * @param $dropdown_name The name of the dropdown to be synched |
|
163 | - * @param $dropdown array The dropdown currently being saved |
|
164 | - * @param $selected_lang String the language currently selected in Studio/MB |
|
165 | - * @param $module MBModule the module to update the languages in |
|
166 | - */ |
|
159 | + * function synchMBDropDown |
|
160 | + * Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module |
|
161 | + * |
|
162 | + * @param $dropdown_name The name of the dropdown to be synched |
|
163 | + * @param $dropdown array The dropdown currently being saved |
|
164 | + * @param $selected_lang String the language currently selected in Studio/MB |
|
165 | + * @param $module MBModule the module to update the languages in |
|
166 | + */ |
|
167 | 167 | function synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module) { |
168 | - $selected_lang = $selected_lang . '.lang.php'; |
|
169 | - foreach($module->mblanguage->appListStrings as $lang => $listStrings) { |
|
170 | - if ($lang != $selected_lang) |
|
171 | - { |
|
172 | - $langDropDown = array(); |
|
173 | - if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
174 | - { |
|
175 | - $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
176 | - } else |
|
177 | - { |
|
178 | - $langDropDown = $dropdown; |
|
179 | - } |
|
180 | - $module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown; |
|
181 | - $module->mblanguage->save($module->key_name); |
|
182 | - } |
|
183 | - } |
|
168 | + $selected_lang = $selected_lang . '.lang.php'; |
|
169 | + foreach($module->mblanguage->appListStrings as $lang => $listStrings) { |
|
170 | + if ($lang != $selected_lang) |
|
171 | + { |
|
172 | + $langDropDown = array(); |
|
173 | + if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
174 | + { |
|
175 | + $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
176 | + } else |
|
177 | + { |
|
178 | + $langDropDown = $dropdown; |
|
179 | + } |
|
180 | + $module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown; |
|
181 | + $module->mblanguage->save($module->key_name); |
|
182 | + } |
|
183 | + } |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | private function synchDDKeys($dom, $sub) { |
187 | - //check for extra keys |
|
187 | + //check for extra keys |
|
188 | 188 | foreach($sub as $key=>$value) { |
189 | - if (!isset($dom[$key])) { |
|
190 | - unset ($sub[$key]); |
|
191 | - } |
|
189 | + if (!isset($dom[$key])) { |
|
190 | + unset ($sub[$key]); |
|
191 | + } |
|
192 | 192 | } |
193 | 193 | //check for missing keys |
194 | 194 | foreach($dom as $key=>$value) { |
195 | - if (!isset($sub[$key])) { |
|
196 | - $sub[$key] = $value; |
|
197 | - } |
|
195 | + if (!isset($sub[$key])) { |
|
196 | + $sub[$key] = $value; |
|
197 | + } |
|
198 | 198 | } |
199 | 199 | return $sub; |
200 | 200 | } |
201 | 201 | |
202 | 202 | function getPatternMatch($dropdown_name) { |
203 | - return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\'' |
|
204 | - . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism'; |
|
203 | + return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\'' |
|
204 | + . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | function getNewCustomContents($dropdown_name, $dropdown, $lang) { |
208 | - $contents = return_custom_app_list_strings_file_contents($lang); |
|
208 | + $contents = return_custom_app_list_strings_file_contents($lang); |
|
209 | 209 | $contents = str_replace("?>", '', $contents); |
210 | - if(empty($contents))$contents = "<?php"; |
|
211 | - $contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents); |
|
212 | - $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";"; |
|
213 | - return $contents; |
|
210 | + if(empty($contents))$contents = "<?php"; |
|
211 | + $contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents); |
|
212 | + $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";"; |
|
213 | + return $contents; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @param REQUEST params $params |
51 | 51 | */ |
52 | - function saveDropDown($params){ |
|
52 | + function saveDropDown($params) { |
|
53 | 53 | require_once('modules/Administration/Common.php'); |
54 | 54 | $emptyMarker = translate('LBL_BLANK'); |
55 | - $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']); |
|
55 | + $selected_lang = (!empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language']); |
|
56 | 56 | $type = $_REQUEST['view_package']; |
57 | 57 | $dir = ''; |
58 | 58 | $dropdown_name = $params['dropdown_name']; |
@@ -60,63 +60,63 @@ discard block |
||
60 | 60 | |
61 | 61 | $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']); |
62 | 62 | //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes. |
63 | - $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) ); |
|
64 | - $dropdown = array () ; |
|
63 | + $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES)); |
|
64 | + $dropdown = array(); |
|
65 | 65 | // dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order |
66 | 66 | // we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered |
67 | - if(is_array($temp)) |
|
67 | + if (is_array($temp)) |
|
68 | 68 | { |
69 | - foreach ( $temp as $item ) |
|
69 | + foreach ($temp as $item) |
|
70 | 70 | { |
71 | - $dropdown[ SugarCleaner::stripTags(from_html($item [ 0 ]), false) ] = SugarCleaner::stripTags(from_html($item [ 1 ]), false) ; |
|
71 | + $dropdown[SugarCleaner::stripTags(from_html($item [0]), false)] = SugarCleaner::stripTags(from_html($item [1]), false); |
|
72 | 72 | } |
73 | 73 | } |
74 | - if(array_key_exists($emptyMarker, $dropdown)){ |
|
75 | - $output=array(); |
|
76 | - foreach($dropdown as $key => $value){ |
|
77 | - if($emptyMarker===$key) |
|
78 | - $output['']=''; |
|
74 | + if (array_key_exists($emptyMarker, $dropdown)) { |
|
75 | + $output = array(); |
|
76 | + foreach ($dropdown as $key => $value) { |
|
77 | + if ($emptyMarker === $key) |
|
78 | + $output[''] = ''; |
|
79 | 79 | else |
80 | - $output[$key]=$value; |
|
80 | + $output[$key] = $value; |
|
81 | 81 | } |
82 | - $dropdown=$output; |
|
82 | + $dropdown = $output; |
|
83 | 83 | } |
84 | 84 | |
85 | - if($type != 'studio'){ |
|
85 | + if ($type != 'studio') { |
|
86 | 86 | $mb = new ModuleBuilder(); |
87 | 87 | $module = $mb->getPackageModule($params['view_package'], $params['view_module']); |
88 | 88 | $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module); |
89 | 89 | //Can't use synch on selected lang as we want to overwrite values, not just keys |
90 | 90 | $module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown; |
91 | 91 | $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of |
92 | - }else{ |
|
92 | + } else { |
|
93 | 93 | $contents = return_custom_app_list_strings_file_contents($selected_lang); |
94 | 94 | $my_list_strings = return_app_list_strings_language($selected_lang); |
95 | - if($selected_lang == $GLOBALS['current_language']){ |
|
95 | + if ($selected_lang == $GLOBALS['current_language']) { |
|
96 | 96 | $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown; |
97 | 97 | } |
98 | 98 | //write to contents |
99 | 99 | $contents = str_replace("?>", '', $contents); |
100 | - if(empty($contents))$contents = "<?php"; |
|
100 | + if (empty($contents))$contents = "<?php"; |
|
101 | 101 | //add new drop down to the bottom |
102 | - if(!empty($params['use_push'])){ |
|
102 | + if (!empty($params['use_push'])) { |
|
103 | 103 | //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed |
104 | - foreach($dropdown as $key=>$value){ |
|
104 | + foreach ($dropdown as $key=>$value) { |
|
105 | 105 | //only if the value has changed or does not exist do we want to add it this way |
106 | - if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){ |
|
106 | + if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) { |
|
107 | 107 | //clear out the old value |
108 | 108 | $pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism'; |
109 | 109 | $contents = preg_replace($pattern_match, "\n", $contents); |
110 | 110 | //add the new ones |
111 | - $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";"; |
|
111 | + $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=".var_export_helper($value).";"; |
|
112 | 112 | } |
113 | 113 | } |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs. |
116 | 116 | $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir); |
117 | 117 | $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang); |
118 | 118 | } |
119 | - if(!empty($dir) && !is_dir($dir)) |
|
119 | + if (!empty($dir) && !is_dir($dir)) |
|
120 | 120 | { |
121 | 121 | $continue = mkdir_recursive($dir); |
122 | 122 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param $saveLov String the path to the directory to save the new lang file in. |
137 | 137 | */ |
138 | 138 | function synchDropDown($dropdown_name, $dropdown, $selected_lang, $saveLoc) { |
139 | - $allLanguages = get_languages(); |
|
139 | + $allLanguages = get_languages(); |
|
140 | 140 | foreach ($allLanguages as $lang => $langName) { |
141 | 141 | if ($lang != $selected_lang) { |
142 | 142 | $listStrings = return_app_list_strings_language($lang); |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | * @param $module MBModule the module to update the languages in |
166 | 166 | */ |
167 | 167 | function synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module) { |
168 | - $selected_lang = $selected_lang . '.lang.php'; |
|
169 | - foreach($module->mblanguage->appListStrings as $lang => $listStrings) { |
|
168 | + $selected_lang = $selected_lang.'.lang.php'; |
|
169 | + foreach ($module->mblanguage->appListStrings as $lang => $listStrings) { |
|
170 | 170 | if ($lang != $selected_lang) |
171 | 171 | { |
172 | 172 | $langDropDown = array(); |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | |
186 | 186 | private function synchDDKeys($dom, $sub) { |
187 | 187 | //check for extra keys |
188 | - foreach($sub as $key=>$value) { |
|
188 | + foreach ($sub as $key=>$value) { |
|
189 | 189 | if (!isset($dom[$key])) { |
190 | 190 | unset ($sub[$key]); |
191 | 191 | } |
192 | 192 | } |
193 | 193 | //check for missing keys |
194 | - foreach($dom as $key=>$value) { |
|
194 | + foreach ($dom as $key=>$value) { |
|
195 | 195 | if (!isset($sub[$key])) { |
196 | 196 | $sub[$key] = $value; |
197 | 197 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | function getNewCustomContents($dropdown_name, $dropdown, $lang) { |
208 | 208 | $contents = return_custom_app_list_strings_file_contents($lang); |
209 | 209 | $contents = str_replace("?>", '', $contents); |
210 | - if(empty($contents))$contents = "<?php"; |
|
210 | + if (empty($contents))$contents = "<?php"; |
|
211 | 211 | $contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents); |
212 | - $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";"; |
|
212 | + $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=".var_export_helper($dropdown).";"; |
|
213 | 213 | return $contents; |
214 | 214 | } |
215 | 215 | } |
@@ -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,6 @@ 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 | * SugarCRM Community Edition is a customer relationship management program developed by |
6 | 6 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -50,141 +50,141 @@ discard block |
||
50 | 50 | * There are two relevant modules for every subpanel - the module whose detailview this subpanel will appear in ($module_name), and the module that is the source of the data for the subpanel ($subPanelParentModule) |
51 | 51 | */ |
52 | 52 | |
53 | -require_once ('modules/ModuleBuilder/parsers/parser.modifylistview.php') ; |
|
53 | +require_once ('modules/ModuleBuilder/parsers/parser.modifylistview.php'); |
|
54 | 54 | |
55 | 55 | class ParserModifySubPanel extends ParserModifyListView |
56 | 56 | { |
57 | 57 | |
58 | - var $listViewDefs = false ; |
|
59 | - var $defaults = array ( ) ; |
|
60 | - var $additional = array ( ) ; |
|
61 | - var $available = array ( ) ; |
|
62 | - var $columns = array ( 'LBL_DEFAULT' => 'getDefaultFields' , 'LBL_HIDDEN' => 'getAvailableFields' ) ; |
|
58 | + var $listViewDefs = false; |
|
59 | + var $defaults = array( ); |
|
60 | + var $additional = array( ); |
|
61 | + var $available = array( ); |
|
62 | + var $columns = array('LBL_DEFAULT' => 'getDefaultFields', 'LBL_HIDDEN' => 'getAvailableFields'); |
|
63 | 63 | |
64 | - function init ($module_name , $subPanelName) |
|
64 | + function init($module_name, $subPanelName) |
|
65 | 65 | { |
66 | - $GLOBALS [ 'log' ]->debug ( "in ParserModifySubPanel: module_name={$module_name} child_module={$subPanelName}" ) ; |
|
67 | - $this->moduleName = $module_name ; |
|
68 | - $this->subPanelName = $subPanelName ; |
|
69 | - global $beanList, $beanFiles ; |
|
66 | + $GLOBALS ['log']->debug("in ParserModifySubPanel: module_name={$module_name} child_module={$subPanelName}"); |
|
67 | + $this->moduleName = $module_name; |
|
68 | + $this->subPanelName = $subPanelName; |
|
69 | + global $beanList, $beanFiles; |
|
70 | 70 | |
71 | 71 | // Sometimes we receive a module name which is not in the correct CamelCase, so shift to lower case for all beanList lookups |
72 | - $beanListLower = array_change_key_case ( $beanList ) ; |
|
72 | + $beanListLower = array_change_key_case($beanList); |
|
73 | 73 | |
74 | 74 | // Retrieve the definitions for all the available subpanels for this module |
75 | - $class = $beanListLower [ strtolower ( $this->moduleName ) ] ; |
|
76 | - require_once ($beanFiles [ $class ]) ; |
|
77 | - $module = new $class ( ) ; |
|
78 | - require_once ('include/SubPanel/SubPanelDefinitions.php') ; |
|
79 | - $spd = new SubPanelDefinitions ( $module ) ; |
|
75 | + $class = $beanListLower [strtolower($this->moduleName)]; |
|
76 | + require_once ($beanFiles [$class]); |
|
77 | + $module = new $class( ); |
|
78 | + require_once ('include/SubPanel/SubPanelDefinitions.php'); |
|
79 | + $spd = new SubPanelDefinitions($module); |
|
80 | 80 | |
81 | 81 | // Get the lists of fields already in the subpanel and those that can be added in |
82 | 82 | // Get the fields lists from an aSubPanel object describing this subpanel from the SubPanelDefinitions object |
83 | - $this->originalListViewDefs = array ( ) ; |
|
84 | - if (array_key_exists ( strtolower ( $this->subPanelName ), $spd->layout_defs [ 'subpanel_setup' ] )) |
|
83 | + $this->originalListViewDefs = array( ); |
|
84 | + if (array_key_exists(strtolower($this->subPanelName), $spd->layout_defs ['subpanel_setup'])) |
|
85 | 85 | { |
86 | - $originalPanel = $spd->load_subpanel ( $this->subPanelName, true ) ; |
|
87 | - $this->originalListViewDefs = $originalPanel->get_list_fields () ; |
|
88 | - $this->panel = $spd->load_subpanel ( $subPanelName, false ) ; |
|
89 | - $this->listViewDefs = $this->panel->get_list_fields () ; |
|
86 | + $originalPanel = $spd->load_subpanel($this->subPanelName, true); |
|
87 | + $this->originalListViewDefs = $originalPanel->get_list_fields(); |
|
88 | + $this->panel = $spd->load_subpanel($subPanelName, false); |
|
89 | + $this->listViewDefs = $this->panel->get_list_fields(); |
|
90 | 90 | |
91 | 91 | // Retrieve a copy of the bean for the parent module of this subpanel - so we can find additional fields for the layout |
92 | - $subPanelParentModuleName = $this->panel->get_module_name () ; |
|
93 | - $this->subPanelParentModule = null ; |
|
92 | + $subPanelParentModuleName = $this->panel->get_module_name(); |
|
93 | + $this->subPanelParentModule = null; |
|
94 | 94 | |
95 | - if (! empty ( $subPanelParentModuleName ) && isset($beanListLower[strtolower($subPanelParentModuleName)])) |
|
95 | + if (!empty ($subPanelParentModuleName) && isset($beanListLower[strtolower($subPanelParentModuleName)])) |
|
96 | 96 | { |
97 | 97 | $class = $beanListLower[strtolower($subPanelParentModuleName)]; |
98 | - if (isset($beanFiles [ $class ])) |
|
98 | + if (isset($beanFiles [$class])) |
|
99 | 99 | { |
100 | - require_once ($beanFiles [ $class ]) ; |
|
101 | - $this->subPanelParentModule = new $class ( ) ; |
|
100 | + require_once ($beanFiles [$class]); |
|
101 | + $this->subPanelParentModule = new $class( ); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - $this->language_module = $this->panel->template_instance->module_dir ; |
|
106 | + $this->language_module = $this->panel->template_instance->module_dir; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Return a list of the fields that will be displayed in the subpanel |
111 | 111 | */ |
112 | - function getDefaultFields () |
|
112 | + function getDefaultFields() |
|
113 | 113 | { |
114 | - $this->defaults = array ( ) ; |
|
115 | - foreach ( $this->listViewDefs as $key => $def ) |
|
114 | + $this->defaults = array( ); |
|
115 | + foreach ($this->listViewDefs as $key => $def) |
|
116 | 116 | { |
117 | - if (! empty ( $def [ 'usage' ] ) && strcmp ( $def [ 'usage' ], 'query_only' ) == 0) |
|
118 | - continue ; |
|
119 | - if (! empty ( $def [ 'vname' ] )) |
|
120 | - $def [ 'label' ] = $def [ 'vname' ] ; |
|
121 | - $this->defaults [ $key ] = $def ; |
|
117 | + if (!empty ($def ['usage']) && strcmp($def ['usage'], 'query_only') == 0) |
|
118 | + continue; |
|
119 | + if (!empty ($def ['vname'])) |
|
120 | + $def ['label'] = $def ['vname']; |
|
121 | + $this->defaults [$key] = $def; |
|
122 | 122 | } |
123 | - return $this->defaults ; |
|
123 | + return $this->defaults; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Return a list of fields that are not currently included in the subpanel but that are available for use |
128 | 128 | */ |
129 | - function getAvailableFields () |
|
129 | + function getAvailableFields() |
|
130 | 130 | { |
131 | - $this->availableFields = array ( ) ; |
|
131 | + $this->availableFields = array( ); |
|
132 | 132 | if ($this->subPanelParentModule != null) |
133 | 133 | { |
134 | - $lowerFieldList = array_change_key_case ( $this->listViewDefs ) ; |
|
135 | - foreach ( $this->originalListViewDefs as $key => $def ) |
|
134 | + $lowerFieldList = array_change_key_case($this->listViewDefs); |
|
135 | + foreach ($this->originalListViewDefs as $key => $def) |
|
136 | 136 | { |
137 | - $key = strtolower ( $key ) ; |
|
138 | - if (! isset ( $lowerFieldList [ $key ] )) |
|
137 | + $key = strtolower($key); |
|
138 | + if (!isset ($lowerFieldList [$key])) |
|
139 | 139 | { |
140 | - $this->availableFields [ $key ] = $def ; |
|
140 | + $this->availableFields [$key] = $def; |
|
141 | 141 | } |
142 | 142 | } |
143 | - $GLOBALS [ 'log' ]->debug ( 'parser.modifylistview.php->getAvailableFields(): field_defs=' . print_r ( $this->availableFields, true ) ) ; |
|
144 | - foreach ( $this->subPanelParentModule->field_defs as $key => $fieldDefinition ) |
|
143 | + $GLOBALS ['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields, true)); |
|
144 | + foreach ($this->subPanelParentModule->field_defs as $key => $fieldDefinition) |
|
145 | 145 | { |
146 | - $fieldName = strtolower ( $key ) ; |
|
147 | - if (! isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries |
|
146 | + $fieldName = strtolower($key); |
|
147 | + if (!isset ($lowerFieldList [$fieldName])) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries |
|
148 | 148 | { |
149 | - if ((empty ( $fieldDefinition [ 'source' ] ) || $fieldDefinition [ 'source' ] == 'db' || $fieldDefinition [ 'source' ] == 'custom_fields') && $fieldDefinition [ 'type' ] != 'id' && strcmp ( $fieldName, 'deleted' ) != 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) != false) || ! empty ( $def [ 'custom_type' ] ) && (empty ( $fieldDefinition [ 'dbType' ] ) || $fieldDefinition [ 'dbType' ] != 'id') && (empty ( $fieldDefinition [ 'dbtype' ] ) || $fieldDefinition [ 'dbtype' ] != 'id') || (! empty ( $fieldDefinition [ 'studio' ] ) && $fieldDefinition [ 'studio' ] == 'visible')) |
|
149 | + if ((empty ($fieldDefinition ['source']) || $fieldDefinition ['source'] == 'db' || $fieldDefinition ['source'] == 'custom_fields') && $fieldDefinition ['type'] != 'id' && strcmp($fieldName, 'deleted') != 0 || (isset ($def ['name']) && strpos($def ['name'], "_name") != false) || !empty ($def ['custom_type']) && (empty ($fieldDefinition ['dbType']) || $fieldDefinition ['dbType'] != 'id') && (empty ($fieldDefinition ['dbtype']) || $fieldDefinition ['dbtype'] != 'id') || (!empty ($fieldDefinition ['studio']) && $fieldDefinition ['studio'] == 'visible')) |
|
150 | 150 | { |
151 | - $label = (isset ( $fieldDefinition [ 'vname' ] )) ? $fieldDefinition [ 'vname' ] : (isset ( $fieldDefinition [ 'label' ] ) ? $fieldDefinition [ 'label' ] : $fieldDefinition [ 'name' ]) ; |
|
152 | - $this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ; |
|
151 | + $label = (isset ($fieldDefinition ['vname'])) ? $fieldDefinition ['vname'] : (isset ($fieldDefinition ['label']) ? $fieldDefinition ['label'] : $fieldDefinition ['name']); |
|
152 | + $this->availableFields [$fieldName] = array('width' => '10', 'label' => $label); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | - return $this->availableFields ; |
|
158 | + return $this->availableFields; |
|
159 | 159 | } |
160 | 160 | |
161 | - function getField ($fieldName) |
|
161 | + function getField($fieldName) |
|
162 | 162 | { |
163 | - foreach ( $this->listViewDefs as $key => $def ) |
|
163 | + foreach ($this->listViewDefs as $key => $def) |
|
164 | 164 | { |
165 | - $key = strtolower ( $key ) ; |
|
165 | + $key = strtolower($key); |
|
166 | 166 | if ($key == $fieldName) |
167 | 167 | { |
168 | - return $def ; |
|
168 | + return $def; |
|
169 | 169 | } |
170 | 170 | } |
171 | - foreach ( $this->originalListViewDefs as $key => $def ) |
|
171 | + foreach ($this->originalListViewDefs as $key => $def) |
|
172 | 172 | { |
173 | - $key = strtolower ( $key ) ; |
|
173 | + $key = strtolower($key); |
|
174 | 174 | if ($key == $fieldName) |
175 | 175 | { |
176 | - return $def ; |
|
176 | + return $def; |
|
177 | 177 | } |
178 | 178 | } |
179 | - foreach ( $this->panel->template_instance->field_defs as $key => $def ) |
|
179 | + foreach ($this->panel->template_instance->field_defs as $key => $def) |
|
180 | 180 | { |
181 | - $key = strtolower ( $key ) ; |
|
181 | + $key = strtolower($key); |
|
182 | 182 | if ($key == $fieldName) |
183 | 183 | { |
184 | - return $def ; |
|
184 | + return $def; |
|
185 | 185 | } |
186 | 186 | } |
187 | - return array ( ) ; |
|
187 | + return array( ); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /* |
@@ -192,67 +192,67 @@ discard block |
||
192 | 192 | * Obtains the field definitions from a _REQUEST array, and merges them with the other fields from the original definitions |
193 | 193 | * Uses the subpanel override mechanism from SubPanel to save them |
194 | 194 | */ |
195 | - function handleSave () |
|
195 | + function handleSave() |
|
196 | 196 | { |
197 | - $GLOBALS [ 'log' ]->debug ( "in ParserModifySubPanel->handleSave()" ) ; |
|
198 | - require_once ('include/SubPanel/SubPanel.php') ; |
|
199 | - $subpanel = new SubPanel ( $this->moduleName, 'fab4', $this->subPanelName, $this->panel ) ; |
|
197 | + $GLOBALS ['log']->debug("in ParserModifySubPanel->handleSave()"); |
|
198 | + require_once ('include/SubPanel/SubPanel.php'); |
|
199 | + $subpanel = new SubPanel($this->moduleName, 'fab4', $this->subPanelName, $this->panel); |
|
200 | 200 | |
201 | - $newFields = array ( ) ; |
|
202 | - foreach ( $this->listViewDefs as $name => $field ) |
|
201 | + $newFields = array( ); |
|
202 | + foreach ($this->listViewDefs as $name => $field) |
|
203 | 203 | { |
204 | - if (! isset ( $field [ 'usage' ] ) || $field [ 'usage' ] != 'query_only') |
|
204 | + if (!isset ($field ['usage']) || $field ['usage'] != 'query_only') |
|
205 | 205 | { |
206 | - $existingFields [ $name ] = $field ; |
|
206 | + $existingFields [$name] = $field; |
|
207 | 207 | |
208 | 208 | } else |
209 | 209 | { |
210 | - $newFields [ $name ] = $field ; |
|
210 | + $newFields [$name] = $field; |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | 214 | // Loop through all of the fields defined in the 'Default' group of the ListView data in $_REQUEST |
215 | 215 | // Replace the field specification in the originalListViewDef with this new updated specification |
216 | - foreach ( $_REQUEST [ 'group_0' ] as $field ) |
|
216 | + foreach ($_REQUEST ['group_0'] as $field) |
|
217 | 217 | { |
218 | - if (! empty ( $this->originalListViewDefs [ $field ] )) |
|
218 | + if (!empty ($this->originalListViewDefs [$field])) |
|
219 | 219 | { |
220 | - $newFields [ $field ] = $this->originalListViewDefs [ $field ] ; |
|
220 | + $newFields [$field] = $this->originalListViewDefs [$field]; |
|
221 | 221 | } else |
222 | 222 | { |
223 | 223 | |
224 | - $vname = '' ; |
|
225 | - if (isset ( $this->panel->template_instance->field_defs [ $field ] )) |
|
224 | + $vname = ''; |
|
225 | + if (isset ($this->panel->template_instance->field_defs [$field])) |
|
226 | 226 | { |
227 | - $vname = $this->panel->template_instance->field_defs [ $field ] [ 'vname' ] ; |
|
227 | + $vname = $this->panel->template_instance->field_defs [$field] ['vname']; |
|
228 | 228 | } |
229 | - if (($this->subPanelParentModule != null) && (isset ( $this->subPanelParentModule->field_name_map [ $field ] ) && ($this->subPanelParentModule->field_name_map [ $field ] [ 'type' ] == 'bool' || (isset ( $this->subPanelParentModule->field_name_map [ $field ] [ 'custom_type' ] ) && $this->subPanelParentModule->field_name_map [ $field ] [ 'custom_type' ] == 'bool')))) |
|
229 | + if (($this->subPanelParentModule != null) && (isset ($this->subPanelParentModule->field_name_map [$field]) && ($this->subPanelParentModule->field_name_map [$field] ['type'] == 'bool' || (isset ($this->subPanelParentModule->field_name_map [$field] ['custom_type']) && $this->subPanelParentModule->field_name_map [$field] ['custom_type'] == 'bool')))) |
|
230 | 230 | { |
231 | - $newFields [ $field ] = array ( 'name' => $field , 'vname' => $vname , 'widget_type' => 'checkbox' ) ; |
|
231 | + $newFields [$field] = array('name' => $field, 'vname' => $vname, 'widget_type' => 'checkbox'); |
|
232 | 232 | } else |
233 | 233 | { |
234 | - $newFields [ $field ] = array ( 'name' => $field , 'vname' => $vname ) ; |
|
234 | + $newFields [$field] = array('name' => $field, 'vname' => $vname); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
238 | 238 | // Now set the field width if specified in the $_REQUEST data |
239 | - if (isset ( $_REQUEST [ strtolower ( $field ) . 'width' ] )) |
|
239 | + if (isset ($_REQUEST [strtolower($field).'width'])) |
|
240 | 240 | { |
241 | - $width = substr ( $_REQUEST [ strtolower ( $field ) . 'width' ], 6, 3 ) ; |
|
242 | - if (strpos ( $width, "%" ) != false) |
|
241 | + $width = substr($_REQUEST [strtolower($field).'width'], 6, 3); |
|
242 | + if (strpos($width, "%") != false) |
|
243 | 243 | { |
244 | - $width = substr ( $width, 0, 2 ) ; |
|
244 | + $width = substr($width, 0, 2); |
|
245 | 245 | } |
246 | 246 | if ($width < 101 && $width > 0) |
247 | 247 | { |
248 | - $newFields [ $field ] [ 'width' ] = $width ; |
|
248 | + $newFields [$field] ['width'] = $width; |
|
249 | 249 | } |
250 | - } else if (isset ( $this->listViewDefs [ $field ] [ 'width' ] )) |
|
250 | + } else if (isset ($this->listViewDefs [$field] ['width'])) |
|
251 | 251 | { |
252 | - $newFields [ $field ] [ 'width' ] = $this->listViewDefs [ $field ] [ 'width' ] ; |
|
252 | + $newFields [$field] ['width'] = $this->listViewDefs [$field] ['width']; |
|
253 | 253 | } |
254 | 254 | } |
255 | - $subpanel->saveSubPanelDefOverride ( $this->panel, 'list_fields', $newFields ) ; |
|
255 | + $subpanel->saveSubPanelDefOverride($this->panel, 'list_fields', $newFields); |
|
256 | 256 | |
257 | 257 | } |
258 | 258 |
@@ -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 | } |