Completed
Push — console-installer ( 3d54e5...e2b50d )
by Adam
69:10 queued 48:24
created
modules/ModuleBuilder/views/view.history.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
  ********************************************************************************/
39 39
 
40 40
 
41
-require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ;
42
-require_once ('modules/ModuleBuilder/parsers/views/History.php') ;
43
-require_once ('modules/ModuleBuilder/parsers/ParserFactory.php') ;
41
+require_once ('modules/ModuleBuilder/MB/AjaxCompose.php');
42
+require_once ('modules/ModuleBuilder/parsers/views/History.php');
43
+require_once ('modules/ModuleBuilder/parsers/ParserFactory.php');
44 44
 
45 45
 class ViewHistory extends SugarView
46 46
 {
47
-    var $pageSize = 10 ;
47
+    var $pageSize = 10;
48 48
 
49 49
     /**
50 50
 	 * @see SugarView::_getModuleTitleParams()
@@ -54,125 +54,125 @@  discard block
 block discarded – undo
54 54
 	    global $mod_strings;
55 55
 	    
56 56
     	return array(
57
-    	   translate('LBL_MODULE_NAME','Administration'),
57
+    	   translate('LBL_MODULE_NAME', 'Administration'),
58 58
     	   ModuleBuilderController::getModuleTitle(),
59 59
     	   );
60 60
     }
61 61
 
62
-	function display ()
62
+	function display()
63 63
     {
64
-        $this->layout = strtolower ( $_REQUEST [ 'view' ] ) ;
64
+        $this->layout = strtolower($_REQUEST ['view']);
65 65
         
66
-        $subpanelName = null ;
67
-        if ((strtolower ( $this->layout ) == 'listview') && (!empty ( $_REQUEST [ 'subpanel' ] )))
66
+        $subpanelName = null;
67
+        if ((strtolower($this->layout) == 'listview') && (!empty ($_REQUEST ['subpanel'])))
68 68
         {
69
-            $subpanelName = $_REQUEST [ 'subpanel' ] ;
69
+            $subpanelName = $_REQUEST ['subpanel'];
70 70
             
71 71
         }
72 72
         
73
-        $packageName = (isset ( $_REQUEST [ 'view_package' ] ) && (strtolower ( $_REQUEST [ 'view_package' ] ) != 'studio')) ? $_REQUEST [ 'view_package' ] : null ;
74
-        $this->module = $_REQUEST [ 'view_module' ] ;
73
+        $packageName = (isset ($_REQUEST ['view_package']) && (strtolower($_REQUEST ['view_package']) != 'studio')) ? $_REQUEST ['view_package'] : null;
74
+        $this->module = $_REQUEST ['view_module'];
75 75
         
76
-        $this->parser = ParserFactory::getParser ( $this->layout, $this->module, $packageName, $subpanelName ) ;
77
-        $this->history = $this->parser->getHistory () ;
78
-        $action = ! empty ( $_REQUEST [ 'histAction' ] ) ? $_REQUEST [ 'histAction' ] : 'browse' ;
79
-        $GLOBALS['log']->debug( get_class($this)."->display(): performing History action {$action}" ) ;
80
-        $this->$action () ;
76
+        $this->parser = ParserFactory::getParser($this->layout, $this->module, $packageName, $subpanelName);
77
+        $this->history = $this->parser->getHistory();
78
+        $action = !empty ($_REQUEST ['histAction']) ? $_REQUEST ['histAction'] : 'browse';
79
+        $GLOBALS['log']->debug(get_class($this)."->display(): performing History action {$action}");
80
+        $this->$action();
81 81
     }
82 82
 
83
-    function browse ()
83
+    function browse()
84 84
     {
85
-        $smarty = new Sugar_Smarty ( ) ;
86
-        global $mod_strings ;
87
-        $smarty->assign ( 'mod_strings', $mod_strings ) ;
88
-        $smarty->assign ( 'view_module', $this->module ) ;
89
-        $smarty->assign ( 'view', $this->layout ) ;
85
+        $smarty = new Sugar_Smarty( );
86
+        global $mod_strings;
87
+        $smarty->assign('mod_strings', $mod_strings);
88
+        $smarty->assign('view_module', $this->module);
89
+        $smarty->assign('view', $this->layout);
90 90
         
91
-        if (! empty ( $_REQUEST [ 'subpanel' ] ))
91
+        if (!empty ($_REQUEST ['subpanel']))
92 92
         {
93
-            $smarty->assign ( 'subpanel', $_REQUEST [ 'subpanel' ] ) ;
93
+            $smarty->assign('subpanel', $_REQUEST ['subpanel']);
94 94
         }
95
-        $stamps = array ( ) ;
96
-        global $timedate ;
97
-        $userFormat = $timedate->get_date_time_format () ;
98
-        $page = ! empty ( $_REQUEST [ 'page' ] ) ? $_REQUEST [ 'page' ] : 0 ;
95
+        $stamps = array( );
96
+        global $timedate;
97
+        $userFormat = $timedate->get_date_time_format();
98
+        $page = !empty ($_REQUEST ['page']) ? $_REQUEST ['page'] : 0;
99 99
         $count = $this->history->getCount();
100
-        $ts = $this->history->getNth ( $page * $this->pageSize ) ;
101
-        $snapshots = array ( ) ;
102
-        for ( $i = 0 ; $i <= $this->pageSize && $ts > 0 ; $i ++ )
100
+        $ts = $this->history->getNth($page * $this->pageSize);
101
+        $snapshots = array( );
102
+        for ($i = 0; $i <= $this->pageSize && $ts > 0; $i++)
103 103
         {
104 104
             $dbDate = $timedate->fromTimestamp($ts)->asDb();
105
-            $displayTS = $timedate->to_display_date_time ( $dbDate ) ;
105
+            $displayTS = $timedate->to_display_date_time($dbDate);
106 106
             if ($page * $this->pageSize + $i + 1 == $count)
107 107
                 $displayTS = translate("LBL_MB_DEFAULT_LAYOUT");
108
-            $snapshots [ $ts ] = $displayTS ;
109
-            $ts = $this->history->getNext () ;
108
+            $snapshots [$ts] = $displayTS;
109
+            $ts = $this->history->getNext();
110 110
         }
111
-        if (count ( $snapshots ) > $this->pageSize)
111
+        if (count($snapshots) > $this->pageSize)
112 112
         {
113
-            $smarty->assign ( 'nextPage', true ) ;
113
+            $smarty->assign('nextPage', true);
114 114
         }
115
-        $snapshots = array_slice ( $snapshots, 0, $this->pageSize, true ) ;
116
-        $smarty->assign ( 'currentPage', $page ) ;
117
-        $smarty->assign ( 'snapshots', $snapshots ) ;
115
+        $snapshots = array_slice($snapshots, 0, $this->pageSize, true);
116
+        $smarty->assign('currentPage', $page);
117
+        $smarty->assign('snapshots', $snapshots);
118 118
         
119
-        $html = $smarty->fetch ( 'modules/ModuleBuilder/tpls/history.tpl' ) ;
120
-        echo $html ;
119
+        $html = $smarty->fetch('modules/ModuleBuilder/tpls/history.tpl');
120
+        echo $html;
121 121
     }
122 122
 
123
-    function preview ()
123
+    function preview()
124 124
     {
125
-        global $mod_strings ;
126
-        if (! isset ( $_REQUEST [ 'sid' ] ))
125
+        global $mod_strings;
126
+        if (!isset ($_REQUEST ['sid']))
127 127
         {
128
-            die ( 'SID Required' ) ;
128
+            die ('SID Required');
129 129
         }
130
-        $sid = $_REQUEST [ 'sid' ] ;
130
+        $sid = $_REQUEST ['sid'];
131 131
         $subpanel = '';
132
-        if (! empty ( $_REQUEST [ 'subpanel' ] ))
132
+        if (!empty ($_REQUEST ['subpanel']))
133 133
         {
134
-            $subpanel = ',"' . $_REQUEST [ 'subpanel' ] . '"' ;
134
+            $subpanel = ',"'.$_REQUEST ['subpanel'].'"';
135 135
         }
136
-        echo "<input type='button' name='close$sid' value='". translate ( 'LBL_BTN_CLOSE' )."' " . 
137
-                "class='button' onclick='ModuleBuilder.tabPanel.removeTab(ModuleBuilder.tabPanel.get(\"activeTab\"));' style='margin:5px;'>" . 
138
-             "<input type='button' name='restore$sid' value='" . translate ( 'LBL_MB_RESTORE' ) . "' " .  
139
-                "class='button' onclick='ModuleBuilder.history.revert(\"$this->module\",\"{$this->layout}\",\"$sid\"$subpanel);' style='margin:5px;'>" ;
140
-        $this->history->restoreByTimestamp ( $sid ) ;
141
-        $view ;
136
+        echo "<input type='button' name='close$sid' value='".translate('LBL_BTN_CLOSE')."' ". 
137
+                "class='button' onclick='ModuleBuilder.tabPanel.removeTab(ModuleBuilder.tabPanel.get(\"activeTab\"));' style='margin:5px;'>". 
138
+             "<input type='button' name='restore$sid' value='".translate('LBL_MB_RESTORE')."' ".  
139
+                "class='button' onclick='ModuleBuilder.history.revert(\"$this->module\",\"{$this->layout}\",\"$sid\"$subpanel);' style='margin:5px;'>";
140
+        $this->history->restoreByTimestamp($sid);
141
+        $view;
142 142
         if ($this->layout == 'listview')
143 143
         {
144
-            require_once ("modules/ModuleBuilder/views/view.listview.php") ;
145
-            $view = new ViewListView ( ) ;
144
+            require_once ("modules/ModuleBuilder/views/view.listview.php");
145
+            $view = new ViewListView( );
146 146
         } else if ($this->layout == 'basic_search' || $this->layout == 'advanced_search')
147 147
         {
148
-            require_once ("modules/ModuleBuilder/views/view.searchview.php") ;
149
-            $view = new ViewSearchView ( ) ;
148
+            require_once ("modules/ModuleBuilder/views/view.searchview.php");
149
+            $view = new ViewSearchView( );
150 150
         } else if ($this->layout == 'dashlet' || $this->layout == 'dashletsearch')
151 151
         {
152
-        	require_once ("modules/ModuleBuilder/views/view.dashlet.php") ;
153
-        	$view = new ViewDashlet ( ) ;
154
-        }  else if ($this->layout == 'popuplist' || $this->layout == 'popupsearch')
152
+        	require_once ("modules/ModuleBuilder/views/view.dashlet.php");
153
+        	$view = new ViewDashlet( );
154
+        } else if ($this->layout == 'popuplist' || $this->layout == 'popupsearch')
155 155
         {
156
-        	require_once ("modules/ModuleBuilder/views/view.popupview.php") ;
157
-        	$view = new ViewPopupview ( ) ;
156
+        	require_once ("modules/ModuleBuilder/views/view.popupview.php");
157
+        	$view = new ViewPopupview( );
158 158
         } else
159 159
         {
160
-            require_once ("modules/ModuleBuilder/views/view.layoutview.php") ;
161
-            $view = new ViewLayoutView ( ) ;
160
+            require_once ("modules/ModuleBuilder/views/view.layoutview.php");
161
+            $view = new ViewLayoutView( );
162 162
         }
163 163
         
164
-        $view->display ( true ) ;
165
-        $this->history->undoRestore () ;
164
+        $view->display(true);
165
+        $this->history->undoRestore();
166 166
     }
167 167
 
168
-    function restore ()
168
+    function restore()
169 169
     {
170
-        if (! isset ( $_REQUEST [ 'sid' ] ))
170
+        if (!isset ($_REQUEST ['sid']))
171 171
         {
172
-            die ( 'SID Required' ) ;
172
+            die ('SID Required');
173 173
         }
174
-        $sid = $_REQUEST [ 'sid' ] ;
175
-        $this->history->restoreByTimestamp ( $sid ) ;
174
+        $sid = $_REQUEST ['sid'];
175
+        $this->history->restoreByTimestamp($sid);
176 176
     }
177 177
 
178 178
 	/**
@@ -181,6 +181,6 @@  discard block
 block discarded – undo
181 181
  	 */
182 182
     function unrestore() 
183 183
     {
184
-    	$this->history->undoRestore () ;
184
+    	$this->history->undoRestore();
185 185
     }
186 186
 }
