Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 class ActivitiesRelationship extends OneToManyRelationship
73 73
 {
74 74
 
75
-	protected static $subpanelsAdded = array();
76
-	protected static $labelsAdded = array();
75
+    protected static $subpanelsAdded = array();
76
+    protected static $labelsAdded = array();
77 77
 
78
-	/*
78
+    /*
79 79
      * Constructor
80 80
      * @param array $definition Parameters passed in as array defined in parent::$definitionKeys
81 81
      * The lhs_module value is for the One side; the rhs_module value is for the Many
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * BUILD methods called during the build
90 90
      */
91 91
 
92
-	/*
92
+    /*
93 93
      * Define the labels to be added to the module for the new relationships
94 94
      * @return array    An array of system value => display value
95 95
      */
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     }
141 141
 
142 142
 
143
-	/*
143
+    /*
144 144
      * @return array    An array of field definitions, ready for the vardefs, keyed by module
145 145
      */
146 146
     function buildVardefs ( )
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         return $vardefs ;
155 155
     }
156 156
 
157
-	protected function getLinkFieldDefinition ($sourceModule , $relationshipName)
157
+    protected function getLinkFieldDefinition ($sourceModule , $relationshipName)
158 158
     {
159 159
         $vardef = array ( ) ;
160 160
         $vardef [ 'name' ] = $relationshipName;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         return array( $this->rhs_module => $this->relationship_name . "_name" ) ; // this must match the name of the relate field from buildVardefs
180 180
     }
181 181
 
182
- 	function buildSubpanelDefinitions ()
182
+        function buildSubpanelDefinitions ()
183 183
     {
184 184
         if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module]))
185 185
             return array () ;
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
         ActivitiesRelationship::$subpanelsAdded[$this->lhs_module] = true;
188 188
         $relationshipName = substr($this->relationship_name, 0, strrpos($this->relationship_name, '_'));
189 189
         return array( $this->lhs_module => array (
190
-        			  'activities' => $this->buildActivitiesSubpanelDefinition ( $relationshipName ),
191
-        			  'history' => $this->buildHistorySubpanelDefinition ( $relationshipName ) ,
192
-        			));
190
+                        'activities' => $this->buildActivitiesSubpanelDefinition ( $relationshipName ),
191
+                        'history' => $this->buildHistorySubpanelDefinition ( $relationshipName ) ,
192
+                    ));
193 193
     }
194 194
 
195 195
     /*
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
         $relMetadata ['relationship_role_column'] = 'parent_type';
210 210
         $relMetadata ['relationship_role_column_value'] = $this->definition [ 'lhs_module' ] ;
211 211
 
212
-    	return array( $this->lhs_module => array(
213
-    		'relationships' => array ($relationshipName => $relMetadata),
214
-    		'fields' => '', 'indices' => '', 'table' => '')
215
-    	) ;
212
+        return array( $this->lhs_module => array(
213
+            'relationships' => array ($relationshipName => $relMetadata),
214
+            'fields' => '', 'indices' => '', 'table' => '')
215
+        ) ;
216 216
     }
217 217
 
218 218
 /*
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     protected function buildActivitiesSubpanelDefinition ( $relationshipName )
223 223
     {
224
-		return array (
224
+        return array (
225 225
             'order' => 10 ,
226 226
             'sort_order' => 'desc' ,
227 227
             'sort_by' => 'date_start' ,
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             'module' => 'History' ,
266 266
             'top_buttons' => array (
267 267
                 array ( 'widget_class' => 'SubPanelTopCreateNoteButton' ) ,
268
-				array ( 'widget_class' => 'SubPanelTopArchiveEmailButton'),
268
+                array ( 'widget_class' => 'SubPanelTopArchiveEmailButton'),
269 269
                 array ( 'widget_class' => 'SubPanelTopSummaryButton' ) ) ,
270 270
                 'collection_list' => array (
271 271
                     'meetings' => array (
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/constants.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,6 +67,6 @@
 block discarded – undo
67 67
 
68 68
 class MBConstants
69 69
 {
70
-	static $EMPTY = array ( 'name' => '(empty)' , 'label' => '(empty)' ) ;
71
-	static $FILLER = array ( 'name' => '(filler)' , 'label' => 'LBL_FILLER' ) ; // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants
70
+    static $EMPTY = array ( 'name' => '(empty)' , 'label' => '(empty)' ) ;
71
+    static $FILLER = array ( 'name' => '(filler)' , 'label' => 'LBL_FILLER' ) ; // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants
72 72
 }
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/parser.dropdown.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 require_once('modules/ModuleBuilder/parsers/ModuleBuilderParser.php');
43 43
 
44
- class ParserDropDown extends ModuleBuilderParser {
44
+    class ParserDropDown extends ModuleBuilderParser {
45 45
 
46 46
     /**
47 47
      * Takes in the request params from a save request and processes
@@ -51,19 +51,19 @@  discard block
 block discarded – undo
51 51
      */
52 52
     function saveDropDown($params){
53 53
         require_once('modules/Administration/Common.php');
54
-		$emptyMarker = translate('LBL_BLANK');
55
-		$selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']);
56
-		$type = $_REQUEST['view_package'];
57
-		$dir = '';
58
-		$dropdown_name = $params['dropdown_name'];
59
-		$json = getJSONobj();
54
+        $emptyMarker = translate('LBL_BLANK');
55
+        $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']);
56
+        $type = $_REQUEST['view_package'];
57
+        $dir = '';
58
+        $dropdown_name = $params['dropdown_name'];
59
+        $json = getJSONobj();
60 60
 
61
-		$list_value = str_replace('"":""', '"__empty__":""', $params['list_value']);
62
-		//Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
63
-		$temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) );
64
-		$dropdown = array () ;
65
-		// dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order
66
-		// we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered
61
+        $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']);
62
+        //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
63
+        $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) );
64
+        $dropdown = array () ;
65
+        // dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order
66
+        // we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered
67 67
         if(is_array($temp))
68 68
         {
69 69
             foreach ( $temp as $item )
@@ -71,146 +71,146 @@  discard block
 block discarded – undo
71 71
                 $dropdown[ SugarCleaner::stripTags(from_html($item [ 0 ]), false) ] = SugarCleaner::stripTags(from_html($item [ 1 ]), false) ;
72 72
             }
73 73
         }
74
-		if(array_key_exists($emptyMarker, $dropdown)){
74
+        if(array_key_exists($emptyMarker, $dropdown)){
75 75
             $output=array();
76 76
             foreach($dropdown as $key => $value){
77 77
                 if($emptyMarker===$key)
78 78
                     $output['']='';
79 79
                 else
80 80
                     $output[$key]=$value;
81
-		}
81
+        }
82 82
             $dropdown=$output;
83
-		}
83
+        }
84 84
 
