Completed
Push — console-installer ( 03fc02...67c42e )
by Adam
72:27 queued 53:14
created
modules/Contacts/metadata/SearchFields.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -40,47 +40,47 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Contacts";
42 42
 $searchFields['Contacts'] = 
43
-	array (
44
-		'first_name' => array( 'query_type'=>'default'),
45
-		'last_name'=> array('query_type'=>'default'),
46
-		'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true),
47
-		'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
48
-		'lead_source'=> array('query_type'=>'default','operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
49
-		'do_not_call'=> array('query_type'=>'default', 'input_type' => 'checkbox', 'operator'=>'='),
50
-		'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','assistant_phone')),
51
-		'email'=> array(
52
-			'query_type' => 'default',
53
-			'operator' => 'subquery',
54
-			'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
55
-			'db_field' => array(
56
-				'id',
57
-			),
58
-		),	
43
+    array (
44
+        'first_name' => array( 'query_type'=>'default'),
45
+        'last_name'=> array('query_type'=>'default'),
46
+        'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true),
47
+        'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
48
+        'lead_source'=> array('query_type'=>'default','operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
49
+        'do_not_call'=> array('query_type'=>'default', 'input_type' => 'checkbox', 'operator'=>'='),
50
+        'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','assistant_phone')),
51
+        'email'=> array(
52
+            'query_type' => 'default',
53
+            'operator' => 'subquery',
54
+            'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
55
+            'db_field' => array(
56
+                'id',
57
+            ),
58
+        ),	
59 59
         'favorites_only' => array(
60 60
             'query_type'=>'format',
61 61
             'operator' => 'subquery',
62
-			'subquery' => "SELECT favorites.parent_id FROM favorites
62
+            'subquery' => "SELECT favorites.parent_id FROM favorites
63 63
 			                    WHERE favorites.deleted = 0
64 64
 			                        and favorites.parent_type = '".$module_name."'
65 65
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
66 66
             'db_field'=>array('id')),
67
-		'assistant'=> array('query_type'=>'default'),
68
-		'address_street'=> array('query_type'=>'default','db_field'=>array('primary_address_street','alt_address_street')),
69
-		'address_city'=> array('query_type'=>'default','db_field'=>array('primary_address_city','alt_address_city')),
70
-		'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')),
71
-		'address_postalcode'=> array('query_type'=>'default','db_field'=>array('primary_address_postalcode','alt_address_postalcode')),
72
-		'address_country'=> array('query_type'=>'default','db_field'=>array('primary_address_country','alt_address_country')),
73
-		'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
74
-		'assigned_user_id'=> array('query_type'=>'default'),
67
+        'assistant'=> array('query_type'=>'default'),
68
+        'address_street'=> array('query_type'=>'default','db_field'=>array('primary_address_street','alt_address_street')),
69
+        'address_city'=> array('query_type'=>'default','db_field'=>array('primary_address_city','alt_address_city')),
70
+        'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')),
71
+        'address_postalcode'=> array('query_type'=>'default','db_field'=>array('primary_address_postalcode','alt_address_postalcode')),
72
+        'address_country'=> array('query_type'=>'default','db_field'=>array('primary_address_country','alt_address_country')),
73
+        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
74
+        'assigned_user_id'=> array('query_type'=>'default'),
75 75
         'account_id'=> array('query_type'=>'default','db_field'=>array('accounts.id')),
76 76
         'campaign_name'=> array('query_type'=>'default'),
77
-		//Range Search Support 
78
-	    'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
-	    'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
80
-	    'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
81
-	    'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
82
-	    'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
77
+        //Range Search Support 
78
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
+        'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
80
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
81
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
82
+        'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
83 83
         'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
84
-	    //Range Search Support 			
85
-	);
84
+        //Range Search Support 			
85
+    );
86 86
 ?>
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Contacts";
42 42
 $searchFields['Contacts'] = 
43
-	array (
44
-		'first_name' => array( 'query_type'=>'default'),
43
+	array(
44
+		'first_name' => array('query_type'=>'default'),
45 45
 		'last_name'=> array('query_type'=>'default'),
46
-		'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true),
47
-		'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
48
-		'lead_source'=> array('query_type'=>'default','operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
46
+		'search_name'=> array('query_type'=>'default', 'db_field'=>array('first_name', 'last_name'), 'force_unifiedsearch'=>true),
47
+		'account_name'=> array('query_type'=>'default', 'db_field'=>array('accounts.name')),
48
+		'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
49 49
 		'do_not_call'=> array('query_type'=>'default', 'input_type' => 'checkbox', 'operator'=>'='),
50
-		'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','assistant_phone')),
50
+		'phone'=> array('query_type'=>'default', 'db_field'=>array('phone_mobile', 'phone_work', 'phone_other', 'phone_fax', 'assistant_phone')),
51 51
 		'email'=> array(
52 52
 			'query_type' => 'default',
53 53
 			'operator' => 'subquery',
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 			'subquery' => "SELECT favorites.parent_id FROM favorites
63 63
 			                    WHERE favorites.deleted = 0
64 64
 			                        and favorites.parent_type = '".$module_name."'
65
-			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
65
+			                        and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}",
66 66
             'db_field'=>array('id')),
67 67
 		'assistant'=> array('query_type'=>'default'),
68
-		'address_street'=> array('query_type'=>'default','db_field'=>array('primary_address_street','alt_address_street')),
69
-		'address_city'=> array('query_type'=>'default','db_field'=>array('primary_address_city','alt_address_city')),
70
-		'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')),
71
-		'address_postalcode'=> array('query_type'=>'default','db_field'=>array('primary_address_postalcode','alt_address_postalcode')),
72
-		'address_country'=> array('query_type'=>'default','db_field'=>array('primary_address_country','alt_address_country')),
73
-		'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
68
+		'address_street'=> array('query_type'=>'default', 'db_field'=>array('primary_address_street', 'alt_address_street')),
69
+		'address_city'=> array('query_type'=>'default', 'db_field'=>array('primary_address_city', 'alt_address_city')),
70
+		'address_state'=> array('query_type'=>'default', 'db_field'=>array('primary_address_state', 'alt_address_state')),
71
+		'address_postalcode'=> array('query_type'=>'default', 'db_field'=>array('primary_address_postalcode', 'alt_address_postalcode')),
72
+		'address_country'=> array('query_type'=>'default', 'db_field'=>array('primary_address_country', 'alt_address_country')),
73
+		'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
74 74
 		'assigned_user_id'=> array('query_type'=>'default'),
75
-        'account_id'=> array('query_type'=>'default','db_field'=>array('accounts.id')),
75
+        'account_id'=> array('query_type'=>'default', 'db_field'=>array('accounts.id')),
76 76
         'campaign_name'=> array('query_type'=>'default'),
77 77
 		//Range Search Support 
78
-	    'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
-	    'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
80
-	    'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
81
-	    'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
82
-	    'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
83
-        'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
78
+	    'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
+	    'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
80
+	    'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
81
+	    'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
82
+	    'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
83
+        'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
84 84
 	    //Range Search Support 			
85 85
 	);
86 86
 ?>
Please login to merge, or discard this patch.
modules/Opportunities/metadata/SearchFields.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -40,48 +40,48 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Opportunities";
42 42
 $searchFields['Opportunities'] = 
43
-	array (
44
-		'name' => array( 'query_type'=>'default'),
45
-		'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
46
-		'amount'=> array('query_type'=>'default'),
47
-		'next_step'=> array('query_type'=>'default'),
48
-		'probability'=> array('query_type'=>'default'),
49
-		'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50
-		'opportunity_type'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'opportunity_type_dom', 'template_var' => 'TYPE_OPTIONS'),
51
-		'sales_stage'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'sales_stage_dom', 'template_var' => 'SALES_STAGE_OPTIONS', 'options_add_blank' => true),
52
-		'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
53
-		'assigned_user_id'=> array('query_type'=>'default'),
54
-		'open_only' => array(
55
-			'query_type'=>'default',
56
-			'db_field'=>array('sales_stage'),
57
-			'operator'=>'not in',
58
-			'closed_values' => array('Closed Won', 'Closed Lost'),
59
-			'type'=>'bool',
60
-		),
43
+    array (
44
+        'name' => array( 'query_type'=>'default'),
45
+        'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
46
+        'amount'=> array('query_type'=>'default'),
47
+        'next_step'=> array('query_type'=>'default'),
48
+        'probability'=> array('query_type'=>'default'),
49
+        'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50
+        'opportunity_type'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'opportunity_type_dom', 'template_var' => 'TYPE_OPTIONS'),
51
+        'sales_stage'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'sales_stage_dom', 'template_var' => 'SALES_STAGE_OPTIONS', 'options_add_blank' => true),
52
+        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
53
+        'assigned_user_id'=> array('query_type'=>'default'),
54
+        'open_only' => array(
55
+            'query_type'=>'default',
56
+            'db_field'=>array('sales_stage'),
57
+            'operator'=>'not in',
58
+            'closed_values' => array('Closed Won', 'Closed Lost'),
59
+            'type'=>'bool',
60
+        ),
61 61
         'favorites_only' => array(
62 62
             'query_type'=>'format',
63 63
             'operator' => 'subquery',
64
-			'subquery' => "SELECT favorites.parent_id FROM favorites
64
+            'subquery' => "SELECT favorites.parent_id FROM favorites
65 65
 			                    WHERE favorites.deleted = 0
66 66
 			                        and favorites.parent_type = '".$module_name."'
67 67
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
68 68
             'db_field'=>array('id')),
69 69
 
70
-		//Range Search Support 
71
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
72
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
73
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
75
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
76
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
70
+        //Range Search Support 
71
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
72
+        'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
73
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
75
+        'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
76
+        'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
77 77
 	   
78
-       'range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
-	   'start_range_date_closed' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
80
-       'end_range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
78
+        'range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
+        'start_range_date_closed' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
80
+        'end_range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
81 81
 
82
-       'range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
83
-	   'start_range_amount' => array ('query_type' => 'default',  'enable_range_search' => true),
84
-       'end_range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
85
-		//Range Search Support 			
86
-	);
82
+        'range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
83
+        'start_range_amount' => array ('query_type' => 'default',  'enable_range_search' => true),
84
+        'end_range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
85
+        //Range Search Support 			
86
+    );
87 87
 ?>
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Opportunities";
42 42
 $searchFields['Opportunities'] = 
43
-	array (
44
-		'name' => array( 'query_type'=>'default'),
45
-		'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
43
+	array(
44
+		'name' => array('query_type'=>'default'),
45
+		'account_name'=> array('query_type'=>'default', 'db_field'=>array('accounts.name')),
46 46
 		'amount'=> array('query_type'=>'default'),
47 47
 		'next_step'=> array('query_type'=>'default'),
48 48
 		'probability'=> array('query_type'=>'default'),
49 49
 		'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50 50
 		'opportunity_type'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'opportunity_type_dom', 'template_var' => 'TYPE_OPTIONS'),
51 51
 		'sales_stage'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'sales_stage_dom', 'template_var' => 'SALES_STAGE_OPTIONS', 'options_add_blank' => true),
52
-		'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
52
+		'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
53 53
 		'assigned_user_id'=> array('query_type'=>'default'),
54 54
 		'open_only' => array(
55 55
 			'query_type'=>'default',
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 			'subquery' => "SELECT favorites.parent_id FROM favorites
65 65
 			                    WHERE favorites.deleted = 0
66 66
 			                        and favorites.parent_type = '".$module_name."'
67
-			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
67
+			                        and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}",
68 68
             'db_field'=>array('id')),
69 69
 
70 70
 		//Range Search Support 
71
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
72
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
73
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
75
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
76
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
71
+	   'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
72
+	   'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
73
+	   'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
+	   'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
75
+	   'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
76
+       'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
77 77
 	   
78
-       'range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
-	   'start_range_date_closed' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
80
-       'end_range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
78
+       'range_date_closed' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
+	   'start_range_date_closed' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
80
+       'end_range_date_closed' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
81 81
 
82
-       'range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
83
-	   'start_range_amount' => array ('query_type' => 'default',  'enable_range_search' => true),
84
-       'end_range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
82
+       'range_amount' => array('query_type' => 'default', 'enable_range_search' => true),
83
+	   'start_range_amount' => array('query_type' => 'default', 'enable_range_search' => true),
84
+       'end_range_amount' => array('query_type' => 'default', 'enable_range_search' => true),
85 85
 		//Range Search Support 			
86 86
 	);
87 87
 ?>
Please login to merge, or discard this patch.
modules/Campaigns/WizardNewsletter.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 /*************** GENERAL SETUP WORK **********/
65 65
 
66 66
 $focus = new Campaign();
67
-if(isset($_REQUEST['record'])) {
67
+if (isset($_REQUEST['record'])) {
68 68
     $focus->retrieve($_REQUEST['record']);
69 69
 }
70
-if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
70
+if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
71 71
     $focus->id = "";
72 72
 }
73 73
 global $theme;
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
 $GLOBALS['log']->info("Campaign NewsLetter Wizard");
80 80
 
81
-if( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==1)  ||  ($focus->campaign_type=='NewsLetter')){
81
+if ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1) || ($focus->campaign_type == 'NewsLetter')) {
82 82
     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_NEWSLETTER WIZARD_TITLE'].$focus->name), true, false);
83
-}else{
83
+} else {
84 84
     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_CAMPAIGN'].$focus->name), true, false);   
85 85
 }
86 86
 
@@ -104,26 +104,26 @@  discard block
 block discarded – undo
104 104
 $sqs_objects = array('parent_name' => $qsd->getQSParent(), 
105 105
                     'assigned_user_name' => $qsd->getQSUser(),
106 106
                     //'prospect_list_name' => getProspectListQSObjects(),
107
-                    'test_name' => getProspectListQSObjects('prospect_list_type_test', 'test_name','wiz_step3_test_name_id'),
108
-                    'unsubscription_name' => getProspectListQSObjects('prospect_list_type_exempt', 'unsubscription_name','wiz_step3_unsubscription_name_id'),
109
-                    'subscription_name' => getProspectListQSObjects('prospect_list_type_default', 'subscription_name','wiz_step3_subscription_name_id'),
107
+                    'test_name' => getProspectListQSObjects('prospect_list_type_test', 'test_name', 'wiz_step3_test_name_id'),
108
+                    'unsubscription_name' => getProspectListQSObjects('prospect_list_type_exempt', 'unsubscription_name', 'wiz_step3_unsubscription_name_id'),
109
+                    'subscription_name' => getProspectListQSObjects('prospect_list_type_default', 'subscription_name', 'wiz_step3_subscription_name_id'),
110 110
                     );
111 111
                     
112 112
 
113
-$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
113
+$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = '.$json->encode($sqs_objects).'</script>';
114 114
 
115 115
 $ss->assign("JAVASCRIPT", $quicksearch_js);
116 116
 
117 117
 
118 118
 //set the campaign type based on wizardtype value from request object
119 119
 $campaign_type = 'newsletter';
120
-if( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==1)  ||  ($focus->campaign_type=='NewsLetter')){
120
+if ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1) || ($focus->campaign_type == 'NewsLetter')) {
121 121
     $campaign_type = 'newsletter';
122 122
     $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());    
123
-}elseif( (isset($_REQUEST['wizardtype'])  && $_REQUEST['wizardtype']==2)  || ($focus->campaign_type=='Email') ){
123
+}elseif ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 2) || ($focus->campaign_type == 'Email')) {
124 124
     $campaign_type = 'email';
125 125
     $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
126
-}else{
126
+} else {
127 127
     $campaign_type = 'general';
128 128
 }
129 129
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 //set default values
145 145
 $ss->assign("CALENDAR_LANG", "en");
146
-$ss->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')');
146
+$ss->assign("USER_DATEFORMAT", '('.$timedate->get_user_date_format().')');
147 147
 $ss->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
148 148
 $ss->assign("CAMP_DATE_ENTERED", $focus->date_entered);
149 149
 $ss->assign("CAMP_DATE_MODIFIED", $focus->date_modified);
@@ -170,50 +170,50 @@  discard block
 block discarded – undo
170 170
 
171 171
 $focus->list_view_parse_additional_sections($ss);
172 172
 
173
-$ss->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
173
+$ss->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
174 174
 
175
-if((!isset($focus->status)) && (!isset($focus->id)))
175
+if ((!isset($focus->status)) && (!isset($focus->id)))
176 176
     $ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], 'Planning'));
177 177
 else
178 178
     $ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], $focus->status));
179 179
 
180 180
 //hide frequency options if this is not a newsletter
181
-if($campaign_type == 'newsletter'){
181
+if ($campaign_type == 'newsletter') {
182 182
     $ss->assign("HIDE_FREQUENCY_IF_NEWSLETTER", "Select");
183 183
     $ss->assign("FREQUENCY_LABEL", $mod_strings['LBL_CAMPAIGN_FREQUENCY']);
184
-    if((!isset($focus->frequency)) && (!isset($focus->id))){
184
+    if ((!isset($focus->frequency)) && (!isset($focus->id))) {
185 185
         $ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], 'Monthly'));
186
-    }else{
186
+    } else {
187 187
         $ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], $focus->frequency));
188 188
     }
189
-}else{
189
+} else {
190 190
     $ss->assign("HIDE_FREQUENCY_IF_NEWSLETTER", "input type='hidden'");
191 191
     $ss->assign("FREQUENCY_LABEL", '&nbsp;');
192 192
 }
193 193
 global $current_user;
194 194
 require_once('modules/Currencies/ListCurrency.php');