Please login to merge, or discard this patch.
modules/ModuleBuilder/views/view.labels.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	    global $mod_strings;
56 56
 
57 57
     	return array(
58
-    	   translate('LBL_MODULE_NAME','Administration'),
58
+    	   translate('LBL_MODULE_NAME', 'Administration'),
59 59
     	   ModuleBuilderController::getModuleTitle(),
60 60
     	   );
61 61
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
  	function display()
66 66
  	{
67 67
 		$editModule = $_REQUEST['view_module'];
68
-		$allLabels = (!empty($_REQUEST['labels']) && $_REQUEST['labels']== 'all');
68
+		$allLabels = (!empty($_REQUEST['labels']) && $_REQUEST['labels'] == 'all');
69 69
 
70 70
  		if (!isset($_REQUEST['MB']))
71 71
 		{
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 		    $moduleNames = array_change_key_case($app_list_strings['moduleList']);
74 74
 		    $translatedEditModule = $moduleNames[strtolower($editModule)];
75 75
 		}
76
-		$selected_lang = (!empty($_REQUEST['selected_lang'])? $_REQUEST['selected_lang']:$_SESSION['authenticated_user_language']);
77
-		if(empty($selected_lang)){
76
+		$selected_lang = (!empty($_REQUEST['selected_lang']) ? $_REQUEST['selected_lang'] : $_SESSION['authenticated_user_language']);
77
+		if (empty($selected_lang)) {
78 78
 		    $selected_lang = $GLOBALS['sugar_config']['default_language'];
79 79
 		}
80 80
 
81 81
 		$smarty = new Sugar_Smarty();
82 82
 		global $mod_strings;
83 83
         $smarty->assign('mod_strings', $mod_strings);
84
-		$smarty->assign('available_languages',get_languages());
84
+		$smarty->assign('available_languages', get_languages());
85 85
 
86 86
 
87 87
         $objectName = BeanFactory::getObjectName($editModule);
@@ -89,28 +89,28 @@  discard block
 block discarded – undo
89 89
         global $dictionary;
90 90
         $vnames = array();
91 91
 		//jchi 24557 . We should list all the lables in viewdefs(list,detail,edit,quickcreate) that the user can edit them.
92
-		require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php' ;
93
-        $parser = new ListLayoutMetaDataParser ( MB_LISTVIEW, $editModule ) ;
94
-        foreach ( $parser->getLayout() as $key => $def )
92
+		require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php';
93
+        $parser = new ListLayoutMetaDataParser(MB_LISTVIEW, $editModule);
94
+        foreach ($parser->getLayout() as $key => $def)
95 95
         {
96
-        	if(isset($def['label']) ) {
96
+        	if (isset($def['label'])) {
97 97
                $vnames[$def['label']] = $def['label'];
98 98
         	}
99 99
         }
100 100
 
101
-       require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php' ;
101
+       require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php';
102 102
         $variableMap = $this->getVariableMap($editModule);
103
-        foreach($variableMap as $key => $value){
104
-        	$gridLayoutMetaDataParserTemp = new GridLayoutMetaDataParser ( $value, $editModule) ;
105
-        	foreach ( $gridLayoutMetaDataParserTemp->getLayout() as $panel)
103
+        foreach ($variableMap as $key => $value) {
104
+        	$gridLayoutMetaDataParserTemp = new GridLayoutMetaDataParser($value, $editModule);
105
+        	foreach ($gridLayoutMetaDataParserTemp->getLayout() as $panel)
106 106
 	        {
107
-	                foreach ( $panel as $row )
107
+	                foreach ($panel as $row)
108 108
 	                {
109
-	                    foreach ( $row as $fieldArray )
109
+	                    foreach ($row as $fieldArray)
110 110
 	                    { // fieldArray is an array('name'=>name,'label'=>label)
111
-	                        if (isset ( $fieldArray [ 'label' ] ))
111
+	                        if (isset ($fieldArray ['label']))
112 112
 	                        {
113
-	                            $vnames[$fieldArray [ 'label' ] ] = $fieldArray [ 'label' ] ;
113
+	                            $vnames[$fieldArray ['label']] = $fieldArray ['label'];
114 114
 	                        }
115 115
 	                    }
116 116
 	                }
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
         //end
120 120
 
121 121
         //Get Subpanel Labels:
122
-        require_once ('include/SubPanel/SubPanel.php') ;
123
-        $subList =  SubPanel::getModuleSubpanels ( $editModule );
124
-        foreach($subList as $subpanel => $titleLabel) {
122
+        require_once ('include/SubPanel/SubPanel.php');
123
+        $subList = SubPanel::getModuleSubpanels($editModule);
124
+        foreach ($subList as $subpanel => $titleLabel) {
125 125
         	$vnames[$titleLabel] = $titleLabel;
126 126
         }
127 127
 
128
-        foreach($dictionary[$objectName]['fields'] as $name=>$def) {
129
-        	if(isset($def['vname'])) {
128
+        foreach ($dictionary[$objectName]['fields'] as $name=>$def) {
129
+        	if (isset($def['vname'])) {
130 130
                $vnames[$def['vname']] = $def['vname'];
131 131
         	}
132 132
 		}
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 
135 135
  	    //we shouldn't set the $refresh=true here, or will lost template language mod_strings.
136 136
  	    //return_module_language($selected_lang, $editModule,false) : the mod_strings will be included from cache files here.
137
-        foreach(return_module_language($selected_lang, $editModule,false) as $name=>$label) {
137
+        foreach (return_module_language($selected_lang, $editModule, false) as $name=>$label) {
138 138
         		//#25294
139
-        	 	if($allLabels || isset($vnames[$name]) || preg_match( '/lbl_city|lbl_country|lbl_billing_address|lbl_alt_address|lbl_shipping_address|lbl_postal_code|lbl_state$/si' , $name)) {
139
+        	 	if ($allLabels || isset($vnames[$name]) || preg_match('/lbl_city|lbl_country|lbl_billing_address|lbl_alt_address|lbl_shipping_address|lbl_postal_code|lbl_state$/si', $name)) {
140 140
                     $formatted_mod_strings[$name] = htmlentities($label, ENT_QUOTES, 'UTF-8');
141 141
         	 	}
142 142
         }
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
             "custom/modules/$editModule/language/$selected_lang.lang.php",
147 147
             "custom/modules/$editModule/Ext/Language/$selected_lang.lang.ext.php"
148 148
         );
149
-        foreach($files as $langfile){
149
+        foreach ($files as $langfile) {
150 150
         	$mod_strings = array();
151 151
         	if (is_file($langfile))
152 152
         	{
153 153
         	   include($langfile);
154
-        	   foreach($mod_strings as $key => $label)
154
+        	   foreach ($mod_strings as $key => $label)
155 155
         	   {
156 156
                     $formatted_mod_strings[$key] = htmlentities($label, ENT_QUOTES, 'UTF-8');
157 157
         	   }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$smarty->assign('defaultHelp', 'labelsBtn');
167 167
 		$smarty->assign('assistant', array('key'=>'labels', 'group'=>'module'));
168 168
 		$smarty->assign('labels_choice', $mod_strings['labelTypes']);
169
-		$smarty->assign('labels_current', $allLabels?"all":"");
169
+		$smarty->assign('labels_current', $allLabels ? "all" : "");
170 170
 
171 171
 		$ajax = new AjaxCompose();
172 172
 		$ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
                                            'Quotes',
192 192
                                            'ProductTemplates');
193 193
         
194
-        if(in_array($module, $hideQuickCreateForModules))
194
+        if (in_array($module, $hideQuickCreateForModules))
195 195
         {
196
-            if(isset($variableMap['quickcreate']))
196
+            if (isset($variableMap['quickcreate']))
197 197
             {
198 198
                 unset($variableMap['quickcreate']);
199 199
             }
200 200
         }
201 201
         
202
-        if($module == 'KBDocuments')
202
+        if ($module == 'KBDocuments')
203 203
         {
204
-            $variableMap  = array();
204
+            $variableMap = array();
205 205
         }
206 206
         
207 207
         return $variableMap;
Please login to merge, or discard this patch.
modules/ModuleBuilder/views/view.modulefields.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	    global $mod_strings;
53 53
 	    
54 54
     	return array(
55
-    	   translate('LBL_MODULE_NAME','Administration'),
55
+    	   translate('LBL_MODULE_NAME', 'Administration'),
56 56
     	   ModuleBuilderController::getModuleTitle(),
57 57
     	   );
58 58
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	{
62 62
         $smarty = new Sugar_Smarty();
63 63
         global $mod_strings;
64
-        $bak_mod_strings=$mod_strings;
64
+        $bak_mod_strings = $mod_strings;
65 65
         $smarty->assign('mod_strings', $mod_strings);
66 66
 
67 67
         $module_name = $_REQUEST['view_module'];
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         //add datetimecombo type field from the vardef overrides to point to Datetime type
78 78
         $fieldTypes['datetime'] = $fieldTypes['datetimecombo'];
79 79
 
80
-        if(!isset($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio') {
80
+        if (!isset($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio') {
81 81
             //$this->loadPackageHelp($module_name);
82 82
             $studioClass = new stdClass;
83 83
             $studioClass->name = $module_name;
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
             global $dictionary;
89 89
             $f = array($mod_strings['LBL_HCUSTOM']=>array(), $mod_strings['LBL_HDEFAULT']=>array());
90 90
 
91
-            foreach($dictionary[$objectName]['fields'] as $def) {
91
+            foreach ($dictionary[$objectName]['fields'] as $def) {
92 92
                 if ($this->isValidStudioField($def))
93 93
                 {
94 94
                     $def['label'] = translate($def['vname'], $module_name);
95 95
 					//Custom relate fields will have a non-db source, but custom_module set
96
-                	if(isset($def['source']) && $def['source'] == 'custom_fields' || isset($def['custom_module'])) {
96
+                	if (isset($def['source']) && $def['source'] == 'custom_fields' || isset($def['custom_module'])) {
97 97
                        $f[$mod_strings['LBL_HCUSTOM']][$def['name']] = $def;
98 98
                        $def['custom'] = true;
99 99
                     } else {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
123 123
             $ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module='.$module_name.'")');
124 124
             $ajax->addCrumb($mod_strings['LBL_FIELDS'], '');
125
-            $ajax->addSection('center', $mod_strings['LBL_EDIT_FIELDS'],$smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
125
+            $ajax->addSection('center', $mod_strings['LBL_EDIT_FIELDS'], $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
126 126
             $_REQUEST['field'] = '';
127 127
 
128 128
             echo $ajax->getJavascript();
@@ -139,20 +139,20 @@  discard block
 block discarded – undo
139 139
             $this->mbModule->mbvardefs->vardefs['fields'] = array_reverse($this->mbModule->mbvardefs->vardefs['fields'], true);
140 140
             $loadedFields = array();
141 141
 
142
-            if(file_exists($this->mbModule->path. '/language/'.$current_language.'.lang.php'))
142
+            if (file_exists($this->mbModule->path.'/language/'.$current_language.'.lang.php'))
143 143
             {
144
-                include($this->mbModule->path .'/language/'.$current_language.'.lang.php');
145
-                $this->mbModule->setModStrings($current_language,$mod_strings);
146
-            }elseif(file_exists($this->mbModule->path. '/language/en_us.lang.php')){
147
-                include($this->mbModule->path .'/language/en_us.lang.php');
148
-                $this->mbModule->setModStrings('en_us',$mod_strings);
144
+                include($this->mbModule->path.'/language/'.$current_language.'.lang.php');
145
+                $this->mbModule->setModStrings($current_language, $mod_strings);
146
+            }elseif (file_exists($this->mbModule->path.'/language/en_us.lang.php')) {
147
+                include($this->mbModule->path.'/language/en_us.lang.php');
148
+                $this->mbModule->setModStrings('en_us', $mod_strings);
149 149
             }
150 150
 
151
-            foreach($this->mbModule->mbvardefs->vardefs['fields'] as $k=>$v)
151
+            foreach ($this->mbModule->mbvardefs->vardefs['fields'] as $k=>$v)
152 152
             {
153 153
                 if ($k != $this->mbModule->name)
154 154
                 {
155
-                    foreach($v as $field => $def)
155
+                    foreach ($v as $field => $def)
156 156
                     {
157 157
                         if (in_array($field, array_keys($this->mbModule->mbvardefs->vardefs['fields'][$this->mbModule->name])))
158 158
                         {
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
                 }
165 165
             }
166 166
 
167
-            foreach($this->mbModule->mbvardefs->vardefs['fields'] as $k=>$v)
167
+            foreach ($this->mbModule->mbvardefs->vardefs['fields'] as $k=>$v)
168 168
             {
169
-                if($k != $module_name)
169
+                if ($k != $module_name)
170 170
                 {
171
-                    $titleLBL[$k]=translate("LBL_".strtoupper($k),'ModuleBuilder');
172
-                }else{
173
-                    $titleLBL[$k]=$k;
171
+                    $titleLBL[$k] = translate("LBL_".strtoupper($k), 'ModuleBuilder');
172
+                } else {
173
+                    $titleLBL[$k] = $k;
174 174
                 }
175
-                foreach($v as $field => $def)
175
+                foreach ($v as $field => $def)
176 176
                 {
177 177
                 	if (isset($loadedFields[$field]))
178 178
                     {
@@ -199,15 +199,15 @@  discard block
 block discarded – undo
199 199
             $smarty->assign('title', $titleLBL);
200 200
             $smarty->assign('package', $package);
201 201
             $smarty->assign('module', $this->mbModule);
202
-            $smarty->assign('editLabelsMb','1');
202
+            $smarty->assign('editLabelsMb', '1');
203 203
             $smarty->assign('studio', false);
204 204
 
205 205
             $ajax = new AjaxCompose();
206 206
             $ajax->addCrumb($bak_mod_strings['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")');
207
-            $ajax->addCrumb($package->name,'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package='.$package->name.'")');
208
-            $ajax->addCrumb($module_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package='.$package->name.'&view_module='. $module_name . '")');
207
+            $ajax->addCrumb($package->name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package='.$package->name.'")');
208
+            $ajax->addCrumb($module_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package='.$package->name.'&view_module='.$module_name.'")');
209 209
             $ajax->addCrumb($bak_mod_strings['LBL_FIELDS'], '');
210
-            $ajax->addSection('center', $bak_mod_strings["LBL_FIELDS"],$smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
210
+            $ajax->addSection('center', $bak_mod_strings["LBL_FIELDS"], $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
211 211
             $_REQUEST['field'] = '';
212 212
 
213 213
             echo $ajax->getJavascript();
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $name
221 221
         )
222 222
     {
223
-        $this->mbModule->help['default'] = (empty($name))?'create':'modify';
223
+        $this->mbModule->help['default'] = (empty($name)) ? 'create' : 'modify';
224 224
         $this->mbModule->help['group'] = 'module';
225 225
         $this->mbModule->help['group'] = 'module';
226 226
     }
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
         $def
230 230
         )
231 231
     {
232
-        if(!empty($def['parent_id']))
232
+        if (!empty($def['parent_id']))
233 233
             unset($def['parent_id']);
234
-        if(!empty($def['parent_type']))
234
+        if (!empty($def['parent_type']))
235 235
             unset($def['parent_type']);
236
-        if(!empty($def['currency_id']))
236
+        if (!empty($def['currency_id']))
237 237
             unset($def['currency_id']);
238 238
         return $def;
239 239
     }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         )
244 244
 	{
245 245
     	if (isset($def['studio'])) {
246
-            if (is_array($def [ 'studio' ]))
246
+            if (is_array($def ['studio']))
247 247
             {
248 248
     			if (isset($def['studio']['editField']) && $def['studio']['editField'] == true)
249 249
                     return true;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     		{
255 255
     			if ($def['studio'] == 'visible')
256 256
                     return true;
257
-                if ($def['studio'] == 'hidden' || $def['studio'] == 'false' || !$def['studio'] )
257
+                if ($def['studio'] == 'hidden' || $def['studio'] == 'false' || !$def['studio'])
258 258
                     return false;
259 259
             }
260 260
         }
Please login to merge, or discard this patch.
modules/ModuleBuilder/views/view.deletepackage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	    global $mod_strings;
51 51
 	    
52 52
     	return array(
53
-    	   translate('LBL_MODULE_NAME','Administration'),
53
+    	   translate('LBL_MODULE_NAME', 'Administration'),
54 54
     	   ModuleBuilderController::getModuleTitle(),
55 55
     	   );
56 56
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         
62 62
         $ajax = new AjaxCompose();
63 63
         $ajax->addSection('center', $mod_strings['LBL_PACKAGE_DELETED'], 
64
-            str_replace('[[package]]',$_REQUEST['package'],$mod_strings['LBL_PACKAGE_WAS_DELETED']));
64
+            str_replace('[[package]]', $_REQUEST['package'], $mod_strings['LBL_PACKAGE_WAS_DELETED']));
65 65
         echo $ajax->getJavascript();
66 66
  	}
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
modules/ModuleBuilder/views/view.home.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	    global $mod_strings;
49 49
 	    
50 50
     	return array(
51
-    	   translate('LBL_MODULE_NAME','Administration'),
51
+    	   translate('LBL_MODULE_NAME', 'Administration'),
52 52
     	   ModuleBuilderController::getModuleTitle(),
53 53
     	   );
54 54
     }
@@ -58,19 +58,19 @@  discard block
 block discarded – undo
58 58
 		global $current_user;
59 59
 		global $mod_strings;
60 60
 		$smarty = new Sugar_Smarty();
61
-		$smarty->assign('title' , $mod_strings['LBL_DEVELOPER_TOOLS']);
61
+		$smarty->assign('title', $mod_strings['LBL_DEVELOPER_TOOLS']);
62 62
 		$smarty->assign('question', $mod_strings['LBL_QUESTION_EDITOR']);
63 63
 		$smarty->assign('defaultHelp', 'mainHelp');
64 64
 		$this->generateHomeButtons();
65 65
 		$smarty->assign('buttons', $this->buttons);
66
-		$assistant=array('group'=>'main', 'key'=>'welcome');
67
-		$smarty->assign('assistant',$assistant);
66
+		$assistant = array('group'=>'main', 'key'=>'welcome');
67
+		$smarty->assign('assistant', $assistant);
68 68
 		//initialize Assistant's display property.
69 69
 		$userPref = $current_user->getPreference('mb_assist', 'Assistant');
70
-		if(!$userPref) $userPref="na";
71
-		$smarty->assign('userPref',$userPref);
70
+		if (!$userPref) $userPref = "na";
71
+		$smarty->assign('userPref', $userPref);
72 72
 		$ajax = new AjaxCompose();
73
-		$ajax->addSection('center', $mod_strings['LBL_HOME'],$smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl'));
73
+		$ajax->addSection('center', $mod_strings['LBL_HOME'], $smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl'));
74 74
 		echo $ajax->getJavascript();
75 75
 	}
76 76
 
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 	function generateHomeButtons() 
79 79
 	{
80 80
 	    global $current_user;
81
-        if(displayStudioForCurrentUser() == true) {
81
+        if (displayStudioForCurrentUser() == true) {
82 82
 		//$this->buttons['Application'] = array ('action' => '', 'imageTitle' => 'Application', 'size' => '128', 'help'=>'appBtn');
83
-		$this->buttons[$GLOBALS['mod_strings']['LBL_STUDIO']] = array ('action' => 'javascript:ModuleBuilder.main("studio")', 'imageTitle' => 'Studio', 'size' => '128', 'help'=>'studioBtn');
83
+		$this->buttons[$GLOBALS['mod_strings']['LBL_STUDIO']] = array('action' => 'javascript:ModuleBuilder.main("studio")', 'imageTitle' => 'Studio', 'size' => '128', 'help'=>'studioBtn');
84 84
         }
85
-        if(is_admin($current_user)) {
86
-		$this->buttons[$GLOBALS['mod_strings']['LBL_MODULEBUILDER']] = array ('action' => 'javascript:ModuleBuilder.main("mb")', 'imageTitle' => 'ModuleBuilder', 'size' => '128', 'help'=>'mbBtn');
85
+        if (is_admin($current_user)) {
86
+		$this->buttons[$GLOBALS['mod_strings']['LBL_MODULEBUILDER']] = array('action' => 'javascript:ModuleBuilder.main("mb")', 'imageTitle' => 'ModuleBuilder', 'size' => '128', 'help'=>'mbBtn');
87 87
         }
88
-		$this->buttons[$GLOBALS['mod_strings']['LBL_DROPDOWNEDITOR']] = array ('action' => 'javascript:ModuleBuilder.main("dropdowns")', 'imageTitle' => $GLOBALS['mod_strings']['LBL_HOME_EDIT_DROPDOWNS'], 'imageName' => 'DropDownEditor', 'size' => '128', 'help'=>'dropDownEditorBtn');
88
+		$this->buttons[$GLOBALS['mod_strings']['LBL_DROPDOWNEDITOR']] = array('action' => 'javascript:ModuleBuilder.main("dropdowns")', 'imageTitle' => $GLOBALS['mod_strings']['LBL_HOME_EDIT_DROPDOWNS'], 'imageName' => 'DropDownEditor', 'size' => '128', 'help'=>'dropDownEditorBtn');
89 89
 	}
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/StandardField.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-    die ( 'Not A Valid Entry Point' ) ;
2
+if (!defined('sugarEntry') || !sugarEntry)
3
+    die ('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
6 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  ********************************************************************************/
41 41
 
42 42
 
43
-require_once ('modules/DynamicFields/DynamicField.php') ;
43
+require_once ('modules/DynamicFields/DynamicField.php');
44 44
 
45 45
 class StandardField extends DynamicField
46 46
 {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         parent::DynamicField($module);
54 54
     }
55 55
     
56
-    protected function loadCustomDef($field){
56
+    protected function loadCustomDef($field) {
57 57
     	global $beanList;
58 58
     	if (!empty($beanList[$this->module]) && is_file("custom/Extension/modules/{$this->module}/Ext/Vardefs/sugarfield_$field.php"))
59 59
     	{
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     	}
66 66
     }
67 67
 
68
-    protected function loadBaseDef($field){
68
+    protected function loadBaseDef($field) {
69 69
         global $beanList;
70 70
         if (!empty($beanList[$this->module]) && is_file("modules/{$this->module}/vardefs.php"))
71 71
         {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param Field Object $field
83 83
      * @return boolean
84 84
      */
85
-    function addFieldObject(&$field){
85
+    function addFieldObject(&$field) {
86 86
         global $dictionary, $beanList;
87 87
         
88 88
         
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
         // set $field->unified_search=true if field supports unified search
100 100
         // regarding #51427
101
-        if($field->supports_unified_search)
101
+        if ($field->supports_unified_search)
102 102
         {
103
-            if(isset($dictionary[$bean_name]['unified_search_default_enabled']) && isset($dictionary[$bean_name]['unified_search'])
103
+            if (isset($dictionary[$bean_name]['unified_search_default_enabled']) && isset($dictionary[$bean_name]['unified_search'])
104 104
             && $dictionary[$bean_name]['unified_search_default_enabled'] && $dictionary[$bean_name]['unified_search'])
105 105
             {
106 106
                 $currdef['unified_search'] = $field->unified_search = isset($currdef['unified_search'])
@@ -114,21 +114,21 @@  discard block
 block discarded – undo
114 114
         $this->loadBaseDef($field->name);
115 115
         $newDef = $field->get_field_def();
116 116
         
117
-        require_once ('modules/DynamicFields/FieldCases.php') ;
118
-        $this->baseField = get_widget ( $field->type) ;
119
-        foreach ($field->vardef_map as $property => $fmd_col){
117
+        require_once ('modules/DynamicFields/FieldCases.php');
118
+        $this->baseField = get_widget($field->type);
119
+        foreach ($field->vardef_map as $property => $fmd_col) {
120 120
            
121 121
         	if ($property == "action" || $property == "label_value" || $property == "label"
122
-            	|| ((substr($property, 0,3) == 'ext' && strlen($property) == 4))
122
+            	|| ((substr($property, 0, 3) == 'ext' && strlen($property) == 4))
123 123
             ) 
124 124
             	continue;
125 125
        	 		
126 126
             // Bug 37043 - Avoid writing out vardef defintions that are the default value.
127 127
             if (isset($newDef[$property]) &&
128
-            	((!isset($currdef[$property]) && !$this->isDefaultValue($property,$newDef[$property], $this->baseField))
128
+            	((!isset($currdef[$property]) && !$this->isDefaultValue($property, $newDef[$property], $this->baseField))
129 129
             		|| (isset($currdef[$property]) && $currdef[$property] != $newDef[$property])
130 130
             	)
131
-            ){
131
+            ) {
132 132
             	$this->custom_def[$property] =
133 133
                     is_string($newDef[$property]) ? htmlspecialchars_decode($newDef[$property], ENT_QUOTES) : $newDef[$property];
134 134
             }
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
             if (!empty($this->base_def[$property]) && !isset($newDef[$property]))
142 142
             {
143 143
                 //Switch on type of the property to find what the correct 'empty' is.
144
-                if(is_string($this->base_def[$property]))
144
+                if (is_string($this->base_def[$property]))
145 145
                     $this->custom_def[$property] = "";
146
-                else if(is_array($this->base_def[$property]))
146
+                else if (is_array($this->base_def[$property]))
147 147
                     $this->custom_def[$property] = array();
148
-                else if(is_bool($this->base_def[$property]))
148
+                else if (is_bool($this->base_def[$property]))
149 149
                     $this->custom_def[$property] = false;
150 150
                 else
151 151
                     $this->custom_def[$property] = null;
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/relationships/OneToOneRelationship.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
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-One Relationship
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
      * Constructor
72 72
      * @param array $definition Parameters passed in as array with keys defined in parent::keys
73 73
      */
74
-    function __construct ($definition)
74
+    function __construct($definition)
75 75
     {
76
-        parent::__construct ( $definition ) ;
76
+        parent::__construct($definition);
77 77
     }
78 78
     
79 79
     /*
@@ -83,55 +83,55 @@  discard block
 block discarded – undo
83 83
     /*
84 84
      * @return array    An array of relationship metadata definitions
85 85
      */
86
-    function buildRelationshipMetaData ()
86
+    function buildRelationshipMetaData()
87 87
     {
88
-        return array( $this->lhs_module => $this->getRelationshipMetaData ( MB_ONETOONE ) ) ;
88
+        return array($this->lhs_module => $this->getRelationshipMetaData(MB_ONETOONE));
89 89
     }
90 90
 
91 91
     /* Build a set of Link Field definitions for this relationship
92 92
      * @return array    An array of field definitions, ready for the vardefs, keyed by module
93 93
      */
94
-    function buildVardefs ( )
94
+    function buildVardefs( )
95 95
     {
96
-        $vardefs = array ( ) ;
97
-        $vardefs [ $this->rhs_module ] [] = $this->getLinkFieldDefinition ( $this->lhs_module, $this->relationship_name , false, 
98
-            'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel() ) . '_TITLE' ,
99
-            $this->relationship_only ? false : $this->getIDName( $this->lhs_module )
100
-        ) ;
101
-        $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, false, 
102
-            'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel()   ) . '_TITLE'  ,
103
-            $this->relationship_only ? false : $this->getIDName( $this->rhs_module )
104
-        ) ;
96
+        $vardefs = array( );
97
+        $vardefs [$this->rhs_module] [] = $this->getLinkFieldDefinition($this->lhs_module, $this->relationship_name, false, 
98
+            'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getLeftModuleSystemLabel()).'_TITLE',
99
+            $this->relationship_only ? false : $this->getIDName($this->lhs_module)
100
+        );
101
+        $vardefs [$this->lhs_module] [] = $this->getLinkFieldDefinition($this->rhs_module, $this->relationship_name, false, 
102
+            'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getRightModuleSystemLabel()).'_TITLE',
103
+            $this->relationship_only ? false : $this->getIDName($this->rhs_module)
104
+        );
105 105
         
106 106
         if (!$this->relationship_only)
107 107
         {
108
-            $vardefs [ $this->lhs_module ] [] = $this->getRelateFieldDefinition ( $this->rhs_module, $this->relationship_name, $this->getRightModuleSystemLabel() ) ;
109
-            $vardefs [ $this->rhs_module ] [] = $this->getRelateFieldDefinition ( $this->lhs_module, $this->relationship_name, $this->getLeftModuleSystemLabel() ) ;
110
-            $vardefs [ $this->lhs_module ] [] = $this->getLink2FieldDefinition ( $this->rhs_module, $this->relationship_name , false, 
111
-            'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel()   ) . '_TITLE' ) ;
112
-            $vardefs [ $this->rhs_module ] [] = $this->getLink2FieldDefinition ( $this->lhs_module, $this->relationship_name , false, 
113
-            'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel() ) . '_TITLE' ) ;
108
+            $vardefs [$this->lhs_module] [] = $this->getRelateFieldDefinition($this->rhs_module, $this->relationship_name, $this->getRightModuleSystemLabel());
109
+            $vardefs [$this->rhs_module] [] = $this->getRelateFieldDefinition($this->lhs_module, $this->relationship_name, $this->getLeftModuleSystemLabel());
110
+            $vardefs [$this->lhs_module] [] = $this->getLink2FieldDefinition($this->rhs_module, $this->relationship_name, false, 
111
+            'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getRightModuleSystemLabel()).'_TITLE');
112
+            $vardefs [$this->rhs_module] [] = $this->getLink2FieldDefinition($this->lhs_module, $this->relationship_name, false, 
113
+            'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getLeftModuleSystemLabel()).'_TITLE');
114 114
         }
115 115
         
116
-        return $vardefs ;
116
+        return $vardefs;
117 117
     }
118 118
 
119 119
     /*
120 120
      * Define what fields to add to which modules layouts
121 121
      * @return array    An array of module => fieldname
122 122
      */
123
-    function buildFieldsToLayouts ()
123
+    function buildFieldsToLayouts()
124 124
     {
125 125
         if ($this->relationship_only)
126
-            return array () ;
126
+            return array();
127 127
  
128 128
         if ($this->lhs_module == $this->rhs_module) // don't add in two fields on recursive relationships
129
-            return array ( $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") );
129
+            return array($this->lhs_module => $this->getValidDBName($this->relationship_name."_name"));
130 130
         else
131
-            return array (
132
-                $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") ,
133
-                $this->rhs_module => $this->getValidDBName($this->relationship_name . "_name")
134
-            ) ;
131
+            return array(
132
+                $this->lhs_module => $this->getValidDBName($this->relationship_name."_name"),
133
+                $this->rhs_module => $this->getValidDBName($this->relationship_name."_name")
134
+            );
135 135
     }
136 136
 
137 137
 }
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php 1 patch
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 class AbstractRelationship
48 48
 {
49 49
     
50
-    protected $definition ; // enough information to rebuild this relationship
50
+    protected $definition; // enough information to rebuild this relationship
51 51
     
52 52
 
53 53
     /*
@@ -56,35 +56,35 @@  discard block
 block discarded – undo
56 56
      * The base set of keys are those used in the Relationships table 
57 57
      * Defined as Public as MBRelationship uses these to read the _POST data
58 58
      */
59
-    public static $definitionKeys = array ( 
59
+    public static $definitionKeys = array( 
60 60
         // atttributes of this relationship - here in the definition so they are preserved across saves and loads
61 61
         'for_activities',
62 62
     	'is_custom',
63 63
         'from_studio',
64
-        'readonly' , // a readonly relationship cannot be Built by subclasses of AbstractRelationships
65
-        'deleted' , // a deleted relationship will not be built, and if it had been built previously the built relationship will be removed
66
-        'relationship_only' , // means that we won't build any UI components for this relationship - required while the Subpanel code is restricted to one subpanel only from any module, and probably useful afterwards also for developers to build relationships for new code - it's a feature!
64
+        'readonly', // a readonly relationship cannot be Built by subclasses of AbstractRelationships
65
+        'deleted', // a deleted relationship will not be built, and if it had been built previously the built relationship will be removed
66
+        'relationship_only', // means that we won't build any UI components for this relationship - required while the Subpanel code is restricted to one subpanel only from any module, and probably useful afterwards also for developers to build relationships for new code - it's a feature!
67 67
         // keys not found in Relationships table
68
-        'label' , // optional
68
+        'label', // optional
69 69
         'rhs_label', // optional
70 70
         'lhs_label', // optional
71
-        'lhs_subpanel' , // subpanel FROM the lhs_module to display on the rhs_module detail view
72
-        'rhs_subpanel' , // subpanel FROM the rhs_module to display on the lhs_module detail view
71
+        'lhs_subpanel', // subpanel FROM the lhs_module to display on the rhs_module detail view
72
+        'rhs_subpanel', // subpanel FROM the rhs_module to display on the lhs_module detail view
73 73
         // keys from Relationships table
74
-        'relationship_name' ,
75
-        'lhs_module' , 
76
-        'lhs_table' , 
77
-        'lhs_key' , 
78
-        'rhs_module' , 
79
-        'rhs_table' , 
80
-        'rhs_key' , 
81
-        'join_table' , 
82
-        'join_key_lhs' , 
83
-        'join_key_rhs' , 
84
-        'relationship_type' , 
85
-        'relationship_role_column' , 
86
-        'relationship_role_column_value' , 
87
-        'reverse' ) ;
74
+        'relationship_name',
75
+        'lhs_module', 
76
+        'lhs_table', 
77
+        'lhs_key', 
78
+        'rhs_module', 
79
+        'rhs_table', 
80
+        'rhs_key', 
81
+        'join_table', 
82
+        'join_key_lhs', 
83
+        'join_key_rhs', 
84
+        'relationship_type', 
85
+        'relationship_role_column', 
86
+        'relationship_role_column_value', 
87
+        'reverse' );
88 88
 
89 89
     /*
90 90
      * Relationship_role_column and relationship_role_column_value:
@@ -104,65 +104,65 @@  discard block
 block discarded – undo
104 104
      * Constructor
105 105
      * @param string $definition    Definition array for this relationship. Parameters are given in self::keys
106 106
      */
107
-    function __construct ($definition)
107
+    function __construct($definition)
108 108
     {
109 109
         // set any undefined attributes to the default value
110
-        foreach ( array ( 'readonly' , 'deleted' , 'relationship_only', 'for_activities', 'is_custom', 'from_studio' ) as $key )
111
-            if (! isset ( $definition [ $key ] ))
112
-                $definition [ $key ] = false ;
110
+        foreach (array('readonly', 'deleted', 'relationship_only', 'for_activities', 'is_custom', 'from_studio') as $key)
111
+            if (!isset ($definition [$key]))
112
+                $definition [$key] = false;
113 113
         
114
-        foreach ( self::$definitionKeys as $key )
114
+        foreach (self::$definitionKeys as $key)
115 115
         {
116
-            $this->$key = isset ( $definition [ $key ] ) ? $definition [ $key ] : '' ;
116
+            $this->$key = isset ($definition [$key]) ? $definition [$key] : '';
117 117
         }
118
-        $this->definition = $definition ;
118
+        $this->definition = $definition;
119 119
     }
120 120
 
121 121
     /*
122 122
      * Get the unique name of this relationship
123 123
      * @return string   The unique name (actually just that given to the constructor)
124 124
      */
125
-    public function getName ()
125
+    public function getName()
126 126
     {
127
-        return isset ( $this->definition [ 'relationship_name' ] ) ? $this->definition [ 'relationship_name' ] : null ;
127
+        return isset ($this->definition ['relationship_name']) ? $this->definition ['relationship_name'] : null;
128 128
     }
129 129
 
130
-    public function setName ($relationshipName)
130
+    public function setName($relationshipName)
131 131
     {
132
-        $this->relationship_name = $this->definition [ 'relationship_name' ] = $relationshipName ;
132
+        $this->relationship_name = $this->definition ['relationship_name'] = $relationshipName;
133 133
     }
134 134
 
135 135
     /*
136 136
      * Is this relationship readonly or not?
137 137
      * @return boolean True if cannot be changed; false otherwise
138 138
      */
139
-    public function readonly ()
139
+    public function readonly()
140 140
     {
141
-        return $this->definition [ 'readonly' ] ;
141
+        return $this->definition ['readonly'];
142 142
     }
143 143
 
144
-    public function setReadonly ($set = true)
144
+    public function setReadonly($set = true)
145 145
     {
146
-        $this->readonly = $this->definition [ 'readonly' ] = $set ;
146
+        $this->readonly = $this->definition ['readonly'] = $set;
147 147
     }
148 148
 
149
-    public function setFromStudio ()
149
+    public function setFromStudio()
150 150
     {
151
-        $this->from_studio = $this->definition [ 'from_studio' ] = true ;
151
+        $this->from_studio = $this->definition ['from_studio'] = true;
152 152
     }
153 153
 
154 154
     /*
155 155
      * Has this relationship been deleted? A deleted relationship does not get built, and is no longer visible in the list of relationships
156 156
      * @return boolean True if it has been deleted; false otherwise
157 157
      */
158
-    public function deleted ()
158
+    public function deleted()
159 159
     {
160
-        return $this->definition [ 'deleted' ] ;
160
+        return $this->definition ['deleted'];
161 161
     }
162 162
 
163
-    public function delete ()
163
+    public function delete()
164 164
     {
165
-        $this->deleted = $this->definition [ 'deleted' ] = true ;
165
+        $this->deleted = $this->definition ['deleted'] = true;
166 166
     }
167 167
     
168 168
     public function getFromStudio()
@@ -180,19 +180,19 @@  discard block
 block discarded – undo
180 180
         return $this->rhs_module;
181 181
     }
182 182
 
183
-    public function getType ()
183
+    public function getType()
184 184
     {
185
-        return $this->relationship_type ;
185
+        return $this->relationship_type;
186 186
     }
187 187
     
188
-    public function relationship_only ()
188
+    public function relationship_only()
189 189
     {
190
-        return $this->definition [ 'relationship_only' ] ;   
190
+        return $this->definition ['relationship_only'];   
191 191
     }
192 192
     
193
-    public function setRelationship_only ()
193
+    public function setRelationship_only()
194 194
     {
195
-        $this->relationship_only = $this->definition [ 'relationship_only' ] = true ;
195
+        $this->relationship_only = $this->definition ['relationship_only'] = true;
196 196
     }
197 197
 
198 198
     /*
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
      * `relationship_name`, `lhs_module`, `lhs_table`, `lhs_key`, `rhs_module`, `rhs_table`,`rhs_key`, `join_table`, `join_key_lhs`, `join_key_rhs`, `relationship_type`, `relationship_role_column`, `relationship_role_column_value`, `reverse`,
204 204
      * @return array    Set of parameters to pass to an AbstractRelationship constructor - must contain at least ['relationship_type']='OneToOne' or 'OneToMany' or 'ManyToMany'
205 205
      */
206
-    function getDefinition ()
206
+    function getDefinition()
207 207
     {
208
-        return $this->definition ;
208
+        return $this->definition;
209 209
     }
210 210
 
211 211
     /*
@@ -216,42 +216,42 @@  discard block
 block discarded – undo
216 216
      * Define the labels to be added to the module for the new relationships
217 217
      * @return array    An array of system value => display value
218 218
      */
219
-    function buildLabels ($update=false)
219
+    function buildLabels($update = false)
220 220
     {
221
-        $labelDefinitions = array ( ) ;
221
+        $labelDefinitions = array( );
222 222
         if (!$this->relationship_only)
223 223
         {
224
-        	if(!$this->is_custom && $update && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")){
224
+        	if (!$this->is_custom && $update && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")) {
225 225
         		include("modules/{$this->rhs_module}/metadata/subpaneldefs.php");
226
-        		if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){
226
+        		if (isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])) {
227 227
         			$rightSysLabel = $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'];
228 228
         		}
229 229
         		$layout_defs = array();
230 230
         	}
231
-        	if(!$this->is_custom && $update && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){
231
+        	if (!$this->is_custom && $update && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")) {
232 232
         		include("modules/{$this->lhs_module}/metadata/subpaneldefs.php");
233
-        		if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){
233
+        		if (isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])) {
234 234
         			$leftSysLabel = $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'];
235 235
         		}
236 236
         		$layout_defs = array();
237 237
         	}
238
-        	$labelDefinitions [] = array (
239
-        		'module' => $this->rhs_module ,
240
-        		'system_label' => isset($rightSysLabel)?$rightSysLabel : 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel() ) . '_TITLE' ,
241
-        		'display_label' => ($update && !empty($_REQUEST [ 'lhs_label' ] ))?$_REQUEST [ 'lhs_label' ] :(empty($this->lhs_label) ? translate ( $this->lhs_module ) : $this->lhs_label),
242
-        	) ;
243
-            $labelDefinitions [] = array (
244
-            	'module' => $this->lhs_module ,
245
-            	'system_label' =>  isset($leftSysLabel)?$leftSysLabel :'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel() ) . '_TITLE' ,
246
-            	'display_label' => ($update && !empty($_REQUEST [ 'rhs_label' ] ))?$_REQUEST [ 'rhs_label' ] :(empty($this->rhs_label) ? translate ( $this->rhs_module ) : $this->rhs_label),
247
-            ) ;
238
+        	$labelDefinitions [] = array(
239
+        		'module' => $this->rhs_module,
240
+        		'system_label' => isset($rightSysLabel) ? $rightSysLabel : 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getLeftModuleSystemLabel()).'_TITLE',
241
+        		'display_label' => ($update && !empty($_REQUEST ['lhs_label'])) ? $_REQUEST ['lhs_label'] : (empty($this->lhs_label) ? translate($this->lhs_module) : $this->lhs_label),
242
+        	);
243
+            $labelDefinitions [] = array(
244
+            	'module' => $this->lhs_module,
245
+            	'system_label' =>  isset($leftSysLabel) ? $leftSysLabel : 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getRightModuleSystemLabel()).'_TITLE',
246
+            	'display_label' => ($update && !empty($_REQUEST ['rhs_label'])) ? $_REQUEST ['rhs_label'] : (empty($this->rhs_label) ? translate($this->rhs_module) : $this->rhs_label),
247
+            );
248 248
         }
249
-        return $labelDefinitions ;
249
+        return $labelDefinitions;
250 250
     }
251 251
 
252 252
 	function getLeftModuleSystemLabel()
253 253
     {
254
-		if($this->lhs_module == $this->rhs_module){
254
+		if ($this->lhs_module == $this->rhs_module) {
255 255
 			return $this->lhs_module.'_L';
256 256
 		}
257 257
 		return $this->lhs_module;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
     function getRightModuleSystemLabel()
261 261
     {
262
-		if($this->lhs_module == $this->rhs_module){
262
+		if ($this->lhs_module == $this->rhs_module) {
263 263
 			return $this->rhs_module.'_R';
264 264
 		}
265 265
 		return $this->rhs_module;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     public function getLabels() {
273 273
         $labels = array();
274 274
         $labelDefinitions = $this->buildLabels();
275
-        foreach($labelDefinitions as $def){
275
+        foreach ($labelDefinitions as $def) {
276 276
             $labels[$def['module']][$def['system_label']] = $def['display_label'];
277 277
         }
278 278
 
@@ -295,29 +295,29 @@  discard block
 block discarded – undo
295 295
      * @param string $subpanelName      Name of the subpanel provided by the sourceModule
296 296
      * @param string $titleKeyName      Name of the subpanel title , if none, we will use the module name as the subpanel title.
297 297
      */
298
-    protected function getSubpanelDefinition ($relationshipName , $sourceModule , $subpanelName, $titleKeyName = '', $source = "")
298
+    protected function getSubpanelDefinition($relationshipName, $sourceModule, $subpanelName, $titleKeyName = '', $source = "")
299 299
     {
300 300
         if (empty($source)) 
301 301
         	$source = $this->getValidDBName($relationshipName);
302
-    	$subpanelDefinition = array ( ) ;
303
-        $subpanelDefinition [ 'order' ] = 100 ;
304
-        $subpanelDefinition [ 'module' ] = $sourceModule ;
305
-        $subpanelDefinition [ 'subpanel_name' ] = $subpanelName ;
302
+    	$subpanelDefinition = array( );
303
+        $subpanelDefinition ['order'] = 100;
304
+        $subpanelDefinition ['module'] = $sourceModule;
305
+        $subpanelDefinition ['subpanel_name'] = $subpanelName;
306 306
         // following two lines are required for the subpanel pagination code in ListView.php->processUnionBeans() to correctly determine the relevant field for sorting
307
-        $subpanelDefinition [ 'sort_order' ] = 'asc' ;
308
-        $subpanelDefinition [ 'sort_by' ] = 'id' ;
309
-		if(!empty($titleKeyName)){
310
-			$subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $titleKeyName ) . '_TITLE' ;
311
-		}else{
312
-			$subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ;
307
+        $subpanelDefinition ['sort_order'] = 'asc';
308
+        $subpanelDefinition ['sort_by'] = 'id';
309
+		if (!empty($titleKeyName)) {
310
+			$subpanelDefinition ['title_key'] = 'LBL_'.strtoupper($relationshipName.'_FROM_'.$titleKeyName).'_TITLE';
311
+		} else {
312
+			$subpanelDefinition ['title_key'] = 'LBL_'.strtoupper($relationshipName.'_FROM_'.$sourceModule).'_TITLE';
313 313
 		}
314
-        $subpanelDefinition [ 'get_subpanel_data' ] = $source ;
315
-        $subpanelDefinition [ 'top_buttons' ] = array(
314
+        $subpanelDefinition ['get_subpanel_data'] = $source;
315
+        $subpanelDefinition ['top_buttons'] = array(
316 316
 		    array('widget_class' => "SubPanelTopButtonQuickCreate"),
317 317
 		    array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect')
318 318
 		);
319 319
         
320
-        return array ( $subpanelDefinition );
320
+        return array($subpanelDefinition);
321 321
     }
322 322
 
323 323
     
@@ -328,24 +328,24 @@  discard block
 block discarded – undo
328 328
      * @param string $sourceModule      Name of the source module for this field
329 329
      * @param string $relationshipName  Name of the relationship
330 330
      */
331
-    protected function getLinkFieldDefinition ($sourceModule , $relationshipName, $right_side = false, $vname = "", $id_name = false)
331
+    protected function getLinkFieldDefinition($sourceModule, $relationshipName, $right_side = false, $vname = "", $id_name = false)
332 332
     {
333
-        $vardef = array ( ) ;
334
-
335
-        $vardef [ 'name' ] = $this->getValidDBName($relationshipName) ;
336
-        $vardef [ 'type' ] = 'link' ;
337
-        $vardef [ 'relationship' ] = $relationshipName ;
338
-        $vardef [ 'source' ] = 'non-db' ;
339
-        $vardef [ 'module' ] = $sourceModule ;
340
-        $vardef [ 'bean_name' ] = BeanFactory::getObjectName($sourceModule) ;
333
+        $vardef = array( );
334
+
335
+        $vardef ['name'] = $this->getValidDBName($relationshipName);
336
+        $vardef ['type'] = 'link';
337
+        $vardef ['relationship'] = $relationshipName;
338
+        $vardef ['source'] = 'non-db';
339
+        $vardef ['module'] = $sourceModule;
340
+        $vardef ['bean_name'] = BeanFactory::getObjectName($sourceModule);
341 341
         if ($right_side)
342
-        	$vardef [ 'side' ] = 'right' ;
342
+        	$vardef ['side'] = 'right';
343 343
         if (!empty($vname))
344
-            $vardef [ 'vname' ] = $vname;
344
+            $vardef ['vname'] = $vname;
345 345
         if (!empty($id_name))
346 346
             $vardef['id_name'] = $id_name;
347 347
 
348
-        return $vardef ;
348
+        return $vardef;
349 349
     }
350 350
 
351 351
     /*
@@ -356,23 +356,23 @@  discard block
 block discarded – undo
356 356
      * @param string $sourceModule      Name of the source module for this field
357 357
      * @param string $relationshipName  Name of the relationship
358 358
      */
359
-    protected function getLink2FieldDefinition ($sourceModule , $relationshipName, $right_side = false,  $vname = "")
359
+    protected function getLink2FieldDefinition($sourceModule, $relationshipName, $right_side = false, $vname = "")
360 360
     {
361
-        $vardef = array ( ) ;
361
+        $vardef = array( );
362 362
 
363
-        $vardef [ 'name' ] = $this->getIDName( $sourceModule ) ; // must match the id_name field value in the relate field definition
364
-        $vardef [ 'type' ] = 'link' ;
365
-        $vardef [ 'relationship' ] = $relationshipName ;
366
-        $vardef [ 'source' ] = 'non-db' ;
363
+        $vardef ['name'] = $this->getIDName($sourceModule); // must match the id_name field value in the relate field definition
364
+        $vardef ['type'] = 'link';
365
+        $vardef ['relationship'] = $relationshipName;
366
+        $vardef ['source'] = 'non-db';
367 367
 		$vardef ['reportable'] = false;
368 368
         if ($right_side)
369
-        	$vardef [ 'side' ] = 'right' ;
369
+        	$vardef ['side'] = 'right';
370 370
         else
371
-        	$vardef [ 'side' ] = 'left' ;
371
+        	$vardef ['side'] = 'left';
372 372
         if (!empty($vname))
373
-            $vardef [ 'vname' ] = $vname;
373
+            $vardef ['vname'] = $vname;
374 374
 
375
-        return $vardef ;
375
+        return $vardef;
376 376
     }
377 377
 
378 378
     /*
@@ -382,78 +382,78 @@  discard block
 block discarded – undo
382 382
      * @param string $relationshipName  Name of the relationship
383 383
      * @param string $moduleType        Optional - "Types" of the module - array of SugarObject types such as "file" or "basic"
384 384
      */
385
-    protected function getRelateFieldDefinition ($sourceModule , $relationshipName , $vnameLabel='')
385
+    protected function getRelateFieldDefinition($sourceModule, $relationshipName, $vnameLabel = '')
386 386
     {
387
-        $vardef = array ( ) ;
388
-        $vardef [ 'name' ] = $this->getValidDBName($relationshipName . "_name") ; // must end in _name for the QuickSearch code in TemplateHandler->createQuickSearchCode
389
-        $vardef [ 'type' ] = 'relate' ;
390
-
391
-        $vardef [ 'source' ] = 'non-db' ;
392
-		if(!empty($vnameLabel)){
393
-			$vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $vnameLabel ) . '_TITLE' ;
394
-		}else{
395
-			$vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ;
387
+        $vardef = array( );
388
+        $vardef ['name'] = $this->getValidDBName($relationshipName."_name"); // must end in _name for the QuickSearch code in TemplateHandler->createQuickSearchCode
389
+        $vardef ['type'] = 'relate';
390
+
391
+        $vardef ['source'] = 'non-db';
392
+		if (!empty($vnameLabel)) {
393
+			$vardef ['vname'] = 'LBL_'.strtoupper($relationshipName.'_FROM_'.$vnameLabel).'_TITLE';
394
+		} else {
395
+			$vardef ['vname'] = 'LBL_'.strtoupper($relationshipName.'_FROM_'.$sourceModule).'_TITLE';
396 396
 		}
397 397
         
398
-        $vardef [ 'save' ] = true; // the magic value to tell SugarBean to save this relate field even though it is not listed in the $relationship_fields array
398
+        $vardef ['save'] = true; // the magic value to tell SugarBean to save this relate field even though it is not listed in the $relationship_fields array
399 399
        
400 400
         // id_name matches the join_key_ column in the relationship table for the sourceModule - that is, the column in the relationship table containing the id of the corresponding field in the source module's table (vardef['table'])
401
-        $vardef [ 'id_name' ] = $this->getIDName( $sourceModule ) ;
401
+        $vardef ['id_name'] = $this->getIDName($sourceModule);
402 402
         
403 403
         // link cannot match id_name otherwise the $bean->$id_name value set from the POST is overwritten by the Link object created by this 'link' entry
404
-        $vardef [ 'link' ] = $this->getValidDBName($relationshipName) ; // the name of the link field that points to the relationship - required for the save to function
405
-        $vardef [ 'table' ] = $this->getTablename( $sourceModule ) ;
406
-        $vardef [ 'module' ] = $sourceModule ;
404
+        $vardef ['link'] = $this->getValidDBName($relationshipName); // the name of the link field that points to the relationship - required for the save to function
405
+        $vardef ['table'] = $this->getTablename($sourceModule);
406
+        $vardef ['module'] = $sourceModule;
407 407
         
408
-        require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationships.php' ;
409
-        $parsedModuleName = AbstractRelationships::parseDeployedModuleName( $sourceModule ) ;
408
+        require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationships.php';
409
+        $parsedModuleName = AbstractRelationships::parseDeployedModuleName($sourceModule);
410 410
 
411 411
         // now determine the appropriate 'rname' field for this relate
412 412
         // the 'rname' points to the field in source module that contains the displayable name for the record
413 413
         // usually this is 'name' but sometimes it is not...
414 414
         
415
-        $vardef [ 'rname' ] = 'name' ;
416
-        if ( isset( $parsedModuleName['packageName'] ) )
415
+        $vardef ['rname'] = 'name';
416
+        if (isset($parsedModuleName['packageName']))
417 417
         {
418
-            require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php' ;
419
-            $mb = new ModuleBuilder ( ) ;
420
-            $module = $mb->getPackageModule ( $parsedModuleName['packageName'] , $parsedModuleName['moduleName'] ) ;
421
-            if (in_array( 'file' , array_keys ( $module->config [ 'templates' ] ) ) ){
422
-                $vardef [ 'rname' ] = 'document_name' ;
423
-            }elseif(in_array ( 'person' , array_keys ( $module->config [ 'templates' ] ) ) ){
424
-            	$vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ;
418
+            require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
419
+            $mb = new ModuleBuilder( );
420
+            $module = $mb->getPackageModule($parsedModuleName['packageName'], $parsedModuleName['moduleName']);
421
+            if (in_array('file', array_keys($module->config ['templates']))) {
422
+                $vardef ['rname'] = 'document_name';
423
+            }elseif (in_array('person', array_keys($module->config ['templates']))) {
424
+            	$vardef ['db_concat_fields'] = array(0 =>'first_name', 1 =>'last_name');
425 425
             }
426 426
         }
427 427
         else
428 428
         {
429
-            switch ( strtolower( $sourceModule ) )
429
+            switch (strtolower($sourceModule))
430 430
             {
431 431
                 case 'prospects' :
432
-                    $vardef [ 'rname' ] = 'account_name' ;
433
-                    break ;
432
+                    $vardef ['rname'] = 'account_name';
433
+                    break;
434 434
                 case 'documents' :
435
-                    $vardef [ 'rname' ] = 'document_name' ;
436
-                    break ;
435
+                    $vardef ['rname'] = 'document_name';
436
+                    break;
437 437
                 case 'kbdocuments' :
438
-                    $vardef [ 'rname' ] = 'kbdocument_name' ;
439
-                    break ;
438
+                    $vardef ['rname'] = 'kbdocument_name';
439
+                    break;
440 440
                 case 'leads' :
441 441
                 case 'contacts' : 
442 442
                     // special handling as these modules lack a name column in the database; instead 'name' refers to a non-db field that concatenates first_name and last_name
443 443
                     // luckily, the relate field mechanism can handle this with an equivalent additional db_concat_fields entry
444
-                    $vardef [ 'rname' ] = 'name' ;
445
-                    $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ;
446
-                    break ;
444
+                    $vardef ['rname'] = 'name';
445
+                    $vardef ['db_concat_fields'] = array(0 =>'first_name', 1 =>'last_name');
446
+                    break;
447 447
                 default :
448 448
                     // now see if we have any module inheriting from the 'file' template - records in file-type modules are named by the document_name field, not the usual 'name' field
449
-                    $object = $GLOBALS ['beanList'] [ $sourceModule ];
450
-                    require_once ( $GLOBALS ['beanFiles'] [ $object ] );
449
+                    $object = $GLOBALS ['beanList'] [$sourceModule];
450
+                    require_once ($GLOBALS ['beanFiles'] [$object]);
451 451
                     $bean = new $object();
452
-                    if ( isset ( $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){
453
-                    	if(in_array ( 'file' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){
454
-                    		$vardef [ 'rname' ] = 'document_name' ;
455
-                    	}elseif(in_array ( 'person' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){
456
-                    		 $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ;
452
+                    if (isset ($GLOBALS ['dictionary'] [$object] ['templates'])) {
453
+                    	if (in_array('file', $GLOBALS ['dictionary'] [$object] ['templates'])) {
454
+                    		$vardef ['rname'] = 'document_name';
455
+                    	}elseif (in_array('person', $GLOBALS ['dictionary'] [$object] ['templates'])) {
456
+                    		 $vardef ['db_concat_fields'] = array(0 =>'first_name', 1 =>'last_name');
457 457
                     	}
458 458
                     }
459 459
                         
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
             
462 462
         }
463 463
             
464
-        return $vardef ;
464
+        return $vardef;
465 465
     }
466 466
 
467 467
     /*
@@ -474,111 +474,111 @@  discard block
 block discarded – undo
474 474
      * @param string $relationshipType  Cardinality of the relationship, for example, MB_ONETOONE or MB_ONETOMANY or MB_MANYTOMANY
475 475
      * @param bool $checkExisting check if a realtionship with the given name is already depolyed in this instance. If so, we will clones its table and column names to preserve existing data.
476 476
      */
477
-    function getRelationshipMetaData ($relationshipType, $checkExisting = true)
477
+    function getRelationshipMetaData($relationshipType, $checkExisting = true)
478 478
     {
479 479
         global $dictionary;
480
-        $relationshipName = $this->definition [ 'relationship_name' ] ;
481
-        $lhs_module = $this->lhs_module ;
482
-        $rhs_module = $this->rhs_module ;
480
+        $relationshipName = $this->definition ['relationship_name'];
481
+        $lhs_module = $this->lhs_module;
482
+        $rhs_module = $this->rhs_module;
483 483
         
484
-        $lhs_table = $this->getTablename ( $lhs_module ) ;
485
-        $rhs_table = $this->getTablename ( $rhs_module ) ;
484
+        $lhs_table = $this->getTablename($lhs_module);
485
+        $rhs_table = $this->getTablename($rhs_module);
486 486
         
487
-        $properties = array ( ) ;
487
+        $properties = array( );
488 488
 
489 489
         //bug 47903
490 490
         if ($checkExisting && !empty($dictionary[$relationshipName])
491
-            && !empty($dictionary[$relationshipName][ 'true_relationship_type' ])
492
-            && $dictionary[$relationshipName][ 'true_relationship_type' ]  == $relationshipType
491
+            && !empty($dictionary[$relationshipName]['true_relationship_type'])
492
+            && $dictionary[$relationshipName]['true_relationship_type'] == $relationshipType
493 493
             && !empty($dictionary[$relationshipName]['relationships'][$relationshipName]))
494 494
         {
495 495
             //bug 51336
496
-            $properties [ 'true_relationship_type' ] = $relationshipType ;
496
+            $properties ['true_relationship_type'] = $relationshipType;
497 497
             $rel_properties = $dictionary[$relationshipName]['relationships'][$relationshipName];
498 498
         } else
499 499
         {
500 500
             // first define section 1, the relationship element of the metadata entry
501 501
 
502
-            $rel_properties = array ( ) ;
503
-            $rel_properties [ 'lhs_module' ] = $lhs_module ;
504
-            $rel_properties [ 'lhs_table' ] = $lhs_table ;
505
-            $rel_properties [ 'lhs_key' ] = 'id' ;
506
-            $rel_properties [ 'rhs_module' ] = $rhs_module ;
507
-            $rel_properties [ 'rhs_table' ] = $rhs_table ;
508
-            $rel_properties [ 'rhs_key' ] = 'id' ;
502
+            $rel_properties = array( );
503
+            $rel_properties ['lhs_module'] = $lhs_module;
504
+            $rel_properties ['lhs_table'] = $lhs_table;
505
+            $rel_properties ['lhs_key'] = 'id';
506
+            $rel_properties ['rhs_module'] = $rhs_module;
507
+            $rel_properties ['rhs_table'] = $rhs_table;
508
+            $rel_properties ['rhs_key'] = 'id';
509 509
 
510 510
             // because the implementation of one-to-many relationships within SugarBean does not use a join table and so requires schema changes to add a foreign key for each new relationship,
511 511
             // we currently implement all new relationships as many-to-many regardless of the real type and enforce cardinality through the relate fields and subpanels
512
-            $rel_properties [ 'relationship_type' ] = MB_MANYTOMANY ;
512
+            $rel_properties ['relationship_type'] = MB_MANYTOMANY;
513 513
             // but as we need to display the true cardinality in Studio and ModuleBuilder we also record the actual relationship type
514 514
             // this property is only used by Studio/MB
515
-            $properties [ 'true_relationship_type' ] = $relationshipType ;
515
+            $properties ['true_relationship_type'] = $relationshipType;
516 516
             if ($this->from_studio)
517
-                $properties [ 'from_studio' ] = true;
517
+                $properties ['from_studio'] = true;
518 518
 
519
-            $rel_properties [ 'join_table' ] = $this->getValidDBName ( $relationshipName."_c" ) ;
519
+            $rel_properties ['join_table'] = $this->getValidDBName($relationshipName."_c");
520 520
             // a and b are in case the module relates to itself
521
-            $rel_properties [ 'join_key_lhs' ] = $this->getJoinKeyLHS() ;
522
-            $rel_properties [ 'join_key_rhs' ] = $this->getJoinKeyRHS() ;
521
+            $rel_properties ['join_key_lhs'] = $this->getJoinKeyLHS();
522
+            $rel_properties ['join_key_rhs'] = $this->getJoinKeyRHS();
523 523
         }
524 524
         
525 525
         // set the extended properties if they exist = for now, many-to-many definitions do not have to contain a role_column even if role_column_value is set; we'll just create a likely name if missing
526
-        if (isset ( $this->definition [ 'relationship_role_column_value' ] ))
526
+        if (isset ($this->definition ['relationship_role_column_value']))
527 527
         {
528
-            if (! isset ( $this->definition [ 'relationship_role_column' ] ))
529
-                $this->definition [ 'relationship_role_column' ] = 'relationship_role_column' ;
530
-            $rel_properties [ 'relationship_role_column' ] = $this->definition [ 'relationship_role_column' ] ;
531
-            $rel_properties [ 'relationship_role_column_value' ] = $this->definition [ 'relationship_role_column_value' ] ;
528
+            if (!isset ($this->definition ['relationship_role_column']))
529
+                $this->definition ['relationship_role_column'] = 'relationship_role_column';
530
+            $rel_properties ['relationship_role_column'] = $this->definition ['relationship_role_column'];
531
+            $rel_properties ['relationship_role_column_value'] = $this->definition ['relationship_role_column_value'];
532 532
         }
533 533
         
534
-        $properties [ 'relationships' ] [ $relationshipName ] = $rel_properties ;
534
+        $properties ['relationships'] [$relationshipName] = $rel_properties;
535 535
         
536 536
         // construct section 2, the name of the join table
537 537
         
538
-        $properties [ 'table' ] = $rel_properties [ 'join_table' ] ;
538
+        $properties ['table'] = $rel_properties ['join_table'];
539 539
         
540 540
         // now construct section 3, the fields in the join table
541 541
         
542
-        $properties [ 'fields' ] [] = array ( 'name' => 'id' , 'type' => 'varchar' , 'len' => 36 ) ;
543
-        $properties [ 'fields' ] [] = array ( 'name' => 'date_modified' , 'type' => 'datetime' ) ;
544
-        $properties [ 'fields' ] [] = array ( 'name' => 'deleted' , 'type' => 'bool' , 'len' => '1' , 'default' => '0' , 'required' => true ) ;
545
-        $properties [ 'fields' ] [] = array ( 'name' => $rel_properties [ 'join_key_lhs' ] , 'type' => 'varchar' , 'len' => 36 ) ;
546
-        $properties [ 'fields' ] [] = array ( 'name' => $rel_properties [ 'join_key_rhs' ] , 'type' => 'varchar' , 'len' => 36 ) ;
547
-        if (strtolower ( $lhs_module ) == 'documents' || strtolower ( $rhs_module ) == 'documents' )
542
+        $properties ['fields'] [] = array('name' => 'id', 'type' => 'varchar', 'len' => 36);
543
+        $properties ['fields'] [] = array('name' => 'date_modified', 'type' => 'datetime');
544
+        $properties ['fields'] [] = array('name' => 'deleted', 'type' => 'bool', 'len' => '1', 'default' => '0', 'required' => true);
545
+        $properties ['fields'] [] = array('name' => $rel_properties ['join_key_lhs'], 'type' => 'varchar', 'len' => 36);
546
+        $properties ['fields'] [] = array('name' => $rel_properties ['join_key_rhs'], 'type' => 'varchar', 'len' => 36);
547
+        if (strtolower($lhs_module) == 'documents' || strtolower($rhs_module) == 'documents')
548 548
         {
549
-            $properties [ 'fields' ] [] = array ( 'name' => 'document_revision_id' , 'type' => 'varchar' , 'len' => '36' ) ;
549
+            $properties ['fields'] [] = array('name' => 'document_revision_id', 'type' => 'varchar', 'len' => '36');
550 550
         }
551 551
         // if we have an extended relationship condition, then add in the corresponding relationship_role_column to the relationship (join) table
552 552
         // for now this is restricted to extended relationships that can be specified by a varchar
553
-        if (isset ( $this->definition [ 'relationship_role_column_value' ] ))
553
+        if (isset ($this->definition ['relationship_role_column_value']))
554 554
         {
555
-            $properties [ 'fields' ] [] = array ( 'name' => $this->definition [ 'relationship_role_column' ] , 'type' => 'varchar' ) ;
555
+            $properties ['fields'] [] = array('name' => $this->definition ['relationship_role_column'], 'type' => 'varchar');
556 556
         }
557 557
         
558 558
         // finally, wrap up with section 4, the indices on the join table
559 559
         
560
-        $indexBase = $this->getValidDBName ( $relationshipName ) ;
561
-        $properties [ 'indices' ] [] = array ( 'name' => $indexBase . 'spk' , 'type' => 'primary' , 'fields' => array ( 'id' ) ) ;
560
+        $indexBase = $this->getValidDBName($relationshipName);
561
+        $properties ['indices'] [] = array('name' => $indexBase.'spk', 'type' => 'primary', 'fields' => array('id'));
562 562
 
563 563
         switch ($relationshipType)
564 564
         {
565 565
             case MB_ONETOONE:
566
-                $alternateKeys = array () ;
567
-                $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_ida1' , 'type' => 'index' , 'fields' => array ( $rel_properties [ 'join_key_lhs' ] ) ) ;
568
-                $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_idb2' , 'type' => 'index' , 'fields' => array ( $rel_properties [ 'join_key_rhs' ] ) ) ;
566
+                $alternateKeys = array();
567
+                $properties ['indices'] [] = array('name' => $indexBase.'_ida1', 'type' => 'index', 'fields' => array($rel_properties ['join_key_lhs']));
568
+                $properties ['indices'] [] = array('name' => $indexBase.'_idb2', 'type' => 'index', 'fields' => array($rel_properties ['join_key_rhs']));
569 569
                 break;
570 570
             case MB_ONETOMANY :
571
-                $alternateKeys = array ( $rel_properties [ 'join_key_rhs' ] ) ;
572
-                $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_ida1' , 'type' => 'index' , 'fields' => array ( $rel_properties [ 'join_key_lhs' ] ) ) ;
571
+                $alternateKeys = array($rel_properties ['join_key_rhs']);
572
+                $properties ['indices'] [] = array('name' => $indexBase.'_ida1', 'type' => 'index', 'fields' => array($rel_properties ['join_key_lhs']));
573 573
                 break;
574 574
             default:
575
-                $alternateKeys = array ( $rel_properties [ 'join_key_lhs' ] , $rel_properties [ 'join_key_rhs' ] ) ;
575
+                $alternateKeys = array($rel_properties ['join_key_lhs'], $rel_properties ['join_key_rhs']);
576 576
         }
577 577
         
578
-        if (count($alternateKeys)>0)
579
-            $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_alt' , 'type' => 'alternate_key' , 'fields' => $alternateKeys ) ; // type must be set to alternate_key for Link.php to correctly update an existing record rather than inserting a copy - it uses the fields in this array as the keys to check if a duplicate record already exists
578
+        if (count($alternateKeys) > 0)
579
+            $properties ['indices'] [] = array('name' => $indexBase.'_alt', 'type' => 'alternate_key', 'fields' => $alternateKeys); // type must be set to alternate_key for Link.php to correctly update an existing record rather than inserting a copy - it uses the fields in this array as the keys to check if a duplicate record already exists
580 580
         
581
-        return $properties ;
581
+        return $properties;
582 582
     }
583 583
     
584 584
     
@@ -591,9 +591,9 @@  discard block
 block discarded – undo
591 591
      * Used primarily in UndeployedRelationships to ensure that the subpanels we construct for Activities get their data from the correct relationships
592 592
      * @param string $activitiesSubModuleName Name of the activities submodule, such as Tasks
593 593
      */
594
-    function getActivitiesSubModuleRelationshipName ( $activitiesSubModuleName )
594
+    function getActivitiesSubModuleRelationshipName($activitiesSubModuleName)
595 595
     {
596
-        return $this->lhs_module . "_" . strtolower ( $activitiesSubModuleName ) ;
596
+        return $this->lhs_module."_".strtolower($activitiesSubModuleName);
597 597
     }
598 598
 
599 599
     /*
@@ -604,10 +604,10 @@  discard block
 block discarded – undo
604 604
      * @param string $ensureUnique 
605 605
      * @return string Valid column name trimmed to right length and with invalid characters removed
606 606
      */
607
-    static function getValidDBName ($name, $ensureUnique = true)
607
+    static function getValidDBName($name, $ensureUnique = true)
608 608
     {
609 609
 
610
-        require_once 'modules/ModuleBuilder/parsers/constants.php' ;
610
+        require_once 'modules/ModuleBuilder/parsers/constants.php';
611 611
         return getValidDBName($name, $ensureUnique, MB_MAXDBIDENTIFIERLENGTH);
612 612
     }
613 613
 
@@ -616,25 +616,25 @@  discard block
 block discarded – undo
616 616
      * @param string $type Relationship type
617 617
      * @return string Canonical type
618 618
      */
619
-    static function parseRelationshipType ($type)
619
+    static function parseRelationshipType($type)
620 620
     {
621
-        $type = strtolower ( $type ) ;
622
-        $type = preg_replace ( '/[^\w]+/i', '', strtolower ( $type ) ) ;
623
-        $canonicalTypes = array ( ) ;
624
-        foreach ( array ( MB_ONETOONE , MB_ONETOMANY , MB_MANYTOMANY , MB_MANYTOONE) as $canonicalType )
621
+        $type = strtolower($type);
622
+        $type = preg_replace('/[^\w]+/i', '', strtolower($type));
623
+        $canonicalTypes = array( );
624
+        foreach (array(MB_ONETOONE, MB_ONETOMANY, MB_MANYTOMANY, MB_MANYTOONE) as $canonicalType)
625 625
         {
626
-            if ($type == preg_replace ( '/[^\w]+/i', '', strtolower ( $canonicalType ) ))
627
-                return $canonicalType ;
626
+            if ($type == preg_replace('/[^\w]+/i', '', strtolower($canonicalType)))
627
+                return $canonicalType;
628 628
         }
629 629
         // ok, we give up...
630
-        return MB_MANYTOMANY ;
630
+        return MB_MANYTOMANY;
631 631
     }
632 632
 
633 633
     
634 634
     function getJoinKeyLHS()
635 635
     {
636 636
         if (!isset($this->joinKeyLHS))
637
-        	$this->joinKeyLHS = $this->getValidDBName ( $this->relationship_name . $this->lhs_module . "_ida"  , true) ;
637
+        	$this->joinKeyLHS = $this->getValidDBName($this->relationship_name.$this->lhs_module."_ida", true);
638 638
         
639 639
         return $this->joinKeyLHS;
640 640
     }
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
     function getJoinKeyRHS()
643 643
     {
644 644
         if (!isset($this->joinKeyRHS))
645
-        	$this->joinKeyRHS = $this->getValidDBName ( $this->relationship_name . $this->rhs_module . "_idb"  , true) ;
645
+        	$this->joinKeyRHS = $this->getValidDBName($this->relationship_name.$this->rhs_module."_idb", true);
646 646
     	
647 647
         return $this->joinKeyRHS;
648 648
     }
@@ -652,9 +652,9 @@  discard block
 block discarded – undo
652 652
      * @param string $sourceModule  The name of the primary module in the relationship
653 653
      * @return string Name of the id field
654 654
      */
655
-    function getIDName( $sourceModule )
655
+    function getIDName($sourceModule)
656 656
     {
657
-        return ($sourceModule == $this->lhs_module ) ? $this->getJoinKeyLHS() : $this->getJoinKeyRHS() ;
657
+        return ($sourceModule == $this->lhs_module) ? $this->getJoinKeyLHS() : $this->getJoinKeyRHS();
658 658
     }
659 659
     
660 660
     /*
@@ -662,42 +662,42 @@  discard block
 block discarded – undo
662 662
      * @param string $moduleName    Name of the module for which we are to find the table
663 663
      * @return string Tablename
664 664
      */
665
-    protected function getTablename ($moduleName)
665
+    protected function getTablename($moduleName)
666 666
     {
667 667
         // Check the moduleName exists in the beanList before calling get_module_info - Activities is the main culprit here
668
-        if (isset ( $GLOBALS [ 'beanList' ] [ $moduleName ] ))
668
+        if (isset ($GLOBALS ['beanList'] [$moduleName]))
669 669
         {
670
-            $module = get_module_info ( $moduleName ) ;
671
-            return $module->table_name ;
670
+            $module = get_module_info($moduleName);
671
+            return $module->table_name;
672 672
         }
673
-        return strtolower ( $moduleName ) ;
673
+        return strtolower($moduleName);
674 674
     }
675 675
 
676
-    public function getTitleKey($left=false){
677
-		if(!$this->is_custom && !$left && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")){
676
+    public function getTitleKey($left = false) {
677
+		if (!$this->is_custom && !$left && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")) {
678 678
     		include("modules/{$this->rhs_module}/metadata/subpaneldefs.php");
679
-    		if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){
679
+    		if (isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])) {
680 680
     			return $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'];
681 681
     		}
682
-    	}else if(!$this->is_custom &&  file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){
682
+    	} else if (!$this->is_custom && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")) {
683 683
     		include("modules/{$this->lhs_module}/metadata/subpaneldefs.php");
684
-    		if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){
684
+    		if (isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])) {
685 685
     			return $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'];
686 686
     		}
687 687
     	}
688 688
     	
689
-    	if($left){
689
+    	if ($left) {
690 690
     		$titleKeyName = $this->getRightModuleSystemLabel();
691 691
     		$sourceModule = $this->rhs_module;
692
-    	}else{
692
+    	} else {
693 693
     		$titleKeyName = $this->getLeftModuleSystemLabel();
694 694
     		$sourceModule = $this->lhs_module;
695 695
     	}
696 696
     	
697
-		if(!empty($titleKeyName)){
698
-			$title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $titleKeyName ) . '_TITLE' ;
699
-		}else{
700
-			$title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $sourceModule ) . '_TITLE' ;
697
+		if (!empty($titleKeyName)) {
698
+			$title_key = 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$titleKeyName).'_TITLE';
699
+		} else {
700
+			$title_key = 'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$sourceModule).'_TITLE';
701 701
 		}
702 702
 		
703 703
 		return $title_key;
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/relationships/ManyToManyRelationship.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
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 Many-To-Many Relationship
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
      * Constructor
58 58
      * @param array $definition Parameters passed in as array with keys defined in parent::keys
59 59
      */
60
-    function __construct ($definition)
60
+    function __construct($definition)
61 61
     {
62
-        parent::__construct ( $definition ) ;
62
+        parent::__construct($definition);
63 63
     }
64 64
   
65 65
     /*
@@ -71,37 +71,37 @@  discard block
 block discarded – undo
71 71
      * The format is that of TO_MODULE => relationship, FROM_MODULE, FROM_MODULES_SUBPANEL, mimicking the format in the layoutdefs.php
72 72
      * @return array    An array of subpanel definitions, keyed by module
73 73
      */
74
-    function buildSubpanelDefinitions ()
74
+    function buildSubpanelDefinitions()
75 75
     {        
76
-        $subpanelDefinitions = array ( ) ;
76
+        $subpanelDefinitions = array( );
77 77
         if (!$this->relationship_only)
78 78
         {
79
-            $subpanelDefinitions [ $this->rhs_module ] = $this->getSubpanelDefinition ( $this->relationship_name, $this->lhs_module, $this->lhs_subpanel, $this->getLeftModuleSystemLabel() ) ;
80
-            $subpanelDefinitions [ $this->lhs_module ] = $this->getSubpanelDefinition ( $this->relationship_name, $this->rhs_module, $this->rhs_subpanel, $this->getRightModuleSystemLabel() ) ;
79
+            $subpanelDefinitions [$this->rhs_module] = $this->getSubpanelDefinition($this->relationship_name, $this->lhs_module, $this->lhs_subpanel, $this->getLeftModuleSystemLabel());
80
+            $subpanelDefinitions [$this->lhs_module] = $this->getSubpanelDefinition($this->relationship_name, $this->rhs_module, $this->rhs_subpanel, $this->getRightModuleSystemLabel());
81 81
         }
82
-        return $subpanelDefinitions ;
82
+        return $subpanelDefinitions;
83 83
     }
84 84
 
85 85
 
86 86
     /*
87 87
      * @return array    An array of field definitions, ready for the vardefs, keyed by module
88 88
      */
89
-    function buildVardefs ( )
89
+    function buildVardefs( )
90 90
     {
91
-        $vardefs = array ( ) ;
92
-        $vardefs [ $this->rhs_module ] [] = $this->getLinkFieldDefinition ( $this->lhs_module, $this->relationship_name, false, 
93
-            'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel() ) . '_TITLE' ) ;
94
-        $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, false, 
95
-            'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel()  ) . '_TITLE' ) ;
96
-        return $vardefs ;
91
+        $vardefs = array( );
92
+        $vardefs [$this->rhs_module] [] = $this->getLinkFieldDefinition($this->lhs_module, $this->relationship_name, false, 
93
+            'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getLeftModuleSystemLabel()).'_TITLE');
94
+        $vardefs [$this->lhs_module] [] = $this->getLinkFieldDefinition($this->rhs_module, $this->relationship_name, false, 
95
+            'LBL_'.strtoupper($this->relationship_name.'_FROM_'.$this->getRightModuleSystemLabel()).'_TITLE');
96
+        return $vardefs;
97 97
     }
98 98
     
99 99
     /*
100 100
      * @return array    An array of relationship metadata definitions
101 101
      */
102
-    function buildRelationshipMetaData ()
102
+    function buildRelationshipMetaData()
103 103
     {
104
-        return array( $this->lhs_module => $this->getRelationshipMetaData ( MB_MANYTOMANY ) ) ;
104
+        return array($this->lhs_module => $this->getRelationshipMetaData(MB_MANYTOMANY));
105 105
     }
106 106
     
107 107
 
Please login to merge, or discard this patch.