Passed
Push — scrutinizer-code-quality ( eedb15...27193c )
by Adam
54:15 queued 15s
created
modules/UpgradeWizard/silentUpgrade.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -35,29 +35,29 @@  discard block
 block discarded – undo
35 35
  ********************************************************************************/
36 36
 
37 37
 function build_argument_string($arguments=array()) {
38
-   if(!is_array($arguments)) {
39
-   	  return '';
40
-   }
38
+    if(!is_array($arguments)) {
39
+            return '';
40
+    }
41 41
 
42
-   $argument_string = '';
43
-   $count = 0;
44
-   foreach($arguments as $arg) {
45
-   	   if($count != 0)
46
-   	   {
47
-   	   	  //If current directory or parent directory is specified, substitute with full path
48
-   	   	  if($arg == '.')
49
-   	   	  {
50
-   	   	  	 $arg = getcwd();
51
-   	   	  } else if ($arg == '..') {
52
-   	   	  	 $dir = getcwd();
53
-			 $arg = substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR));
54
-   	   	  }
55
-          $argument_string .= ' ' . escapeshellarg($arg);
56
-   	   }
57
-   	   $count++;
58
-   }
42
+    $argument_string = '';
43
+    $count = 0;
44
+    foreach($arguments as $arg) {
45
+            if($count != 0)
46
+            {
47
+                //If current directory or parent directory is specified, substitute with full path
48
+                if($arg == '.')
49
+                {
50
+                        $arg = getcwd();
51
+                } else if ($arg == '..') {
52
+                        $dir = getcwd();
53
+                $arg = substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR));
54
+                }
55
+            $argument_string .= ' ' . escapeshellarg($arg);
56
+            }
57
+            $count++;
58
+    }
59 59
 
60
-   return $argument_string;
60
+    return $argument_string;
61 61
 }
62 62
 
63 63
 //Bug 52872. Dies if the request does not come from CLI.
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
                 $run_dce_upgrade = true;
76 76
                 //set the php path if found
77 77
                 if(is_file($argv[7].'dce_config.php')){
78
-                   include($argv[7].'dce_config.php');
79
-                   $php_path = $dce_config['client_php_path'].'/';
78
+                    include($argv[7].'dce_config.php');
79
+                    $php_path = $dce_config['client_php_path'].'/';
80 80
                 }
81 81
 }
82 82
 
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
 $has_error = $output == 0 ? false : true;
93 93
 
94 94
 if(!$has_error) {
95
-	if($run_dce_upgrade) {
96
-		$step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php " . build_argument_string($argv);
97
-		passthru($step2, $output);
98
-	} else {
99
-		$step2 = "php -f {$php_dir}silentUpgrade_step2.php " . build_argument_string($argv);
100
-		passthru($step2, $output);
101
-	}
95
+    if($run_dce_upgrade) {
96
+        $step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php " . build_argument_string($argv);
97
+        passthru($step2, $output);
98
+    } else {
99
+        $step2 = "php -f {$php_dir}silentUpgrade_step2.php " . build_argument_string($argv);
100
+        passthru($step2, $output);
101
+    }
102 102
 }
103 103
 
104 104
 if($run_dce_upgrade) {
105
-	$has_error = $output == 0 ? false : true;
106
-	if(!$has_error) {
107
-	   $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php " . build_argument_string($argv);
108
-	   passthru($step3, $output);
109
-	}
105
+    $has_error = $output == 0 ? false : true;
106
+    if(!$has_error) {
107
+        $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php " . build_argument_string($argv);
108
+        passthru($step3, $output);
109
+    }
110 110
 }
111 111
 
112 112
 if($output != 0) {
113
-   echo "***************         silentupgrade failed         ***************: $output\n";
113
+    echo "***************         silentupgrade failed         ***************: $output\n";
114 114
 }
115 115
 exit($output);
116 116
 ?>
Please login to merge, or discard this patch.
modules/AOR_Reports/vardefs.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -38,45 +38,45 @@  discard block
 block discarded – undo
38 38
  ********************************************************************************/
39 39
 