195 195
 $currency = new ListCurrency();
196
-if(isset($focus->currency_id) && !empty($focus->currency_id)){
196
+if (isset($focus->currency_id) && !empty($focus->currency_id)) {
197 197
     $selectCurrency = $currency->getSelectOptions($focus->currency_id);
198 198
     $ss->assign("CURRENCY", $selectCurrency);
199 199
 }
200
-else if($current_user->getPreference('currency') && !isset($focus->id))
200
+else if ($current_user->getPreference('currency') && !isset($focus->id))
201 201
 {
202 202
     $selectCurrency = $currency->getSelectOptions($current_user->getPreference('currency'));
203 203
     $ss->assign("CURRENCY", $selectCurrency);
204
-}else{
204
+} else {
205 205
 
206 206
     $selectCurrency = $currency->getSelectOptions();
207 207
     $ss->assign("CURRENCY", $selectCurrency);
208 208
 
209 209
 }
210 210
 global $current_user;
211
-if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){  
211
+if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {  
212 212
     $record = '';
213
-    if(!empty($_REQUEST['record'])){
214
-        $record =   $_REQUEST['record'];
213
+    if (!empty($_REQUEST['record'])) {
214
+        $record = $_REQUEST['record'];
215 215
     }
216
-    $ss->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$record. "'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDIT_LAYOUT'])."</a>");
216
+    $ss->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action']."&from_module=".$_REQUEST['module']."&record=".$record."'>".SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT'])."</a>");
217 217
 
218 218
 }
219 219
 
@@ -226,55 +226,55 @@  discard block
 block discarded – undo
226 226
 
227 227
 //fill out the campaign type dropdown based on type of campaign being created
228 228
 $ss->assign("campaign_type", $campaign_type);
229
-if($campaign_type == 'general'){
229
+if ($campaign_type == 'general') {
230 230
     //get regular campaign dom object and strip out entries for email and newsletter
231 231
     $myTypeOptionsArr = array();
232 232
     $OptionsArr = $app_list_strings['campaign_type_dom'];
233
-    foreach($OptionsArr as $key=>$val){
234
-        if($val =='Newsletter' || $val =='Email' || $val =='' ){
233
+    foreach ($OptionsArr as $key=>$val) {
234
+        if ($val == 'Newsletter' || $val == 'Email' || $val == '') {
235 235
             //do not add   
236
-        }else{
236
+        } else {
237 237
             $myTypeOptionsArr[$key] = $val;
238 238
         }
239 239
     }
240 240
     
241 241
     //now create select option html without the newsletter/email, or blank ('') options
242
-    $type_option_html =' ';
242
+    $type_option_html = ' ';
243 243
     $selected = false;
244
-    foreach($myTypeOptionsArr as $optionKey=>$optionName){
244
+    foreach ($myTypeOptionsArr as $optionKey=>$optionName) {
245 245
         //if the selected flag is set to true, then just populate
246
-        if($selected){
247
-            $type_option_html .="<option value='$optionKey' >$optionName</option>";
248
-        }else{//if not selected yet, check to see if this option should be selected
246
+        if ($selected) {
247
+            $type_option_html .= "<option value='$optionKey' >$optionName</option>";
248
+        } else {//if not selected yet, check to see if this option should be selected
249 249
             //if the campaign type is not empty, then select the retrieved type
250
-            if(!empty($focus->campaign_type)){
250
+            if (!empty($focus->campaign_type)) {
251 251
                 //check to see if key matches campaign type
252
-                if($optionKey == $focus->campaign_type){
252
+                if ($optionKey == $focus->campaign_type) {
253 253
                     //mark as selected
254
-                    $type_option_html .="<option value='$optionKey' selected>$optionName</option>";
254
+                    $type_option_html .= "<option value='$optionKey' selected>$optionName</option>";
255 255
                     //mark as selected for next time
256
-                    $selected=true;
257
-                }else{
256
+                    $selected = true;
257
+                } else {
258 258
                     //key does not match, just populate
259
-                    $type_option_html .="<option value='$optionKey' >$optionName</option>";
259
+                    $type_option_html .= "<option value='$optionKey' >$optionName</option>";
260 260
                 }
261
-            }else{
261
+            } else {
262 262
             //since the campaign type is empty, then select first one                
263
-                $type_option_html .="<option value='$optionKey' selected>$optionName</option>";    
263
+                $type_option_html .= "<option value='$optionKey' selected>$optionName</option>";    
264 264
                 //mark as selected for next time
265
-                $selected=true;
265
+                $selected = true;
266 266
             }
267 267
         }    
268 268
     }
269 269
     //assign the modified dropdown for general campaign creation
270 270
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $type_option_html);
271 271
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "select");    
272
-}elseif($campaign_type == 'email'){
272
+}elseif ($campaign_type == 'email') {
273 273
     //Assign Email as type of campaign being created an disable the select widget
274 274
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_EMAIL']);
275 275
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='Email'");
276 276
     $ss->assign("HIDE_CAMPAIGN_TYPE", true);
277
-}else{
277
+} else {
278 278
     //Assign NewsLetter as type of campaign being created an disable the select widget
279 279
     $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_NEWSLETTER']);
280 280
     $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='NewsLetter'");
@@ -291,33 +291,33 @@  discard block
 block discarded – undo
291 291
 $focus->load_relationship('tracked_urls');
292 292
 
293 293
 $trkr_lists = $focus->tracked_urls->get();
294
-$trkr_html ='';    
295
-$ss->assign('TRACKER_COUNT',count($trkr_lists));
296
-if(count($trkr_lists)>0){
294
+$trkr_html = '';    
295
+$ss->assign('TRACKER_COUNT', count($trkr_lists));
296
+if (count($trkr_lists) > 0) {
297 297
 global $odd_bg, $even_bg, $hilite_bg;
298 298
     
299 299
     $trkr_count = 0;
300 300
 //create the html to create tracker table
301
-    foreach($trkr_lists as $trkr_id){
301
+    foreach ($trkr_lists as $trkr_id) {
302 302
         $ct_focus = new CampaignTracker();
303 303
         $ct_focus->retrieve($trkr_id);
304
-      if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
305
-            if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
306
-            $trkr_html .= "<div id='existing_trkr".$trkr_count."'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>" ;
307
-            $trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout".$trkr_count."' title='".$mod_strings['LBL_EDIT_OPT_OUT'] . $trkr_count ."' id='existing_is_optout". $trkr_count ."' class='checkbox' type='checkbox' $opt  /><input name='wiz_step3_id".$trkr_count."' value='".$ct_focus->id."' id='existing_tracker_id". $trkr_count ."'type='hidden''/></td>";
308
-            $trkr_html .= "<td width='40%'> <input id='existing_tracker_name". $trkr_count ."' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name". $trkr_count ."' title='".$mod_strings['LBL_EDIT_TRACKER_NAME']. $trkr_count ."' value='".$ct_focus->tracker_name."' ></td>";
309
-            $trkr_html .= "<td width='40%'><input type='text' size='60' maxlength='255' name='wiz_step3_tracker_url". $trkr_count ."' title='".$mod_strings['LBL_EDIT_TRACKER_URL']. $trkr_count ."' id='existing_tracker_url". $trkr_count ."' value='".$ct_focus->tracker_url."' ></td>";
304
+      if (isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)) {
305
+            if ($ct_focus->is_optout) {$opt = 'checked'; } else {$opt = ''; }
306
+            $trkr_html .= "<div id='existing_trkr".$trkr_count."'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>";
307
+            $trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout".$trkr_count."' title='".$mod_strings['LBL_EDIT_OPT_OUT'].$trkr_count."' id='existing_is_optout".$trkr_count."' class='checkbox' type='checkbox' $opt  /><input name='wiz_step3_id".$trkr_count."' value='".$ct_focus->id."' id='existing_tracker_id".$trkr_count."'type='hidden''/></td>";
308
+            $trkr_html .= "<td width='40%'> <input id='existing_tracker_name".$trkr_count."' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name".$trkr_count."' title='".$mod_strings['LBL_EDIT_TRACKER_NAME'].$trkr_count."' value='".$ct_focus->tracker_name."' ></td>";
309
+            $trkr_html .= "<td width='40%'><input type='text' size='60' maxlength='255' name='wiz_step3_tracker_url".$trkr_count."' title='".$mod_strings['LBL_EDIT_TRACKER_URL'].$trkr_count."' id='existing_tracker_url".$trkr_count."' value='".$ct_focus->tracker_url."' ></td>";
310 310
             $trkr_html .= "<td><a href='#' onclick=\"javascript:remove_existing_tracker('existing_trkr".$trkr_count."','".$ct_focus->id."'); \" >  ";
311 311
             $trkr_html .= SugarThemeRegistry::current()->getImage('delete_inline', "border='0'  align='absmiddle'", 12, 12, ".gif", $mod_strings['LBL_DELETE'])."</a></td></tr></table></div>";
312 312
 
313 313
 
314 314
 
315 315
       }
316
-      $trkr_count =$trkr_count+1;
316
+      $trkr_count = $trkr_count + 1;
317 317
     }
318 318
     
319 319
     $trkr_html .= "<div id='no_trackers'></div>";
320
-    }else{
320
+    } else {
321 321
         $trkr_html .= "<div id='no_trackers'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
322 322
     }
323 323
     $ss->assign('EXISTING_TRACKERS', $trkr_html);
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 $targetList = BeanFactory::getBean('ProspectLists')->get_full_list();
397 397
 
398 398
 $targetListData = array();
399
-foreach($targetList as $prospectLst) {
399
+foreach ($targetList as $prospectLst) {
400 400
     $nxt = array(
401 401
         'id' => $prospectLst->id,
402 402
         'name' => $prospectLst->name,
@@ -425,29 +425,29 @@  discard block
 block discarded – undo
425 425
 
426 426
 $prospect_lists = $focus->prospectlists->get();
427 427
 
428
-if((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] ==1) || ($focus->campaign_type=='NewsLetter')){
428
+if ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1) || ($focus->campaign_type == 'NewsLetter')) {
429 429
  //this is a newsletter type campaign, fill in subscription values   
430 430
 
431 431
 //if prospect lists are returned, then iterate through and populate form values
432
-if(count($prospect_lists)>0){
432
+if (count($prospect_lists) > 0) {
433 433
     
434
-    foreach($prospect_lists as $pl_id){
434
+    foreach ($prospect_lists as $pl_id) {
435 435
     //retrieve prospect list
436 436
      $pl = new ProspectList();   
437 437
      $pl->retrieve($pl_id);
438 438
 
439
-      if(isset($pl->list_type) && !empty($pl->list_type)){
439
+      if (isset($pl->list_type) && !empty($pl->list_type)) {
440 440
          //assign values based on type
441
-         if(($pl->list_type == 'default') || ($pl->list_type == 'seed')){            
441
+         if (($pl->list_type == 'default') || ($pl->list_type == 'seed')) {            
442 442
             $ss->assign('SUBSCRIPTION_ID', $pl->id);
443 443
             $ss->assign('SUBSCRIPTION_NAME', $pl->name);
444 444
          };
445
-         if($pl->list_type == 'exempt'){
445
+         if ($pl->list_type == 'exempt') {
446 446
             $ss->assign('UNSUBSCRIPTION_ID', $pl->id);
447 447
             $ss->assign('UNSUBSCRIPTION_NAME', $pl->name);
448 448
          
449 449
          };
450
-         if($pl->list_type == 'test'){
450
+         if ($pl->list_type == 'test') {
451 451
             $ss->assign('TEST_ID', $pl->id);
452 452
             $ss->assign('TEST_NAME', $pl->name);
453 453
          
@@ -459,73 +459,73 @@  discard block
 block discarded – undo
459 459
 
460 460
 
461 461
 
462
-}else{
462
+} else {
463 463
     //this is not a newlsetter campaign, so fill in target list table
464 464
     //create array for javascript, this will help to display the option text, not the value
465
-    $dom_txt =' ';
466
-    foreach($app_list_strings['prospect_list_type_dom'] as $key=>$val){
467
-        $dom_txt .="if(trgt_type_text =='$key'){trgt_type_text='$val';}";
465
+    $dom_txt = ' ';
466
+    foreach ($app_list_strings['prospect_list_type_dom'] as $key=>$val) {
467
+        $dom_txt .= "if(trgt_type_text =='$key'){trgt_type_text='$val';}";
468 468
     }
469 469
     $ss->assign("PL_DOM_STMT", $dom_txt);
470 470
     $trgt_count = 0;
471 471
     $trgt_html = ' ';
472
-    if(count($prospect_lists)>0){
472
+    if (count($prospect_lists) > 0) {
473 473
 
474
-        foreach($prospect_lists as $pl_id){
474
+        foreach ($prospect_lists as $pl_id) {
475 475
             //retrieve prospect list
476 476
             $pl = new ProspectList();
477 477
             $pl_focus = $pl->retrieve($pl_id);
478
-            $trgt_html .= "<div id='existing_trgt".$trgt_count."'> <table class='tabDetailViewDL2' width='100%'>" ;
479
-            $trgt_html .= "<td width='100' style=\"width:25%\"> <input id='existing_target_name". $trgt_count ."' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name". $trgt_count ."'  value='". $pl_focus->name."' ><a href=\"index.php?module=ProspectLists&action=DetailView&record=" . $pl_focus->id . "\" target=\"_blank\" title=\"" . $mod_strings['LBL_OPEN_IN_NEW_WINDOW'] . "\">". $pl_focus->name."</a></td>";
478
+            $trgt_html .= "<div id='existing_trgt".$trgt_count."'> <table class='tabDetailViewDL2' width='100%'>";
479
+            $trgt_html .= "<td width='100' style=\"width:25%\"> <input id='existing_target_name".$trgt_count."' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name".$trgt_count."'  value='".$pl_focus->name."' ><a href=\"index.php?module=ProspectLists&action=DetailView&record=".$pl_focus->id."\" target=\"_blank\" title=\"".$mod_strings['LBL_OPEN_IN_NEW_WINDOW']."\">".$pl_focus->name."</a></td>";
480 480
             $trgt_html .= "<td width='100' style=\"width:25%\">".$pl_focus->get_entry_count()."</td>";
481
-            $trgt_html .= "<td width='100' style=\"width:25%\"><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type". $trgt_count ."'   id='existing_tracker_list_type". $trgt_count ."' value='".$pl_focus->list_type."' >".$app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
482
-            $trgt_html .= "<input type='hidden' name='added_target_id". $trgt_count ."' id='added_target_id". $trgt_count ."' value='". $pl_focus->id ."' ></td>";
481
+            $trgt_html .= "<td width='100' style=\"width:25%\"><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type".$trgt_count."'   id='existing_tracker_list_type".$trgt_count."' value='".$pl_focus->list_type."' >".$app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
482
+            $trgt_html .= "<input type='hidden' name='added_target_id".$trgt_count."' id='added_target_id".$trgt_count."' value='".$pl_focus->id."' ></td>";
483 483
             $trgt_html .= "<td width='100' style=\"width:25%\"><a href='#' onclick=\"javascript:remove_existing_target('existing_trgt".$trgt_count."','".$pl_focus->id."'); \" >  ";
484 484
             $trgt_html .= SugarThemeRegistry::current()->getImage('delete_inline', "border='0' align='absmiddle'", 12, 12, ".gif", $mod_strings['LBL_DELETE'])."</a></td></tr></table></div>";
485 485
 
486
-            $trgt_count =$trgt_count +1;
486
+            $trgt_count = $trgt_count + 1;
487 487
         }
488 488
 
489 489
         $trgt_html  .= "<div id='no_targets'></div>";
490
-    }else{
490
+    } else {
491 491
         $trgt_html  .= "<div id='no_targets'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
492 492
 
493 493
     }
494
-    $ss->assign('EXISTING_TARGETS', $trgt_html );
494
+    $ss->assign('EXISTING_TARGETS', $trgt_html);
495 495
 
496 496
 }
497 497
 
498 498
     
499 499
 /**************************** WIZARD UI DIV Stuff *******************/
500 500
 $mrkt_string = $mod_strings['LBL_NAVIGATION_MENU_MARKETING'];
501
-if(!empty($focus->id)){
501
+if (!empty($focus->id)) {
502 502
     $mrkt_url = "<a  href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
503 503
     $mrkt_url .= "&return_id=".$focus->id."&campaign_id=".$focus->id;
504
-    $mrkt_url .= "'>". $mrkt_string."</a>";
504
+    $mrkt_url .= "'>".$mrkt_string."</a>";
505 505
     $mrkt_string = $mrkt_url;
506 506
 }
507 507
     $summ_url = $mod_strings['LBL_NAVIGATION_MENU_SUMMARY'];
508
-    if(!empty($focus->id)){
508
+    if (!empty($focus->id)) {
509 509
         $summ_url = "<a  href='index.php?action=WizardHome&module=Campaigns";
510 510
         $summ_url .= "&return_id=".$focus->id."&record=".$focus->id;
511
-        $summ_url .= "'> ". $mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";
511
+        $summ_url .= "'> ".$mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";
512 512
     } 
513 513
    
514 514
 
515 515
 
516
-$script_to_call ='';
517
-    if (!empty($focus->id)){
516
+$script_to_call = '';
517
+    if (!empty($focus->id)) {
518 518
         $maxStep = 2;
519 519
         $script_to_call = "link_navs(1, {$maxStep});";
520
-        if(isset($_REQUEST['direct_step']) and !empty($_REQUEST['direct_step'])){
521
-            $directStep = (int) $_REQUEST['direct_step'];
522
-            if($directStep < 1) {
520
+        if (isset($_REQUEST['direct_step']) and !empty($_REQUEST['direct_step'])) {
521
+            $directStep = (int)$_REQUEST['direct_step'];
522
+            if ($directStep < 1) {
523 523
                 $directStep = 1;
524 524
             }
525
-            if($directStep > $maxStep) {
525
+            if ($directStep > $maxStep) {
526 526
                 $directStep = $maxStep;
527 527
             }
528
-            $script_to_call .='   direct(' . $directStep . ');';
528
+            $script_to_call .= '   direct('.$directStep.');';
529 529
         }
530 530
     } 
531 531
     $ss->assign("HILITE_ALL", $script_to_call);
@@ -565,56 +565,56 @@  discard block
 block discarded – undo
565 565
 
566 566
 //Create the html to fill in the wizard steps
567 567
 
568
-if($campaign_type == 'general'){
568
+if ($campaign_type == 'general') {
569 569
     $steps = create_campaign_steps();
570 570
 
571
-    foreach($steps as $key => $step) {
571
+    foreach ($steps as $key => $step) {
572 572
         $_steps[$key] = false;
573 573
     }
574
-    $ss->assign('NAV_ITEMS',create_wiz_menu_items($_steps,'campaign',$mrkt_string,$summ_url, 'dotlist'));
575
-    $ss->assign('HIDE_CONTINUE','hidden');
574
+    $ss->assign('NAV_ITEMS', create_wiz_menu_items($_steps, 'campaign', $mrkt_string, $summ_url, 'dotlist'));
575
+    $ss->assign('HIDE_CONTINUE', 'hidden');
576 576
 
577
-}elseif($campaign_type == 'email'){
577
+}elseif ($campaign_type == 'email') {
578 578
     $steps = create_email_steps();
579
-    if($focus->id) {
580
-        $summ_url = "index.php?action=WizardHome&module=Campaigns&return_id=" . $focus->id . "&record=" . $focus->id;
579
+    if ($focus->id) {
580
+        $summ_url = "index.php?action=WizardHome&module=Campaigns&return_id=".$focus->id."&record=".$focus->id;
581 581
     }
582 582
     else {
583 583
         $summ_url = false;
584 584
     }
585
-    foreach($steps as $key => $step) {
585
+    foreach ($steps as $key => $step) {
586 586
         $_steps[$key] = false;
587 587
     }
588 588
     $campaign_id = $focus->id;
589 589
     $marketing_id = isset($_REQUEST['marketing_id']) && $_REQUEST['marketing_id'] ? $_REQUEST['marketing_id'] : null;
590 590
     $template_id = isset($_REQUEST['template_id']) && $_REQUEST['template_id'] ? $_REQUEST['template_id'] : null;
591
-    $ss->assign('NAV_ITEMS',create_wiz_menu_items($_steps,'email',$mrkt_string,$summ_url, 'dotlist', $campaign_id, $marketing_id, $template_id));
592
-    $ss->assign('HIDE_CONTINUE','submit');
593
-}else{
591
+    $ss->assign('NAV_ITEMS', create_wiz_menu_items($_steps, 'email', $mrkt_string, $summ_url, 'dotlist', $campaign_id, $marketing_id, $template_id));
592
+    $ss->assign('HIDE_CONTINUE', 'submit');
593
+} else {
594 594
     $steps = create_newsletter_steps();
595 595
 
596
-    if($focus->id) {
597
-        $summ_url = "index.php?action=WizardHome&module=Campaigns&return_id=" . $focus->id . "&record=" . $focus->id;
596
+    if ($focus->id) {
597
+        $summ_url = "index.php?action=WizardHome&module=Campaigns&return_id=".$focus->id."&record=".$focus->id;
598 598
     }
599 599
     else {
600 600
         $summ_url = false;
601 601
     }
602
-    foreach($steps as $key => $step) {
602
+    foreach ($steps as $key => $step) {
603 603
         $_steps[$key] = false;
604 604
     }
605
-    $ss->assign('NAV_ITEMS',create_wiz_menu_items($_steps,'newsletter',$mrkt_string,$summ_url, 'dotlist'));
606
-    $ss->assign('HIDE_CONTINUE','submit');
605
+    $ss->assign('NAV_ITEMS', create_wiz_menu_items($_steps, 'newsletter', $mrkt_string, $summ_url, 'dotlist'));
606
+    $ss->assign('HIDE_CONTINUE', 'submit');
607 607
 }
608 608
 
609 609
 $ss->assign('TOTAL_STEPS', count($steps));
610
-$sshtml = create_wiz_step_divs($steps,$ss);
611
-$ss->assign('STEPS',$sshtml);
610
+$sshtml = create_wiz_step_divs($steps, $ss);
611
+$ss->assign('STEPS', $sshtml);
612 612
      	   	
613 613
 
614 614
 /**************************** FINAL END OF PAGE UI Stuff *******************/
615 615
 
616
-if(isset($_REQUEST['wizardtype'])) {
617
-    switch($_REQUEST['wizardtype']) {
616
+if (isset($_REQUEST['wizardtype'])) {
617
+    switch ($_REQUEST['wizardtype']) {
618 618
         case '1':
619 619
             $ss->assign('campaign_type', 'NewsLetter');
620 620
             break;
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
 
630 630
 $ss->display(file_exists('custom/modules/Campaigns/tpls/WizardNewsletter.tpl') ? 'custom/modules/Campaigns/tpls/WizardNewsletter.tpl' : 'modules/Campaigns/tpls/WizardNewsletter.tpl');
631 631
 
632
-if(!$focus->id) {
632
+if (!$focus->id) {
633 633
     unset($_SESSION['campaignWizard'][$campaign_id]['defaultSelectedMarketingId']);
634 634
 }
635 635
 
636 636
 
637
-function create_newsletter_steps(){
637
+function create_newsletter_steps() {
638 638
     global $mod_strings;
639 639
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
640 640
     //$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl' : 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
@@ -643,54 +643,54 @@  discard block
 block discarded – undo
643 643
     return  $steps;
644 644
 }
645 645
 
646
-function create_campaign_steps(){
646
+function create_campaign_steps() {
647 647
     global $mod_strings;
648 648
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
649 649
     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl' : 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
650
-    $steps[$mod_strings['LBL_TARGET_LISTS']]                   = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
650
+    $steps[$mod_strings['LBL_TARGET_LISTS']] = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
651 651
     return  $steps;
652 652
 }
653 653
 
654
-function create_email_steps(){
654
+function create_email_steps() {
655 655
     global $mod_strings;
656
-    $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
656
+    $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']] = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
657 657
     //$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl' : 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
658 658
     //$steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']]      = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTracker.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTracker.tpl' : 'modules/Campaigns/tpls/WizardCampaignTracker.tpl';
659
-    $steps[$mod_strings['LBL_TARGET_LISTS']]                   = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
659
+    $steps[$mod_strings['LBL_TARGET_LISTS']] = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
660 660
     return  $steps;
661 661
 }
662 662
 
663 663
 
664
-function create_wiz_step_divs($steps,$ss){
664
+function create_wiz_step_divs($steps, $ss) {
665 665
     $step_html = '';
666
-    if(isset($steps)  && !empty($steps)){
667
-        $i=1;
668
-        foreach($steps as $name=>$step){
669
-            $step_html .="<p><div id='step$i'>";
666
+    if (isset($steps) && !empty($steps)) {
667
+        $i = 1;
668
+        foreach ($steps as $name=>$step) {
669
+            $step_html .= "<p><div id='step$i'>";
670 670
             $step_html .= $ss->fetch($step);
671
-            $step_html .="</div></p>";
672
-            $i = $i+1;
671
+            $step_html .= "</div></p>";
672
+            $i = $i + 1;
673 673
         }    
674 674
     }
675 675
     return $step_html;
676 676
 }
677 677
 
678
-function create_wiz_menu_items($steps,$type,$mrkt_string,$summ_url, $view = null, $campaign_id = null, $marketing_id = null, $template_id = null){
678
+function create_wiz_menu_items($steps, $type, $mrkt_string, $summ_url, $view = null, $campaign_id = null, $marketing_id = null, $template_id = null) {
679 679
 
680 680
     global $mod_strings;
681 681
 
682 682
 
683
-    if($view == 'dotlist') {
683
+    if ($view == 'dotlist') {
684 684
 
685 685
         include_once 'modules/Campaigns/DotListWizardMenu.php';
686 686
 
687
-        if($type!='campaign') {
687
+        if ($type != 'campaign') {
688 688
             $templateURLForProgressBar = false;
689 689
             if ($campaign_id && $marketing_id && $template_id) {
690 690
                 $templateURLForProgressBar = "index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome&return_id={$campaign_id}&campaign_id={$campaign_id}&jump=2&marketing_id={$marketing_id}&record={$marketing_id}&campaign_type=Email&template_id={$template_id}";
691 691
             }
692 692
 
693
-            if(preg_match('/\bhref=\'([^\']*)/', $mrkt_string, $matches)) {
693
+            if (preg_match('/\bhref=\'([^\']*)/', $mrkt_string, $matches)) {
694 694
                 $templateURLForProgressBar = $matches[1];
695 695
             }
696 696
 
@@ -700,8 +700,8 @@  discard block
 block discarded – undo
700 700
         if ($type == 'newsletter' || $type == 'email') {
701 701
 
702 702
             preg_match('/\bhref=\'([^\']*)/', $mrkt_string, $matches);
703
-            if(isset($matches[1])) {
704
-                $marketingLink = $matches[1] . ($matches[1] ? '&jump=2' : false);
703
+            if (isset($matches[1])) {
704
+                $marketingLink = $matches[1].($matches[1] ? '&jump=2' : false);
705 705
             }
706 706
             else {
707 707
                 $marketingLink = false;
@@ -719,19 +719,19 @@  discard block
 block discarded – undo
719 719
     }
720 720
     else {
721 721
         $nav_html = '<table border="0" cellspacing="0" cellpadding="0" width="100%" >';
722
-        if(isset($steps)  && !empty($steps)){
723
-            $i=1;
724
-            foreach($steps as $name=>$step){
722
+        if (isset($steps) && !empty($steps)) {
723
+            $i = 1;
724
+            foreach ($steps as $name=>$step) {
725 725
                 $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step$i'>$name</div></td></tr>";
726
-                $i=$i+1;
726
+                $i = $i + 1;
727 727
             }
728 728
         }
729
-        if($type == 'newsletter'  ||  $type == 'email'){
730
-            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">$mrkt_string</div></td></tr>";
731
-            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></li>";
732
-            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
733
-        }else{
734
-            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";
729
+        if ($type == 'newsletter' || $type == 'email') {
730
+            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 1).">$mrkt_string</div></td></tr>";
731
+            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></li>";
732
+            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 3).">".$summ_url."</div></td></tr>";
733
+        } else {
734
+            $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i + 1).">".$summ_url."</div></td></tr>";
735 735
         }
736 736
 
737 737
         $nav_html .= '</table>';
Please login to merge, or discard this patch.
modules/AOR_Reports/AOR_Report.php 1 patch
Spacing   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	var $object_name = 'AOR_Report';
45 45
 	var $table_name = 'aor_reports';
46 46
 	var $importable = true;
47
-	var $disable_row_level_security = true ;
47
+	var $disable_row_level_security = true;
48 48
 
49 49
 	var $id;
50 50
 	var $name;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	var $assigned_user_link;
64 64
 	var $report_module;
65 65
 
66
-	function __construct(){
66
+	function __construct() {
67 67
 		parent::__construct();
68 68
         $this->load_report_beans();
69 69
         require_once('modules/AOW_WorkFlow/aow_utils.php');
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
75 75
      */
76
-    function AOR_Report(){
76
+    function AOR_Report() {
77 77
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
78
-        if(isset($GLOBALS['log'])) {
78
+        if (isset($GLOBALS['log'])) {
79 79
             $GLOBALS['log']->deprecated($deprecatedMessage);
80 80
         }
81 81
         else {
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
     }
86 86
 
87 87
 
88
-	function bean_implements($interface){
89
-		switch($interface){
88
+	function bean_implements($interface) {
89
+		switch ($interface) {
90 90
 			case 'ACL': return true;
91 91
 		}
92 92
 		return false;
93 93
 	}
94 94
 
95
-    function save($check_notify = FALSE){
95
+    function save($check_notify = FALSE) {
96 96
 
97 97
         // TODO: process of saveing the fields and conditions is too long so we will have to make some optimization on save_lines functions
98 98
         set_time_limit(3600);
99 99
 
100
-        if (empty($this->id)){
100
+        if (empty($this->id)) {
101 101
             unset($_POST['aor_conditions_id']);
102 102
             unset($_POST['aor_fields_id']);
103 103
         }
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
         $chart->save_lines($_POST, $this, 'aor_chart_');
118 118
     }
119 119
 
120
-    function load_report_beans(){
120
+    function load_report_beans() {
121 121
         global $beanList, $app_list_strings;
122 122
 
123 123
         $app_list_strings['aor_moduleList'] = $app_list_strings['moduleList'];
124 124
 
125
-        foreach($app_list_strings['aor_moduleList'] as $mkey => $mvalue){
126
-            if(!isset($beanList[$mkey]) || str_begin($mkey, 'AOR_') || str_begin($mkey, 'AOW_')){
125
+        foreach ($app_list_strings['aor_moduleList'] as $mkey => $mvalue) {
126
+            if (!isset($beanList[$mkey]) || str_begin($mkey, 'AOR_') || str_begin($mkey, 'AOW_')) {
127 127
                 unset($app_list_strings['aor_moduleList'][$mkey]);
128 128
             }
129 129
         }
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
     }
135 135
 
136 136
 
137
-    function getReportFields(){
137
+    function getReportFields() {
138 138
         $fields = array();
139
-        foreach($this->get_linked_beans('aor_fields','AOR_Fields') as $field){
139
+        foreach ($this->get_linked_beans('aor_fields', 'AOR_Fields') as $field) {
140 140
             $fields[] = $field;
141 141
         }
142
-        usort($fields,function($a,$b){
142
+        usort($fields, function($a, $b) {
143 143
             return $a->field_order - $b->field_order;
144 144
         });
145 145
         return $fields;
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
     const CHART_TYPE_RGRAPH = 'rgraph';
151 151
 
152 152
 
153
-    function build_report_chart($chartIds = null, $chartType = self::CHART_TYPE_PCHART){
153
+    function build_report_chart($chartIds = null, $chartType = self::CHART_TYPE_PCHART) {
154 154
         global $beanList;
155
-        $linkedCharts = $this->get_linked_beans('aor_charts','AOR_Charts');
156
-	if(!$linkedCharts){
155
+        $linkedCharts = $this->get_linked_beans('aor_charts', 'AOR_Charts');
156
+	if (!$linkedCharts) {
157 157
             //No charts to display
158 158
             return '';
159 159
         }
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 
178 178
             $field_module = $this->report_module;
179 179
             $field_alias = $field_bean->table_name;
180
-            if($path[0] != $this->report_module){
181
-                foreach($path as $rel){
182
-                    if(empty($rel)){
180
+            if ($path[0] != $this->report_module) {
181
+                foreach ($path as $rel) {
182
+                    if (empty($rel)) {
183 183
                         continue;
184 184
                     }
185
-                    $field_module = getRelatedModule($field_module,$rel);
186
-                    $field_alias = $field_alias . ':'.$rel;
185
+                    $field_module = getRelatedModule($field_module, $rel);
186
+                    $field_alias = $field_alias.':'.$rel;
187 187
                 }
188 188
             }
189
-            $label = str_replace(' ','_',$field->label).$i;
189
+            $label = str_replace(' ', '_', $field->label).$i;
190 190
             $fields[$label]['field'] = $field->field;
191 191
             $fields[$label]['label'] = $field->label;
192 192
             $fields[$label]['display'] = $field->display;
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 
202 202
             // get the main group
203 203
 
204
-            if($field->group_display) {
204
+            if ($field->group_display) {
205 205
 
206 206
                 // if we have a main group already thats wrong cause only one main grouping field possible
207
-                if(!is_null($mainGroupField)) {
207
+                if (!is_null($mainGroupField)) {
208 208
                     $GLOBALS['log']->fatal('main group already found');
209 209
                 }
210 210
 
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
         $query = $this->build_report_query();
220 220
         $result = $this->db->query($query);
221 221
         $data = array();
222
-        while($row = $this->db->fetchByAssoc($result, false))
222
+        while ($row = $this->db->fetchByAssoc($result, false))
223 223
         {
224
-            foreach($fields as $name => $att){
224
+            foreach ($fields as $name => $att) {
225 225
 
226 226
                 $currency_id = isset($row[$att['alias'].'_currency_id']) ? $row[$att['alias'].'_currency_id'] : '';
227 227
 
228
-                switch ($att['function']){
228
+                switch ($att['function']) {
229 229
                     case 'COUNT':
230 230
                         break;
231 231
                     default:
232
-                        if(!is_numeric($row[$name])) {
233
-                            $row[$name] = trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'], 'DetailView', $row[$name], '', $currency_id,$att['params'])));
232
+                        if (!is_numeric($row[$name])) {
233
+                            $row[$name] = trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'], 'DetailView', $row[$name], '', $currency_id, $att['params'])));
234 234
 
235 235
                         }
236 236
                         break;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         }
241 241
         $fields = $this->getReportFields();
242 242
 
243
-        switch($chartType) {
243
+        switch ($chartType) {
244 244
             case self::CHART_TYPE_PCHART:
245 245
                 $html = '<script src="modules/AOR_Charts/lib/pChart/imagemap.js"></script>';
246 246
                 break;
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
                 $html = '<script src="modules/AOR_Reports/js/Chart.js"></script>';
249 249
                 break;
250 250
             case self::CHART_TYPE_RGRAPH:
251
-                if($_REQUEST['module']!= 'Home')//Need the require_once for the rgraphincludes as they are only loaded when the home page is hit
251
+                if ($_REQUEST['module'] != 'Home')//Need the require_once for the rgraphincludes as they are only loaded when the home page is hit
252 252
                     require_once('include/SuiteGraphs/RGraphIncludes.php');
253 253
 
254 254
                 break;
255 255
         }
256 256
         $x = 0;
257
-        foreach($linkedCharts as $chart){
258
-            if($chartIds !== null && !in_array($chart->id,$chartIds)){
257
+        foreach ($linkedCharts as $chart) {
258
+            if ($chartIds !== null && !in_array($chart->id, $chartIds)) {
259 259
                 continue;
260 260
             }
261
-            $html .= $chart->buildChartHTML($data,$fields,$x, $chartType, $mainGroupField);
261
+            $html .= $chart->buildChartHTML($data, $fields, $x, $chartType, $mainGroupField);
262 262
             $x++;
263 263
         }
264 264
         return $html;
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 
271 271
         $rows = $this->getGroupDisplayFieldByReportId($this->id, $level);
272 272
 
273
-        if(count($rows) > 1) {
274
-            $GLOBALS['log']->fatal('ambiguous group display for report ' . $this->id);
273
+        if (count($rows) > 1) {
274
+            $GLOBALS['log']->fatal('ambiguous group display for report '.$this->id);
275 275
         }
276
-        else if(count($rows) == 1){
276
+        else if (count($rows) == 1) {
277 277
             $rows[0]['module_path'] = unserialize(base64_decode($rows[0]['module_path']));
278
-            if(!$rows[0]['module_path'][0]) {
278
+            if (!$rows[0]['module_path'][0]) {
279 279
                 $module = new $beanList[$this->report_module]();
280 280
                 $rows[0]['field_id_name'] = $module->field_defs[$rows[0]['field']]['id_name'] ? $module->field_defs[$rows[0]['field']]['id_name'] : $module->field_defs[$rows[0]['field']]['name'];
281 281
                 $rows[0]['module_path'][0] = $module->table_name;
@@ -285,23 +285,23 @@  discard block
 block discarded – undo
285 285
             }
286 286
             $path[] = $rows[0];
287 287
 
288
-            if($level>10) {
288
+            if ($level > 10) {
289 289
                 $msg = 'Too many nested groups';
290 290
                 $GLOBALS['log']->fatal($msg);
291 291
                 return null;
292 292
             }
293 293
 
294
-            return $this->buildMultiGroupReport($offset, $links, $level+1, $path);
294
+            return $this->buildMultiGroupReport($offset, $links, $level + 1, $path);
295 295
         }
296
-        else if(!$rows) {
297
-            if($path) {
296
+        else if (!$rows) {
297
+            if ($path) {
298 298
                 $html = '';
299 299
                 foreach ($path as $pth) {
300 300
                     $_fieldIdName = $this->db->quoteIdentifier($pth['field_id_name']);
301
-                    $query = "SELECT $_fieldIdName FROM " . $this->db->quoteIdentifier($pth['module_path'][0]) . " GROUP BY $_fieldIdName;";
301
+                    $query = "SELECT $_fieldIdName FROM ".$this->db->quoteIdentifier($pth['module_path'][0])." GROUP BY $_fieldIdName;";
302 302
                     $values = $this->dbSelect($query);
303 303
 
304
-                    foreach($values as $value) {
304
+                    foreach ($values as $value) {
305 305
 
306 306
                         //$where = [ $this->db->quote($pth['module_path'][0]) . '.' . $_fieldIdName . ' = \'' . $this->db->quote($value[$pth['field_id_name']]) . '\'' ];
307 307
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         // escape values for query
338 338
 
339 339
         $_id = $this->db->quote($reportId);
340
-        $_level = (int) $level;
340
+        $_level = (int)$level;
341 341
 
342 342
         // get results array
343 343
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         $results = $this->db->query($query);
353 353
 
354 354
         $rows = array();
355
-        while($row = $this->db->fetchByAssoc($results)) {
355
+        while ($row = $this->db->fetchByAssoc($results)) {
356 356
             $rows[] = $row;
357 357
         }
358 358
 
@@ -361,20 +361,20 @@  discard block
 block discarded – undo
361 361
 
362 362
     private function getMultiGroupFrameHTML($header, $body) {
363 363
         $html = '<div class="multi-group-list" style="border: 1px solid black; padding: 10px;">
364
-                    <h3>' . $header . '</h3>
365
-                    <div class="multi-group-list-inner">' . $body . '</div>
364
+                    <h3>' . $header.'</h3>
365
+                    <div class="multi-group-list-inner">' . $body.'</div>
366 366
                 </div>';
367 367
         return $html;
368 368
     }
369 369
 
370 370
     private function addDataIdValueToInnertext($html) {
371 371
         preg_match('/\sdata-id-value\s*=\s*"([^"]*)"/', $html, $match);
372
-        $html = preg_replace('/(>)([^<]*)(<\/\w+>$)/', '$1$2' . $match[1] . '$3', $html);
372
+        $html = preg_replace('/(>)([^<]*)(<\/\w+>$)/', '$1$2'.$match[1].'$3', $html);
373 373
         return $html;
374 374
     }
375 375
 
376 376
 
377
-    function build_group_report($offset = -1, $links = true, $extra = array()){
377
+    function build_group_report($offset = -1, $links = true, $extra = array()) {
378 378
         global $beanList;
379 379
 
380 380
         $html = '';
@@ -385,23 +385,23 @@  discard block
 block discarded – undo
385 385
         $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND group_display = 1 AND deleted = 0 ORDER BY field_order ASC";
386 386
         $field_id = $this->db->getOne($sql);
387 387
 
388
-        if(!$field_id) {
389
-            $query_array['select'][] = $module->table_name . ".id AS '" . $module->table_name . "_id'";
388
+        if (!$field_id) {
389
+            $query_array['select'][] = $module->table_name.".id AS '".$module->table_name."_id'";
390 390
         }
391 391
 
392
-        if($field_id != ''){
392
+        if ($field_id != '') {
393 393
             $field = new AOR_Field();
394 394
             $field->retrieve($field_id);
395 395
 
396
-            $field_label = str_replace(' ','_',$field->label);
396
+            $field_label = str_replace(' ', '_', $field->label);
397 397
 
398 398
             $path = unserialize(base64_decode($field->module_path));
399 399
 
400 400
             $field_module = $module;
401 401
             $table_alias = $field_module->table_name;
402
-            if(!empty($path[0]) && $path[0] != $module->module_dir){
403
-                foreach($path as $rel){
404
-                    $new_field_module = new $beanList[getRelatedModule($field_module->module_dir,$rel)];
402
+            if (!empty($path[0]) && $path[0] != $module->module_dir) {
403
+                foreach ($path as $rel) {
404
+                    $new_field_module = new $beanList[getRelatedModule($field_module->module_dir, $rel)];
405 405
                     $oldAlias = $table_alias;
406 406
                     $table_alias = $table_alias.":".$rel;
407 407
 
@@ -415,71 +415,71 @@  discard block
 block discarded – undo
415 415
 
416 416
             $data = $field_module->field_defs[$field->field];
417 417
 
418
-            if($data['type'] == 'relate' && isset($data['id_name'])) {
418
+            if ($data['type'] == 'relate' && isset($data['id_name'])) {
419 419
                 $field->field = $data['id_name'];
420 420
             }
421 421
 
422
-            if($data['type'] == 'currency' && !stripos($field->field, '_USD') && isset($field_module->field_defs['currency_id'])) {
423
-                if((isset($field_module->field_defs['currency_id']['source']) && $field_module->field_defs['currency_id']['source'] == 'custom_fields')) {
422
+            if ($data['type'] == 'currency' && !stripos($field->field, '_USD') && isset($field_module->field_defs['currency_id'])) {
423
+                if ((isset($field_module->field_defs['currency_id']['source']) && $field_module->field_defs['currency_id']['source'] == 'custom_fields')) {
424 424
                     $query['select'][$table_alias.'_currency_id'] = $table_alias.'_cstm'.".currency_id AS '".$table_alias."_currency_id'";
425 425
                 } else {
426
-                    $query_array['select'][$table_alias . '_currency_id'] = $table_alias . ".currency_id AS '" . $table_alias . "_currency_id'";
426
+                    $query_array['select'][$table_alias.'_currency_id'] = $table_alias.".currency_id AS '".$table_alias."_currency_id'";
427 427
                 }
428 428
             }
429 429
 
430
-            if(  (isset($data['source']) && $data['source'] == 'custom_fields')) {
430
+            if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
431 431
                 $select_field = $this->db->quoteIdentifier($table_alias.'_cstm').'.'.$field->field;
432 432
                 // Fix for #1251 - added a missing parameter to the function call
433 433
                 $query_array = $this->build_report_query_join($table_alias.'_cstm', $table_alias.'_cstm', $table_alias, $field_module, 'custom', $query);
434 434
             } else {
435
-                $select_field= $this->db->quoteIdentifier($table_alias).'.'.$field->field;
435
+                $select_field = $this->db->quoteIdentifier($table_alias).'.'.$field->field;
436 436
             }
437 437
 
438
-            if($field->sort_by != ''){
438
+            if ($field->sort_by != '') {
439 439
                 $query_array['sort_by'][] = $field_label.' '.$field->sort_by;
440 440
             }
441 441
 
442
-            if($field->group_by == 1){
442
+            if ($field->group_by == 1) {
443 443
                 $query_array['group_by'][] = $select_field;
444 444
             }
445 445
 
446
-            if($field->field_function != null){
446
+            if ($field->field_function != null) {
447 447
                 $select_field = $field->field_function.'('.$select_field.')';
448 448
             }
449 449
 
450
-            $query_array['select'][] = $select_field ." AS '".$field_label."'";
451
-            if(isset($extra['select']) && $extra['select']) {
452
-                foreach($extra['select'] as $selectField => $selectAlias) {
453
-                    if($selectAlias) {
454
-                        $query_array['select'][] = $selectField . " AS " . $selectAlias;
450
+            $query_array['select'][] = $select_field." AS '".$field_label."'";
451
+            if (isset($extra['select']) && $extra['select']) {
452
+                foreach ($extra['select'] as $selectField => $selectAlias) {
453
+                    if ($selectAlias) {
454
+                        $query_array['select'][] = $selectField." AS ".$selectAlias;
455 455
                     }
456 456
                     else {
457 457
                         $query_array['select'][] = $selectField;
458 458
                     }
459 459
                 }
460 460
             }
461
-            $query_array['where'][] = $select_field ." IS NOT NULL AND ";
462
-            if(isset($extra['where']) && $extra['where']) {
463
-                $query_array['where'][] = implode(' AND ', $extra['where']) . ' AND ';
461
+            $query_array['where'][] = $select_field." IS NOT NULL AND ";
462
+            if (isset($extra['where']) && $extra['where']) {
463
+                $query_array['where'][] = implode(' AND ', $extra['where']).' AND ';
464 464
             }
465 465
 
466 466
             $query_array = $this->build_report_query_where($query_array);
467 467
 
468
-            foreach ($query_array['select'] as $select){
469
-                $query .=  ($query == '' ? 'SELECT ' : ', ').$select;
468
+            foreach ($query_array['select'] as $select) {
469
+                $query .= ($query == '' ? 'SELECT ' : ', ').$select;
470 470
             }
471 471
 
472 472
             $query .= ' FROM '.$module->table_name.' ';
473 473
 
474
-            if(isset($query_array['join'])){
475
-                foreach ($query_array['join'] as $join){
474
+            if (isset($query_array['join'])) {
475
+                foreach ($query_array['join'] as $join) {
476 476
                     $query .= $join;
477 477
                 }
478 478
             }
479
-            if(isset($query_array['where'])){
479
+            if (isset($query_array['where'])) {
480 480
                 $query_where = '';
481
-                foreach ($query_array['where'] as $where){
482
-                    $query_where .=  ($query_where == '' ? 'WHERE ' : ' ').$where;
481
+                foreach ($query_array['where'] as $where) {
482
+                    $query_where .= ($query_where == '' ? 'WHERE ' : ' ').$where;
483 483
                 }
484 484
 
485 485
                 $query_where = $this->queryWhereRepair($query_where);
@@ -487,38 +487,38 @@  discard block
 block discarded – undo
487 487
                 $query .= ' '.$query_where;
488 488
             }
489 489
 
490
-            if(isset($query_array['group_by'])){
490
+            if (isset($query_array['group_by'])) {
491 491
                 $query_group_by = '';
492
-                foreach ($query_array['group_by'] as $group_by){
493
-                    $query_group_by .=  ($query_group_by == '' ? 'GROUP BY ' : ', ').$group_by;
492
+                foreach ($query_array['group_by'] as $group_by) {
493
+                    $query_group_by .= ($query_group_by == '' ? 'GROUP BY ' : ', ').$group_by;
494 494
                 }
495 495
                 $query .= ' '.$query_group_by;
496 496
             }
497 497
 
498
-            if(isset($query_array['sort_by'])){
498
+            if (isset($query_array['sort_by'])) {
499 499
                 $query_sort_by = '';
500
-                foreach ($query_array['sort_by'] as $sort_by){
501
-                    $query_sort_by .=  ($query_sort_by == '' ? 'ORDER BY ' : ', ').$sort_by;
500
+                foreach ($query_array['sort_by'] as $sort_by) {
501
+                    $query_sort_by .= ($query_sort_by == '' ? 'ORDER BY ' : ', ').$sort_by;
502 502
                 }
503 503
                 $query .= ' '.$query_sort_by;
504 504
             }
505 505
             $result = $this->db->query($query);
506 506
 
507 507
             while ($row = $this->db->fetchByAssoc($result)) {
508
-                if($html != '') $html .= '<br />';
508
+                if ($html != '') $html .= '<br />';
509 509
 
510 510
                $html .= $this->build_report_html($offset, $links, $row[$field_label], '', $extra);
511 511
 
512 512
             }
513 513
         }
514 514
 
515
-        if($html == '') $html = $this->build_report_html($offset, $links);
515
+        if ($html == '') $html = $this->build_report_html($offset, $links);
516 516
         return $html;
517 517
 
518 518
     }
519 519
 
520 520
 
521
-    function build_report_html($offset = -1, $links = true, $group_value = '', $tableIdentifier = '', $extra = array()){
521
+    function build_report_html($offset = -1, $links = true, $group_value = '', $tableIdentifier = '', $extra = array()) {
522 522
 
523 523
         global $beanList, $sugar_config;
524 524
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         $report_sql = $this->build_report_query($_group_value, $extra);
528 528
 
529 529
         // Fix for issue 1232 - items listed in a single report, should adhere to the same standard as ListView items.
530
-        if($sugar_config['list_max_entries_per_page']!='') {
530
+        if ($sugar_config['list_max_entries_per_page'] != '') {
531 531
             $max_rows = $sugar_config['list_max_entries_per_page'];
532 532
         } else {
533 533
             $max_rows = 20;
@@ -540,27 +540,27 @@  discard block
 block discarded – undo
540 540
         // We have a count query.  Run it and get the results.
541 541
         $result = $this->db->query($count_query);
542 542
         $assoc = $this->db->fetchByAssoc($result);
543
-        if(!empty($assoc['c']))
543
+        if (!empty($assoc['c']))
544 544
         {
545 545
             $total_rows = $assoc['c'];
546 546
         }
547 547
 
548 548
         $html = "<table class='list' id='report_table".$group_value."' width='100%' cellspacing='0' cellpadding='0' border='0' repeat_header='1'>";
549 549
 
550
-        if($offset >= 0){
550
+        if ($offset >= 0) {
551 551
             $start = 0;
552 552
             $end = 0;
553 553
             $previous_offset = 0;
554 554
             $next_offset = 0;
555 555
             $last_offset = 0;
556 556
 
557
-            if($total_rows > 0){
558
-                $start = $offset +1;
557
+            if ($total_rows > 0) {
558
+                $start = $offset + 1;
559 559
                 $end = (($offset + $max_rows) < $total_rows) ? $offset + $max_rows : $total_rows;
560 560
                 $previous_offset = ($offset - $max_rows) < 0 ? 0 : $offset - $max_rows;
561 561
                 $next_offset = $offset + $max_rows;
562
-                if(is_int($total_rows / $max_rows)){
563
-                    $last_offset = $max_rows * ($total_rows / $max_rows -1);
562
+                if (is_int($total_rows / $max_rows)) {
563
+                    $last_offset = $max_rows * ($total_rows / $max_rows - 1);
564 564
                 } else {
565 565
                     $last_offset = $max_rows * floor($total_rows / $max_rows);
566 566
                 }
@@ -572,36 +572,36 @@  discard block
 block discarded – undo
572 572
 
573 573
             $moduleFieldByGroupValue = $this->getModuleFieldByGroupValue($beanList, $group_value);
574 574
 
575
-            $html .="<td colspan='18'>
575
+            $html .= "<td colspan='18'>
576 576
                        <table class='paginationTable' border='0' cellpadding='0' cellspacing='0' width='100%'>
577 577
                         <td style='text-align:left' ><H3><a href=\"javascript:void(0)\" class=\"collapseLink\" onclick=\"groupedReportToggler.toggleList(this);\"><img border=\"0\" id=\"detailpanel_1_img_hide\" src=\"themes/SuiteR/images/basic_search.gif\"></a>$moduleFieldByGroupValue</H3></td>
578 578
                         <td class='paginationChangeButtons' align='right' nowrap='nowrap' width='1%'>";
579 579
 
580
-            if($offset == 0){
581
-                $html .="<button type='button' id='listViewStartButton_top' name='listViewStartButton' title='Start' class='button' disabled='disabled'>
580
+            if ($offset == 0) {
581
+                $html .= "<button type='button' id='listViewStartButton_top' name='listViewStartButton' title='Start' class='button' disabled='disabled'>
582 582
                     <img src='".SugarThemeRegistry::current()->getImageURL('start_off.gif')."' alt='Start' align='absmiddle' border='0'>
583 583
                 </button>
584 584
                 <button type='button' id='listViewPrevButton_top' name='listViewPrevButton' class='button' title='Previous' disabled='disabled'>
585 585
                     <img src='".SugarThemeRegistry::current()->getImageURL('previous_off.gif')."' alt='Previous' align='absmiddle' border='0'>
586 586
                 </button>";
587 587
             } else {
588
-                $html .="<button type='button' id='listViewStartButton_top' name='listViewStartButton' title='Start' class='button' onclick='changeReportPage(\"".$this->id."\",0,\"".$group_value."\",\"".$tableIdentifier."\")'>
588
+                $html .= "<button type='button' id='listViewStartButton_top' name='listViewStartButton' title='Start' class='button' onclick='changeReportPage(\"".$this->id."\",0,\"".$group_value."\",\"".$tableIdentifier."\")'>
589 589
                     <img src='".SugarThemeRegistry::current()->getImageURL('start.gif')."' alt='Start' align='absmiddle' border='0'>
590 590
                 </button>
591 591
                 <button type='button' id='listViewPrevButton_top' name='listViewPrevButton' class='button' title='Previous' onclick='changeReportPage(\"".$this->id."\",".$previous_offset.",\"".$group_value."\",\"".$tableIdentifier."\")'>
592 592
                     <img src='".SugarThemeRegistry::current()->getImageURL('previous.gif')."' alt='Previous' align='absmiddle' border='0'>
593 593
                 </button>";
594 594
             }
595
-            $html .=" <span class='pageNumbers'>(".$start ." - ".$end ." of ". $total_rows .")</span>";
596
-            if($next_offset < $total_rows){
597
-                $html .="<button type='button' id='listViewNextButton_top' name='listViewNextButton' title='Next' class='button' onclick='changeReportPage(\"".$this->id."\",".$next_offset.",\"".$group_value."\",\"".$tableIdentifier."\")'>
595
+            $html .= " <span class='pageNumbers'>(".$start." - ".$end." of ".$total_rows.")</span>";
596
+            if ($next_offset < $total_rows) {
597
+                $html .= "<button type='button' id='listViewNextButton_top' name='listViewNextButton' title='Next' class='button' onclick='changeReportPage(\"".$this->id."\",".$next_offset.",\"".$group_value."\",\"".$tableIdentifier."\")'>
598 598
                         <img src='".SugarThemeRegistry::current()->getImageURL('next.gif')."' alt='Next' align='absmiddle' border='0'>
599 599
                     </button>
600 600
                      <button type='button' id='listViewEndButton_top' name='listViewEndButton' title='End' class='button' onclick='changeReportPage(\"".$this->id."\",".$last_offset.",\"".$group_value."\",\"".$tableIdentifier."\")'>
601 601
                         <img src='".SugarThemeRegistry::current()->getImageURL('end.gif')."' alt='End' align='absmiddle' border='0'>
602 602
                     </button>";
603 603
             } else {
604
-                $html .="<button type='button' id='listViewNextButton_top' name='listViewNextButton' title='Next' class='button'  disabled='disabled'>
604
+                $html .= "<button type='button' id='listViewNextButton_top' name='listViewNextButton' title='Next' class='button'  disabled='disabled'>
605 605
                         <img src='".SugarThemeRegistry::current()->getImageURL('next_off.gif')."' alt='Next' align='absmiddle' border='0'>
606 606
                     </button>
607 607
                      <button type='button' id='listViewEndButton_top' name='listViewEndButton' title='End' class='button'  disabled='disabled'>
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
 
611 611
             }
612 612
 
613
-            $html .="</td>
613
+            $html .= "</td>
614 614
                        </table>
615 615
                       </td>";
616 616
 
617
-            $html .="</tr></thead>";
618
-        } else{
617
+            $html .= "</tr></thead>";
618
+        } else {
619 619
 
620 620
             $moduleFieldByGroupValue = $this->getModuleFieldByGroupValue($beanList, $group_value);
621 621
 
@@ -641,16 +641,16 @@  discard block
 block discarded – undo
641 641
 
642 642
             $field_module = $this->report_module;
643 643
             $field_alias = $field_bean->table_name;
644
-            if($path[0] != $this->report_module){
645
-                foreach($path as $rel){
646
-                    if(empty($rel)){
644
+            if ($path[0] != $this->report_module) {
645
+                foreach ($path as $rel) {
646
+                    if (empty($rel)) {
647 647
                         continue;
648 648
                     }
649
-                    $field_module = getRelatedModule($field_module,$rel);
650
-                    $field_alias = $field_alias . ':'.$rel;
649
+                    $field_module = getRelatedModule($field_module, $rel);
650
+                    $field_alias = $field_alias.':'.$rel;
651 651
                 }
652 652
             }
653
-            $label = str_replace(' ','_',$field->label).$i;
653
+            $label = str_replace(' ', '_', $field->label).$i;
654 654
             $fields[$label]['field'] = $field->field;
655 655
             $fields[$label]['label'] = $field->label;
656 656
             $fields[$label]['display'] = $field->display;
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
             $fields[$label]['params'] = array("date_format" => $field->format);
664 664
 
665 665
 
666
-            if($fields[$label]['display']){
666
+            if ($fields[$label]['display']) {
667 667
                 $html .= "<th scope='col'>";
668 668
                 $html .= "<div style='white-space: normal;' width='100%' align='left'>";
669 669
                 $html .= $field->label;
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
         $html .= "</thead>";
677 677
         $html .= "<tbody>";
678 678
 
679
-        if($offset >= 0){
679
+        if ($offset >= 0) {
680 680
             $result = $this->db->limitQuery($report_sql, $offset, $max_rows);
681 681
         } else {
682 682
             $result = $this->db->query($report_sql);
@@ -689,39 +689,39 @@  discard block
 block discarded – undo
689 689
         while ($row = $this->db->fetchByAssoc($result)) {
690 690
             $html .= "<tr class='".$row_class."' height='20'>";
691 691
 
692
-            foreach($fields as $name => $att){
693
-                if($att['display']){
692
+            foreach ($fields as $name => $att) {
693
+                if ($att['display']) {
694 694
                     $html .= "<td class='' valign='top' align='left'>";
695
-                    if($att['link'] && $links){
696
-                        $html .= "<a href='" . $sugar_config['site_url'] . "/index.php?module=".$att['module']."&action=DetailView&record=".$row[$att['alias'].'_id']."'>";
695
+                    if ($att['link'] && $links) {
696
+                        $html .= "<a href='".$sugar_config['site_url']."/index.php?module=".$att['module']."&action=DetailView&record=".$row[$att['alias'].'_id']."'>";
697 697
                     }
698 698
 
699 699
                     $currency_id = isset($row[$att['alias'].'_currency_id']) ? $row[$att['alias'].'_currency_id'] : '';
700 700
 
701
-                    switch ($att['function']){
701
+                    switch ($att['function']) {
702 702
                         case 'COUNT':
703 703
                         //case 'SUM':
704 704
                             $html .= $row[$name];
705 705
                             break;
706 706
                         default:
707 707
 
708
-                            $html .= getModuleField($att['module'], $att['field'], $att['field'], 'DetailView',$row[$name],'',$currency_id, $att['params']);
708
+                            $html .= getModuleField($att['module'], $att['field'], $att['field'], 'DetailView', $row[$name], '', $currency_id, $att['params']);
709 709
                             break;
710 710
                     }
711
-                    if($att['total']){
711
+                    if ($att['total']) {
712 712
                         $totals[$name][] = $row[$name];
713 713
                     }
714
-                    if($att['link'] && $links) $html .= "</a>";
714
+                    if ($att['link'] && $links) $html .= "</a>";
715 715
                     $html .= "</td>";
716 716
                 }
717 717
             }
718 718
             $html .= "</tr>";
719 719
 
720
-            $row_class = $row_class == 'oddListRowS1' ?  'evenListRowS1':'oddListRowS1';
720
+            $row_class = $row_class == 'oddListRowS1' ? 'evenListRowS1' : 'oddListRowS1';
721 721
         }
722 722
         $html .= "</tbody>";
723 723
 
724
-        $html .= $this->getTotalHtml($fields,$totals);
724
+        $html .= $this->getTotalHtml($fields, $totals);
725 725
 
726 726
         $html .= "</table>";
727 727
 
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
 
765 765
             $field_module = $this->report_module;
766 766
             $field_alias = $field_bean->table_name;
767
-            if($path[0] != $this->report_module){
768
-                foreach($path as $rel){
769
-                    if(empty($rel)){
767
+            if ($path[0] != $this->report_module) {
768
+                foreach ($path as $rel) {
769
+                    if (empty($rel)) {
770 770
                         continue;
771 771
                     }
772
-                    $field_module = getRelatedModule($field_module,$rel);
773
-                    $field_alias = $field_alias . ':'.$rel;
772
+                    $field_module = getRelatedModule($field_module, $rel);
773
+                    $field_alias = $field_alias.':'.$rel;
774 774
                 }
775 775
             }
776 776
 
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
         return $moduleFieldByGroupValue;
784 784
     }
785 785
 
786
-    function getTotalHTML($fields,$totals){
786
+    function getTotalHTML($fields, $totals) {
787 787
         global $app_list_strings;
788 788
 
789 789
         $currency = new Currency();
@@ -792,36 +792,36 @@  discard block
 block discarded – undo
792 792
         $html = '';
793 793
         $html .= "<tbody>";
794 794
         $html .= "<tr>";
795
-        foreach($fields as $label => $field){
796
-            if(!$field['display']){
795
+        foreach ($fields as $label => $field) {
796
+            if (!$field['display']) {
797 797
                 continue;
798 798
             }
799
-            if($field['total']){
800
-                $totalLabel = $field['label'] ." ".$app_list_strings['aor_total_options'][$field['total']];
799
+            if ($field['total']) {
800
+                $totalLabel = $field['label']." ".$app_list_strings['aor_total_options'][$field['total']];
801 801
                 $html .= "<th>{$totalLabel}</th>";
802
-            }else{
802
+            } else {
803 803
                 $html .= "<th></th>";
804 804
             }
805 805
         }
806 806
         $html .= "</tr>";
807 807
         $html .= "<tr>";
808
-        foreach($fields as $label => $field){
809
-            if(!$field['display']){
808
+        foreach ($fields as $label => $field) {
809
+            if (!$field['display']) {
810 810
                 continue;
811 811
             }
812
-            if($field['total'] && isset($totals[$label])){
812
+            if ($field['total'] && isset($totals[$label])) {
813 813
                 $type = $field['total'];
814 814
                 $total = $this->calculateTotal($type, $totals[$label]);
815 815
                 // Customise display based on the field type
816 816
                 $moduleBean = BeanFactory::newBean($field['module']);
817 817
                 $fieldDefinition = $moduleBean->field_defs[$field['field']];
818 818
                 $fieldDefinitionType = $fieldDefinition['type'];
819
-                switch($fieldDefinitionType) {
819
+                switch ($fieldDefinitionType) {
820 820
                     case "currency":
821 821
                         // Customise based on type of function
822
-                        switch($type){
822
+                        switch ($type) {
823 823
                             case 'SUM':
824
-                                if($currency->id == -99) {
824
+                                if ($currency->id == -99) {
825 825
                                     $total = $currency->symbol.format_number($total, null, null);
826 826
                                 } else {
827 827
                                     $total = $currency->symbol.format_number($total, null, null, array('convert' => true));
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
                             case 'COUNT':
830 830
                                 break;
831 831
                             case 'AVG':
832
-                                if($currency->id == -99) {
832
+                                if ($currency->id == -99) {
833 833
                                     $total = $currency->symbol.format_number($total, null, null);
834 834
                                 } else {
835 835
                                     $total = $currency->symbol.format_number($total, null, null, array('convert' => true));
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                         break;
843 843
                 }
844 844
                 $html .= "<td>".$total."</td>";
845
-            }else{
845
+            } else {
846 846
                 $html .= "<td></td>";
847 847
             }
848 848
         }
@@ -851,24 +851,24 @@  discard block
 block discarded – undo
851 851
         return $html;
852 852
     }
853 853
 
854
-    function calculateTotal($type, $totals){
855
-        switch($type){
854
+    function calculateTotal($type, $totals) {
855
+        switch ($type) {
856 856
             case 'SUM':
857 857
                 return array_sum($totals);
858 858
             case 'COUNT':
859 859
                 return count($totals);
860 860
             case 'AVG':
861
-                return array_sum($totals)/count($totals);
861
+                return array_sum($totals) / count($totals);
862 862
             default:
863 863
                 return '';
864 864
         }
865 865
     }
866 866
 
867
-    private function encloseForCSV($field){
867
+    private function encloseForCSV($field) {
868 868
         return '"'.$field.'"';
869 869
     }
870 870
 
871
-    function build_report_csv(){
871
+    function build_report_csv() {
872 872
 
873 873
         ini_set('zlib.output_compression', 'Off');
874 874
 
@@ -892,20 +892,20 @@  discard block
 block discarded – undo
892 892
             $path = unserialize(base64_decode($field->module_path));
893 893
 
894 894
             $field_module = $this->report_module;
895
-            if($path[0] != $this->report_module){
896
-                foreach($path as $rel){
897
-                    $field_module = getRelatedModule($field_module,$rel);
895
+            if ($path[0] != $this->report_module) {
896
+                foreach ($path as $rel) {
897
+                    $field_module = getRelatedModule($field_module, $rel);
898 898
                 }
899 899
             }
900
-            $label = str_replace(' ','_',$field->label).$i;
900
+            $label = str_replace(' ', '_', $field->label).$i;
901 901
             $fields[$label]['field'] = $field->field;
902 902
             $fields[$label]['display'] = $field->display;
903 903
             $fields[$label]['function'] = $field->field_function;
904 904
             $fields[$label]['module'] = $field_module;
905 905
 
906 906
 
907
-            if($field->display){
908
-                $csv.= $this->encloseForCSV($field->label);
907
+            if ($field->display) {
908
+                $csv .= $this->encloseForCSV($field->label);
909 909
                 $csv .= $delimiter;
910 910
             }
911 911
             ++$i;
@@ -916,30 +916,30 @@  discard block
 block discarded – undo
916 916
 
917 917
         while ($row = $this->db->fetchByAssoc($result)) {
918 918
             $csv .= "\r\n";
919
-            foreach($fields as $name => $att){
920
-                if($att['display']){
921
-                    if($att['function'] != '' )
919
+            foreach ($fields as $name => $att) {
920
+                if ($att['display']) {
921
+                    if ($att['function'] != '')
922 922
                         $csv .= $this->encloseForCSV($row[$name]);
923 923
                     else
924
-                        $csv .= $this->encloseForCSV(trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'], 'DetailView',$row[$name]))));
924
+                        $csv .= $this->encloseForCSV(trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'], 'DetailView', $row[$name]))));
925 925
                     $csv .= $delimiter;
926 926
                 }
927 927
             }
928 928
         }
929 929
 
930
-        $csv= $GLOBALS['locale']->translateCharset($csv, 'UTF-8', $GLOBALS['locale']->getExportCharset());
930
+        $csv = $GLOBALS['locale']->translateCharset($csv, 'UTF-8', $GLOBALS['locale']->getExportCharset());
931 931
 
932 932
         ob_clean();
933 933
         header("Pragma: cache");
934 934
         header("Content-type: text/comma-separated-values; charset=".$GLOBALS['locale']->getExportCharset());
935 935
         header("Content-Disposition: attachment; filename=\"{$this->name}.csv\"");
936 936
         header("Content-transfer-encoding: binary");
937
-        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
938
-        header("Last-Modified: " . TimeDate::httpTime() );
939
-        header("Cache-Control: post-check=0, pre-check=0", false );
937
+        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
938
+        header("Last-Modified: ".TimeDate::httpTime());
939
+        header("Cache-Control: post-check=0, pre-check=0", false);
940 940
         header("Content-Length: ".mb_strlen($csv, '8bit'));
941 941
         if (!empty($sugar_config['export_excel_compatible'])) {
942
-            $csv==chr(255) . chr(254) . mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8');
942
+            $csv == chr(255).chr(254).mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8');
943 943
         }
944 944
         print $csv;
945 945
 
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 
949 949
 
950 950
 
951
-    function build_report_query($group_value ='', $extra = array()){
951
+    function build_report_query($group_value = '', $extra = array()) {
952 952
         global $beanList;
953 953
 
954 954
         $module = new $beanList[$this->report_module]();
@@ -957,26 +957,26 @@  discard block
 block discarded – undo
957 957
         $query_array = array();
958 958
 
959 959
         $query_array = $this->build_report_query_select($query_array, $group_value);
960
-        if(isset($extra['where']) && $extra['where']) {
961
-            $query_array['where'][] = implode(' AND ', $extra['where']) . ' AND ';
960
+        if (isset($extra['where']) && $extra['where']) {
961
+            $query_array['where'][] = implode(' AND ', $extra['where']).' AND ';
962 962
         }
963 963
         $query_array = $this->build_report_query_where($query_array);
964 964
 
965
-        foreach ($query_array['select'] as $select){
966
-            $query .=  ($query == '' ? 'SELECT ' : ', ').$select;
965
+        foreach ($query_array['select'] as $select) {
966
+            $query .= ($query == '' ? 'SELECT ' : ', ').$select;
967 967
         }
968 968
 
969 969
         $query .= ' FROM '.$this->db->quoteIdentifier($module->table_name).' ';
970 970
 
971
-        if(isset($query_array['join'])){
972
-            foreach ($query_array['join'] as $join){
971
+        if (isset($query_array['join'])) {
972
+            foreach ($query_array['join'] as $join) {
973 973
                 $query .= $join;
974 974
             }
975 975
         }
976
-        if(isset($query_array['where'])){
976
+        if (isset($query_array['where'])) {
977 977
             $query_where = '';
978
-            foreach ($query_array['where'] as $where){
979
-                $query_where .=  ($query_where == '' ? 'WHERE ' : ' ').$where;
978
+            foreach ($query_array['where'] as $where) {
979
+                $query_where .= ($query_where == '' ? 'WHERE ' : ' ').$where;
980 980
             }
981 981
 
982 982
             $query_where = $this->queryWhereRepair($query_where);
@@ -984,23 +984,23 @@  discard block
 block discarded – undo
984 984
             $query .= ' '.$query_where;
985 985
         }
986 986
 
987
-        if(isset($query_array['group_by'])){
987
+        if (isset($query_array['group_by'])) {
988 988
             $query_group_by = '';
989
-            foreach ($query_array['group_by'] as $group_by){
990
-                $query_group_by .=  ($query_group_by == '' ? 'GROUP BY ' : ', ').$group_by;
989
+            foreach ($query_array['group_by'] as $group_by) {
990
+                $query_group_by .= ($query_group_by == '' ? 'GROUP BY ' : ', ').$group_by;
991 991
             }
992
-            if($query_group_by != '') {
992
+            if ($query_group_by != '') {
993 993
                 foreach ($query_array['second_group_by'] as $group_by) {
994
-                    $query_group_by .= ', ' . $group_by;
994
+                    $query_group_by .= ', '.$group_by;
995 995
                 }
996 996
             }
997 997
             $query .= ' '.$query_group_by;
998 998
         }
999 999
 
1000
-        if(isset($query_array['sort_by'])){
1000
+        if (isset($query_array['sort_by'])) {
1001 1001
             $query_sort_by = '';
1002
-            foreach ($query_array['sort_by'] as $sort_by){
1003
-                $query_sort_by .=  ($query_sort_by == '' ? 'ORDER BY ' : ', ').$sort_by;
1002
+            foreach ($query_array['sort_by'] as $sort_by) {
1003
+                $query_sort_by .= ($query_sort_by == '' ? 'ORDER BY ' : ', ').$sort_by;
1004 1004
             }
1005 1005
             $query .= ' '.$query_sort_by;
1006 1006
         }
@@ -1014,11 +1014,11 @@  discard block
 block discarded – undo
1014 1014
 
1015 1015
         $safe = 0;
1016 1016
         $query_where_clean = '';
1017
-        while($query_where_clean != $query_where) {
1017
+        while ($query_where_clean != $query_where) {
1018 1018
             $query_where_clean = $query_where;
1019 1019
             $query_where = preg_replace('/\b(AND|OR)\s*\(\s*\)|[^\w+\s*]\(\s*\)/i', '', $query_where_clean);
1020 1020
             $safe++;
1021
-            if($safe>100){
1021
+            if ($safe > 100) {
1022 1022
                 $GLOBALS['log']->fatal('Invalid report query conditions');
1023 1023
                 break;
1024 1024
             }
@@ -1027,10 +1027,10 @@  discard block
 block discarded – undo
1027 1027
         return $query_where;
1028 1028
     }
1029 1029
 
1030
-    function build_report_query_select($query = array(), $group_value =''){
1030
+    function build_report_query_select($query = array(), $group_value = '') {
1031 1031
         global $beanList;
1032 1032
 
1033
-        if($beanList[$this->report_module]){
1033
+        if ($beanList[$this->report_module]) {
1034 1034
             $module = new $beanList[$this->report_module]();
1035 1035
 
1036 1036
             $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '".$this->id."' AND deleted = 0 ORDER BY field_order ASC";
@@ -1042,16 +1042,16 @@  discard block
 block discarded – undo
1042 1042
                 $field = new AOR_Field();
1043 1043
                 $field->retrieve($row['id']);
1044 1044
 
1045
-                $field->label = str_replace(' ','_',$field->label).$i;
1045
+                $field->label = str_replace(' ', '_', $field->label).$i;
1046 1046
 
1047 1047
                 $path = unserialize(base64_decode($field->module_path));
1048 1048
 
1049 1049
                 $field_module = $module;
1050 1050
                 $table_alias = $field_module->table_name;
1051 1051
                 $oldAlias = $table_alias;
1052
-                if(!empty($path[0]) && $path[0] != $module->module_dir){
1053
-                    foreach($path as $rel){
1054
-                        $new_field_module = new $beanList[getRelatedModule($field_module->module_dir,$rel)];
1052
+                if (!empty($path[0]) && $path[0] != $module->module_dir) {
1053
+                    foreach ($path as $rel) {
1054
+                        $new_field_module = new $beanList[getRelatedModule($field_module->module_dir, $rel)];
1055 1055
                         $oldAlias = $table_alias;
1056 1056
                         $table_alias = $table_alias.":".$rel;
1057 1057
                         $query = $this->build_report_query_join($rel, $table_alias, $oldAlias, $field_module, 'relationship', $query, $new_field_module);
@@ -1062,26 +1062,26 @@  discard block
 block discarded – undo
1062 1062
 
1063 1063
                 $data = $field_module->field_defs[$field->field];
1064 1064
 
1065
-                if($data['type'] == 'relate' && isset($data['id_name'])) {
1065
+                if ($data['type'] == 'relate' && isset($data['id_name'])) {
1066 1066
                     $field->field = $data['id_name'];
1067 1067
                     $data_new = $field_module->field_defs[$field->field];
1068
-                    if(isset($data_new['source']) && $data_new['source'] == 'non-db' && $data_new['type'] != 'link' && isset($data['link'])){
1068
+                    if (isset($data_new['source']) && $data_new['source'] == 'non-db' && $data_new['type'] != 'link' && isset($data['link'])) {
1069 1069
                         $data_new['type'] = 'link';
1070 1070
                         $data_new['relationship'] = $data['link'];
1071 1071
                     }
1072 1072
                     $data = $data_new;
1073 1073
                 }
1074 1074
 
1075
-                if($data['type'] == 'link' && $data['source'] == 'non-db') {
1076
-                    $new_field_module = new $beanList[getRelatedModule($field_module->module_dir,$data['relationship'])];
1075
+                if ($data['type'] == 'link' && $data['source'] == 'non-db') {
1076
+                    $new_field_module = new $beanList[getRelatedModule($field_module->module_dir, $data['relationship'])];
1077 1077
                     $table_alias = $data['relationship'];
1078
-                    $query = $this->build_report_query_join($data['relationship'],$table_alias, $oldAlias, $field_module, 'relationship', $query, $new_field_module);
1078
+                    $query = $this->build_report_query_join($data['relationship'], $table_alias, $oldAlias, $field_module, 'relationship', $query, $new_field_module);
1079 1079
                     $field_module = $new_field_module;
1080 1080
                     $field->field = 'id';
1081 1081
                 }
1082 1082
 
1083
-                if($data['type'] == 'currency' && isset($field_module->field_defs['currency_id'])) {
1084
-                    if((isset($field_module->field_defs['currency_id']['source']) && $field_module->field_defs['currency_id']['source'] == 'custom_fields')) {
1083
+                if ($data['type'] == 'currency' && isset($field_module->field_defs['currency_id'])) {
1084
+                    if ((isset($field_module->field_defs['currency_id']['source']) && $field_module->field_defs['currency_id']['source'] == 'custom_fields')) {
1085 1085
                         $query['select'][$table_alias.'_currency_id'] = $this->db->quoteIdentifier($table_alias.'_cstm').".currency_id AS '".$table_alias."_currency_id'";
1086 1086
                         $query['second_group_by'][] = $this->db->quoteIdentifier($table_alias.'_cstm').".currency_id";
1087 1087
                     } else {
@@ -1090,30 +1090,30 @@  discard block
 block discarded – undo
1090 1090
                     }
1091 1091
                 }
1092 1092
 
1093
-                if((isset($data['source']) && $data['source'] == 'custom_fields')) {
1093
+                if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1094 1094
                     $select_field = $this->db->quoteIdentifier($table_alias.'_cstm').'.'.$field->field;
1095
-                    $query = $this->build_report_query_join($table_alias.'_cstm', $table_alias.'_cstm',$table_alias, $field_module, 'custom', $query);
1095
+                    $query = $this->build_report_query_join($table_alias.'_cstm', $table_alias.'_cstm', $table_alias, $field_module, 'custom', $query);
1096 1096
                 } else {
1097
-                    $select_field= $this->db->quoteIdentifier($table_alias).'.'.$field->field;
1097
+                    $select_field = $this->db->quoteIdentifier($table_alias).'.'.$field->field;
1098 1098
                 }
1099 1099
 
1100
-                if($field->group_by == 1){
1101
-                    $query['group_by'][] = $field->format ? str_replace('(%1)', '(' . $select_field . ')', preg_replace(array('/\s+/', '/Y/', '/m/', '/d/'), array(', ', 'YEAR(%1)', 'MONTH(%1)', 'DAY(%1)'), trim(preg_replace('/[^Ymd]/', ' ', $field->format)))) : $select_field;
1100
+                if ($field->group_by == 1) {
1101
+                    $query['group_by'][] = $field->format ? str_replace('(%1)', '('.$select_field.')', preg_replace(array('/\s+/', '/Y/', '/m/', '/d/'), array(', ', 'YEAR(%1)', 'MONTH(%1)', 'DAY(%1)'), trim(preg_replace('/[^Ymd]/', ' ', $field->format)))) : $select_field;
1102 1102
                 } else {
1103
-                    $query['second_group_by'][] = $field->format ? str_replace('(%1)', '(' . $select_field . ')', preg_replace(array('/\s+/', '/Y/', '/m/', '/d/'), array(', ', 'YEAR(%1)', 'MONTH(%1)', 'DAY(%1)'), trim(preg_replace('/[^Ymd]/', ' ', $field->format)))) : $select_field;
1103
+                    $query['second_group_by'][] = $field->format ? str_replace('(%1)', '('.$select_field.')', preg_replace(array('/\s+/', '/Y/', '/m/', '/d/'), array(', ', 'YEAR(%1)', 'MONTH(%1)', 'DAY(%1)'), trim(preg_replace('/[^Ymd]/', ' ', $field->format)))) : $select_field;
1104 1104
                 }
1105 1105
 
1106
-                if($field->field_function != null){
1106
+                if ($field->field_function != null) {
1107 1107
                     $select_field = $field->field_function.'('.$select_field.')';
1108 1108
                 }
1109 1109
 
1110
-                if($field->sort_by != ''){
1110
+                if ($field->sort_by != '') {
1111 1111
                     $query['sort_by'][] = $select_field." ".$field->sort_by;
1112 1112
                 }
1113 1113
 
1114
-                $query['select'][] = $select_field ." AS '".$field->label."'";
1114
+                $query['select'][] = $select_field." AS '".$field->label."'";
1115 1115
 
1116
-                if($field->group_display == 1 && $group_value) $query['where'][] = $select_field." = '".$group_value."' AND ";
1116
+                if ($field->group_display == 1 && $group_value) $query['where'][] = $select_field." = '".$group_value."' AND ";
1117 1117
                     ++$i;
1118 1118
             }
1119 1119
         }
@@ -1121,30 +1121,30 @@  discard block
 block discarded – undo
1121 1121
     }
1122 1122
 
1123 1123
 
1124
-    function build_report_query_join($name, $alias, $parentAlias, SugarBean $module, $type, $query = array(),SugarBean $rel_module = null ){
1124
+    function build_report_query_join($name, $alias, $parentAlias, SugarBean $module, $type, $query = array(), SugarBean $rel_module = null) {
1125 1125
 
1126
-        if(!isset($query['join'][$alias])){
1126
+        if (!isset($query['join'][$alias])) {
1127 1127
 
1128
-            switch ($type){
1128
+            switch ($type) {
1129 1129
                 case 'custom':
1130
-                    $query['join'][$alias] = 'LEFT JOIN '.$this->db->quoteIdentifier($module->get_custom_table_name()).' '.$this->db->quoteIdentifier($name).' ON '.$this->db->quoteIdentifier($parentAlias).'.id = '. $this->db->quoteIdentifier($name).'.id_c ';
1130
+                    $query['join'][$alias] = 'LEFT JOIN '.$this->db->quoteIdentifier($module->get_custom_table_name()).' '.$this->db->quoteIdentifier($name).' ON '.$this->db->quoteIdentifier($parentAlias).'.id = '.$this->db->quoteIdentifier($name).'.id_c ';
1131 1131
                     break;
1132 1132
 
1133 1133
                 case 'relationship':
1134
-                    if($module->load_relationship($name)){
1134
+                    if ($module->load_relationship($name)) {
1135 1135
                         $params['join_type'] = 'LEFT JOIN';
1136
-                        if($module->$name->relationship_type != 'one-to-many'){
1137
-                            if($module->$name->getSide() == REL_LHS){
1136
+                        if ($module->$name->relationship_type != 'one-to-many') {
1137
+                            if ($module->$name->getSide() == REL_LHS) {
1138 1138
                                 $params['right_join_table_alias'] = $this->db->quoteIdentifier($alias);
1139 1139
                                 $params['join_table_alias'] = $this->db->quoteIdentifier($alias);
1140 1140
                                 $params['left_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
1141
-                            }else{
1141
+                            } else {
1142 1142
                                 $params['right_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
1143 1143
                                 $params['join_table_alias'] = $this->db->quoteIdentifier($alias);
1144 1144
                                 $params['left_join_table_alias'] = $this->db->quoteIdentifier($alias);
1145 1145
                             }
1146 1146
 
1147
-                        }else{
1147
+                        } else {
1148 1148
                             $params['right_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
1149 1149
                             $params['join_table_alias'] = $this->db->quoteIdentifier($alias);
1150 1150
                             $params['left_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
                         $params['join_table_link_alias'] = $this->db->quoteIdentifier($linkAlias);
1154 1154
                         $join = $module->$name->getJoin($params, true);
1155 1155
                         $query['join'][$alias] = $join['join'];
1156
-                        if($rel_module != null) {
1156
+                        if ($rel_module != null) {
1157 1157
                             $query['join'][$alias] .= $this->build_report_access_query($rel_module, $name);
1158 1158
                         }
1159 1159
                     }
@@ -1167,11 +1167,11 @@  discard block
 block discarded – undo
1167 1167
         return $query;
1168 1168
     }
1169 1169
 
1170
-    function build_report_access_query(SugarBean $module, $alias){
1170
+    function build_report_access_query(SugarBean $module, $alias) {
1171 1171
 
1172 1172
         $module->table_name = $alias;
1173 1173
         $where = '';
1174
-        if($module->bean_implements('ACL') && ACLController::requireOwner($module->module_dir, 'list') )
1174
+        if ($module->bean_implements('ACL') && ACLController::requireOwner($module->module_dir, 'list'))
1175 1175
         {
1176 1176
             global $current_user;
1177 1177
             $owner_where = $module->getOwnerWhere($current_user->id);
@@ -1179,18 +1179,18 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
         }
1181 1181
 
1182
-        if(file_exists('modules/SecurityGroups/SecurityGroup.php')){
1182
+        if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
1183 1183
             /* BEGIN - SECURITY GROUPS */
1184
-            if($module->bean_implements('ACL') && ACLController::requireSecurityGroup($module->module_dir, 'list') )
1184
+            if ($module->bean_implements('ACL') && ACLController::requireSecurityGroup($module->module_dir, 'list'))
1185 1185
             {
1186 1186
                 require_once('modules/SecurityGroups/SecurityGroup.php');
1187 1187
                 global $current_user;
1188 1188
                 $owner_where = $module->getOwnerWhere($current_user->id);
1189
-                $group_where = SecurityGroup::getGroupWhere($alias,$module->module_dir,$current_user->id);
1190
-                if(!empty($owner_where)){
1191
-                    $where .= " AND (".  $owner_where." or ".$group_where.") ";
1189
+                $group_where = SecurityGroup::getGroupWhere($alias, $module->module_dir, $current_user->id);
1190
+                if (!empty($owner_where)) {
1191
+                    $where .= " AND (".$owner_where." or ".$group_where.") ";
1192 1192
                 } else {
1193
-                    $where .= ' AND '.  $group_where;
1193
+                    $where .= ' AND '.$group_where;
1194 1194
                 }
1195 1195
             }
1196 1196
             /* END - SECURITY GROUPS */
@@ -1203,16 +1203,16 @@  discard block
 block discarded – undo
1203 1203
      * @param array $query
1204 1204
      * @return array
1205 1205
      */
1206
-    function build_report_query_where($query = array()){
1206
+    function build_report_query_where($query = array()) {
1207 1207
         global $beanList, $app_list_strings, $sugar_config;
1208 1208
 
1209 1209
         $closure = false;
1210
-        if(!empty($query['where'])) {
1210
+        if (!empty($query['where'])) {
1211 1211
             $query['where'][] = '(';
1212 1212
             $closure = true;
1213 1213
         }
1214 1214
 
1215
-        if($beanList[$this->report_module]){
1215
+        if ($beanList[$this->report_module]) {
1216 1216
             $module = new $beanList[$this->report_module]();
1217 1217
 
1218 1218
             $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '".$this->id."' AND deleted = 0 ORDER BY condition_order ASC";
@@ -1229,21 +1229,21 @@  discard block
 block discarded – undo
1229 1229
                 $condition_module = $module;
1230 1230
                 $table_alias = $condition_module->table_name;
1231 1231
                 $oldAlias = $table_alias;
1232
-                if(!empty($path[0]) && $path[0] != $module->module_dir){
1233
-                    foreach($path as $rel){
1234
-                        if(empty($rel)){
1232
+                if (!empty($path[0]) && $path[0] != $module->module_dir) {
1233
+                    foreach ($path as $rel) {
1234
+                        if (empty($rel)) {
1235 1235
                             continue;
1236 1236
                         }
1237 1237
                         // Bug: Prevents relationships from loading.
1238 1238
                         //$rel = strtolower($rel);
1239
-                        $new_condition_module = new $beanList[getRelatedModule($condition_module->module_dir,$rel)];
1239
+                        $new_condition_module = new $beanList[getRelatedModule($condition_module->module_dir, $rel)];
1240 1240
                         $oldAlias = $table_alias;
1241 1241
                         $table_alias = $table_alias.":".$rel;
1242 1242
                         $query = $this->build_report_query_join($rel, $table_alias, $oldAlias, $condition_module, 'relationship', $query, $new_condition_module);
1243 1243
                         $condition_module = $new_condition_module;
1244 1244
                     }
1245 1245
                 }
1246
-                if(isset($app_list_strings['aor_sql_operator_list'][$condition->operator])) {
1246
+                if (isset($app_list_strings['aor_sql_operator_list'][$condition->operator])) {
1247 1247
                     $where_set = false;
1248 1248
 
1249 1249
                     $data = $condition_module->field_defs[$condition->field];
@@ -1258,24 +1258,24 @@  discard block
 block discarded – undo
1258 1258
                         $data = $data_new;
1259 1259
                     }
1260 1260
 
1261
-                    if($data['type'] == 'link' && $data['source'] == 'non-db') {
1262
-                        $new_field_module = new $beanList[getRelatedModule($condition_module->module_dir,$data['relationship'])];
1261
+                    if ($data['type'] == 'link' && $data['source'] == 'non-db') {
1262
+                        $new_field_module = new $beanList[getRelatedModule($condition_module->module_dir, $data['relationship'])];
1263 1263
                         $table_alias = $data['relationship'];
1264
-                        $query = $this->build_report_query_join($data['relationship'],$table_alias, $oldAlias, $condition_module, 'relationship', $query, $new_field_module);
1264
+                        $query = $this->build_report_query_join($data['relationship'], $table_alias, $oldAlias, $condition_module, 'relationship', $query, $new_field_module);
1265 1265
                         $condition_module = $new_field_module;
1266 1266
 
1267 1267
                         // Debugging: security groups conditions - It's a hack to just get the query working
1268
-                        if($condition_module->module_dir = 'SecurityGroups' && count($path) > 1) {
1268
+                        if ($condition_module->module_dir = 'SecurityGroups' && count($path) > 1) {
1269 1269
 //                            $table_alias = 'opportunities:assigned_user_link:SecurityGroups' ;
1270
-                            $table_alias = $oldAlias. ':' .$rel;
1270
+                            $table_alias = $oldAlias.':'.$rel;
1271 1271
                         }
1272 1272
                         $condition->field = 'id';
1273 1273
                     }
1274 1274
                     if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1275
-                        $field = $this->db->quoteIdentifier($table_alias . '_cstm') . '.' . $condition->field;
1276
-                        $query = $this->build_report_query_join($table_alias . '_cstm', $table_alias . '_cstm', $oldAlias, $condition_module, 'custom', $query);
1275
+                        $field = $this->db->quoteIdentifier($table_alias.'_cstm').'.'.$condition->field;
1276
+                        $query = $this->build_report_query_join($table_alias.'_cstm', $table_alias.'_cstm', $oldAlias, $condition_module, 'custom', $query);
1277 1277
                     } else {
1278
-                        $field = $this->db->quoteIdentifier($table_alias) . '.' . $condition->field;
1278
+                        $field = $this->db->quoteIdentifier($table_alias).'.'.$condition->field;
1279 1279
                     }
1280 1280
 
1281 1281
                     if (!empty($this->user_parameters[$condition->id]) && $condition->parameter) {
@@ -1307,10 +1307,10 @@  discard block
 block discarded – undo
1307 1307
                                 $condition->field = 'id';
1308 1308
                             }
1309 1309
                             if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1310
-                                $value = $condition_module->table_name . '_cstm.' . $condition->value;
1311
-                                $query = $this->build_report_query_join($condition_module->table_name . '_cstm', $table_alias . '_cstm', $table_alias, $condition_module, 'custom', $query);
1310
+                                $value = $condition_module->table_name.'_cstm.'.$condition->value;
1311
+                                $query = $this->build_report_query_join($condition_module->table_name.'_cstm', $table_alias.'_cstm', $table_alias, $condition_module, 'custom', $query);
1312 1312
                             } else {
1313
-                                $value = ($table_alias ? "`$table_alias`" : $condition_module->table_name) . '.' . $condition->value;
1313
+                                $value = ($table_alias ? "`$table_alias`" : $condition_module->table_name).'.'.$condition->value;
1314 1314
                             }
1315 1315
                             break;
1316 1316
 
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
                             $params = unserialize(base64_decode($condition->value));
1319 1319
 
1320 1320
                             // Fix for issue #1272 - AOR_Report module cannot update Date type parameter.
1321
-                            if($params == false) {
1321
+                            if ($params == false) {
1322 1322
                                 $params = $condition->value;
1323 1323
                             }
1324 1324
 
@@ -1328,10 +1328,10 @@  discard block
 block discarded – undo
1328 1328
                                 } else {
1329 1329
                                     $value = 'NOW()';
1330 1330
                                 }
1331
-                            } else if($params[0] == 'today'){
1332
-                                if($sugar_config['dbconfig']['db_type'] == 'mssql'){
1331
+                            } else if ($params[0] == 'today') {
1332
+                                if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
1333 1333
                                     //$field =
1334
-                                    $value  = 'CAST(GETDATE() AS DATE)';
1334
+                                    $value = 'CAST(GETDATE() AS DATE)';
1335 1335
                                 } else {
1336 1336
                                     $field = 'DATE('.$field.')';
1337 1337
                                     $value = 'Curdate()';
@@ -1339,10 +1339,10 @@  discard block
 block discarded – undo
1339 1339
                             } else {
1340 1340
                                 $data = $condition_module->field_defs[$params[0]];
1341 1341
                                 if ((isset($data['source']) && $data['source'] == 'custom_fields')) {
1342
-                                    $value = $condition_module->table_name . '_cstm.' . $params[0];
1343
-                                    $query = $this->build_report_query_join($condition_module->table_name . '_cstm', $table_alias . '_cstm', $table_alias, $condition_module, 'custom', $query);
1342
+                                    $value = $condition_module->table_name.'_cstm.'.$params[0];
1343
+                                    $query = $this->build_report_query_join($condition_module->table_name.'_cstm', $table_alias.'_cstm', $table_alias, $condition_module, 'custom', $query);
1344 1344
                                 } else {
1345
-                                    $value = $condition_module->table_name . '.' . $params[0];
1345
+                                    $value = $condition_module->table_name.'.'.$params[0];
1346 1346
                                 }
1347 1347
                             }
1348 1348
 
@@ -1353,9 +1353,9 @@  discard block
 block discarded – undo
1353 1353
                                         $params[3] = 'hours';
1354 1354
                                     default:
1355 1355
                                         if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
1356
-                                            $value = "DATEADD(" . $params[3] . ",  " . $app_list_strings['aor_date_operator'][$params[1]] . " $params[2], $value)";
1356
+                                            $value = "DATEADD(".$params[3].",  ".$app_list_strings['aor_date_operator'][$params[1]]." $params[2], $value)";
1357 1357
                                         } else {
1358
-                                            $value = "DATE_ADD($value, INTERVAL " . $app_list_strings['aor_date_operator'][$params[1]] . " $params[2] " . $params[3] . ")";
1358
+                                            $value = "DATE_ADD($value, INTERVAL ".$app_list_strings['aor_date_operator'][$params[1]]." $params[2] ".$params[3].")";
1359 1359
                                         }
1360 1360
                                         break;
1361 1361
                                 }
@@ -1370,11 +1370,11 @@  discard block
 block discarded – undo
1370 1370
                                 $value = '(';
1371 1371
                                 foreach ($multi_values as $multi_value) {
1372 1372
                                     if ($value != '(') $value .= $sep;
1373
-                                    $value .= $field . ' ' . $app_list_strings['aor_sql_operator_list'][$condition->operator] . " '" . $multi_value . "'";
1373
+                                    $value .= $field.' '.$app_list_strings['aor_sql_operator_list'][$condition->operator]." '".$multi_value."'";
1374 1374
                                 }
1375 1375
                                 $value .= ')';
1376 1376
                             }
1377
-                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ': 'AND ')) . $value;
1377
+                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$value;
1378 1378
                             $where_set = true;
1379 1379
                             break;
1380 1380
                         case "Period":
@@ -1383,20 +1383,20 @@  discard block
 block discarded – undo
1383 1383
                             } else {
1384 1384
                                 $params = base64_decode($condition->value);
1385 1385
                             }
1386
-                            $value = '"' . getPeriodDate($params)->format('Y-m-d H:i:s') . '"';
1386
+                            $value = '"'.getPeriodDate($params)->format('Y-m-d H:i:s').'"';
1387 1387
                             break;
1388 1388
                         case "CurrentUserID":
1389 1389
                             global $current_user;
1390
-                            $value = '"' . $current_user->id . '"';
1390
+                            $value = '"'.$current_user->id.'"';
1391 1391
                             break;
1392 1392
                         case 'Value':
1393 1393
                         default:
1394
-                            $value = "'" . $this->db->quote($condition->value) . "'";
1394
+                            $value = "'".$this->db->quote($condition->value)."'";
1395 1395
                             break;
1396 1396
                     }
1397 1397
 
1398 1398
                     //handle like conditions
1399
-                    Switch($condition->operator) {
1399
+                    Switch ($condition->operator) {
1400 1400
                         case 'Contains':
1401 1401
                             $value = "CONCAT('%', ".$value." ,'%')";
1402 1402
                             break;
@@ -1408,11 +1408,11 @@  discard block
 block discarded – undo
1408 1408
                             break;
1409 1409
                     }
1410 1410
 
1411
-                    if($condition->value_type == 'Value' && !$condition->value && $condition->operator == 'Equal_To') {
1411
+                    if ($condition->value_type == 'Value' && !$condition->value && $condition->operator == 'Equal_To') {
1412 1412
                         $value = "{$value} OR {$field} IS NULL";
1413 1413
                     }
1414 1414
 
1415
-                    if(!$where_set) {
1415
+                    if (!$where_set) {
1416 1416
                         if ($condition->value_type == "Period") {
1417 1417
                             if (array_key_exists($condition->value, $app_list_strings['date_time_period_list'])) {
1418 1418
                                 $params = $condition->value;
@@ -1420,34 +1420,34 @@  discard block
 block discarded – undo
1420 1420
                                 $params = base64_decode($condition->value);
1421 1421
                             }
1422 1422
                             $date = getPeriodEndDate($params)->format('Y-m-d H:i:s');
1423
-                            $value = '"' . getPeriodDate($params)->format('Y-m-d H:i:s') . '"';
1423
+                            $value = '"'.getPeriodDate($params)->format('Y-m-d H:i:s').'"';
1424 1424
 
1425
-                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ': 'AND '));
1425
+                            $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND '));
1426 1426
                             $tiltLogicOp = false;
1427 1427
 
1428 1428
                             switch ($app_list_strings['aor_sql_operator_list'][$condition->operator]) {
1429 1429
                                 case "=":
1430
-                                    $query['where'][] = $field . ' BETWEEN ' . $value .  ' AND ' . '"' . $date . '"';
1430
+                                    $query['where'][] = $field.' BETWEEN '.$value.' AND '.'"'.$date.'"';
1431 1431
                                     break;
1432 1432
                                 case "!=":
1433
-                                    $query['where'][] = $field . ' NOT BETWEEN ' . $value .  ' AND ' . '"' . $date . '"';
1433
+                                    $query['where'][] = $field.' NOT BETWEEN '.$value.' AND '.'"'.$date.'"';
1434 1434
                                     break;
1435 1435
                                 case ">":
1436 1436
                                 case "<":
1437 1437
                                 case ">=":
1438 1438
                                 case "<=":
1439
-                                    $query['where'][] = $field . ' ' . $app_list_strings['aor_sql_operator_list'][$condition->operator] . ' ' . $value;
1439
+                                    $query['where'][] = $field.' '.$app_list_strings['aor_sql_operator_list'][$condition->operator].' '.$value;
1440 1440
                                     break;
1441 1441
                             }
1442 1442
                         } else {
1443
-                            if (!$where_set) $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ': 'AND ')) . $field . ' ' . $app_list_strings['aor_sql_operator_list'][$condition->operator] . ' ' . $value;
1443
+                            if (!$where_set) $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).$field.' '.$app_list_strings['aor_sql_operator_list'][$condition->operator].' '.$value;
1444 1444
                         }
1445 1445
                     }
1446 1446
                     $tiltLogicOp = false;
1447 1447
                 }
1448
-                else if($condition->parenthesis) {
1449
-                    if($condition->parenthesis == 'START') {
1450
-                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) .  '(';
1448
+                else if ($condition->parenthesis) {
1449
+                    if ($condition->parenthesis == 'START') {
1450
+                        $query['where'][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op.' ' : 'AND ')).'(';
1451 1451
                         $tiltLogicOp = true;
1452 1452
                     }
1453 1453
                     else {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
             }
1463 1463
 
1464
-            if(isset($query['where']) && $query['where']) {
1464
+            if (isset($query['where']) && $query['where']) {
1465 1465
                 array_unshift($query['where'], '(');
1466 1466
                 $query['where'][] = ') AND ';
1467 1467
             }
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 
1470 1470
         }
1471 1471
 
1472
-        if($closure) {
1472
+        if ($closure) {
1473 1473
             $query['where'][] = ')';
1474 1474
         }
1475 1475
 
Please login to merge, or discard this patch.
modules/AOS_Products/metadata/SearchFields.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // created: 2013-05-07 12:48:58
3 3
 global $current_user;
4
-$searchFields['AOS_Products'] = array (
4
+$searchFields['AOS_Products'] = array(
5 5
   'name' => 
6
-  array (
6
+  array(
7 7
     'query_type' => 'default',
8 8
   ),
9 9
   'current_user_only' => 
10
-  array (
10
+  array(
11 11
     'query_type' => 'default',
12 12
     'db_field' => 
13
-    array (
13
+    array(
14 14
       0 => 'created_by',
15 15
     ),
16 16
     'my_items' => true,
@@ -18,67 +18,67 @@  discard block
 block discarded – undo
18 18
     'type' => 'bool',
19 19
   ),
20 20
   'range_price' => 
21
-  array (
21
+  array(
22 22
     'query_type' => 'default',
23 23
     'enable_range_search' => true,
24 24
   ),
25 25
   'start_range_price' => 
26
-  array (
26
+  array(
27 27
     'query_type' => 'default',
28 28
     'enable_range_search' => true,
29 29
   ),
30 30
   'end_range_price' => 
31
-  array (
31
+  array(
32 32
     'query_type' => 'default',
33 33
     'enable_range_search' => true,
34 34
   ),
35 35
   'range_cost' => 
36
-  array (
36
+  array(
37 37
     'query_type' => 'default',
38 38
     'enable_range_search' => true,
39 39
   ),
40 40
   'start_range_cost' => 
41
-  array (
41
+  array(
42 42
     'query_type' => 'default',
43 43
     'enable_range_search' => true,
44 44
   ),
45 45
   'end_range_cost' => 
46
-  array (
46
+  array(
47 47
     'query_type' => 'default',
48 48
     'enable_range_search' => true,
49 49
   ),
50 50
   'range_date_entered' => 
51
-  array (
51
+  array(
52 52
     'query_type' => 'default',
53 53
     'enable_range_search' => true,
54 54
     'is_date_field' => true,
55 55
   ),
56 56
   'start_range_date_entered' => 
57
-  array (
57
+  array(
58 58
     'query_type' => 'default',
59 59
     'enable_range_search' => true,
60 60
     'is_date_field' => true,
61 61
   ),
62 62
   'end_range_date_entered' => 
63
-  array (
63
+  array(
64 64
     'query_type' => 'default',
65 65
     'enable_range_search' => true,
66 66
     'is_date_field' => true,
67 67
   ),
68 68
   'range_date_modified' => 
69
-  array (
69
+  array(
70 70
     'query_type' => 'default',
71 71
     'enable_range_search' => true,
72 72
     'is_date_field' => true,
73 73
   ),
74 74
   'start_range_date_modified' => 
75
-  array (
75
+  array(
76 76
     'query_type' => 'default',
77 77
     'enable_range_search' => true,
78 78
     'is_date_field' => true,
79 79
   ),
80 80
   'end_range_date_modified' => 
81
-  array (
81
+  array(
82 82
     'query_type' => 'default',
83 83
     'enable_range_search' => true,
84 84
     'is_date_field' => true,
@@ -89,6 +89,6 @@  discard block
 block discarded – undo
89 89
         'subquery' => "SELECT favorites.parent_id FROM favorites
90 90
 			                    WHERE favorites.deleted = 0
91 91
 			                        and favorites.parent_type = '".$module_name."'
92
-			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
92
+			                        and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}",
93 93
         'db_field'=>array('id')),
94 94
 );
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Documents/metadata/SearchFields.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,79 +2,79 @@  discard block
 block discarded – undo
2 2
 // created: 2015-02-17 15:14:28
3 3
 global $current_user;
4 4
 $module_name = "Documents";
5
-$searchFields['Documents'] = array (
5
+$searchFields['Documents'] = array(
6 6
   'document_name' => 
7
-  array (
7
+  array(
8 8
     'query_type' => 'default',
9 9
   ),
10 10
   'category_id' => 
11
-  array (
11
+  array(
12 12
     'query_type' => 'default',
13 13
     'options' => 'document_category_dom',
14 14
     'template_var' => 'CATEGORY_OPTIONS',
15 15
   ),
16 16
   'subcategory_id' => 
17
-  array (
17
+  array(
18 18
     'query_type' => 'default',
19 19
     'options' => 'document_subcategory_dom',
20 20
     'template_var' => 'SUBCATEGORY_OPTIONS',
21 21
   ),
22 22
   'active_date' => 
23
-  array (
23
+  array(
24 24
     'query_type' => 'default',
25 25
   ),
26 26
   'exp_date' => 
27
-  array (
27
+  array(
28 28
     'query_type' => 'default',
29 29
   ),
30 30
   'assigned_user_id' => 
31
-  array (
31
+  array(
32 32
     'query_type' => 'default',
33 33
   ),
34 34
   'filename' => 
35
-  array (
35
+  array(
36 36
     'query_type' => 'format',
37 37
     'operator' => 'subquery',
38 38
     'subquery' => 'SELECT document_revisions.id FROM document_revisions
39 39
 			           WHERE document_revisions.deleted=0
40 40
 				   AND document_revisions.filename LIKE \'{0}\'',
41 41
     'db_field' => 
42
-    array (
42
+    array(
43 43
       0 => 'document_revision_id',
44 44
     ),
45 45
   ),
46 46
   'range_date_entered' => 
47
-  array (
47
+  array(
48 48
     'query_type' => 'default',
49 49
     'enable_range_search' => true,
50 50
     'is_date_field' => true,
51 51
   ),
52 52
   'start_range_date_entered' => 
53
-  array (
53
+  array(
54 54
     'query_type' => 'default',
55 55
     'enable_range_search' => true,
56 56
     'is_date_field' => true,
57 57
   ),
58 58
   'end_range_date_entered' => 
59
-  array (
59
+  array(
60 60
     'query_type' => 'default',
61 61
     'enable_range_search' => true,
62 62
     'is_date_field' => true,
63 63
   ),
64 64
   'range_date_modified' => 
65
-  array (
65
+  array(
66 66
     'query_type' => 'default',
67 67
     'enable_range_search' => true,
68 68
     'is_date_field' => true,
69 69
   ),
70 70
   'start_range_date_modified' => 
71
-  array (
71
+  array(
72 72
     'query_type' => 'default',
73 73
     'enable_range_search' => true,
74 74
     'is_date_field' => true,
75 75
   ),
76 76
   'end_range_date_modified' => 
77
-  array (
77
+  array(
78 78
     'query_type' => 'default',
79 79
     'enable_range_search' => true,
80 80
     'is_date_field' => true,
@@ -85,6 +85,6 @@  discard block
 block discarded – undo
85 85
         'subquery' => "SELECT favorites.parent_id FROM favorites
86 86
 			                    WHERE favorites.deleted = 0
87 87
 			                        and favorites.parent_type = '".$module_name."'
88
-			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
88
+			                        and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}",
89 89
         'db_field'=>array('id')),
90 90
 );
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Meetings/metadata/SearchFields.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -40,42 +40,42 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Meetings";
42 42
 $searchFields['Meetings'] = 
43
-	array (
44
-		'name' => array( 'query_type'=>'default'),
43
+    array (
44
+        'name' => array( 'query_type'=>'default'),
45 45
         'contact_name' => array( 'query_type'=>'default','db_field'=>array('contacts.first_name','contacts.last_name')),        
46 46
         'date_start' => array( 'query_type'=>'default'),
47 47
         'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
48 48
         'assigned_user_id'=> array('query_type'=>'default'),
49 49
         'status'=> array('query_type'=>'default', 'options' => 'meeting_status_dom', 'template_var' => 'STATUS_FILTER'),
50 50
         
51
-		'open_only' => array(
52
-			'query_type'=>'default',
53
-			'db_field'=>array('status'),
54
-			'operator'=>'not in',
55
-			'closed_values' => array('Held', 'Not Held'),
56
-			'type'=>'bool',
57
-		),		
51
+        'open_only' => array(
52
+            'query_type'=>'default',
53
+            'db_field'=>array('status'),
54
+            'operator'=>'not in',
55
+            'closed_values' => array('Held', 'Not Held'),
56
+            'type'=>'bool',
57
+        ),		
58 58
         'favorites_only' => array(
59 59
             'query_type'=>'format',
60 60
             'operator' => 'subquery',
61
-			'subquery' => "SELECT favorites.parent_id FROM favorites
61
+            'subquery' => "SELECT favorites.parent_id FROM favorites
62 62
 			                    WHERE favorites.deleted = 0
63 63
 			                        and favorites.parent_type = '".$module_name."'
64 64
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
65 65
             'db_field'=>array('id')),
66
-		//Range Search Support
67
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
69
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
71
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
72
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
73
-	   'range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
-	   'start_range_date_start' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
75
-	   'end_range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
76
-	   'range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
77
-	   'start_range_date_end' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
78
-       'end_range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
79
-	    //Range Search Support 				
80
-	);
66
+        //Range Search Support
67
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
+        'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
69
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
71
+        'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
72
+        'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
73
+        'range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
+        'start_range_date_start' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
75
+        'end_range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
76
+        'range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
77
+        'start_range_date_end' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
78
+        'end_range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
79
+        //Range Search Support 				
80
+    );
81 81
 ?>
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Meetings";
42 42
 $searchFields['Meetings'] = 
43
-	array (
44
-		'name' => array( 'query_type'=>'default'),
45
-        'contact_name' => array( 'query_type'=>'default','db_field'=>array('contacts.first_name','contacts.last_name')),        
46
-        'date_start' => array( 'query_type'=>'default'),
47
-        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
43
+	array(
44
+		'name' => array('query_type'=>'default'),
45
+        'contact_name' => array('query_type'=>'default', 'db_field'=>array('contacts.first_name', 'contacts.last_name')),        
46
+        'date_start' => array('query_type'=>'default'),
47
+        'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
48 48
         'assigned_user_id'=> array('query_type'=>'default'),
49 49
         'status'=> array('query_type'=>'default', 'options' => 'meeting_status_dom', 'template_var' => 'STATUS_FILTER'),
50 50
         
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 			'subquery' => "SELECT favorites.parent_id FROM favorites
62 62
 			                    WHERE favorites.deleted = 0
63 63
 			                        and favorites.parent_type = '".$module_name."'
64
-			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
64
+			                        and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}",
65 65
             'db_field'=>array('id')),
66 66
 		//Range Search Support
67
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
69
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
71
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
72
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
73
-	   'range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
-	   'start_range_date_start' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
75
-	   'end_range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
76
-	   'range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
77
-	   'start_range_date_end' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
78
-       'end_range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
67
+	   'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
+	   'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
69
+	   'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
+	   'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
71
+	   'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
72
+       'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
73
+	   'range_date_start' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
+	   'start_range_date_start' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
75
+	   'end_range_date_start' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
76
+	   'range_date_end' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
77
+	   'start_range_date_end' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
78
+       'end_range_date_end' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
79 79
 	    //Range Search Support 				
80 80
 	);
81 81
 ?>
Please login to merge, or discard this patch.
modules/Leads/metadata/SearchFields.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
         'last_name'=> array('query_type'=>'default'),
46 46
         'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true),
47 47
         'account_name'=> array('query_type'=>'default','db_field'=>array('leads.account_name')),
48
-		/*'acc_name_from_accounts' => array('query_type'=>'default','related_field'=>'account_name'),*/
48
+        /*'acc_name_from_accounts' => array('query_type'=>'default','related_field'=>'account_name'),*/
49 49
         'lead_source'=> array('query_type'=>'default','operator'=>'=', 'options'=>'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50 50
         'do_not_call'=> array('query_type'=>'default', 'operator'=>'=', 'input_type' => 'checkbox'),
51 51
         'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','phone_home')),
52
-		'email'=> array(
53
-			'query_type' => 'default',
54
-			'operator' => 'subquery',
55
-			'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
56
-			'db_field' => array(
57
-				'id',
58
-			),
59
-		),	
52
+        'email'=> array(
53
+            'query_type' => 'default',
54
+            'operator' => 'subquery',
55
+            'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
56
+            'db_field' => array(
57
+                'id',
58
+            ),
59
+        ),	
60 60
         'favorites_only' => array(
61 61
             'query_type'=>'format',
62 62
             'operator' => 'subquery',
63
-			'subquery' => "SELECT favorites.parent_id FROM favorites
63
+            'subquery' => "SELECT favorites.parent_id FROM favorites
64 64
 			                    WHERE favorites.deleted = 0
65 65
 			                        and favorites.parent_type = '".$module_name."'
66 66
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
         'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
76 76
         'assigned_user_id'=> array('query_type'=>'default'),
77 77
         'status'=> array('query_type'=>'default', 'options'=>'lead_status_dom', 'template_var' => 'STATUS_OPTIONS'),
78
-		'open_only' => array(
79
-			'query_type'=>'default',
80
-			'db_field'=>array('status'),
81
-			'operator'=>'not in',
82
-			'closed_values' => array('Dead', 'Recycled', 'Converted'),
83
-			'type'=>'bool',
84
-		),
85
-		//Range Search Support 
86
-	    'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
87
-	    'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
88
-	    'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
89
-	    'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
90
-	    'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
78
+        'open_only' => array(
79
+            'query_type'=>'default',
80
+            'db_field'=>array('status'),
81
+            'operator'=>'not in',
82
+            'closed_values' => array('Dead', 'Recycled', 'Converted'),
83
+            'type'=>'bool',
84
+        ),
85
+        //Range Search Support 
86
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
87
+        'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
88
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
89
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
90
+        'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
91 91
         'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
92
-	    //Range Search Support 				
92
+        //Range Search Support 				
93 93
     );
94 94
 ?>
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Leads";
42 42
 $searchFields['Leads'] = 
43
-    array (
44
-        'first_name' => array( 'query_type'=>'default'),
43
+    array(
44
+        'first_name' => array('query_type'=>'default'),
45 45
         'last_name'=> array('query_type'=>'default'),
46
-        'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true),
47
-        'account_name'=> array('query_type'=>'default','db_field'=>array('leads.account_name')),
46
+        'search_name'=> array('query_type'=>'default', 'db_field'=>array('first_name', 'last_name'), 'force_unifiedsearch'=>true),
47
+        'account_name'=> array('query_type'=>'default', 'db_field'=>array('leads.account_name')),
48 48
 		/*'acc_name_from_accounts' => array('query_type'=>'default','related_field'=>'account_name'),*/
49
-        'lead_source'=> array('query_type'=>'default','operator'=>'=', 'options'=>'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
49
+        'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options'=>'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50 50
         'do_not_call'=> array('query_type'=>'default', 'operator'=>'=', 'input_type' => 'checkbox'),
51
-        'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','phone_home')),
51
+        'phone'=> array('query_type'=>'default', 'db_field'=>array('phone_mobile', 'phone_work', 'phone_other', 'phone_fax', 'phone_home')),
52 52
 		'email'=> array(
53 53
 			'query_type' => 'default',
54 54
 			'operator' => 'subquery',
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
 			'subquery' => "SELECT favorites.parent_id FROM favorites
64 64
 			                    WHERE favorites.deleted = 0
65 65
 			                        and favorites.parent_type = '".$module_name."'
66
-			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
66
+			                        and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}",
67 67
             'db_field'=>array('id')),
68 68
         'assistant'=> array('query_type'=>'default'),
69 69
         'website'=> array('query_type'=>'default'),
70
-        'address_street'=> array('query_type'=>'default','db_field'=>array('primary_address_street','alt_address_street')),
71
-        'address_city'=> array('query_type'=>'default','db_field'=>array('primary_address_city','alt_address_city')),
72
-        'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')),
73
-        'address_postalcode'=> array('query_type'=>'default','db_field'=>array('primary_address_postalcode','alt_address_postalcode')),
74
-        'address_country'=> array('query_type'=>'default','db_field'=>array('primary_address_country','alt_address_country')),
75
-        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
70
+        'address_street'=> array('query_type'=>'default', 'db_field'=>array('primary_address_street', 'alt_address_street')),
71
+        'address_city'=> array('query_type'=>'default', 'db_field'=>array('primary_address_city', 'alt_address_city')),
72
+        'address_state'=> array('query_type'=>'default', 'db_field'=>array('primary_address_state', 'alt_address_state')),
73
+        'address_postalcode'=> array('query_type'=>'default', 'db_field'=>array('primary_address_postalcode', 'alt_address_postalcode')),
74
+        'address_country'=> array('query_type'=>'default', 'db_field'=>array('primary_address_country', 'alt_address_country')),
75
+        'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
76 76
         'assigned_user_id'=> array('query_type'=>'default'),
77 77
         'status'=> array('query_type'=>'default', 'options'=>'lead_status_dom', 'template_var' => 'STATUS_OPTIONS'),
78 78
 		'open_only' => array(
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 			'type'=>'bool',
84 84
 		),
85 85
 		//Range Search Support 
86
-	    'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
87
-	    'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
88
-	    'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
89
-	    'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
90
-	    'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
91
-        'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
86
+	    'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
87
+	    'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
88
+	    'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
89
+	    'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
90
+	    'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
91
+        'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
92 92
 	    //Range Search Support 				
93 93
     );
94 94
 ?>
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Project/metadata/SearchFields.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@
 block discarded – undo
46 46
         'favorites_only' => array(
47 47
             'query_type'=>'format',
48 48
             'operator' => 'subquery',
49
-			'subquery' => "SELECT favorites.parent_id FROM favorites
49
+            'subquery' => "SELECT favorites.parent_id FROM favorites
50 50
 			                    WHERE favorites.deleted = 0
51 51
 			                        and favorites.parent_type = '".$module_name."'
52 52
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
53 53
             'db_field'=>array('id')),
54
-		//Range Search Support 
55
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
56
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
57
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
58
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
59
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
60
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
54
+        //Range Search Support 
55
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
56
+        'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
57
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
58
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
59
+        'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
60
+        'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
61 61
 	    
62
-	   'range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
63
-	   'start_range_estimated_start_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
64
-	   'end_range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
65
-	   'range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
-	   'start_range_estimated_end_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
67
-       'end_range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
68
-		//Range Search Support 				
62
+        'range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
63
+        'start_range_estimated_start_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
64
+        'end_range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
65
+        'range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
+        'start_range_estimated_end_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
67
+        'end_range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
68
+        //Range Search Support 				
69 69
     );
70 70
 ?>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Project";
42 42
 $searchFields['Project'] = 
43
-    array (
44
-        'name' => array( 'query_type'=>'default'),
45
-        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
43
+    array(
44
+        'name' => array('query_type'=>'default'),
45
+        'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
46 46
         'favorites_only' => array(
47 47
             'query_type'=>'format',
48 48
             'operator' => 'subquery',
49 49
 			'subquery' => "SELECT favorites.parent_id FROM favorites
50 50
 			                    WHERE favorites.deleted = 0
51 51
 			                        and favorites.parent_type = '".$module_name."'
52
-			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
52
+			                        and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}",
53 53
             'db_field'=>array('id')),
54 54
 		//Range Search Support 
55
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
56
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
57
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
58
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
59
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
60
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
55
+	   'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
56
+	   'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
57
+	   'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
58
+	   'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
59
+	   'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
60
+       'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
61 61
 	    
62
-	   'range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
63
-	   'start_range_estimated_start_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
64
-	   'end_range_estimated_start_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
65
-	   'range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
-	   'start_range_estimated_end_date' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
67
-       'end_range_estimated_end_date' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
62
+	   'range_estimated_start_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
63
+	   'start_range_estimated_start_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
64
+	   'end_range_estimated_start_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
65
+	   'range_estimated_end_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
+	   'start_range_estimated_end_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
67
+       'end_range_estimated_end_date' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
68 68
 		//Range Search Support 				
69 69
     );
70 70
 ?>
Please login to merge, or discard this patch.