85
-		if($type != 'studio'){
86
-			$mb = new ModuleBuilder();
87
-			$module = $mb->getPackageModule($params['view_package'], $params['view_module']);
88
-			$this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
89
-			//Can't use synch on selected lang as we want to overwrite values, not just keys
90
-			$module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown;
91
-			$module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of
92
-		}else{
93
-			$contents = return_custom_app_list_strings_file_contents($selected_lang);
94
-			$my_list_strings = return_app_list_strings_language($selected_lang);
95
-			if($selected_lang == $GLOBALS['current_language']){
96
-	           $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
97
-	        }
98
-			//write to contents
99
-			$contents = str_replace("?>", '', $contents);
100
-			if(empty($contents))$contents = "<?php";
101
-	        //add new drop down to the bottom
102
-	        if(!empty($params['use_push'])){
103
-	        	//this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
104
-	        	foreach($dropdown as $key=>$value){
105
-	        		//only if the value has changed or does not exist do we want to add it this way
106
-	        		if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){
107
-		        		//clear out the old value
108
-		        		$pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism';
109
-		        		$contents = preg_replace($pattern_match, "\n", $contents);
110
-		        		//add the new ones
111
-		        		$contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";";
112
-	        		}
113
-	        	}
114
-	        }else{
115
-	        	//Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
116
-	        	$this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
117
-	        	$contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
118
-	        }
119
-		    if(!empty($dir) && !is_dir($dir))
120
-		    {
121
-		     	$continue = mkdir_recursive($dir);
122
-		    }
123
-			save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
124
-		}
125
-		sugar_cache_reset();
126
-		clearAllJsAndJsLangFilesWithoutOutput();
85
+        if($type != 'studio'){
86
+            $mb = new ModuleBuilder();
87
+            $module = $mb->getPackageModule($params['view_package'], $params['view_module']);
88
+            $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
89
+            //Can't use synch on selected lang as we want to overwrite values, not just keys
90
+            $module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown;
91
+            $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of
92
+        }else{
93
+            $contents = return_custom_app_list_strings_file_contents($selected_lang);
94
+            $my_list_strings = return_app_list_strings_language($selected_lang);
95
+            if($selected_lang == $GLOBALS['current_language']){
96
+                $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
97
+            }
98
+            //write to contents
99
+            $contents = str_replace("?>", '', $contents);
100
+            if(empty($contents))$contents = "<?php";
101
+            //add new drop down to the bottom
102
+            if(!empty($params['use_push'])){
103
+                //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
104
+                foreach($dropdown as $key=>$value){
105
+                    //only if the value has changed or does not exist do we want to add it this way
106
+                    if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){
107
+                        //clear out the old value
108
+                        $pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism';
109
+                        $contents = preg_replace($pattern_match, "\n", $contents);
110
+                        //add the new ones
111
+                        $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";";
112
+                    }
113
+                }
114
+            }else{
115
+                //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
116
+                $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
117
+                $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
118
+            }
119
+            if(!empty($dir) && !is_dir($dir))
120
+            {
121
+                    $continue = mkdir_recursive($dir);
122
+            }
123
+            save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
124
+        }
125
+        sugar_cache_reset();
126
+        clearAllJsAndJsLangFilesWithoutOutput();
127 127
     }
128 128
 
129 129
     /**
130
-	 * function synchDropDown
131
-	 * 	Ensures that the set of dropdown keys is consistant accross all languages.
132
-	 *
133
-	 * @param $dropdown_name The name of the dropdown to be synched
134
-	 * @param $dropdown array The dropdown currently being saved
135
-	 * @param $selected_lang String the language currently selected in Studio/MB
136
-	 * @param $saveLov String the path to the directory to save the new lang file in.
137
-	 */
130
+     * function synchDropDown
131
+     * 	Ensures that the set of dropdown keys is consistant accross all languages.
132
+     *
133
+     * @param $dropdown_name The name of the dropdown to be synched
134
+     * @param $dropdown array The dropdown currently being saved
135
+     * @param $selected_lang String the language currently selected in Studio/MB
136
+     * @param $saveLov String the path to the directory to save the new lang file in.
137
+     */
138 138
     function synchDropDown($dropdown_name, $dropdown, $selected_lang, $saveLoc) {
139
-   		$allLanguages =  get_languages();
139
+            $allLanguages =  get_languages();
140 140
         foreach ($allLanguages as $lang => $langName) {
141
-        	if ($lang != $selected_lang) {
142
-        		$listStrings = return_app_list_strings_language($lang);
143
-        		$langDropDown = array();
144
-        		if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
145
-        		{
146
-        		 	$langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
147
-        		} else
148
-        		{
149
-        			//if the dropdown does not exist in the language, justt use what we have.
150
-        			$langDropDown = $dropdown;
151
-        		}
152
-        		$contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang);
153
-        		save_custom_app_list_strings_contents($contents, $lang, $saveLoc);
154
-        	}
141
+            if ($lang != $selected_lang) {
142
+                $listStrings = return_app_list_strings_language($lang);
143
+                $langDropDown = array();
144
+                if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
145
+                {
146
+                        $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
147
+                } else
148
+                {
149
+                    //if the dropdown does not exist in the language, justt use what we have.
150
+                    $langDropDown = $dropdown;
151
+                }
152
+                $contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang);
153
+                save_custom_app_list_strings_contents($contents, $lang, $saveLoc);
154
+            }
155 155
         }
156 156
     }
157 157
 
158 158
     /**
159
-	 * function synchMBDropDown
160
-	 * 	Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module
161
-	 *
162
-	 * @param $dropdown_name The name of the dropdown to be synched
163
-	 * @param $dropdown array The dropdown currently being saved
164
-	 * @param $selected_lang String the language currently selected in Studio/MB
165
-	 * @param $module MBModule the module to update the languages in
166
-	 */
159
+     * function synchMBDropDown
160
+     * 	Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module
161
+     *
162
+     * @param $dropdown_name The name of the dropdown to be synched
163
+     * @param $dropdown array The dropdown currently being saved
164
+     * @param $selected_lang String the language currently selected in Studio/MB
165
+     * @param $module MBModule the module to update the languages in
166
+     */
167 167
     function synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module) {
168
-    	$selected_lang	= $selected_lang . '.lang.php';
169
-		foreach($module->mblanguage->appListStrings as $lang => $listStrings) {
170
-			if ($lang != $selected_lang)
171
-			{
172
-				$langDropDown = array();
173
-				if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
174
-				{
175
-					$langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
176
-				} else
177
-        		{
178
-        			$langDropDown = $dropdown;
179
-        		}
180
-        		$module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown;
181
-				$module->mblanguage->save($module->key_name);
182
-			}
183
-		}
168
+        $selected_lang	= $selected_lang . '.lang.php';
169
+        foreach($module->mblanguage->appListStrings as $lang => $listStrings) {
170
+            if ($lang != $selected_lang)
171
+            {
172
+                $langDropDown = array();
173
+                if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name]))
174
+                {
175
+                    $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
176
+                } else
177
+                {
178
+                    $langDropDown = $dropdown;
179
+                }
180
+                $module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown;
181
+                $module->mblanguage->save($module->key_name);
182
+            }
183
+        }
184 184
     }