40 40
 $dictionary['AOR_Report'] = array(
41
-	'table'=>'aor_reports',
42
-	'audited'=>true,
43
-	'duplicate_merge'=>true,
44
-	'fields'=>array (
45
-	  'report_module' => 
46
-	  array (
47
-		'required' => true,
48
-		'name' => 'report_module',
49
-		'vname' => 'LBL_REPORT_MODULE',
50
-		'type' => 'enum',
51
-		'massupdate' => 0,
52
-		'default' => '',
53
-		'no_default' => false,
54
-		'comments' => '',
55
-		'help' => '',
56
-		'importable' => 'true',
57
-		'duplicate_merge' => 'disabled',
58
-		'duplicate_merge_dom_value' => '0',
59
-		'audited' => true,
60
-		'reportable' => true,
61
-		'unified_search' => false,
62
-		'merge_filter' => 'disabled',
63
-		'len' => 100,
64
-		'size' => '20',
65
-		'options' => 'aor_moduleList',
66
-		'studio' => 'visible',
67
-		'dependency' => false,
68
-	  ),
41
+    'table'=>'aor_reports',
42
+    'audited'=>true,
43
+    'duplicate_merge'=>true,
44
+    'fields'=>array (
45
+        'report_module' => 
46
+        array (
47
+        'required' => true,
48
+        'name' => 'report_module',
49
+        'vname' => 'LBL_REPORT_MODULE',
50
+        'type' => 'enum',
51
+        'massupdate' => 0,
52
+        'default' => '',
53
+        'no_default' => false,
54
+        'comments' => '',
55
+        'help' => '',
56
+        'importable' => 'true',
57
+        'duplicate_merge' => 'disabled',
58
+        'duplicate_merge_dom_value' => '0',
59
+        'audited' => true,
60
+        'reportable' => true,
61
+        'unified_search' => false,
62
+        'merge_filter' => 'disabled',
63
+        'len' => 100,
64
+        'size' => '20',
65
+        'options' => 'aor_moduleList',
66
+        'studio' => 'visible',
67
+        'dependency' => false,
68
+        ),
69 69
 
70
-	'graphs_per_row' =>
71
-	array (
72
-		'required' => true,
73
-		'name' => 'graphs_per_row',
74
-		'vname' => 'LBL_GRAPHS_PER_ROW',
75
-		'type' => 'int',
76
-		'massupdate' => 0,
77
-		'default' => 2,
78
-		'no_default' => false,
79
-	),
70
+    'graphs_per_row' =>
71
+    array (
72
+        'required' => true,
73
+        'name' => 'graphs_per_row',
74
+        'vname' => 'LBL_GRAPHS_PER_ROW',
75
+        'type' => 'int',
76
+        'massupdate' => 0,
77
+        'default' => 2,
78
+        'no_default' => false,
79
+    ),
80 80
 
81 81
     'field_lines' =>
82 82
     array (
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
             'include' => 'modules/AOR_Conditions/conditionLines.php'
119 119
         ),
120 120
     ),
121
-  'aor_fields' =>
122
-  array (
121
+    'aor_fields' =>
122
+    array (
123 123
     'name' => 'aor_fields',
124 124
     'type' => 'link',
125 125
     'relationship' => 'aor_reports_aor_fields',
@@ -127,26 +127,26 @@  discard block
 block discarded – undo
127 127
     'bean_name'=>'AOR_Field',
128 128
     'source'=>'non-db',
129 129
     'id_name' => 'aor_report_id',
130
-  ),
131
-  'aor_conditions' =>
132
-  array (
133
-     'name' => 'aor_conditions',
134
-     'type' => 'link',
135
-     'relationship' => 'aor_reports_aor_conditions',
136
-     'module'=>'AOR_Conditions',
137
-     'bean_name'=>'AOR_Condition',
138
-     'source'=>'non-db',
139
-  ),
140
-  'aor_charts' =>
141
-      array (
130
+    ),
131
+    'aor_conditions' =>
132
+    array (
133
+        'name' => 'aor_conditions',
134
+        'type' => 'link',
135
+        'relationship' => 'aor_reports_aor_conditions',
136
+        'module'=>'AOR_Conditions',
137
+        'bean_name'=>'AOR_Condition',
138
+        'source'=>'non-db',
139
+    ),
140
+    'aor_charts' =>
141
+        array (
142 142
         'name' => 'aor_charts',
143 143
         'type' => 'link',
144 144
         'relationship' => 'aor_charts_aor_reports',
145 145
         'source' => 'non-db',
146 146
         'id_name' => 'aor_report_id',
147 147
         'vname' => 'LBL_AOR_CHARTS',
148
-      ),
149
-  'aor_scheduled_reports' =>
148
+        ),
149
+    'aor_scheduled_reports' =>
150 150
     array (
151 151
         'name' => 'aor_scheduled_reports',
152 152
         'type' => 'link',
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
         'relationship_type'=>'one-to-many',
189 189
     ),
190 190
 ),
191
-	'optimistic_locking'=>true,
192
-	'unified_search'=>true,
191
+    'optimistic_locking'=>true,
192
+    'unified_search'=>true,
193 193
 );
