Test Failed
Push — CI ( 0f01dd...c95a04 )
by Adam
55:13
created
modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
         $source = "";
100 100
         if ($this->rhs_module == $this->lhs_module)
101 101
         {
102
-        	$source = $this->getJoinKeyLHS();
102
+            $source = $this->getJoinKeyLHS();
103 103
         }
104 104
  
105 105
         return array( 
106
-        	$this->lhs_module => $this->getSubpanelDefinition ( 
107
-        		$this->relationship_name, $this->rhs_module, $this->rhs_subpanel , $this->getRightModuleSystemLabel() , $source
108
-        	) 
106
+            $this->lhs_module => $this->getSubpanelDefinition ( 
107
+                $this->relationship_name, $this->rhs_module, $this->rhs_subpanel , $this->getRightModuleSystemLabel() , $source
108
+            ) 
109 109
         );
110 110
     }
111 111
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     /*
114 114
      * @return array    An array of field definitions, ready for the vardefs, keyed by module
115 115
      */
116
-	function buildVardefs ( )
116
+    function buildVardefs ( )
117 117
     {
118 118
         $vardefs = array ( ) ;
119 119
         
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         ) ;
124 124
         if ($this->rhs_module != $this->lhs_module )
125 125
         {
126
-        	$vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, true,
126
+            $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, true,
127 127
                 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel()  ) . '_TITLE');
128 128
         }
129 129
         if (! $this->relationship_only)
Please login to merge, or discard this patch.
modules/ModuleBuilder/parsers/relationships/ManyToOneRelationship.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
     function __construct ($definition) 