185 185
 
186 186
     private function synchDDKeys($dom, $sub) {
187
-    	//check for extra keys
187
+        //check for extra keys
188 188
         foreach($sub as $key=>$value) {
189
-        	if (!isset($dom[$key])) {
190
-        		unset ($sub[$key]);
191
-        	}
189
+            if (!isset($dom[$key])) {
190
+                unset ($sub[$key]);
191
+            }
192 192
         }
193 193
         //check for missing keys
194 194
         foreach($dom as $key=>$value) {
195
-        	if (!isset($sub[$key])) {
196
-        		$sub[$key] = $value;
197
-        	}
195
+            if (!isset($sub[$key])) {
196
+                $sub[$key] = $value;
197
+            }
198 198
         }
199 199
         return $sub;
200 200
     }
201 201
 
202 202
     function getPatternMatch($dropdown_name) {
203
-    	return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\''
204
-    		 . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism';
203
+        return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\''
204
+                . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism';
205 205
     }
206 206
 
207 207
     function getNewCustomContents($dropdown_name, $dropdown, $lang) {
208
-    	$contents = return_custom_app_list_strings_file_contents($lang);
208
+        $contents = return_custom_app_list_strings_file_contents($lang);
209 209
         $contents = str_replace("?>", '', $contents);
210
-		if(empty($contents))$contents = "<?php";
211
-    	$contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents);
212
-	    $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";";
213
-	    return $contents;
210
+        if(empty($contents))$contents = "<?php";
211
+        $contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents);
212
+        $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";";
213
+        return $contents;
214 214
     }
215 215
 }
216 216
 ?>
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/parser.modifylayoutview.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -169,12 +169,12 @@
 block discarded – undo
169 169
         include_once('include/TemplateHandler/TemplateHandler.php');
170 170
         if (strtolower($this->_view) == 'quickcreate')
171 171
         {
172
-        	TemplateHandler::clearCache($this->_module,"form_SubPanelQuickCreate_{$this->_module}.tpl");
173
-        	TemplateHandler::clearCache($this->_module,"form_DCQuickCreate_{$this->_module}.tpl");
172
+            TemplateHandler::clearCache($this->_module,"form_SubPanelQuickCreate_{$this->_module}.tpl");
173
+            TemplateHandler::clearCache($this->_module,"form_DCQuickCreate_{$this->_module}.tpl");
174 174
         } 
175 175
         else 
176 176
         {
177
-        	TemplateHandler::clearCache($this->_module,"{$this->_view}.tpl");
177
+            TemplateHandler::clearCache($this->_module,"{$this->_view}.tpl");
178 178
         }
179 179
 