194 194
 
195 195
 if (!class_exists('VardefManager')){
Please login to merge, or discard this patch.
modules/AOR_Reports/metadata/SearchFields.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -24,18 +24,18 @@
 block discarded – undo
24 24
  */
25 25
 
26 26
 $searchFields['AOR_Reports'] = 
27
-	array (
28
-		'name' => array( 'query_type'=>'default'),
29
-		'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
30
-		'assigned_user_id'=> array('query_type'=>'default'),
27
+    array (
28
+        'name' => array( 'query_type'=>'default'),
29
+        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
30
+        'assigned_user_id'=> array('query_type'=>'default'),
31 31
 	    
32
-		//Range Search Support 
33
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
34
-	   'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
35
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
36
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
37
-	   'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
38
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
39
-	    //Range Search Support 		
40
-	);
32
+        //Range Search Support 
33
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
34
+        'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
35
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
36
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
37
+        'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
38
+        'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
39
+        //Range Search Support 		
40
+    );
41 41
 ?>
Please login to merge, or discard this patch.
modules/AOR_Reports/metadata/quickcreatedefs.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
                                             ),
32 32
                                             
33 33
                                             
34
- 'panels' =>array (
35
-  'default' => 
36
-  array (
34
+    'panels' =>array (
35
+    'default' => 
36
+    array (
37 37
     
38 38
     array (
39
-      'name',
40
-      'assigned_user_name',
39
+        'name',
40
+        'assigned_user_name',
41
+    ),
41 42
     ),
42
-  ),
43 43
                                                     
44 44
 ),
45 45
                         
Please login to merge, or discard this patch.
modules/AOR_Reports/metadata/metafiles.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
  * @author SalesAgility <[email protected]>
23 23
  */
24 24
  
25
- $metafiles['AOR_Reports'] = array(
26
-	'detailviewdefs'  => 	'modules/AOR_Reports/metadata/detailviewdefs.php', 	
27
-	'editviewdefs'    => 	'modules/AOR_Reports/metadata/editviewdefs.php',
28
- 	'listviewdefs'    => 	'modules/AOR_Reports/metadata/listviewdefs.php',
29
- 	'searchdefs'      =>    'modules/AOR_Reports/metadata/searchdefs.php',
30
- 	'popupdefs'	      =>    'modules/AOR_Reports/metadata/popupdefs.php',
31
- 	'searchfields'	  =>    'modules/AOR_Reports/metadata/SearchFields.php',
32
- );
25
+    $metafiles['AOR_Reports'] = array(
26
+    'detailviewdefs'  => 	'modules/AOR_Reports/metadata/detailviewdefs.php', 	
27
+    'editviewdefs'    => 	'modules/AOR_Reports/metadata/editviewdefs.php',
28
+        'listviewdefs'    => 	'modules/AOR_Reports/metadata/listviewdefs.php',
29
+        'searchdefs'      =>    'modules/AOR_Reports/metadata/searchdefs.php',
30
+        'popupdefs'	      =>    'modules/AOR_Reports/metadata/popupdefs.php',
31
+        'searchfields'	  =>    'modules/AOR_Reports/metadata/SearchFields.php',
32
+    );
33 33
 ?>
Please login to merge, or discard this patch.
modules/AOR_Reports/Dashlets/AORReportsDashlet/AORReportsDashlet.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     var $onlyCharts;
13 13
 
14 14
     function AORReportsDashlet($id, $def = array()) {
15
-		global $current_user, $app_strings;
15
+        global $current_user, $app_strings;
16 16
 
17 17
         parent::Dashlet($id);
18 18
         $this->isConfigurable = true;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
     }
70 70
 
71
-	function process() {
71
+    function process() {
72 72
     }
73 73
 
74 74
     public function displayOptions() {
Please login to merge, or discard this patch.
modules/AOR_Reports/Dashlets/AORReportsDashlet/AORReportsDashlet.meta.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,6 +3,6 @@
 block discarded – undo
3 3
 global $app_strings;
4 4
 
5 5
 $dashletMeta['AORReportsDashlet'] = array('module'		=> 'AOR_Reports',
6
-										  'title'       => translate('LBL_AOR_REPORTS_DASHLET', 'AOR_Reports'),
7
-                                          'description' => 'Displays Reports',
8
-                                          'category'    => 'Module Views');
6
+                                            'title'       => translate('LBL_AOR_REPORTS_DASHLET', 'AOR_Reports'),
7
+                                            'description' => 'Displays Reports',
8
+                                            'category'    => 'Module Views');
Please login to merge, or discard this patch.
modules/DynamicFields/DynamicField.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $this->base_path = "custom/Extension/modules/{$this->module}/Ext/Vardefs";
52 52
     }
53 53
 
54
-   function getModuleName()
54
+    function getModuleName()
55 55
     {
56 56
         return $this->module ;
57 57
     }
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 
70 70
 
71 71
     /**
72
-    * This will add the bean as a reference in this object as well as building the custom field cache if it has not been built
73
-    * LOADS THE BEAN IF THE BEAN IS NOT BEING PASSED ALONG IN SETUP IT SHOULD BE SET PRIOR TO SETUP
74
-    *
75
-    * @param SUGARBEAN $bean
76
-    */
72
+     * This will add the bean as a reference in this object as well as building the custom field cache if it has not been built
73
+     * LOADS THE BEAN IF THE BEAN IS NOT BEING PASSED ALONG IN SETUP IT SHOULD BE SET PRIOR TO SETUP
74
+     *
75
+     * @param SUGARBEAN $bean
76
+     */
77 77
     function setup($bean = null) {
78 78
         if ($bean) {
79 79
             $this->bean = $bean;
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
     }
96 96
 
97 97
     /**
98
-    * Builds the cache for custom fields based on the vardefs
99
-    *
100
-    * @param STRING $module
101
-    * @param boolean saveCache Boolean value indicating whether or not to pass saveCache value to saveToVardef, defaults to true
102
-    * @return unknown
103
-    */
98
+     * Builds the cache for custom fields based on the vardefs
99
+     *
100
+     * @param STRING $module
101
+     * @param boolean saveCache Boolean value indicating whether or not to pass saveCache value to saveToVardef, defaults to true
102
+     * @return unknown
103
+     */
104 104
     function buildCache($module = false, $saveCache=true) {
105 105
         //We can't build the cache while installing as the required database tables may not exist.
106 106
         if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true|| empty($GLOBALS['db']))
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
     }
162 162
 
163 163
     /**
164
-    * Returns the widget for a custom field from the fields_meta_data table.
165
-    */
164
+     * Returns the widget for a custom field from the fields_meta_data table.
165
+     */
166 166
     function getFieldWidget($module, $fieldName) {
167 167
         if (empty($module) || empty($fieldName)){
168 168
             sugar_die("Unable to load widget for '$module' : '$fieldName'");
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 
180 180
 
181 181
     /**
182
-    * Updates the cached vardefs with the custom field information stored in result
183
-    *
184
-    * @param string $module
185
-    * @param array $result
186
-    * @param boolean saveCache Boolean value indicating whether or not to call VardefManager::saveCache, defaults to true
187
-    */
182
+     * Updates the cached vardefs with the custom field information stored in result
183
+     *
184
+     * @param string $module
185
+     * @param array $result
186
+     * @param boolean saveCache Boolean value indicating whether or not to call VardefManager::saveCache, defaults to true
187
+     */
188 188
     function saveToVardef($module,$result,$saveCache=true) {
189 189
 
190 190
 
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
     }
249 249
 
250 250
     /**
251
-    * returns either false or an array containing the select and join parameter for a query using custom fields
252
-    * @param $expandedList boolean	If true, return a list of all fields with source=custom_fields in the select instead of the standard _cstm.*
253
-    *     This is required for any downstream construction of a SQL statement where we need to manipulate the select list,
254
-    *     for example, listviews with custom relate fields where the value comes from join rather than from the custom table
255
-    *
256
-    * @return array select=>select columns, join=>prebuilt join statement
257
-    */
258
-  function getJOIN( $expandedList = false , $includeRelates = false, &$where = false){
251
+     * returns either false or an array containing the select and join parameter for a query using custom fields
252
+     * @param $expandedList boolean	If true, return a list of all fields with source=custom_fields in the select instead of the standard _cstm.*
253
+     *     This is required for any downstream construction of a SQL statement where we need to manipulate the select list,
254
+     *     for example, listviews with custom relate fields where the value comes from join rather than from the custom table
255
+     *
256
+     * @return array select=>select columns, join=>prebuilt join statement
257
+     */
258
+    function getJOIN( $expandedList = false , $includeRelates = false, &$where = false){
259 259
         if(!$this->bean->hasCustomFields()){
260 260
             return array(
261 261
                 'select' => '',
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
     }
310 310
 
311
-   function getRelateJoin($field_def, $joinTableAlias, $withIdName = true) {
311
+    function getRelateJoin($field_def, $joinTableAlias, $withIdName = true) {
312 312
         if (empty($field_def['type']) || $field_def['type'] != "relate") {
313 313
             return false;
314 314
         }
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
         $ret_array['from'] = " LEFT JOIN $rel_table $joinTableAlias ON $tableName.$relID = $joinTableAlias.id"
347 347
                             . " AND $joinTableAlias.deleted=0 ";
348 348
         return $ret_array;
349
-   }
349
+    }
350 350
 
351
-   /**
352
-    * Fills in all the custom fields of type relate relationships for an object
353
-    *
354
-    */
355
-   function fill_relationships(){
351
+    /**
352
+     * Fills in all the custom fields of type relate relationships for an object
353
+     *
354
+     */
355
+    function fill_relationships(){
356 356
         global $beanList, $beanFiles;
357 357
         if(!empty($this->bean->relDepth)) {
358 358
             if($this->bean->relDepth > 1)return;
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      *
388 388
      * @param boolean $isUpdate
389 389
      */
390
-     function save($isUpdate){
390
+        function save($isUpdate){
391 391
 
392 392
         if($this->bean->hasCustomFields() && isset($this->bean->id)){
393 393
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
                     }
423 423
 
424 424
                     $val = $this->bean->$name;
425
-					if(($field['type'] == 'date' || $field['type'] == 'datetimecombo') && (empty($this->bean->$name )|| $this->bean->$name == '1900-01-01')){
426
-                    	$quote = '';
425
+                    if(($field['type'] == 'date' || $field['type'] == 'datetimecombo') && (empty($this->bean->$name )|| $this->bean->$name == '1900-01-01')){
426
+                        $quote = '';
427 427
                         $val = 'NULL';
428 428
                         $this->bean->$name = ''; // do not set it to string 'NULL'
429 429
                     }
@@ -571,11 +571,11 @@  discard block
 block discarded – undo
571 571
         if($field){
572 572
             if(!$is_update){
573 573
                 //Do two SQL calls here in this case
574
-            	//The first is to create the column in the custom table without the default value
575
-            	//The second is to modify the column created in the custom table to set the default value
576
-            	//We do this so that the existing entries in the custom table don't have the default value set
577
-            	$field->default = '';
578
-            	$field->default_value = '';
574
+                //The first is to create the column in the custom table without the default value
575
+                //The second is to modify the column created in the custom table to set the default value
576
+                //We do this so that the existing entries in the custom table don't have the default value set
577
+                $field->default = '';
578
+                $field->default_value = '';
579 579
                 // resetting default and default_value does not work for multienum and causes trouble for mssql
580 580
                 // so using a temporary variable here to indicate that we don't want default for this query
581 581
                 $field->no_default = 1;
@@ -583,19 +583,19 @@  discard block
 block discarded – undo
583 583
                 // unsetting temporary member variable
584 584
                 unset($field->no_default);
585 585
                 if(!empty($query)){
586
-                	$GLOBALS['db']->query($query, true, "Cannot create column");
587
-	                $field->default = $fmd->default_value;
588
-	                $field->default_value = $fmd->default_value;
589
-	                $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm');
590
-	                if(!empty($query)){
591
-	                	$GLOBALS['db']->query($query, true, "Cannot set default");
592
-	            	}
586
+                    $GLOBALS['db']->query($query, true, "Cannot create column");
587
+                    $field->default = $fmd->default_value;
588
+                    $field->default_value = $fmd->default_value;
589
+                    $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm');
590
+                    if(!empty($query)){
591
+                        $GLOBALS['db']->query($query, true, "Cannot set default");
592
+                    }
593 593
                 }
594 594
             }else{
595 595
                 $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm');
596 596
                 if(!empty($query)){
597
-                	$GLOBALS['db']->query($query, true, "Cannot modify field");
598
-            	}
597
+                    $GLOBALS['db']->query($query, true, "Cannot modify field");
598
+                }
599 599
             }
600 600
             $fmd->save();
601 601
             $this->buildCache($this->module);
@@ -761,12 +761,12 @@  discard block
 block discarded – undo
761 761
                 )
762 762
             );
763 763
             $ididx = array(
764
-       			'id'=>array(
765
-       				'name' =>$this->bean->table_name."_cstm_pk",
766
-       				'type' =>'primary',
767
-       				'fields'=>array('id_c')
764
+                    'id'=>array(
765
+                        'name' =>$this->bean->table_name."_cstm_pk",
766
+                        'type' =>'primary',
767
+                        'fields'=>array('id_c')
768 768
                 ),
769
-           );
769
+            );
770 770
 
771 771
             $query = $GLOBALS['db']->createTableSQLParams($this->bean->table_name."_cstm", $iddef, $ididx);
772 772
             if(!$GLOBALS['db']->supports("inline_keys")) {
@@ -798,14 +798,14 @@  discard block
 block discarded – undo
798 798
      *
799 799
      */
800 800
     function add_existing_custom_fields($execute = true){
801
-    	$out = "";
801
+        $out = "";
802 802
         if($this->bean->hasCustomFields()){
803
-	        foreach($this->bean->field_defs as $name=>$data){
804
-	        	if(empty($data['source']) || $data['source'] != 'custom_fields')
803
+            foreach($this->bean->field_defs as $name=>$data){
804
+                if(empty($data['source']) || $data['source'] != 'custom_fields')
805 805
                     continue;
806
-	            $out .= $this->add_existing_custom_field($data, $execute);
807
-	        }
808
-    	}
806
+                $out .= $this->add_existing_custom_field($data, $execute);
807
+            }
808
+        }
809 809
         return $out;
810 810
     }
811 811
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 
960 960
     }
961 961
 
962
-   function populateXTPL($xtpl, $view) {
962
+    function populateXTPL($xtpl, $view) {
963 963
 
964 964
         if($this->bean->hasCustomFields()){
965 965
             $results = $this->getAllFieldsView($view, 'xtpl');
@@ -984,12 +984,12 @@  discard block
 block discarded – undo
984 984
     }
985 985
 
986 986
     function getAllFieldsView($view, $type){
987
-         require_once ('modules/DynamicFields/FieldCases.php');
988
-         $results = array();
989
-         foreach($this->bean->field_defs as $name=>$data){
987
+            require_once ('modules/DynamicFields/FieldCases.php');
988
+            $results = array();
989
+            foreach($this->bean->field_defs as $name=>$data){
990 990
             if(empty($data['source']) || $data['source'] != 'custom_fields')
991 991
             {
992
-            	continue;
992
+                continue;
993 993
             }
994 994
             $field = get_widget ( $data ['type'] );
995 995
             $field->populateFromRow($data);
Please login to merge, or discard this patch.
modules/DynamicFields/UpgradeFields.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -40,95 +40,95 @@  discard block
 block discarded – undo
40 40
 
41 41
 require_once('modules/DynamicFields/FieldCases.php');
42 42
 require_once('modules/DynamicFields/DynamicField.php');
43
- global $db;
44
- if(!isset($db)){
45
- 	$db = DBManagerFactory::getInstance();
46
- }
47
- $result = $db->query( 'SELECT * FROM fields_meta_data WHERE deleted = 0 ORDER BY custom_module');
48
- $modules = array();
49
- /*
43
+    global $db;
44
+    if(!isset($db)){
45
+        $db = DBManagerFactory::getInstance();
46
+    }
47
+    $result = $db->query( 'SELECT * FROM fields_meta_data WHERE deleted = 0 ORDER BY custom_module');
48
+    $modules = array();
49
+    /*
50 50
   * get the real field_meta_data
51 51
   */
52
- while($row = $db->fetchByAssoc($result)){
53
- 	$the_modules = $row['custom_module'];
54
- 	if(!isset($modules[$the_modules])){
55
- 		$modules[$the_modules] = array();	
56
- 	}
57
- 	$modules[$the_modules][$row['name']] = $row['name'];
58
- }
52
+    while($row = $db->fetchByAssoc($result)){
53
+        $the_modules = $row['custom_module'];
54
+        if(!isset($modules[$the_modules])){
55
+            $modules[$the_modules] = array();	
56
+        }
57
+        $modules[$the_modules][$row['name']] = $row['name'];
58
+    }
59 59
  	
60
- $simulate = false;
61
- if(!isset($_REQUEST['run'])){
62
- 	$simulate = true;
63
- 	echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE";
64
- }	
60
+    $simulate = false;
61
+    if(!isset($_REQUEST['run'])){
62
+        $simulate = true;
63
+        echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE";
64
+    }	
65 65
 
66
- foreach($modules as $the_module=>$fields){
67
-         if(isset($beanList[$the_module]))
68
-         {
69
- 	$class_name = $beanList[$the_module];
70
- 	echo "<br><br>Scanning $the_module <br>";
66
+    foreach($modules as $the_module=>$fields){
67
+            if(isset($beanList[$the_module]))
68
+            {
69
+        $class_name = $beanList[$the_module];
70
+        echo "<br><br>Scanning $the_module <br>";
71 71
 		
72
-		require_once($beanFiles[$class_name]);
73
-		$mod = new $class_name();
74
-		if(!$db->tableExists($mod->table_name . "_cstm")){
75
-			$mod->custom_fields = new DynamicField();
76
-			$mod->custom_fields->setup($mod);
77
-		$mod->custom_fields->createCustomTable();
78
-		}
72
+        require_once($beanFiles[$class_name]);
73
+        $mod = new $class_name();
74
+        if(!$db->tableExists($mod->table_name . "_cstm")){
75
+            $mod->custom_fields = new DynamicField();
76
+            $mod->custom_fields->setup($mod);
77
+        $mod->custom_fields->createCustomTable();
78
+        }
79 79
 
80
-		$result = $db->query("DESCRIBE $mod->table_name" . "_cstm");
80
+        $result = $db->query("DESCRIBE $mod->table_name" . "_cstm");
81 81
 		
82
-		while($row = $db->fetchByAssoc($result)){
82
+        while($row = $db->fetchByAssoc($result)){
83 83
 			
84 84
 			
85
-			$col = $row['Field'];
86
-			$type = $row['Type'];
87
-			$fieldDef = $mod->getFieldDefinition($col);
88
-			$the_field = get_widget($fieldDef['type']);
89
-			$the_field->set($fieldDef);
85
+            $col = $row['Field'];
86
+            $type = $row['Type'];
87
+            $fieldDef = $mod->getFieldDefinition($col);
88
+            $the_field = get_widget($fieldDef['type']);
89
+            $the_field->set($fieldDef);
90 90
 				
91
-				if(!isset($fields[$col]) && $col != 'id_c'){
92
-					if(!$simulate)$db->query("ALTER TABLE $mod->table_name" . "_cstm DROP COLUMN $col");
93
-					unset($fields[$col]);
94
-					echo "Dropping Column $col from $mod->table_name" . "_cstm for module $the_module<br>";
95
-				}	else{
96
-					if($col != 'id_c'){
97
-					if(trim($the_field->get_db_type()) != trim($type)){
91
+                if(!isset($fields[$col]) && $col != 'id_c'){
92
+                    if(!$simulate)$db->query("ALTER TABLE $mod->table_name" . "_cstm DROP COLUMN $col");
93
+                    unset($fields[$col]);
94
+                    echo "Dropping Column $col from $mod->table_name" . "_cstm for module $the_module<br>";
95
+                }	else{
96
+                    if($col != 'id_c'){
97
+                    if(trim($the_field->get_db_type()) != trim($type)){
98 98
 						
99
-					echo "Fixing Column Type for $col changing $type to ". $the_field->get_db_type() . "<br>";
100
-					if(!$simulate)$db->query($the_field->get_db_modify_alter_table($mod->table_name . '_cstm'));		
101
-					}
102
-					}
99
+                    echo "Fixing Column Type for $col changing $type to ". $the_field->get_db_type() . "<br>";
100
+                    if(!$simulate)$db->query($the_field->get_db_modify_alter_table($mod->table_name . '_cstm'));		
101
+                    }
102
+                    }
103 103
 					
104
-					unset($fields[$col]);
105
-				}
104
+                    unset($fields[$col]);
105
+                }
106 106
 			
107
-		}
107
+        }
108 108
 			
109
-			echo sizeof($fields) . " field(s) missing from $mod->table_name" . "_cstm<br>";
110
-			foreach($fields as $field){
111
-				echo "Adding Column $field to $mod->table_name" . "_cstm<br>";
112
-				if(!$simulate){
113
-					$the_field = $mod->getFieldDefinition($field);
114
-					$field = get_widget($the_field['type']);
115
-					$field->set($the_field);
116
-					$query = $field->get_db_add_alter_table($mod->table_name . '_cstm');
117
-					echo $query;
118
-            		if(!empty($query)){
119
-                		$mod->db->query($query);
120
-            		}
121
-				}
122
-			}
123
-         }
124
-	}
109
+            echo sizeof($fields) . " field(s) missing from $mod->table_name" . "_cstm<br>";
110
+            foreach($fields as $field){
111
+                echo "Adding Column $field to $mod->table_name" . "_cstm<br>";
112
+                if(!$simulate){
113
+                    $the_field = $mod->getFieldDefinition($field);
114
+                    $field = get_widget($the_field['type']);
115
+                    $field->set($the_field);
116
+                    $query = $field->get_db_add_alter_table($mod->table_name . '_cstm');
117
+                    echo $query;
118
+                    if(!empty($query)){
119
+                        $mod->db->query($query);
120
+                    }
121
+                }
122
+            }
123
+            }
124
+    }
125 125
 	
126 126
 	
127
-	DynamicField::deleteCache();	
128
-	echo '<br>Done<br>';
129
-	if($simulate){
130
-		echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>';	
131
-	}
127
+    DynamicField::deleteCache();	
128
+    echo '<br>Done<br>';
129
+    if($simulate){
130
+        echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>';	
131
+    }
132 132
 		
133 133
 		
134 134
  
@@ -137,4 +137,4 @@  discard block
 block discarded – undo
137 137
  
138 138
  
139 139
  
140
- ?>
141 140
\ No newline at end of file
141
+    ?>
142 142
\ No newline at end of file
Please login to merge, or discard this patch.