61 61
     {
62 62
         
63
-    	parent::__construct ( $definition ) ;
64
-    	$onetomanyDef = array_merge($definition, array(
65
-	        'rhs_label'    => isset($definition['lhs_label'])    ? $definition['lhs_label']    : null,
66
-	        'lhs_label'    => isset($definition['rhs_label'])    ? $definition['rhs_label']    : null,
67
-	        'lhs_subpanel' => isset($definition['rhs_subpanel']) ? $definition['rhs_subpanel'] : null,
68
-	        'rhs_subpanel' => isset($definition['lhs_subpanel']) ? $definition['lhs_subpanel'] : null,
69
-	        'lhs_module'   => isset($definition['rhs_module'])   ? $definition['rhs_module']   : null,
70
-	        'lhs_table'    => isset($definition['rhs_table'])    ? $definition['rhs_table']    : null,
71
-	        'lhs_key'      => isset($definition['rhs_key'])      ? $definition['rhs_key']      : null,
72
-	        'rhs_module'   => isset($definition['lhs_module'])   ? $definition['lhs_module']   : null,
73
-	        'rhs_table'    => isset($definition['lhs_table'])    ? $definition['lhs_table']    : null,
74
-	        'rhs_key'      => isset($definition['lhs_key'])      ? $definition['lhs_key']      : null,
75
-	        'join_key_lhs' => isset($definition['join_key_rhs']) ? $definition['join_key_rhs'] : null,
76
-	        'join_key_rhs' => isset($definition['join_key_lhs']) ? $definition['join_key_lhs'] : null,
77
-	        'relationship_type' => MB_ONETOMANY,
63
+        parent::__construct ( $definition ) ;
64
+        $onetomanyDef = array_merge($definition, array(
65
+            'rhs_label'    => isset($definition['lhs_label'])    ? $definition['lhs_label']    : null,
66
+            'lhs_label'    => isset($definition['rhs_label'])    ? $definition['rhs_label']    : null,
67
+            'lhs_subpanel' => isset($definition['rhs_subpanel']) ? $definition['rhs_subpanel'] : null,
68
+            'rhs_subpanel' => isset($definition['lhs_subpanel']) ? $definition['lhs_subpanel'] : null,
69
+            'lhs_module'   => isset($definition['rhs_module'])   ? $definition['rhs_module']   : null,
70
+            'lhs_table'    => isset($definition['rhs_table'])    ? $definition['rhs_table']    : null,
71
+            'lhs_key'      => isset($definition['rhs_key'])      ? $definition['rhs_key']      : null,
72
+            'rhs_module'   => isset($definition['lhs_module'])   ? $definition['lhs_module']   : null,
73
+            'rhs_table'    => isset($definition['lhs_table'])    ? $definition['lhs_table']    : null,
74
+            'rhs_key'      => isset($definition['lhs_key'])      ? $definition['lhs_key']      : null,
75
+            'join_key_lhs' => isset($definition['join_key_rhs']) ? $definition['join_key_rhs'] : null,
76
+            'join_key_rhs' => isset($definition['join_key_lhs']) ? $definition['join_key_lhs'] : null,
77
+            'relationship_type' => MB_ONETOMANY,
78 78
         ));
79 79
         $this->one_to_many = new OneToManyRelationship($onetomanyDef);
80 80
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * BUILD methods called during the build
84 84
      */
85 85
 	
86
-	function buildLabels ()
86
+    function buildLabels ()
87 87
     {
88 88
         return $this->one_to_many->buildLabels();
89 89
     }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     function buildVardefs ( )
106 106
     {
107
-       return $this->one_to_many->buildVardefs();
107
+        return $this->one_to_many->buildVardefs();
108 108
     }
109 109
     
110 110
     /*
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
     public function setName ($relationshipName)
131 131
     {
132 132
         parent::setName($relationshipName);
133
-    	$this->one_to_many->setname($relationshipName);
133
+        $this->one_to_many->setname($relationshipName);
134 134
     }
135 135
     
136 136
     public function setReadonly ()
137 137
     {
138 138
         parent::setReadonly();
139
-    	$this->one_to_many->setReadonly();
139
+        $this->one_to_many->setReadonly();
140 140
     }
141 141
     
142 142
     public function delete ()
143 143
     {
144 144
         parent::delete();
145
-    	$this->one_to_many->delete();
145
+        $this->one_to_many->delete();
146 146
     }
147 147
     
148 148
     public function setRelationship_only ()
Please login to merge, or discard this patch.
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.label.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $deployedModule = true ;
94 94
             $basepath = "custom/modules/$moduleName/language" ;
95 95
             if($forRelationshipLabel){
96
-            	$basepath = "custom/modules/$moduleName/Ext/Language" ;
96
+                $basepath = "custom/modules/$moduleName/Ext/Language" ;
97 97
             }
98 98
             if (! is_dir ( $basepath ))
99 99
             {
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
         $filename = "$basepath/$language.lang.php" ;
106 106
         if($forRelationshipLabel){
107
-        	$filename = "$basepath/$language.lang.ext.php" ;
108
-     	}
107
+            $filename = "$basepath/$language.lang.ext.php" ;
108
+            }
109 109
 
110 110
         $dir_exists = is_dir ( $basepath ) ;
111 111
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             $deployedModule = true ;
171 171
             $basepath = "custom/modules/$moduleName/language" ;
172 172
             if($forRelationshipLabel){
173
-            	$basepath = "custom/modules/$moduleName/Ext/Language" ;
173
+                $basepath = "custom/modules/$moduleName/Ext/Language" ;
174 174
             }
175 175
             if (! is_dir ( $basepath ))
176 176
             {
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 
181 181
         $filename = "$basepath/$language.lang.php" ;
182 182
         if($forRelationshipLabel){
183
-        	$filename = "$basepath/$language.lang.ext.php" ;
184
-     	}
183
+            $filename = "$basepath/$language.lang.ext.php" ;
184
+            }
185 185
         $dir_exists = is_dir ( $basepath ) ;
186 186
 
187 187
         $mod_strings = array ( ) ;
@@ -193,47 +193,47 @@  discard block
 block discarded – undo
193 193
                 // obtain $mod_strings
194 194
                 include ($filename) ;
195 195
             }else if($forRelationshipLabel){
196
-            	$fh = fopen ($filename, 'a');
197
-            	fclose($fh);
196
+                $fh = fopen ($filename, 'a');
197
+                fclose($fh);
198 198
             }
199 199
         } else
200 200
         {
201 201
             return false ;
202 202
         }
203 203
 
204
-        	$changed = false ;
204
+            $changed = false ;
205 205
 
206 206
         //$charset = (isset($app_strings['LBL_CHARSET'])) ? $app_strings['LBL_CHARSET'] : $GLOBALS['sugar_config']['default_charset'] ;
207 207
 
208
-	        foreach ( $labels as $key => $value )
209
-	        {
208
+            foreach ( $labels as $key => $value )
209
+            {
210 210
             if (! isset ( $mod_strings [ $key ] ) || strcmp ( $value, $mod_strings [ $key ] ) != 0)
211
-	            {
211
+                {
212 212
                     $mod_strings [$key] = to_html(strip_tags(from_html($value))); // must match encoding used in view.labels.php
213
-	                $changed = true ;
214
-	            }
215
-	        }
213
+                    $changed = true ;
214
+                }
215
+            }
216 216
 
217
-	        if ($changed)
218
-	        {
217
+            if ($changed)
218
+            {
219 219
             $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: writing new mod_strings to $filename" ) ;
220
-	            $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: mod_strings=".print_r($mod_strings,true) ) ;
220
+                $GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: mod_strings=".print_r($mod_strings,true) ) ;
221 221
             if (! write_array_to_file ( "mod_strings", $mod_strings, $filename ))
222
-	            {
222
+                {
223 223
                 $GLOBALS [ 'log' ]->fatal ( "Could not write $filename" ) ;
224
-	            } else
225
-	            {
226
-	                // if we have a cache to worry about, then clear it now
224
+                } else
225
+                {
226
+                    // if we have a cache to worry about, then clear it now
227 227
                 if ($deployedModule)
228
-	                {
228
+                    {
229 229
                             SugarCache::cleanOpcodes();
230
-	                    $GLOBALS [ 'log' ]->debug ( "PaserLabel->addLabels: clearing language cache" ) ;
231
-	                    $cache_key = "module_language." . $language . $moduleName ;
232
-	                    sugar_cache_clear ( $cache_key ) ;
233
-	                    LanguageManager::clearLanguageCache ( $moduleName, $language ) ;
234
-	                }
235
-	            }
236
-	        }
230
+                        $GLOBALS [ 'log' ]->debug ( "PaserLabel->addLabels: clearing language cache" ) ;
231
+                        $cache_key = "module_language." . $language . $moduleName ;
232
+                        sugar_cache_clear ( $cache_key ) ;
233
+                        LanguageManager::clearLanguageCache ( $moduleName, $language ) ;
234
+                    }
235
+                }
236
+            }
237 237
 
238 238
         // Fix for bug #51
239 239
         // when the label is recreated it defaults back to the original value (In this case its "User").
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
         {
357 357
         foreach ( $metadata as $definition )
358 358
             {
359
-        	$labels = array();
360
-        	$labels[$definition [ 'system_label' ]] = $definition [ 'display_label' ];
361
-        	self::addLabels ( $language, $labels, $definition [ 'module' ],null,true );
359
+            $labels = array();
360
+            $labels[$definition [ 'system_label' ]] = $definition [ 'display_label' ];
361
+            self::addLabels ( $language, $labels, $definition [ 'module' ],null,true );
362 362
             }
363 363
         }
364 364
 
365 365
     function addLabelsToAllLanguages($labels)
366 366
             {
367
-    	$langs = get_languages();
368
-    	foreach($langs as $lang_key => $lang_display)
367
+        $langs = get_languages();
368
+        foreach($langs as $lang_key => $lang_display)
369 369
         {
370
-    		$this->addLabels($lang_key, $labels, $this->moduleName);
370
+            $this->addLabels($lang_key, $labels, $this->moduleName);
371 371
         }
372 372
     }
373 373
 }
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/ModuleBuilderParser.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -43,32 +43,32 @@  discard block
 block discarded – undo
43 43
 class ModuleBuilderParser
44 44
 {
45 45
 	
46
-	var $_defMap; // private - mapping from view to variable name inside the viewdef file
47
-	var $_variables = array(); // private - set of additional variables (other than the viewdefs) found in the viewdef file that need to be added to the file again when it is saved - used by ModuleBuilder
46
+    var $_defMap; // private - mapping from view to variable name inside the viewdef file
47
+    var $_variables = array(); // private - set of additional variables (other than the viewdefs) found in the viewdef file that need to be added to the file again when it is saved - used by ModuleBuilder
48 48
 	
49
-	function ModuleBuilderParser()
50
-	{
51
-		$this->_defMap = array('listview'=>'listViewDefs','searchview'=>'searchdefs','editview'=>'viewdefs','detailview'=>'viewdefs','quickcreate'=>'viewdefs');
52
-	}
53
-	/*
49
+    function ModuleBuilderParser()
50
+    {
51
+        $this->_defMap = array('listview'=>'listViewDefs','searchview'=>'searchdefs','editview'=>'viewdefs','detailview'=>'viewdefs','quickcreate'=>'viewdefs');
52
+    }
53
+    /*
54 54
 	 * Initialize this parser
55 55
 	 */
56
-	function init ()
57
-	{
58
-	}
56
+    function init ()
57
+    {
58
+    }
59 59
 	
60
-	/*
60
+    /*
61 61
 	 * Dummy function used to ease the transition to the new parser structure
62 62
 	 */
63
-	function populateFromPost()
64
-	{
65
-	}
63
+    function populateFromPost()
64
+    {
65
+    }
66 66
 	
67
-	function _loadFromFile($view,$file,$moduleName)
68
-	{
67
+    function _loadFromFile($view,$file,$moduleName)
68
+    {
69 69
 		
70
-		$variables = array();
71
-	    if (! file_exists($file))
70
+        $variables = array();
71
+        if (! file_exists($file))
72 72
         {
73 73
             $this->_fatalError("ModuleBuilderParser: required viewdef file {$file} does not exist");
74 74
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         foreach ($moduleVariables as $name)
85 85
         {
86 86
             if (isset($$name)) {
87
-            	$variables[$name] = $$name;
87
+                $variables[$name] = $$name;
88 88
             }
89 89
         }
90 90
         $viewVariable = $this->_defMap[strtolower($view)];
@@ -94,33 +94,33 @@  discard block
 block discarded – undo
94 94
 
95 95
         if (isset($variables['module_name']))
96 96
         {
97
-        	$mbName = $variables['module_name'];
98
-        	if ($mbName != $moduleName)
99
-        	{
100
-	        	$GLOBALS['log']->debug('ModuleBuilderParser->_loadFromFile(): tidying module names from '.$mbName.' to '.$moduleName);
101
-	        	$defs[$moduleName] = $defs[$mbName];
102
-	        	unset($defs[$mbName]);
103
-        	}
97
+            $mbName = $variables['module_name'];
98
+            if ($mbName != $moduleName)
99
+            {
100
+                $GLOBALS['log']->debug('ModuleBuilderParser->_loadFromFile(): tidying module names from '.$mbName.' to '.$moduleName);
101
+                $defs[$moduleName] = $defs[$mbName];
102
+                unset($defs[$mbName]);
103
+            }
104 104
         }
105 105
 //	    $GLOBALS['log']->debug('ModuleBuilderParser->_loadFromFile(): '.print_r($defs,true));
106 106
         return (array('viewdefs' => $defs, 'variables' => $variables));
107
-	}
107
+    }
108 108
 	
109
-	function handleSave ($file,$view,$moduleName,$defs)
110
-	{
111
-	}
109
+    function handleSave ($file,$view,$moduleName,$defs)
110
+    {
111
+    }
112 112
 	
113 113
 	
114
-	/*
114
+    /*
115 115
 	 * Save the new layout
116 116
 	 */
117
-	function _writeToFile ($file,$view,$moduleName,$defs,$variables)
118
-	{
119
-	        if(file_exists($file))
120
-	            unlink($file);
117
+    function _writeToFile ($file,$view,$moduleName,$defs,$variables)
118
+    {
119
+            if(file_exists($file))
120
+                unlink($file);
121 121
 	        
122
-	        mkdir_recursive ( dirname ( $file ) ) ;
123
-	        $GLOBALS['log']->debug("ModuleBuilderParser->_writeFile(): file=".$file);
122
+            mkdir_recursive ( dirname ( $file ) ) ;
123
+            $GLOBALS['log']->debug("ModuleBuilderParser->_writeFile(): file=".$file);
124 124
             $useVariables = (count($variables)>0);
125 125
             if( $fh = @sugar_fopen( $file, 'w' ) )
126 126
             {
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
                     // write out the $<variable>=<modulename> lines
131 131
                     foreach($variables as $key=>$value)
132 132
                     {
133
-                    	$out .= "\$$key = '".$value."';\n";
133
+                        $out .= "\$$key = '".$value."';\n";
134 134
                     }
135 135
                 }
136 136
                 
137 137
                 // write out the defs array itself
138 138
                 switch (strtolower($view))
139 139
                 {
140
-                	case 'editview':
141
-                	case 'detailview':
142
-                	case 'quickcreate':
143
-                		$defs = array($view => $defs);
144
-                		break;
145
-                	default:
146
-                		break;
140
+                    case 'editview':
141
+                    case 'detailview':
142
+                    case 'quickcreate':
143
+                        $defs = array($view => $defs);
144
+                        break;
145
+                    default:
146
+                        break;
147 147
                 }
148 148
                 $viewVariable = $this->_defMap[strtolower($view)];
149 149
                 $out .= "\$$viewVariable = ";
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 // tidy up the parenthesis
153 153
                 if ($useVariables)
154 154
                 {
155
-                	$out .= "\n)"; 
155
+                    $out .= "\n)"; 
156 156
                 }
157 157
                 $out .= ";\n?>\n";
158 158
                 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             {
165 165
                 $GLOBALS['log']->fatal("ModuleBuilderParser->_writeFile() Could not write new viewdef file ".$file);
166 166
             }
167
-	}
167
+    }
168 168
 
169 169
 
170 170
     function _fatalError ($msg)
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.