180 180
     }
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/ParserFactory.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     public static function getParser ( $view , $moduleName , $packageName = null , $subpanelName = null )
59 59
     {
60 60
         $GLOBALS [ 'log' ]->info ( "ParserFactory->getParser($view,$moduleName,$packageName,$subpanelName )" ) ;
61
-		$sm = null;
61
+        $sm = null;
62 62
         $lView = strtolower ( $view );
63 63
         if ( empty ( $packageName ) || ( $packageName == 'studio' ) )
64 64
         {
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/parser.modifylistview.php 1 patch
Indentation   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -43,144 +43,144 @@  discard block
 block discarded – undo
43 43
 require_once ('modules/ModuleBuilder/parsers/ModuleBuilderParser.php') ;
44 44
 class ParserModifyListView extends ModuleBuilderParser
45 45
 {
46
-	var $listViewDefs = false ;
47
-	var $defaults = array ( ) ;
48
-	var $additional = array ( ) ;
49
-	var $available = array ( ) ;
50
-	var $reserved = array(); // fields marked by 'studio'=>false in the listviewdefs; need to be preserved
51
-	//	var $language_module = '';
52
-	var $columns = array ( 'LBL_DEFAULT' => 'getDefaultFields' , 'LBL_AVAILABLE' => 'getAdditionalFields' , 'LBL_HIDDEN' => 'getAvailableFields' ) ;
53
-	function init ( $module_name , $submodule = '' )
54
-	{
55
-		global $app_list_strings ;
56
-		$this->module_name = $module_name ;
57
-		$mod_strings = return_module_language ( $GLOBALS [ 'current_language' ], $this->module_name ) ; // needed solely so that listviewdefs that reference this can be included without error
58
-		$class = $GLOBALS [ 'beanList' ] [ $this->module_name ] ;
59
-		require_once ($GLOBALS [ 'beanFiles' ] [ $class ]) ;
60
-		$this->module = new $class ( ) ;
46
+    var $listViewDefs = false ;
47
+    var $defaults = array ( ) ;
48
+    var $additional = array ( ) ;
49
+    var $available = array ( ) ;
50
+    var $reserved = array(); // fields marked by 'studio'=>false in the listviewdefs; need to be preserved
51
+    //	var $language_module = '';
52
+    var $columns = array ( 'LBL_DEFAULT' => 'getDefaultFields' , 'LBL_AVAILABLE' => 'getAdditionalFields' , 'LBL_HIDDEN' => 'getAvailableFields' ) ;
53
+    function init ( $module_name , $submodule = '' )
54
+    {
55
+        global $app_list_strings ;
56
+        $this->module_name = $module_name ;
57
+        $mod_strings = return_module_language ( $GLOBALS [ 'current_language' ], $this->module_name ) ; // needed solely so that listviewdefs that reference this can be included without error
58
+        $class = $GLOBALS [ 'beanList' ] [ $this->module_name ] ;
59
+        require_once ($GLOBALS [ 'beanFiles' ] [ $class ]) ;
60
+        $this->module = new $class ( ) ;
61 61
 
62
-		$loaded = $this->_loadFromFile('ListView','modules/' . $this->module_name . '/metadata/listviewdefs.php',$this->module_name);
63
-		$this->originalListViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
64
-		$this->_variables = $loaded['variables'];
65
-		//		_pp($loaded);
66
-		$this->customFile = 'custom/modules/' . $this->module_name . '/metadata/listviewdefs.php' ;
67
-		if (file_exists ( $this->customFile ))
68
-		{
69
-			$loaded = $this->_loadFromFile('ListView',$this->customFile,$this->module_name);
70
-			$this->listViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
71
-			$this->_variables = $loaded['variables'];
72
-		} else
73
-		{
74
-			$this->listViewDefs = & $this->originalListViewDefs ;
75
-		}
62
+        $loaded = $this->_loadFromFile('ListView','modules/' . $this->module_name . '/metadata/listviewdefs.php',$this->module_name);
63
+        $this->originalListViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
64
+        $this->_variables = $loaded['variables'];
65
+        //		_pp($loaded);
66
+        $this->customFile = 'custom/modules/' . $this->module_name . '/metadata/listviewdefs.php' ;
67
+        if (file_exists ( $this->customFile ))
68
+        {
69
+            $loaded = $this->_loadFromFile('ListView',$this->customFile,$this->module_name);
70
+            $this->listViewDefs = $loaded['viewdefs'] [ $this->module_name ] ;
71
+            $this->_variables = $loaded['variables'];
72
+        } else
73
+        {
74
+            $this->listViewDefs = & $this->originalListViewDefs ;
75
+        }
76 76
 
77
-		$this->fixKeys ( $this->originalListViewDefs ) ;
78
-		$this->fixKeys ( $this->listViewDefs ) ;
79
-		$this->language_module = $this->module_name ;
80
-	}
77
+        $this->fixKeys ( $this->originalListViewDefs ) ;
78
+        $this->fixKeys ( $this->listViewDefs ) ;
79
+        $this->language_module = $this->module_name ;
80
+    }
81 81
 	
82
-	function getLanguage()
83
-	{
84
-	    return $this->language_module;
85
-	}
86
-	// re-key array so that every entry has a key=name and all keys are lowercase - makes it easier in handleSave() later...
87
-	function fixKeys ( &$defs )
88
-	{
89
-		$temp = array ( ) ;
90
-		foreach ( $defs as $key => $value )
91
-		{
92
-			if (! is_array ( $value ))
93
-			{
94
-				$key = $value ;
95
-				$def = array ( ) ;
96
-				$def [ 'name' ] = (isset ( $this->module->field_defs [ $key ] )) ? $this->module->field_defs [ $key ] [ 'name' ] : $key ;
97
-				$value = $def ;
98
-			}
99
-			if (isset ( $value [ 'name' ] ))
100
-			{
101
-				$key = $value [ 'name' ] ; // override key with name, needed when the entry lacks a key
102
-			}
103
-			$temp [ strtolower ( $key ) ] = $value ;
104
-		}
105
-		$defs = $temp ;
106
-	}
82
+    function getLanguage()
83
+    {
84
+        return $this->language_module;
85
+    }
86
+    // re-key array so that every entry has a key=name and all keys are lowercase - makes it easier in handleSave() later...
87
+    function fixKeys ( &$defs )
88
+    {
89
+        $temp = array ( ) ;
90
+        foreach ( $defs as $key => $value )
91
+        {
92
+            if (! is_array ( $value ))
93
+            {
94
+                $key = $value ;
95
+                $def = array ( ) ;
96
+                $def [ 'name' ] = (isset ( $this->module->field_defs [ $key ] )) ? $this->module->field_defs [ $key ] [ 'name' ] : $key ;
97
+                $value = $def ;
98
+            }
99
+            if (isset ( $value [ 'name' ] ))
100
+            {
101
+                $key = $value [ 'name' ] ; // override key with name, needed when the entry lacks a key
102
+            }
103
+            $temp [ strtolower ( $key ) ] = $value ;
104
+        }
105
+        $defs = $temp ;
106
+    }
107 107
 	
108
-	/**
109
-	 * returns the default fields for a listview
110
-	 * Called only when displaying the listview for editing; not called when saving
111
-	 */
112
-	function getDefaultFields ()
113
-	{
114
-		$this->defaults = array ( ) ;
115
-		foreach ( $this->listViewDefs as $key => $def )
116
-		{
117
-		    // add in the default fields from the listviewdefs, stripping out any field with 'studio' set to a value other than true
118
-		    // Important: the 'studio' fields must be added back into the layout on save, as they're not editable rather than hidden
119
-			if (! empty ( $def [ 'default' ] ))
120
-			{
121
-			    if (! isset($def['studio']) || $def['studio'] === true)
122
-			    {
123
-			        $this->defaults [ $key ] = $def ;
124
-			    }
125
-			    else
126
-			    // anything which doesn't go into the defaults is a reserved field - this makes sure we don't miss anything
127
-			    {
128
-			        $this->reserved [ $key ] = $def;
129
-			    }
130
-			}
131
-		}
132
-		return $this->defaults ;
133
-	}
134
-	/**
135
-	 * returns additional fields available for users to create fields
136
-	 */
137
-	function getAdditionalFields ()
138
-	{
139
-		$this->additional = array ( ) ;
140
-		foreach ( $this->listViewDefs as $key => $def )
141
-		{
142
-			if (empty ( $def [ 'default' ] ))
143
-			{
144
-				$key = strtolower ( $key ) ;
145
-				$this->additional [ $key ] = $def ;
146
-			}
147
-		}
148
-		return $this->additional ;
149
-	}
150
-	/**
151
-	 * returns unused fields that are available for using in either default or additional list views
152
-	 */
153
-	function getAvailableFields ()
154
-	{
155
-		$this->availableFields = array ( ) ;
156
-		$lowerFieldList = array_change_key_case ( $this->listViewDefs ) ;
157
-		foreach ( $this->originalListViewDefs as $key => $def )
158
-		{
159
-			$key = strtolower ( $key ) ;
160
-			if (! isset ( $lowerFieldList [ $key ] ))
161
-			{
162
-				$this->availableFields [ $key ] = $def ;
163
-			}
164
-		}
165
-		$GLOBALS['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields,true));
166
-		$modFields = !empty($this->module->field_name_map) ? $this->module->field_name_map : $this->module->field_defs;
167
-		foreach ( $modFields as $key => $def )
168
-		{
169
-			$fieldName = strtolower ( $key ) ;
108
+    /**
109
+     * returns the default fields for a listview
110
+     * Called only when displaying the listview for editing; not called when saving
111
+     */
112
+    function getDefaultFields ()
113
+    {
114
+        $this->defaults = array ( ) ;
115
+        foreach ( $this->listViewDefs as $key => $def )
116
+        {
117
+            // add in the default fields from the listviewdefs, stripping out any field with 'studio' set to a value other than true
118
+            // Important: the 'studio' fields must be added back into the layout on save, as they're not editable rather than hidden
119
+            if (! empty ( $def [ 'default' ] ))
120
+            {
121
+                if (! isset($def['studio']) || $def['studio'] === true)
122
+                {
123
+                    $this->defaults [ $key ] = $def ;
124
+                }
125
+                else
126
+                // anything which doesn't go into the defaults is a reserved field - this makes sure we don't miss anything
127
+                {
128
+                    $this->reserved [ $key ] = $def;
129
+                }
130
+            }
131
+        }
132
+        return $this->defaults ;
133
+    }
134
+    /**
135
+     * returns additional fields available for users to create fields
136
+     */
137
+    function getAdditionalFields ()
138
+    {
139
+        $this->additional = array ( ) ;
140
+        foreach ( $this->listViewDefs as $key => $def )
141
+        {
142
+            if (empty ( $def [ 'default' ] ))
143
+            {
144
+                $key = strtolower ( $key ) ;
145
+                $this->additional [ $key ] = $def ;
146
+            }
147
+        }
148
+        return $this->additional ;
149
+    }
150
+    /**
151
+     * returns unused fields that are available for using in either default or additional list views
152
+     */
153
+    function getAvailableFields ()
154
+    {
155
+        $this->availableFields = array ( ) ;
156
+        $lowerFieldList = array_change_key_case ( $this->listViewDefs ) ;
157
+        foreach ( $this->originalListViewDefs as $key => $def )
158
+        {
159
+            $key = strtolower ( $key ) ;
160
+            if (! isset ( $lowerFieldList [ $key ] ))
161
+            {
162
+                $this->availableFields [ $key ] = $def ;
163
+            }
164
+        }
165
+        $GLOBALS['log']->debug('parser.modifylistview.php->getAvailableFields(): field_defs='.print_r($this->availableFields,true));
166
+        $modFields = !empty($this->module->field_name_map) ? $this->module->field_name_map : $this->module->field_defs;
167
+        foreach ( $modFields as $key => $def )
168
+        {
169
+            $fieldName = strtolower ( $key ) ;
170 170
             if ($fieldName == 'currency_id')
171 171
                 continue;
172
-			if (!isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
173
-			{
172
+            if (!isset ( $lowerFieldList [ $fieldName ] )) // bug 16728 - check this first, so that other conditions (e.g., studio == visible) can't override and add duplicate entries
173
+            {
174 174
             // bug 19656: this test changed after 5.0.0b - we now remove all ID type fields - whether set as type, or dbtype, from the fielddefs
175 175
             if ($this->isValidField($key, $def)){
176
-					$label = (isset ( $def [ 'vname' ] )) ? $def [ 'vname' ] : (isset($def [ 'label' ]) ? $def['label'] : $def['name']) ;
177
-					$this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
178
-				}
179
-			}
180
-		}
176
+                    $label = (isset ( $def [ 'vname' ] )) ? $def [ 'vname' ] : (isset($def [ 'label' ]) ? $def['label'] : $def['name']) ;
177
+                    $this->availableFields [ $fieldName ] = array ( 'width' => '10' , 'label' => $label ) ;
178
+                }
179
+            }
180
+        }
181 181
 
182
-		return $this->availableFields ;
183
-	}
182
+        return $this->availableFields ;
183
+    }
184 184
 
185 185
     function getFieldDefs()
186 186
     {
@@ -188,146 +188,146 @@  discard block
 block discarded – undo
188 188
     }
189 189
 
190 190
 	
191
-	function isValidField($key, $def) {
192
-	    //Allow fields that are studio visible  
193
-		if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible')
194
-		  return true;
191
+    function isValidField($key, $def) {
192
+        //Allow fields that are studio visible  
193
+        if (! empty ( $def [ 'studio' ] ) && $def [ 'studio' ] == 'visible')
194
+            return true;
195 195
 		  
196
-		//No ID fields
197
-		if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id'))
198
-		  return false;
196
+        //No ID fields
197
+        if  ((!empty ( $def [ 'dbType' ] ) && $def [ 'dbType' ] == 'id') || (!empty ( $def [ 'type' ] ) && $def [ 'type' ] == 'id'))
198
+            return false;
199 199
 		  
200
-		//only allow DB and custom fields (if a source is specified)
201
-	    if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields')
202
-		  return false;
200
+        //only allow DB and custom fields (if a source is specified)
201
+        if (!empty($def [ 'source' ]) && $def [ 'source' ] != 'db' && $def [ 'source' ] != 'custom_fields')
202
+            return false;
203 203
 
204
-		//Dont ever show the "deleted" fields or "_name" fields
205
-		if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false))
206
-	       return false;
204
+        //Dont ever show the "deleted" fields or "_name" fields
205
+        if (strcmp ( $key, 'deleted' ) == 0 || (isset ( $def [ 'name' ] ) && strpos ( $def [ 'name' ], "_name" ) !== false))
206
+            return false;
207 207
 
208
-	    //If none of the "ifs" are true, the field is valid
209
-	    return true;
210
-	}
208
+        //If none of the "ifs" are true, the field is valid
209
+        return true;
210
+    }
211 211
 	
212 212
 	
213
-	function getField ( $fieldName )
214
-	{
215
-		$fieldName = strtolower ( $fieldName ) ;
216
-		foreach ( $this->listViewDefs as $key => $def )
217
-		{
218
-			$key = strtolower ( $key ) ;
219
-			if ($key == $fieldName)
220
-			{
221
-				return $def ;
222
-			}
223
-		}
224
-		foreach ( $this->module->field_defs as $key => $def )
225
-		{
226
-			$key = strtolower ( $key ) ;
227
-			if ($key == $fieldName)
228
-			{
229
-				return $def ;
230
-			}
231
-		}
232
-		return array ( ) ;
233
-	}
234
-	function addRelateData($fieldname, $listfielddef) {
235
-		$modFieldDef = $this->module->field_defs [ strtolower ( $fieldname ) ];
236
-		if (!empty($modFieldDef['module']) && !empty($modFieldDef['id_name'])) {
237
-			$listfielddef['module'] = $modFieldDef['module'];
238
-			$listfielddef['id'] = strtoupper($modFieldDef['id_name']);
239
-			$listfielddef['link'] = true;
240
-			$listfielddef['related_fields'] = array (strtolower($modFieldDef['id_name']));
241
-		}
242
-		return $listfielddef;
243
-	}
244
-	function _loadLayoutFromRequest ()
245
-	{
246
-	    $GLOBALS['log']->debug("ParserModifyListView->_loadLayoutFromRequest()");
247
-		$fields = array ( ) ;
248
-		$rejectTypes = array ( 'html' , 'enum' , 'text' ) ;
249
-		for ( $i = 0 ; isset ( $_POST [ 'group_' . $i ] ) && $i < 2 ; $i ++ )
250
-		{
251
-			//echo "\n***group-$i Size:".sizeof($_POST['group_' . $i])."\n";
252
-			foreach ( $_POST [ 'group_' . $i ] as $field )
253
-			{
254
-				$fieldname = strtoupper ( $field ) ;
255
-				//originalListViewDefs are all lower case
256
-				$lowerFieldName = strtolower ( $field ) ;
257
-				if (isset ( $this->originalListViewDefs [ $lowerFieldName ] ))
258
-				{
259
-					$fields [ $fieldname ] = $this->originalListViewDefs [ $lowerFieldName ] ;
260
-				} else
261
-				{
262
-					//check if we have the case wrong for custom fields
263
-					if (! isset ( $this->module->field_defs [ $fieldname ] ))
264
-					{
265
-						foreach ( $this->module->field_defs as $key => $value )
266
-						{
267
-							if (strtoupper ( $key ) == $fieldname)
268
-							{
269
-								$fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $key ] [ 'vname' ] ) ;
270
-								break ;
271
-							}
272
-						}
273
-					} else
274
-					{
275
-						$fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $fieldname ] [ 'vname' ] ) ;
276
-					}
277
-					// sorting fields of certain types will cause a database engine problems
278
-					// we only check this for custom fields, as we assume that OOB fields have been independently confirmed as ok
279
-					if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] ) && (in_array ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ], $rejectTypes ) || isset($this->module->field_defs [ strtolower ( $fieldname ) ]['custom_module'])))
280
-					{
281
-						$fields [ $fieldname ] [ 'sortable' ] = false ;
282
-					}
283
-					// Bug 23728 - Make adding a currency type field default to setting the 'currency_format' to true
284
-					if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type ' ] ) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'currency') 
285
-					{
286
-						$fields [ $fieldname ] [ 'currency_format' ] = true;
287
-					}
288
-				}
289
-				if (isset ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ] ))
290
-				{
291
-					$width = substr ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ], 6, 3 ) ;
292
-					if (strpos ( $width, "%" ) !== false)
293
-					{
294
-						$width = substr ( $width, 0, 2 ) ;
295
-					}
296
-					if ($width < 101 && $width > 0)
297
-					{
298
-						$fields [ $fieldname ] [ 'width' ] = $width ;
299
-					}
300
-				} else if (isset ( $this->listViewDefs [ $fieldname ] [ 'width' ] ))
301
-				{
302
-					$fields [ $fieldname ] [ 'width' ] = $this->listViewDefs [ $fieldname ] [ 'width' ] ;
303
-				}
304
-				//Get additional Data for relate fields
305
-				if (isset($this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ]) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'relate') {
306
-					$fields [ $fieldname ] = $this->addRelateData($field, $fields [ $fieldname ]);
307
-				}
308
-				$fields [ $fieldname ] [ 'default' ] = ($i == 0) ;
309
-			}
310
-		}
311
-		// Add the reserved fields back in to the end of the default fields in the layout
312
-		// ASSUMPTION: reserved fields go back at the end
313
-		// First, load the reserved fields - we cannot assume that getDefaultFields has been called earlier when saving
314
-		$this->getDefaultFields();
315
-		foreach ( $this->reserved as $key => $def)
316
-		{
317
-		    $fields[ $key ] = $def;
318
-		}
213
+    function getField ( $fieldName )
214
+    {
215
+        $fieldName = strtolower ( $fieldName ) ;
216
+        foreach ( $this->listViewDefs as $key => $def )
217
+        {
218
+            $key = strtolower ( $key ) ;
219
+            if ($key == $fieldName)
220
+            {
221
+                return $def ;
222
+            }
223
+        }
224
+        foreach ( $this->module->field_defs as $key => $def )
225
+        {
226
+            $key = strtolower ( $key ) ;
227
+            if ($key == $fieldName)
228
+            {
229
+                return $def ;
230
+            }
231
+        }
232
+        return array ( ) ;
233
+    }
234
+    function addRelateData($fieldname, $listfielddef) {
235
+        $modFieldDef = $this->module->field_defs [ strtolower ( $fieldname ) ];
236
+        if (!empty($modFieldDef['module']) && !empty($modFieldDef['id_name'])) {
237
+            $listfielddef['module'] = $modFieldDef['module'];
238
+            $listfielddef['id'] = strtoupper($modFieldDef['id_name']);
239
+            $listfielddef['link'] = true;
240
+            $listfielddef['related_fields'] = array (strtolower($modFieldDef['id_name']));
241
+        }
242
+        return $listfielddef;
243
+    }
244
+    function _loadLayoutFromRequest ()
245
+    {
246
+        $GLOBALS['log']->debug("ParserModifyListView->_loadLayoutFromRequest()");
247
+        $fields = array ( ) ;
248
+        $rejectTypes = array ( 'html' , 'enum' , 'text' ) ;
249
+        for ( $i = 0 ; isset ( $_POST [ 'group_' . $i ] ) && $i < 2 ; $i ++ )
250
+        {
251
+            //echo "\n***group-$i Size:".sizeof($_POST['group_' . $i])."\n";
252
+            foreach ( $_POST [ 'group_' . $i ] as $field )
253
+            {
254
+                $fieldname = strtoupper ( $field ) ;
255
+                //originalListViewDefs are all lower case
256
+                $lowerFieldName = strtolower ( $field ) ;
257
+                if (isset ( $this->originalListViewDefs [ $lowerFieldName ] ))
258
+                {
259
+                    $fields [ $fieldname ] = $this->originalListViewDefs [ $lowerFieldName ] ;
260
+                } else
261
+                {
262
+                    //check if we have the case wrong for custom fields
263
+                    if (! isset ( $this->module->field_defs [ $fieldname ] ))
264
+                    {
265
+                        foreach ( $this->module->field_defs as $key => $value )
266
+                        {
267
+                            if (strtoupper ( $key ) == $fieldname)
268
+                            {
269
+                                $fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $key ] [ 'vname' ] ) ;
270
+                                break ;
271
+                            }
272
+                        }
273
+                    } else
274
+                    {
275
+                        $fields [ $fieldname ] = array ( 'width' => 10 , 'label' => $this->module->field_defs [ $fieldname ] [ 'vname' ] ) ;
276
+                    }
277
+                    // sorting fields of certain types will cause a database engine problems
278
+                    // we only check this for custom fields, as we assume that OOB fields have been independently confirmed as ok
279
+                    if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] ) && (in_array ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ], $rejectTypes ) || isset($this->module->field_defs [ strtolower ( $fieldname ) ]['custom_module'])))
280
+                    {
281
+                        $fields [ $fieldname ] [ 'sortable' ] = false ;
282
+                    }
283
+                    // Bug 23728 - Make adding a currency type field default to setting the 'currency_format' to true
284
+                    if (isset ( $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type ' ] ) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'currency') 
285
+                    {
286
+                        $fields [ $fieldname ] [ 'currency_format' ] = true;
287
+                    }
288
+                }
289
+                if (isset ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ] ))
290
+                {
291
+                    $width = substr ( $_REQUEST [ strtolower ( $fieldname ) . 'width' ], 6, 3 ) ;
292
+                    if (strpos ( $width, "%" ) !== false)
293
+                    {
294
+                        $width = substr ( $width, 0, 2 ) ;
295
+                    }
296
+                    if ($width < 101 && $width > 0)
297
+                    {
298
+                        $fields [ $fieldname ] [ 'width' ] = $width ;
299
+                    }
300
+                } else if (isset ( $this->listViewDefs [ $fieldname ] [ 'width' ] ))
301
+                {
302
+                    $fields [ $fieldname ] [ 'width' ] = $this->listViewDefs [ $fieldname ] [ 'width' ] ;
303
+                }
304
+                //Get additional Data for relate fields
305
+                if (isset($this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ]) && $this->module->field_defs [ strtolower ( $fieldname ) ] [ 'type' ] == 'relate') {
306
+                    $fields [ $fieldname ] = $this->addRelateData($field, $fields [ $fieldname ]);
307
+                }
308
+                $fields [ $fieldname ] [ 'default' ] = ($i == 0) ;
309
+            }
310
+        }
311
+        // Add the reserved fields back in to the end of the default fields in the layout
312
+        // ASSUMPTION: reserved fields go back at the end
313
+        // First, load the reserved fields - we cannot assume that getDefaultFields has been called earlier when saving
314
+        $this->getDefaultFields();
315
+        foreach ( $this->reserved as $key => $def)
316
+        {
317
+            $fields[ $key ] = $def;
318
+        }
319 319
 		
320
-		return $fields ;
321
-	}
322
-	function handleSave ()
323
-	{
324
-		$fields = $this->_loadLayoutFromRequest();
325
-		$this->_writeToFile($this->customFile,'ListView',$this->module_name,$fields,$this->_variables);
320
+        return $fields ;
321
+    }
322
+    function handleSave ()
323
+    {
324
+        $fields = $this->_loadLayoutFromRequest();
325
+        $this->_writeToFile($this->customFile,'ListView',$this->module_name,$fields,$this->_variables);
326 326
 
327
-		$GLOBALS [ "listViewDefs" ] [ $this->module_name ] = $fields ;
328
-		// now clear the cache so that the results are immediately visible
329
-		include_once ('include/TemplateHandler/TemplateHandler.php') ;
330
-		TemplateHandler::clearCache ( $this->module_name, "ListView.tpl" ) ; // not currently cached, but here for the future
331
-	}
327
+        $GLOBALS [ "listViewDefs" ] [ $this->module_name ] = $fields ;
328
+        // now clear the cache so that the results are immediately visible
329
+        include_once ('include/TemplateHandler/TemplateHandler.php') ;
330
+        TemplateHandler::clearCache ( $this->module_name, "ListView.tpl" ) ; // not currently cached, but here for the future
331
+    }
332 332
 }
333 333
 ?>
Please login to merge, or discard this patch.
modules/SchedulersJobs/field_arrays.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -40,23 +40,23 @@
 block discarded – undo
40 40
 
41 41
 
42 42
 $fields_array['Schedulers_jobs'] = array (
43
-	'column_fields' => array (
44
-		'id',
45
-		'deleted',
46
-		'date_entered',
47
-		'date_modified',
48
-		'job_id',
49
-		'execute_time',
50
-		'status',
51
-	),
52
-	'list_fields' => array (
53
-		'id',
54
-		'job_id',
55
-		'execute_time'
56
-	),
57
-	'required_fields' => array (
58
-		'job_id' => 1,
59
-		'execute_time' => 1
60
-	)
43
+    'column_fields' => array (
44
+        'id',
45
+        'deleted',
46
+        'date_entered',
47
+        'date_modified',
48
+        'job_id',
49
+        'execute_time',
50
+        'status',
51
+    ),
52
+    'list_fields' => array (
53
+        'id',
54
+        'job_id',
55
+        'execute_time'
56
+    ),
57
+    'required_fields' => array (
58
+        'job_id' => 1,
59
+        'execute_time' => 1
60
+    )
61 61
 );
62 62
 ?>
Please login to merge, or discard this patch.
modules/Import/maps/ImportMapOutlook.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 
50 50
 class ImportMapOutlook extends ImportMapOther
51 51
 {
52
-	/**
52
+    /**
53 53
      * String identifier for this import
54 54
      */
55 55
     public $name = 'outlook';
56
-	/**
56
+    /**
57 57
      * Field delimiter
58 58
      */
59 59
     public $delimiter = ',';
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * Field enclosure
62 62
      */
63 63
     public $enclosure = '"';
64
-	/**
64
+    /**
65 65
      * Do we have a header?
66 66
      */
67 67
     public $has_header = true;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param  string $module
73 73
      * @return array field mappings
74 74
      */
75
-	public function getMapping(
75
+    public function getMapping(
76 76
         $module
77 77
         )
78 78
     {
Please login to merge, or discard this patch.
modules/Import/maps/ImportMapGoogle.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 class ImportMapGoogle extends ImportMapOther
46 46
 {
47
-	/**
47
+    /**
48 48
      * String identifier for this import
49 49
      */
50 50
     public $name = 'google';
@@ -55,38 +55,38 @@  discard block
 block discarded – undo
55 55
      * @param  string $module
56 56
      * @return array field mappings
57 57
      */
58
-	public function getMapping($module)
58
+    public function getMapping($module)
59 59
     {
60
-         $return_array = array(
61
-             'first_name' => array('sugar_key' => 'first_name', 'sugar_label' => '', 'default_label' => 'Given Name'),
62
-             'last_name' => array('sugar_key' => 'last_name', 'sugar_label' => '', 'default_label' => 'Family Name'),
63
-             'birthday' => array('sugar_key' => 'birthdate', 'sugar_label' => '', 'default_label' => 'Birthday'),
64
-             'title' => array('sugar_key' => 'title', 'sugar_label' => '', 'default_label' => 'Title'),
65
-             'notes' => array('sugar_key' => 'description', 'sugar_label' => '', 'default_label' => 'Notes'),
60
+            $return_array = array(
61
+                'first_name' => array('sugar_key' => 'first_name', 'sugar_label' => '', 'default_label' => 'Given Name'),
62
+                'last_name' => array('sugar_key' => 'last_name', 'sugar_label' => '', 'default_label' => 'Family Name'),
63
+                'birthday' => array('sugar_key' => 'birthdate', 'sugar_label' => '', 'default_label' => 'Birthday'),
64
+                'title' => array('sugar_key' => 'title', 'sugar_label' => '', 'default_label' => 'Title'),
65
+                'notes' => array('sugar_key' => 'description', 'sugar_label' => '', 'default_label' => 'Notes'),
66 66
 
67
-             'alt_address_street' => array('sugar_key' => 'alt_address_street', 'sugar_label' => '', 'default_label' => 'Home Street'),
68
-             'alt_address_postcode' => array('sugar_key' => 'alt_address_postalcode', 'sugar_label' => '', 'default_label' => 'Home Postcode'),
69
-             'alt_address_city' => array('sugar_key' => 'alt_address_city', 'sugar_label' => '', 'default_label' => 'Home City'),
70
-             'alt_address_state' => array('sugar_key' => 'alt_address_state', 'sugar_label' => '', 'default_label' => 'Home State'),
71
-             'alt_address_country' => array('sugar_key' => 'alt_address_country', 'sugar_label' => '', 'default_label' => 'Home Country'),
67
+                'alt_address_street' => array('sugar_key' => 'alt_address_street', 'sugar_label' => '', 'default_label' => 'Home Street'),
68
+                'alt_address_postcode' => array('sugar_key' => 'alt_address_postalcode', 'sugar_label' => '', 'default_label' => 'Home Postcode'),
69
+                'alt_address_city' => array('sugar_key' => 'alt_address_city', 'sugar_label' => '', 'default_label' => 'Home City'),
70
+                'alt_address_state' => array('sugar_key' => 'alt_address_state', 'sugar_label' => '', 'default_label' => 'Home State'),
71
+                'alt_address_country' => array('sugar_key' => 'alt_address_country', 'sugar_label' => '', 'default_label' => 'Home Country'),
72 72
 
73
-             'primary_address_street' => array('sugar_key' => 'primary_address_street', 'sugar_label' => '', 'default_label' => 'Work Street'),
74
-             'primary_address_postcode' => array('sugar_key' => 'primary_address_postalcode', 'sugar_label' => '', 'default_label' => 'Work Postcode'),
75
-             'primary_address_city' => array('sugar_key' => 'primary_address_city', 'sugar_label' => '', 'default_label' => 'Work City'),
76
-             'primary_address_state' => array('sugar_key' => 'primary_address_state', 'sugar_label' => '', 'default_label' => 'Work State'),
77
-             'primary_address_country' => array('sugar_key' => 'primary_address_country', 'sugar_label' => '', 'default_label' => 'Work Country'),
73
+                'primary_address_street' => array('sugar_key' => 'primary_address_street', 'sugar_label' => '', 'default_label' => 'Work Street'),
74
+                'primary_address_postcode' => array('sugar_key' => 'primary_address_postalcode', 'sugar_label' => '', 'default_label' => 'Work Postcode'),
75
+                'primary_address_city' => array('sugar_key' => 'primary_address_city', 'sugar_label' => '', 'default_label' => 'Work City'),
76
+                'primary_address_state' => array('sugar_key' => 'primary_address_state', 'sugar_label' => '', 'default_label' => 'Work State'),
77
+                'primary_address_country' => array('sugar_key' => 'primary_address_country', 'sugar_label' => '', 'default_label' => 'Work Country'),
78 78
 
79
-             'phone_main' => array('sugar_key' => 'phone_other', 'sugar_label' => '', 'default_label' => 'Main Phone'),
80
-             'phone_mobile' => array('sugar_key' => 'phone_mobile', 'sugar_label' => '', 'default_label' => 'Mobile Phone'),
81
-             'phone_home' => array('sugar_key' => 'phone_home', 'sugar_label' => '', 'default_label' => 'Home phone'),
82
-             'phone_work' => array('sugar_key' => 'phone_work', 'sugar_label' => '', 'default_label' => 'Work phone'),
83
-             'phone_fax' => array('sugar_key' => 'phone_fax', 'sugar_label' => '', 'default_label' => 'Fax phone'),
79
+                'phone_main' => array('sugar_key' => 'phone_other', 'sugar_label' => '', 'default_label' => 'Main Phone'),
80
+                'phone_mobile' => array('sugar_key' => 'phone_mobile', 'sugar_label' => '', 'default_label' => 'Mobile Phone'),
81
+                'phone_home' => array('sugar_key' => 'phone_home', 'sugar_label' => '', 'default_label' => 'Home phone'),
82
+                'phone_work' => array('sugar_key' => 'phone_work', 'sugar_label' => '', 'default_label' => 'Work phone'),
83
+                'phone_fax' => array('sugar_key' => 'phone_fax', 'sugar_label' => '', 'default_label' => 'Fax phone'),
84 84
 
85
-             'email1' => array('sugar_key' => 'email1', 'sugar_label' => 'LBL_EMAIL_ADDRESS', 'default_label' => 'Email Address'),
86
-             'email2' => array('sugar_key' => 'email2', 'sugar_label' => 'LBL_OTHER_EMAIL_ADDRESS', 'default_label' => 'Other Email'),
85
+                'email1' => array('sugar_key' => 'email1', 'sugar_label' => 'LBL_EMAIL_ADDRESS', 'default_label' => 'Email Address'),
86
+                'email2' => array('sugar_key' => 'email2', 'sugar_label' => 'LBL_OTHER_EMAIL_ADDRESS', 'default_label' => 'Other Email'),
87 87
 
88
-             'assigned_user_name' => array('sugar_key' => 'assigned_user_name', 'sugar_help_key' => 'LBL_EXTERNAL_ASSIGNED_TOOLTIP', 'sugar_label' => 'LBL_ASSIGNED_TO_NAME', 'default_label' => 'Assigned To'),
89
-             'team_name' => array('sugar_key' => 'team_name', 'sugar_help_key' => 'LBL_EXTERNAL_TEAM_TOOLTIP','sugar_label' => 'LBL_TEAMS', 'default_label' => 'Teams'),
88
+                'assigned_user_name' => array('sugar_key' => 'assigned_user_name', 'sugar_help_key' => 'LBL_EXTERNAL_ASSIGNED_TOOLTIP', 'sugar_label' => 'LBL_ASSIGNED_TO_NAME', 'default_label' => 'Assigned To'),
89
+                'team_name' => array('sugar_key' => 'team_name', 'sugar_help_key' => 'LBL_EXTERNAL_TEAM_TOOLTIP','sugar_label' => 'LBL_TEAMS', 'default_label' => 'Teams'),
90 90
             );
91 91
 
92 92
         if($module == 'Users')
Please login to merge, or discard this patch.