Completed
Push — develop ( edae1e...431cf5 )
by Adam
20:48
created
modules/ACLActions/metadata/subpaneldefs.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,33 +42,33 @@
 block discarded – undo
42 42
 
43 43
 
44 44
 $layout_defs['ACL'] = array(
45
-	// sets up which panels to show, in which order, and with what linked_fields
46
-	'subpanel_setup' => array(
45
+    // sets up which panels to show, in which order, and with what linked_fields
46
+    'subpanel_setup' => array(
47 47
         'users' => array(
48
-			'top_buttons' => array(	array('widget_class' => 'SubPanelTopSubModuleSelectButton', 'popup_module' => 'Users'),),
49
-			'order' => 20,
50
-			'module' => 'Users',
51
-			'subpanel_name' => 'ForSubModules',
52
-			'get_subpanel_data' => 'users',
53
-			'add_subpanel_data' => 'user_id',
54
-			'title_key' => 'LBL_USERS_SUBPANEL_TITLE',
55
-		),
56
-	),
48
+            'top_buttons' => array(	array('widget_class' => 'SubPanelTopSubModuleSelectButton', 'popup_module' => 'Users'),),
49
+            'order' => 20,
50
+            'module' => 'Users',
51
+            'subpanel_name' => 'ForSubModules',
52
+            'get_subpanel_data' => 'users',
53
+            'add_subpanel_data' => 'user_id',
54
+            'title_key' => 'LBL_USERS_SUBPANEL_TITLE',
55
+        ),
56
+    ),
57 57
 );
58 58
 $layout_defs['UserRoles'] = array(
59
-	// sets up which panels to show, in which order, and with what linked_fields
60
-	'subpanel_setup' => array(
59
+    // sets up which panels to show, in which order, and with what linked_fields
60
+    'subpanel_setup' => array(
61 61
         'acl' => array(
62
-			'top_buttons' => array(array('widget_class' => 'SubPanelTopSubModuleSelectButton', 'popup_module' => 'ACL'),),
63
-			'order' => 20,
64
-			'module' => 'ACL',
65
-			'subpanel_def_path'=>'modules/ACL/Roles/subpanels/default.php',
66
-			'subpanel_name' => 'default',
67
-			'get_subpanel_data' => 'roles',
68
-			'add_subpanel_data' => 'role_id',
69
-			'title_key' => 'LBL_ROLES_SUBPANEL_TITLE',
70
-		),
71
-	),
62
+            'top_buttons' => array(array('widget_class' => 'SubPanelTopSubModuleSelectButton', 'popup_module' => 'ACL'),),
63
+            'order' => 20,
64
+            'module' => 'ACL',
65
+            'subpanel_def_path'=>'modules/ACL/Roles/subpanels/default.php',
66
+            'subpanel_name' => 'default',
67
+            'get_subpanel_data' => 'roles',
68
+            'add_subpanel_data' => 'role_id',
69
+            'title_key' => 'LBL_ROLES_SUBPANEL_TITLE',
70
+        ),
71
+    ),
72 72
 	
73 73
 );
74 74
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	// sets up which panels to show, in which order, and with what linked_fields
46 46
 	'subpanel_setup' => array(
47 47
         'users' => array(
48
-			'top_buttons' => array(	array('widget_class' => 'SubPanelTopSubModuleSelectButton', 'popup_module' => 'Users'),),
48
+			'top_buttons' => array(array('widget_class' => 'SubPanelTopSubModuleSelectButton', 'popup_module' => 'Users'),),
49 49
 			'order' => 20,
50 50
 			'module' => 'Users',
51 51
 			'subpanel_name' => 'ForSubModules',
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/ACLActions/actiondefs.php 3 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -38,96 +38,96 @@
 block discarded – undo
38 38
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 39
  ********************************************************************************/
40 40
 
41
- if(!defined('ACL_ALLOW_NONE')){   
42
- 	define('ACL_ALLOW_ADMIN_DEV', 100);
43
- 	define('ACL_ALLOW_ADMIN', 99);
44
- 	define('ACL_ALLOW_ALL', 90);                        
45
- 	define('ACL_ALLOW_ENABLED', 89);
46
- 	define('ACL_ALLOW_OWNER', 75);
47
- 	define('ACL_ALLOW_NORMAL', 1);
48
- 	define('ACL_ALLOW_DEFAULT', 0);
49
- 	define('ACL_ALLOW_DISABLED', -98);
50
- 	define('ACL_ALLOW_NONE', -99);
51
- 	define('ACL_ALLOW_DEV', 95);
52
- }
53
- /**
54
-  * $GLOBALS['ACLActionAccessLevels
55
-  * these are rendering descriptions for Access Levels giving information such as the label, color, and text color to use when rendering the access level
56
-  */
57
- $GLOBALS['ACLActionAccessLevels'] = array(
58
- 	ACL_ALLOW_ALL=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_ALL', 'text_color'=>'white'),
59
- 	ACL_ALLOW_OWNER=>array('color'=>'#6F6800', 'label'=>'LBL_ACCESS_OWNER', 'text_color'=>'white'),
60
- 	ACL_ALLOW_NONE=>array('color'=>'#FF0000', 'label'=>'LBL_ACCESS_NONE', 'text_color'=>'white'),
61
- 	ACL_ALLOW_ENABLED=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_ENABLED', 'text_color'=>'white'),
62
- 	ACL_ALLOW_DISABLED=>array('color'=>'#FF0000', 'label'=>'LBL_ACCESS_DISABLED', 'text_color'=>'white'),
63
- 	ACL_ALLOW_ADMIN=>array('color'=>'#0000FF', 'label'=>'LBL_ACCESS_ADMIN', 'text_color'=>'white'),
64
- 	ACL_ALLOW_NORMAL=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_NORMAL', 'text_color'=>'white'),
65
- 	ACL_ALLOW_DEFAULT=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_DEFAULT', 'text_color'=>'white'),
66
- 	ACL_ALLOW_DEV=>array('color'=>'#0000FF', 'label'=>'LBL_ACCESS_DEV', 'text_color'=>'white'),
67
- 	ACL_ALLOW_ADMIN_DEV=>array('color'=>'#0000FF', 'label'=>'LBL_ACCESS_ADMIN_DEV', 'text_color'=>'white'),
68
- 	);
41
+    if(!defined('ACL_ALLOW_NONE')){   
42
+        define('ACL_ALLOW_ADMIN_DEV', 100);
43
+        define('ACL_ALLOW_ADMIN', 99);
44
+        define('ACL_ALLOW_ALL', 90);                        
45
+        define('ACL_ALLOW_ENABLED', 89);
46
+        define('ACL_ALLOW_OWNER', 75);
47
+        define('ACL_ALLOW_NORMAL', 1);
48
+        define('ACL_ALLOW_DEFAULT', 0);
49
+        define('ACL_ALLOW_DISABLED', -98);
50
+        define('ACL_ALLOW_NONE', -99);
51
+        define('ACL_ALLOW_DEV', 95);
52
+    }
53
+    /**
54
+     * $GLOBALS['ACLActionAccessLevels
55
+     * these are rendering descriptions for Access Levels giving information such as the label, color, and text color to use when rendering the access level
56
+     */
57
+    $GLOBALS['ACLActionAccessLevels'] = array(
58
+        ACL_ALLOW_ALL=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_ALL', 'text_color'=>'white'),
59
+        ACL_ALLOW_OWNER=>array('color'=>'#6F6800', 'label'=>'LBL_ACCESS_OWNER', 'text_color'=>'white'),
60
+        ACL_ALLOW_NONE=>array('color'=>'#FF0000', 'label'=>'LBL_ACCESS_NONE', 'text_color'=>'white'),
61
+        ACL_ALLOW_ENABLED=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_ENABLED', 'text_color'=>'white'),
62
+        ACL_ALLOW_DISABLED=>array('color'=>'#FF0000', 'label'=>'LBL_ACCESS_DISABLED', 'text_color'=>'white'),
63
+        ACL_ALLOW_ADMIN=>array('color'=>'#0000FF', 'label'=>'LBL_ACCESS_ADMIN', 'text_color'=>'white'),
64
+        ACL_ALLOW_NORMAL=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_NORMAL', 'text_color'=>'white'),
65
+        ACL_ALLOW_DEFAULT=>array('color'=>'#008000', 'label'=>'LBL_ACCESS_DEFAULT', 'text_color'=>'white'),
66
+        ACL_ALLOW_DEV=>array('color'=>'#0000FF', 'label'=>'LBL_ACCESS_DEV', 'text_color'=>'white'),
67
+        ACL_ALLOW_ADMIN_DEV=>array('color'=>'#0000FF', 'label'=>'LBL_ACCESS_ADMIN_DEV', 'text_color'=>'white'),
68
+        );
69 69
 /**
70
- * $GLOBALS['ACLActions
71
- * These are the actions for a given type. It includes the ACCESS Levels for that action and the label for that action. Every an object of the category (e.g. module) is added all associated actions are added for that object
72
- */
70
+         * $GLOBALS['ACLActions
71
+         * These are the actions for a given type. It includes the ACCESS Levels for that action and the label for that action. Every an object of the category (e.g. module) is added all associated actions are added for that object
72
+         */
73 73
 $GLOBALS['ACLActions'] = array(
74
-	'module'=>array('actions'=>
75
-						array(
76
-						'access'=>
77
-								array(
78
-									'aclaccess'=>array(ACL_ALLOW_ENABLED,ACL_ALLOW_DEFAULT, ACL_ALLOW_DISABLED),
79
-									'label'=>'LBL_ACTION_ACCESS',
80
-									'default'=>ACL_ALLOW_ENABLED,
81
-								),
74
+    'module'=>array('actions'=>
75
+                        array(
76
+                        'access'=>
77
+                                array(
78
+                                    'aclaccess'=>array(ACL_ALLOW_ENABLED,ACL_ALLOW_DEFAULT, ACL_ALLOW_DISABLED),
79
+                                    'label'=>'LBL_ACTION_ACCESS',
80
+                                    'default'=>ACL_ALLOW_ENABLED,
81
+                                ),
82 82
 							
83
-						'view'=>
84
-								array(
85
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
86
-									'label'=>'LBL_ACTION_VIEW',
87
-									'default'=>ACL_ALLOW_ALL,
88
-								),
83
+                        'view'=>
84
+                                array(
85
+                                    'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
86
+                                    'label'=>'LBL_ACTION_VIEW',
87
+                                    'default'=>ACL_ALLOW_ALL,
88
+                                ),
89 89
 					
90
-						'list'=>
91
-								array(
92
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
93
-									'label'=>'LBL_ACTION_LIST',
94
-									'default'=>ACL_ALLOW_ALL,
95
-								),
96
-						'edit'=>
97
-								array(
98
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
99
-									'label'=>'LBL_ACTION_EDIT',
100
-									'default'=>ACL_ALLOW_ALL,
90
+                        'list'=>
91
+                                array(
92
+                                    'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
93
+                                    'label'=>'LBL_ACTION_LIST',
94
+                                    'default'=>ACL_ALLOW_ALL,
95
+                                ),
96
+                        'edit'=>
97
+                                array(
98
+                                    'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
99
+                                    'label'=>'LBL_ACTION_EDIT',
100
+                                    'default'=>ACL_ALLOW_ALL,
101 101
 									
102
-								),
103
-						'delete'=>
104
-							array(
105
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
106
-									'label'=>'LBL_ACTION_DELETE',
107
-									'default'=>ACL_ALLOW_ALL,
102
+                                ),
103
+                        'delete'=>
104
+                            array(
105
+                                    'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
106
+                                    'label'=>'LBL_ACTION_DELETE',
107
+                                    'default'=>ACL_ALLOW_ALL,
108 108
 									
109
-								),
110
-						'import'=>
111
-							array(
112
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
113
-									'label'=>'LBL_ACTION_IMPORT',
114
-									'default'=>ACL_ALLOW_ALL,
115
-								),
116
-						'export'=>
117
-							array(
118
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
119
-									'label'=>'LBL_ACTION_EXPORT',
120
-									'default'=>ACL_ALLOW_ALL,
121
-								),
109
+                                ),
110
+                        'import'=>
111
+                            array(
112
+                                    'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
113
+                                    'label'=>'LBL_ACTION_IMPORT',
114
+                                    'default'=>ACL_ALLOW_ALL,
115
+                                ),
116
+                        'export'=>
117
+                            array(
118
+                                    'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
119
+                                    'label'=>'LBL_ACTION_EXPORT',
120
+                                    'default'=>ACL_ALLOW_ALL,
121
+                                ),
122 122
                         'massupdate'=>
123
-							array(
124
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
125
-									'label'=>'LBL_ACTION_MASSUPDATE',
126
-									'default'=>ACL_ALLOW_ALL,
127
-								),
123
+                            array(
124
+                                    'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
125
+                                    'label'=>'LBL_ACTION_MASSUPDATE',
126
+                                    'default'=>ACL_ALLOW_ALL,
127
+                                ),
128 128
 						
129 129
 					
130
-				),),
130
+                ),),
131 131
 );
132 132
 
133 133
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 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.
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 39
  ********************************************************************************/
40 40
 
41
- if(!defined('ACL_ALLOW_NONE')){   
41
+ if (!defined('ACL_ALLOW_NONE')) {   
42 42
  	define('ACL_ALLOW_ADMIN_DEV', 100);
43 43
  	define('ACL_ALLOW_ADMIN', 99);
44 44
  	define('ACL_ALLOW_ALL', 90);                        
@@ -75,53 +75,53 @@  discard block
 block discarded – undo
75 75
 						array(
76 76
 						'access'=>
77 77
 								array(
78
-									'aclaccess'=>array(ACL_ALLOW_ENABLED,ACL_ALLOW_DEFAULT, ACL_ALLOW_DISABLED),
78
+									'aclaccess'=>array(ACL_ALLOW_ENABLED, ACL_ALLOW_DEFAULT, ACL_ALLOW_DISABLED),
79 79
 									'label'=>'LBL_ACTION_ACCESS',
80 80
 									'default'=>ACL_ALLOW_ENABLED,
81 81
 								),
82 82
 							
83 83
 						'view'=>
84 84
 								array(
85
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
85
+									'aclaccess'=>array(ACL_ALLOW_ALL, ACL_ALLOW_OWNER, ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
86 86
 									'label'=>'LBL_ACTION_VIEW',
87 87
 									'default'=>ACL_ALLOW_ALL,
88 88
 								),
89 89
 					
90 90
 						'list'=>
91 91
 								array(
92
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
92
+									'aclaccess'=>array(ACL_ALLOW_ALL, ACL_ALLOW_OWNER, ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
93 93
 									'label'=>'LBL_ACTION_LIST',
94 94
 									'default'=>ACL_ALLOW_ALL,
95 95
 								),
96 96
 						'edit'=>
97 97
 								array(
98
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
98
+									'aclaccess'=>array(ACL_ALLOW_ALL, ACL_ALLOW_OWNER, ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
99 99
 									'label'=>'LBL_ACTION_EDIT',
100 100
 									'default'=>ACL_ALLOW_ALL,
101 101
 									
102 102
 								),
103 103
 						'delete'=>
104 104
 							array(
105
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
105
+									'aclaccess'=>array(ACL_ALLOW_ALL, ACL_ALLOW_OWNER, ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
106 106
 									'label'=>'LBL_ACTION_DELETE',
107 107
 									'default'=>ACL_ALLOW_ALL,
108 108
 									
109 109
 								),
110 110
 						'import'=>
111 111
 							array(
112
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
112
+									'aclaccess'=>array(ACL_ALLOW_ALL, ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
113 113
 									'label'=>'LBL_ACTION_IMPORT',
114 114
 									'default'=>ACL_ALLOW_ALL,
115 115
 								),
116 116
 						'export'=>
117 117
 							array(
118
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_OWNER,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
118
+									'aclaccess'=>array(ACL_ALLOW_ALL, ACL_ALLOW_OWNER, ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
119 119
 									'label'=>'LBL_ACTION_EXPORT',
120 120
 									'default'=>ACL_ALLOW_ALL,
121 121
 								),
122 122
                         'massupdate'=>
123 123
 							array(
124
-									'aclaccess'=>array(ACL_ALLOW_ALL,ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
124
+									'aclaccess'=>array(ACL_ALLOW_ALL, ACL_ALLOW_DEFAULT, ACL_ALLOW_NONE),
125 125
 									'label'=>'LBL_ACTION_MASSUPDATE',
126 126
 									'default'=>ACL_ALLOW_ALL,
127 127
 								),
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
MyPipelineBySalesStageDashlet/MyPipelineBySalesStageDashlet.meta.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@
 block discarded – undo
44 44
 global $app_strings, $current_language;
45 45
 
46 46
 $dashletMeta['MyPipelineBySalesStageDashlet'] = array('title'       => 'LBL_TITLE',  
47
-                                                      'description' => 'LBL_TITLE',
48
-                                                      'icon'		  => 'icon_Charts_Funnel_32.gif',
49
-                                                      'module'        => 'Opportunities', 
50
-                                                      'category'    => 'Charts');
47
+                                                        'description' => 'LBL_TITLE',
48
+                                                        'icon'		  => 'icon_Charts_Funnel_32.gif',
49
+                                                        'module'        => 'Opportunities', 
50
+                                                        'category'    => 'Charts');
51 51
 ?>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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.
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
Dashlets/MyPipelineBySalesStageDashlet/MyPipelineBySalesStageDashlet.php 2 patches
Spacing   +24 added lines, -24 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.
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
     {
63 63
         global $timedate;
64 64
 
65
-        if(empty($options['mypbss_date_start']))
65
+        if (empty($options['mypbss_date_start']))
66 66
             $options['mypbss_date_start'] = $timedate->nowDbDate();
67
-        if(empty($options['mypbss_date_end']))
67
+        if (empty($options['mypbss_date_end']))
68 68
             $options['mypbss_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months"));
69
-        if(empty($options['title']))
69
+        if (empty($options['title']))
70 70
             $options['title'] = translate('LBL_MY_PIPELINE_FORM_TITLE', 'Home');
71 71
 
72
-        parent::__construct($id,$options);
72
+        parent::__construct($id, $options);
73 73
     }
74 74
 
75 75
     /**
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
         $searchFormTab = 'advanced_search';
106 106
         $userId = $current_user->id;
107 107
 
108
-        $url_params = array( 'assigned_user_id' => $current_user->id );
108
+        $url_params = array('assigned_user_id' => $current_user->id);
109 109
         $group_by = $this->constructGroupBy();
110 110
 
111 111
         $currency_symbol = $sugar_config['default_currency_symbol'];
112
-        if ($current_user->getPreference('currency')){
112
+        if ($current_user->getPreference('currency')) {
113 113
 
114 114
             $currency = new Currency();
115 115
             $currency->retrieve($current_user->getPreference('currency'));
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
         $thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
120 120
 
121
-        $subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
121
+        $subtitle = translate('LBL_OPP_SIZE', 'Charts')." ".$currency_symbol."1".translate('LBL_OPP_THOUSANDS', 'Charts');
122 122
 
123 123
         $query = $this->constructQuery();
124 124
         $data = $this->constructCEChartData($this->getChartData($query));
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $startDate = $timedate->to_display_date($this->mypbss_date_start, false);
148 148
         $endDate = $timedate->to_display_date($this->mypbss_date_end, false);
149 149
 
150
-        if(!is_array($chartReadyData['data'])||count($chartReadyData['data']) < 1)
150
+        if (!is_array($chartReadyData['data']) || count($chartReadyData['data']) < 1)
151 151
         {
152 152
             return "<h3 class='noGraphDataPoints'>$this->noDataMessage</h3>";
153 153
         }
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
         $result = $db->query($query);
326 326
         $row = $db->fetchByAssoc($result, false);
327 327
 
328
-        while($row != null){
328
+        while ($row != null) {
329 329
             $temp_data[] = $row;
330 330
             $row = $db->fetchByAssoc($result, false);
331 331
         }
332 332
 
333 333
         // reorder and set the array based on the order of selected_datax
334
-        foreach($selected_datax as $sales_stage){
335
-            foreach($temp_data as $key => $value){
336
-                if ($value['sales_stage'] == $sales_stage){
334
+        foreach ($selected_datax as $sales_stage) {
335
+            foreach ($temp_data as $key => $value) {
336
+                if ($value['sales_stage'] == $sales_stage) {
337 337
                     $value['sales_stage'] = $app_list_strings['sales_stage_dom'][$value['sales_stage']];
338 338
                     $value['key'] = $sales_stage;
339 339
                     $value['value'] = $value['sales_stage'];
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     )
355 355
     {
356 356
         $total = 0;
357
-        foreach($dataset as $value){
357
+        foreach ($dataset as $value) {
358 358
             $total += $value;
359 359
         }
360 360
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     )
371 371
     {
372 372
         $newData = array();
373
-        foreach($dataset as $key=>$value){
373
+        foreach ($dataset as $key=>$value) {
374 374
             $newData[$value['sales_stage']] = $value['total'];
375 375
         }
376 376
         return $newData;
@@ -387,12 +387,12 @@  discard block
 block discarded – undo
387 387
                         count(*) AS opp_count,
388 388
                         sum(amount_usdollar/1000) AS total
389 389
                     FROM users,opportunities  ";
390
-        $query .= " WHERE opportunities.assigned_user_id IN ('{$GLOBALS['current_user']->id}') " .
391
-            " AND opportunities.date_closed >= ". db_convert("'".$this->mypbss_date_start."'",'date').
392
-            " AND opportunities.date_closed <= ".db_convert("'".$this->mypbss_date_end."'",'date') .
390
+        $query .= " WHERE opportunities.assigned_user_id IN ('{$GLOBALS['current_user']->id}') ".
391
+            " AND opportunities.date_closed >= ".db_convert("'".$this->mypbss_date_start."'", 'date').
392
+            " AND opportunities.date_closed <= ".db_convert("'".$this->mypbss_date_end."'", 'date').
393 393
             " AND opportunities.assigned_user_id = users.id  AND opportunities.deleted=0 ";
394
-        if ( count($this->mypbss_sales_stages) > 0 )
395
-            $query .= " AND opportunities.sales_stage IN ('" . implode("','",$this->mypbss_sales_stages) . "') ";
394
+        if (count($this->mypbss_sales_stages) > 0)
395
+            $query .= " AND opportunities.sales_stage IN ('".implode("','", $this->mypbss_sales_stages)."') ";
396 396
         $query .= " GROUP BY opportunities.sales_stage ,users.user_name,opportunities.assigned_user_id";
397 397
 
398 398
         return $query;
@@ -409,22 +409,22 @@  discard block
 block discarded – undo
409 409
         return $groupBy;
410 410
     }
411 411
 
412
-    protected function prepareChartData($data,$currency_symbol, $thousands_symbol)
412
+    protected function prepareChartData($data, $currency_symbol, $thousands_symbol)
413 413
     {
414 414
         //Use the  lead_source to categorise the data for the charts
415 415
         $chart['labels'] = array();
416 416
         $chart['data'] = array();
417 417
         //Need to add all elements into the key, as they are stacked (even though the category is not present, the value could be)
418 418
         $chart['key'] = array();
419
-        $chart['tooltips']= array();
419
+        $chart['tooltips'] = array();
420 420
         $chart['total'] = 0;
421 421
 
422
-        foreach($data as $key=>$value)
422
+        foreach ($data as $key=>$value)
423 423
         {
424 424
             $formattedFloat = (float)number_format((float)$value, 2, '.', '');
425 425
             $chart['labels'][] = $key;
426 426
             $chart['data'][] = $formattedFloat;
427
-            $chart['total']+=$formattedFloat;
427
+            $chart['total'] += $formattedFloat;
428 428
             $chart['tooltips'][] = "'$key' amounts to $currency_symbol$formattedFloat$thousands_symbol (click bar to drill-through)";
429 429
         }
430 430
         return $chart;
Please login to merge, or discard this patch.
Braces   +21 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -62,12 +64,15 @@  discard block
 block discarded – undo
62 64
     {
63 65
         global $timedate;
64 66
 
65
-        if(empty($options['mypbss_date_start']))
66
-            $options['mypbss_date_start'] = $timedate->nowDbDate();
67
-        if(empty($options['mypbss_date_end']))
68
-            $options['mypbss_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months"));
69
-        if(empty($options['title']))
70
-            $options['title'] = translate('LBL_MY_PIPELINE_FORM_TITLE', 'Home');
67
+        if(empty($options['mypbss_date_start'])) {
68
+                    $options['mypbss_date_start'] = $timedate->nowDbDate();
69
+        }
70
+        if(empty($options['mypbss_date_end'])) {
71
+                    $options['mypbss_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months"));
72
+        }
73
+        if(empty($options['title'])) {
74
+                    $options['title'] = translate('LBL_MY_PIPELINE_FORM_TITLE', 'Home');
75
+        }
71 76
 
72 77
         parent::__construct($id,$options);
73 78
     }
@@ -80,11 +85,12 @@  discard block
 block discarded – undo
80 85
         global $app_list_strings;
81 86
 
82 87
         $selected_datax = array();
83
-        if (count($this->mypbss_sales_stages) > 0)
84
-            foreach ($this->mypbss_sales_stages as $key)
88
+        if (count($this->mypbss_sales_stages) > 0) {
89
+                    foreach ($this->mypbss_sales_stages as $key)
85 90
                 $selected_datax[] = $key;
86
-        else
87
-            $selected_datax = array_keys($app_list_strings['sales_stage_dom']);
91
+        } else {
92
+                    $selected_datax = array_keys($app_list_strings['sales_stage_dom']);
93
+        }
88 94
 
89 95
         $this->_searchFields['mypbss_sales_stages']['options'] = $app_list_strings['sales_stage_dom'];
90 96
         $this->_searchFields['mypbss_sales_stages']['input_name0'] = $selected_datax;
@@ -316,8 +322,7 @@  discard block
 block discarded – undo
316 322
                 $datax[$key] = $app_list_strings['sales_stage_dom'][$key];
317 323
                 array_push($selected_datax, $key);
318 324
             }
319
-        }
320
-        else {
325
+        } else {
321 326
             $datax = $app_list_strings['sales_stage_dom'];
322 327
             $selected_datax = array_keys($app_list_strings['sales_stage_dom']);
323 328
         }
@@ -391,8 +396,9 @@  discard block
 block discarded – undo
391 396
             " AND opportunities.date_closed >= ". db_convert("'".$this->mypbss_date_start."'",'date').
392 397
             " AND opportunities.date_closed <= ".db_convert("'".$this->mypbss_date_end."'",'date') .
393 398
             " AND opportunities.assigned_user_id = users.id  AND opportunities.deleted=0 ";
394
-        if ( count($this->mypbss_sales_stages) > 0 )
395
-            $query .= " AND opportunities.sales_stage IN ('" . implode("','",$this->mypbss_sales_stages) . "') ";
399
+        if ( count($this->mypbss_sales_stages) > 0 ) {
400
+                    $query .= " AND opportunities.sales_stage IN ('" . implode("','",$this->mypbss_sales_stages) . "') ";
401
+        }
396 402
         $query .= " GROUP BY opportunities.sales_stage ,users.user_name,opportunities.assigned_user_id";
397 403
 
398 404
         return $query;
Please login to merge, or discard this patch.
modules/Charts/Dashlets/OutcomeByMonthDashlet/OutcomeByMonthDashlet.php 2 patches
Braces   +18 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -66,11 +68,13 @@  discard block
 block discarded – undo
66 68
     {
67 69
         global $timedate;
68 70
 
69
-        if(empty($options['obm_date_start']))
70
-            $options['obm_date_start'] = $timedate->nowDbDate();
71
+        if(empty($options['obm_date_start'])) {
72
+                    $options['obm_date_start'] = $timedate->nowDbDate();
73
+        }
71 74
 
72
-        if(empty($options['obm_date_end']))
73
-            $options['obm_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months"));
75
+        if(empty($options['obm_date_end'])) {
76
+                    $options['obm_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months"));
77
+        }
74 78
 
75 79
         parent::__construct($id,$options);
76 80
     }
@@ -80,8 +84,9 @@  discard block
 block discarded – undo
80 84
      */
81 85
     public function displayOptions()
82 86
     {
83
-        if (!isset($this->obm_ids) || count($this->obm_ids) == 0)
84
-            $this->_searchFields['obm_ids']['input_name0'] = array_keys(get_user_array(false));
87
+        if (!isset($this->obm_ids) || count($this->obm_ids) == 0) {
88
+                    $this->_searchFields['obm_ids']['input_name0'] = array_keys(get_user_array(false));
89
+        }
85 90
 
86 91
         return parent::displayOptions();
87 92
     }
@@ -247,8 +252,9 @@  discard block
 block discarded – undo
247 252
         $query .= " WHERE opportunities.date_closed >= ".db_convert("'".$this->obm_date_start."'",'date') .
248 253
             " AND opportunities.date_closed <= ".db_convert("'".$this->obm_date_end."'",'date') .
249 254
             " AND opportunities.deleted=0";
250
-        if (count($this->obm_ids) > 0)
251
-            $query .= " AND opportunities.assigned_user_id IN ('" . implode("','",$this->obm_ids) . "')";
255
+        if (count($this->obm_ids) > 0) {
256
+                    $query .= " AND opportunities.assigned_user_id IN ('" . implode("','",$this->obm_ids) . "')";
257
+        }
252 258
         $query .= " GROUP BY sales_stage,".
253 259
             db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'")) .
254 260
             " ORDER BY m";
@@ -274,8 +280,9 @@  discard block
 block discarded – undo
274 280
                 $chart['labels'][] = $key;
275 281
                 $chart['data'][] = array();
276 282
             }
277
-            if(!in_array($stage,$chart['key']))
278
-                $chart['key'][] = $stage;
283
+            if(!in_array($stage,$chart['key'])) {
284
+                            $chart['key'][] = $stage;
285
+            }
279 286
 
280 287
             $formattedFloat = (float)number_format((float)$i["total"], 2, '.', '');
281 288
             $chart['data'][count($chart['data'])-1][] = $formattedFloat;
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.
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
     {
67 67
         global $timedate;
68 68
 
69
-        if(empty($options['obm_date_start']))
69
+        if (empty($options['obm_date_start']))
70 70
             $options['obm_date_start'] = $timedate->nowDbDate();
71 71
 
72
-        if(empty($options['obm_date_end']))
72
+        if (empty($options['obm_date_end']))
73 73
             $options['obm_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months"));
74 74
 
75
-        parent::__construct($id,$options);
75
+        parent::__construct($id, $options);
76 76
     }
77 77
 
78 78
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function display()
93 93
     {
94 94
         $currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol'];
95
-        if ($GLOBALS['current_user']->getPreference('currency')){
95
+        if ($GLOBALS['current_user']->getPreference('currency')) {
96 96
 
97 97
             $currency = new Currency();
98 98
             $currency->retrieve($GLOBALS['current_user']->getPreference('currency'));
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
         $action = 'index';
104 104
         $query = 'true';
105 105
         $searchFormTab = 'advanced_search';
106
-        $groupBy = array( 'm', 'sales_stage', );
106
+        $groupBy = array('m', 'sales_stage',);
107 107
 
108 108
 
109 109
         $data = $this->getChartData($this->constructQuery());
110 110
 
111 111
         //I have taken out the sort as this will throw off the labels we have calculated
112
-        $data = $this->sortData($data,'m', false, 'sales_stage', true, true);
112
+        $data = $this->sortData($data, 'm', false, 'sales_stage', true, true);
113 113
 
114 114
         $chartReadyData = $this->prepareChartData($data, $currency_symbol, $thousands_symbol);
115 115
         $canvasId = 'rGraphOutcomeByMonth'.uniqid();
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $colours = "['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928']";
130 130
 
131 131
 
132
-        if(!is_array($chartReadyData['data'])||count($chartReadyData['data']) < 1)
132
+        if (!is_array($chartReadyData['data']) || count($chartReadyData['data']) < 1)
133 133
         {
134 134
             return "<h3 class='noGraphDataPoints'>$this->noDataMessage</h3>";
135 135
         }
@@ -242,45 +242,45 @@  discard block
 block discarded – undo
242 242
     protected function constructQuery()
243 243
     {
244 244
         $query = "SELECT sales_stage,".
245
-            db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))." as m, ".
245
+            db_convert('opportunities.date_closed', 'date_format', array("'%Y-%m'"), array("'YYYY-MM'"))." as m, ".
246 246
             "sum(amount_usdollar/1000) as total, count(*) as opp_count FROM opportunities ";
247
-        $query .= " WHERE opportunities.date_closed >= ".db_convert("'".$this->obm_date_start."'",'date') .
248
-            " AND opportunities.date_closed <= ".db_convert("'".$this->obm_date_end."'",'date') .
247
+        $query .= " WHERE opportunities.date_closed >= ".db_convert("'".$this->obm_date_start."'", 'date').
248
+            " AND opportunities.date_closed <= ".db_convert("'".$this->obm_date_end."'", 'date').
249 249
             " AND opportunities.deleted=0";
250 250
         if (count($this->obm_ids) > 0)
251
-            $query .= " AND opportunities.assigned_user_id IN ('" . implode("','",$this->obm_ids) . "')";
251
+            $query .= " AND opportunities.assigned_user_id IN ('".implode("','", $this->obm_ids)."')";
252 252
         $query .= " GROUP BY sales_stage,".
253
-            db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'")) .
253
+            db_convert('opportunities.date_closed', 'date_format', array("'%Y-%m'"), array("'YYYY-MM'")).
254 254
             " ORDER BY m";
255 255
 
256 256
         return $query;
257 257
     }
258 258
 
259
-    protected function prepareChartData($data,$currency_symbol, $thousands_symbol)
259
+    protected function prepareChartData($data, $currency_symbol, $thousands_symbol)
260 260
     {
261 261
         //Use the  lead_source to categorise the data for the charts
262 262
         $chart['labels'] = array();
263 263
         $chart['data'] = array();
264 264
         //Need to add all elements into the key, as they are stacked (even though the category is not present, the value could be)
265 265
         $chart['key'] = array();
266
-        $chart['tooltips']= array();
266
+        $chart['tooltips'] = array();
267 267
 
268
-        foreach($data as $i)
268
+        foreach ($data as $i)
269 269
         {
270 270
             $key = $i["m"];
271 271
             $stage = $i["sales_stage"];
272 272
             $stage_dom_option = $i["sales_stage_dom_option"];
273
-            if(!in_array($key,$chart['labels']))
273
+            if (!in_array($key, $chart['labels']))
274 274
             {
275 275
                 $chart['labels'][] = $key;
276 276
                 $chart['data'][] = array();
277 277
             }
278
-            if(!in_array($stage,$chart['key']))
278
+            if (!in_array($stage, $chart['key']))
279 279
                 $chart['key'][] = $stage;
280 280
 
281 281
             $formattedFloat = (float)number_format((float)$i["total"], 2, '.', '');
282
-            $chart['data'][count($chart['data'])-1][] = $formattedFloat;
283
-            $chart['tooltips'][]="<div><input type='hidden' class='stage' value='$stage_dom_option'><input type='hidden' class='date' value='$key'></div>".$stage.'('.$currency_symbol.$formattedFloat.$thousands_symbol.') '.$key;
282
+            $chart['data'][count($chart['data']) - 1][] = $formattedFloat;
283
+            $chart['tooltips'][] = "<div><input type='hidden' class='stage' value='$stage_dom_option'><input type='hidden' class='date' value='$key'></div>".$stage.'('.$currency_symbol.$formattedFloat.$thousands_symbol.') '.$key;
284 284
         }
285 285
         return $chart;
286 286
     }
Please login to merge, or discard this patch.
Dashlets/PipelineBySalesStageDashlet/PipelineBySalesStageDashlet.meta.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@
 block discarded – undo
44 44
 global $app_strings, $current_language;
45 45
 
46 46
 $dashletMeta['PipelineBySalesStageDashlet'] = array('title'       => 'LBL_TITLE',  
47
-                                                      'description' => 'LBL_TITLE', 
48
-                                                      'module'        => 'Opportunities', 
49
-	                                                  'icon'		  => 'icon_Charts_Funnel_32.gif',
50
-                                                      'category'    => 'Charts');
47
+                                                        'description' => 'LBL_TITLE', 
48
+                                                        'module'        => 'Opportunities', 
49
+                                                        'icon'		  => 'icon_Charts_Funnel_32.gif',
50
+                                                        'category'    => 'Charts');
51 51
 ?>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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.
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
OpportunitiesByLeadSourceDashlet/OpportunitiesByLeadSourceDashlet.php 2 patches
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.
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         global $current_user, $sugar_config;
86 86
 
87 87
         $currency_symbol = $sugar_config['default_currency_symbol'];
88
-        if ($current_user->getPreference('currency')){
88
+        if ($current_user->getPreference('currency')) {
89 89
 
90 90
             $currency = new Currency();
91 91
             $currency->retrieve($current_user->getPreference('currency'));
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 
107 107
         $module = 'Opportunities';
108 108
         $action = 'index';
109
-        $query  ='true';
110
-        $searchFormTab ='advanced_search';
109
+        $query  = 'true';
110
+        $searchFormTab = 'advanced_search';
111 111
 
112 112
         $colours = "['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928','#8080ff','#c03f80']";
113 113
 
114
-        if(!is_array($chartReadyData['data'])||count($chartReadyData['data']) < 1)
114
+        if (!is_array($chartReadyData['data']) || count($chartReadyData['data']) < 1)
115 115
         {
116 116
             return "<h3 class='noGraphDataPoints'>$this->noDataMessage</h3>";
117 117
         }
@@ -208,28 +208,28 @@  discard block
 block discarded – undo
208 208
 
209 209
         $row = $db->fetchByAssoc($result);
210 210
 
211
-        while ($row != null){
211
+        while ($row != null) {
212 212
             $dataSet[] = $row;
213 213
             $row = $db->fetchByAssoc($result);
214 214
         }
215 215
         return $dataSet;
216 216
     }
217 217
 
218
-    protected function prepareChartData($data,$currency_symbol, $thousands_symbol)
218
+    protected function prepareChartData($data, $currency_symbol, $thousands_symbol)
219 219
     {
220 220
         //return $data;
221
-        $chart['labels']=array();
222
-        $chart['data']=array();
221
+        $chart['labels'] = array();
222
+        $chart['data'] = array();
223 223
         $total = 0;
224
-        foreach($data as $i)
224
+        foreach ($data as $i)
225 225
         {
226
-            $chart['labelsAndValues'][]=$i['lead_source'].' ('.$currency_symbol.(int)$i['total'].$thousands_symbol.')';
226
+            $chart['labelsAndValues'][] = $i['lead_source'].' ('.$currency_symbol.(int)$i['total'].$thousands_symbol.')';
227 227
             //$chart['labelsAndValues'][]=$currency_symbol.(int)$i['total'].$thousands_symbol;
228
-            $chart['labels'][]=$i['lead_source'];
229
-            $chart['data'][]=(int)$i['total'];
230
-            $total+=(int)$i['total'];
228
+            $chart['labels'][] = $i['lead_source'];
229
+            $chart['data'][] = (int)$i['total'];
230
+            $total += (int)$i['total'];
231 231
         }
232
-        $chart['total']=$total;
232
+        $chart['total'] = $total;
233 233
         return $chart;
234 234
     }
235 235
 
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
         $query = "SELECT lead_source,sum(amount_usdollar/1000) as total,count(*) as opp_count ".
242 242
             "FROM opportunities ";
243 243
         $query .= "WHERE opportunities.deleted=0 ";
244
-        if ( count($this->pbls_ids) > 0 )
245
-            $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->pbls_ids)."') ";
246
-        if ( count($this->pbls_lead_sources) > 0 )
247
-            $query .= "AND opportunities.lead_source IN ('".implode("','",$this->pbls_lead_sources)."') ";
244
+        if (count($this->pbls_ids) > 0)
245
+            $query .= "AND opportunities.assigned_user_id IN ('".implode("','", $this->pbls_ids)."') ";
246
+        if (count($this->pbls_lead_sources) > 0)
247
+            $query .= "AND opportunities.lead_source IN ('".implode("','", $this->pbls_lead_sources)."') ";
248 248
         else
249
-            $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
249
+            $query .= "AND opportunities.lead_source IN ('".implode("','", array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
250 250
         $query .= "GROUP BY lead_source ORDER BY total DESC";
251 251
 
252 252
         return $query;
Please login to merge, or discard this patch.
Braces   +19 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -62,17 +64,19 @@  discard block
 block discarded – undo
62 64
         global $app_list_strings;
63 65
 
64 66
         $selected_datax = array();
65
-        if (!empty($this->pbls_lead_sources) && sizeof($this->pbls_lead_sources) > 0)
66
-            foreach ($this->pbls_lead_sources as $key)
67
+        if (!empty($this->pbls_lead_sources) && sizeof($this->pbls_lead_sources) > 0) {
68
+                    foreach ($this->pbls_lead_sources as $key)
67 69
                 $selected_datax[] = $key;
68
-        else
69
-            $selected_datax = array_keys($app_list_strings['lead_source_dom']);
70
+        } else {
71
+                    $selected_datax = array_keys($app_list_strings['lead_source_dom']);
72
+        }
70 73
 
71 74
         $this->_searchFields['pbls_lead_sources']['options'] = array_filter($app_list_strings['lead_source_dom']);
72 75
         $this->_searchFields['pbls_lead_sources']['input_name0'] = $selected_datax;
73 76
 
74
-        if (!isset($this->pbls_ids) || count($this->pbls_ids) == 0)
75
-            $this->_searchFields['pbls_ids']['input_name0'] = array_keys(get_user_array(false));
77
+        if (!isset($this->pbls_ids) || count($this->pbls_ids) == 0) {
78
+                    $this->_searchFields['pbls_ids']['input_name0'] = array_keys(get_user_array(false));
79
+        }
76 80
 
77 81
         return parent::displayOptions();
78 82
     }
@@ -241,12 +245,14 @@  discard block
 block discarded – undo
241 245
         $query = "SELECT lead_source,sum(amount_usdollar/1000) as total,count(*) as opp_count ".
242 246
             "FROM opportunities ";
243 247
         $query .= "WHERE opportunities.deleted=0 ";
244
-        if ( count($this->pbls_ids) > 0 )
245
-            $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->pbls_ids)."') ";
246
-        if ( count($this->pbls_lead_sources) > 0 )
247
-            $query .= "AND opportunities.lead_source IN ('".implode("','",$this->pbls_lead_sources)."') ";
248
-        else
249
-            $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
248
+        if ( count($this->pbls_ids) > 0 ) {
249
+                    $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->pbls_ids)."') ";
250
+        }
251
+        if ( count($this->pbls_lead_sources) > 0 ) {
252
+                    $query .= "AND opportunities.lead_source IN ('".implode("','",$this->pbls_lead_sources)."') ";
253
+        } else {
254
+                    $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
255
+        }
250 256
         $query .= "GROUP BY lead_source ORDER BY total DESC";
251 257
 
252 258
         return $query;
Please login to merge, or discard this patch.
OpportunitiesByLeadSourceByOutcomeDashlet.php 2 patches
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -61,17 +63,19 @@  discard block
 block discarded – undo
61 63
         global $app_list_strings;
62 64
 
63 65
         $selected_datax = array();
64
-        if (!empty($this->lsbo_lead_sources) && sizeof($this->lsbo_lead_sources) > 0)
65
-            foreach ($this->lsbo_lead_sources as $key)
66
+        if (!empty($this->lsbo_lead_sources) && sizeof($this->lsbo_lead_sources) > 0) {
67
+                    foreach ($this->lsbo_lead_sources as $key)
66 68
                 $selected_datax[] = $key;
67
-        else
68
-            $selected_datax = array_keys($app_list_strings['lead_source_dom']);
69
+        } else {
70
+                    $selected_datax = array_keys($app_list_strings['lead_source_dom']);
71
+        }
69 72
 
70 73
         $this->_searchFields['lsbo_lead_sources']['options'] = array_filter($app_list_strings['lead_source_dom']);
71 74
         $this->_searchFields['lsbo_lead_sources']['input_name0'] = $selected_datax;
72 75
 
73
-        if (!isset($this->lsbo_ids) || count($this->lsbo_ids) == 0)
74
-            $this->_searchFields['lsbo_ids']['input_name0'] = array_keys(get_user_array(false));
76
+        if (!isset($this->lsbo_ids) || count($this->lsbo_ids) == 0) {
77
+                    $this->_searchFields['lsbo_ids']['input_name0'] = array_keys(get_user_array(false));
78
+        }
75 79
 
76 80
         return parent::displayOptions();
77 81
     }
@@ -131,8 +135,9 @@  discard block
 block discarded – undo
131 135
 
132 136
 
133 137
         $url_params = array();
134
-        if ( count($this->lsbo_ids) > 0 )
135
-            $url_params['assigned_user_id'] = array_values($this->lsbo_ids);
138
+        if ( count($this->lsbo_ids) > 0 ) {
139
+                    $url_params['assigned_user_id'] = array_values($this->lsbo_ids);
140
+        }
136 141
 
137 142
 
138 143
         $data = $this->getChartData($this->constructQuery());
@@ -253,12 +258,14 @@  discard block
 block discarded – undo
253 258
         $query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total, ".
254 259
             "count(*) as opp_count FROM opportunities ";
255 260
         $query .= " WHERE opportunities.deleted=0 ";
256
-        if ( count($this->lsbo_ids) > 0 )
257
-            $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->lsbo_ids)."') ";
258
-        if ( count($this->lsbo_lead_sources) > 0 )
259
-            $query .= "AND opportunities.lead_source IN ('".implode("','",$this->lsbo_lead_sources)."') ";
260
-        else
261
-            $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
261
+        if ( count($this->lsbo_ids) > 0 ) {
262
+                    $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->lsbo_ids)."') ";
263
+        }
264
+        if ( count($this->lsbo_lead_sources) > 0 ) {
265
+                    $query .= "AND opportunities.lead_source IN ('".implode("','",$this->lsbo_lead_sources)."') ";
266
+        } else {
267
+                    $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
268
+        }
262 269
         $query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage";
263 270
 
264 271
         return $query;
@@ -282,8 +289,9 @@  discard block
 block discarded – undo
282 289
                 $chart['labels'][] = $key;
283 290
                 $chart['data'][] = array();
284 291
             }
285
-            if(!in_array($stage,$chart['key']))
286
-                $chart['key'][] = $stage;
292
+            if(!in_array($stage,$chart['key'])) {
293
+                            $chart['key'][] = $stage;
294
+            }
287 295
 
288 296
             $formattedFloat = (float)number_format((float)$i["total"], 2, '.', '');
289 297
             $chart['data'][count($chart['data'])-1][] = $formattedFloat;
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.
@@ -114,24 +114,24 @@  discard block
 block discarded – undo
114 114
         */
115 115
 
116 116
         $currency_symbol = $sugar_config['default_currency_symbol'];
117
-        if ($current_user->getPreference('currency')){
117
+        if ($current_user->getPreference('currency')) {
118 118
 
119 119
             $currency = new Currency();
120 120
             $currency->retrieve($current_user->getPreference('currency'));
121 121
             $currency_symbol = $currency->symbol;
122 122
         }
123
-        $subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
123
+        $subtitle = translate('LBL_OPP_SIZE', 'Charts')." ".$currency_symbol."1".translate('LBL_OPP_THOUSANDS', 'Charts');
124 124
         $thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
125 125
 
126 126
         $module = 'Opportunities';
127
-        $action =  'index';
128
-        $query =  'true';
127
+        $action = 'index';
128
+        $query = 'true';
129 129
         $searchFormTab = 'advanced_search';
130
-        $groupBy = array( 'lead_source', 'sales_stage' );
130
+        $groupBy = array('lead_source', 'sales_stage');
131 131
 
132 132
 
133 133
         $url_params = array();
134
-        if ( count($this->lsbo_ids) > 0 )
134
+        if (count($this->lsbo_ids) > 0)
135 135
             $url_params['assigned_user_id'] = array_values($this->lsbo_ids);
136 136
 
137 137
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
         $colours = "['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928']";
159 159
 
160
-        if(!is_array($chartReadyData['data'])||count($chartReadyData['data']) < 1)
160
+        if (!is_array($chartReadyData['data']) || count($chartReadyData['data']) < 1)
161 161
         {
162 162
             return "<h3 class='noGraphDataPoints'>$this->noDataMessage</h3>";
163 163
         }
@@ -253,43 +253,43 @@  discard block
 block discarded – undo
253 253
         $query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total, ".
254 254
             "count(*) as opp_count FROM opportunities ";
255 255
         $query .= " WHERE opportunities.deleted=0 ";
256
-        if ( count($this->lsbo_ids) > 0 )
257
-            $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->lsbo_ids)."') ";
258
-        if ( count($this->lsbo_lead_sources) > 0 )
259
-            $query .= "AND opportunities.lead_source IN ('".implode("','",$this->lsbo_lead_sources)."') ";
256
+        if (count($this->lsbo_ids) > 0)
257
+            $query .= "AND opportunities.assigned_user_id IN ('".implode("','", $this->lsbo_ids)."') ";
258
+        if (count($this->lsbo_lead_sources) > 0)
259
+            $query .= "AND opportunities.lead_source IN ('".implode("','", $this->lsbo_lead_sources)."') ";
260 260
         else
261
-            $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
261
+            $query .= "AND opportunities.lead_source IN ('".implode("','", array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
262 262
         $query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage";
263 263
 
264 264
         return $query;
265 265
     }
266 266
 
267
-    protected function prepareChartData($data,$currency_symbol, $thousands_symbol)
267
+    protected function prepareChartData($data, $currency_symbol, $thousands_symbol)
268 268
     {
269 269
         //Use the  lead_source to categorise the data for the charts
270 270
         $chart['labels'] = array();
271 271
         $chart['data'] = array();
272 272
         //Need to add all elements into the key, as they are stacked (even though the category is not present, the value could be
273 273
         $chart['key'] = array();
274
-        $chart['tooltips']= array();
274
+        $chart['tooltips'] = array();
275 275
 
276
-        foreach($data as $i)
276
+        foreach ($data as $i)
277 277
         {
278 278
             $key = $i["lead_source"];
279 279
             $keyDom = $i["lead_source_dom_option"];
280 280
             $stage = $i["sales_stage"];
281 281
             $stageDom = $i["sales_stage_dom_option"];
282
-            if(!in_array($key,$chart['labels']))
282
+            if (!in_array($key, $chart['labels']))
283 283
             {
284 284
                 $chart['labels'][] = $key;
285 285
                 $chart['data'][] = array();
286 286
             }
287
-            if(!in_array($stage,$chart['key']))
287
+            if (!in_array($stage, $chart['key']))
288 288
                 $chart['key'][] = $stage;
289 289
 
290 290
             $formattedFloat = (float)number_format((float)$i["total"], 2, '.', '');
291
-            $chart['data'][count($chart['data'])-1][] = $formattedFloat;
292
-            $chart['tooltips'][]="<div><input type='hidden' class='stage' value='$stageDom'><input type='hidden' class='category' value='$keyDom'></div>".$stage.'('.$currency_symbol.$formattedFloat.$thousands_symbol.') '.$key;
291
+            $chart['data'][count($chart['data']) - 1][] = $formattedFloat;
292
+            $chart['tooltips'][] = "<div><input type='hidden' class='stage' value='$stageDom'><input type='hidden' class='category' value='$keyDom'></div>".$stage.'('.$currency_symbol.$formattedFloat.$thousands_symbol.') '.$key;
293 293
         }
294 294
         return $chart;
295 295
     }
Please login to merge, or discard this patch.
modules/Charts/Dashlets/CampaignROIChartDashlet/CampaignROIChartDashlet.php 2 patches
Braces   +27 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -60,11 +62,12 @@  discard block
 block discarded – undo
60 62
         $this->getSeedBean()->disable_row_level_security = false;
61 63
 
62 64
         $campaigns = $this->getSeedBean()->get_full_list("","");
63
-        if ( $campaigns != null )
64
-            foreach ($campaigns as $c)
65
+        if ( $campaigns != null ) {
66
+                    foreach ($campaigns as $c)
65 67
                 $this->_searchFields['campaign_id']['options'][$c->id] = $c->name;
66
-        else
67
-            $this->_searchFields['campaign_id']['options'] = array();
68
+        } else {
69
+                    $this->_searchFields['campaign_id']['options'] = array();
70
+        }
68 71
 
69 72
         return parent::displayOptions();
70 73
     }
@@ -234,7 +237,9 @@  discard block
 block discarded – undo
234 237
 
235 238
         $opp_result=$focus->db->query($opp_query);
236 239
         $opp_data=$focus->db->fetchByAssoc($opp_result);
237
-        if (empty($opp_data['total_value'])) $opp_data['total_value']=0;
240
+        if (empty($opp_data['total_value'])) {
241
+            $opp_data['total_value']=0;
242
+        }
238 243
 
239 244
         $chartData['Total Value']= $opp_data['total_value'];
240 245
 
@@ -252,7 +257,7 @@  discard block
 block discarded – undo
252 257
         if (empty($opp_data1['revenue'])){
253 258
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = 0;
254 259
             unset($opp_data1['revenue']);
255
-        }else{
260
+        } else{
256 261
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = $opp_data1['revenue'];
257 262
             unset($opp_data1['revenue']);
258 263
             $not_empty = true;
@@ -269,18 +274,21 @@  discard block
 block discarded – undo
269 274
         $camp_data1=$focus->db->fetchByAssoc($camp_result1);
270 275
 
271 276
 
272
-        if (empty($camp_data1['investment']))
273
-            $camp_data1['investment'] = 0;
274
-        else
275
-            $not_empty = true;
276
-        if (empty($camp_data1['budget']))
277
-            $camp_data1['budget'] = 0;
278
-        else
279
-            $not_empty = true;
280
-        if (empty($camp_data1['expected_revenue']))
281
-            $camp_data1['expected_revenue'] = 0;
282
-        else
283
-            $not_empty = true;
277
+        if (empty($camp_data1['investment'])) {
278
+                    $camp_data1['investment'] = 0;
279
+        } else {
280
+                    $not_empty = true;
281
+        }
282
+        if (empty($camp_data1['budget'])) {
283
+                    $camp_data1['budget'] = 0;
284
+        } else {
285
+                    $not_empty = true;
286
+        }
287
+        if (empty($camp_data1['expected_revenue'])) {
288
+                    $camp_data1['expected_revenue'] = 0;
289
+        } else {
290
+                    $not_empty = true;
291
+        }
284 292
 
285 293
         $chartData['Investment']= $camp_data1['investment'];
286 294
         $chartData['Budget']= $camp_data1['budget'];
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 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.
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $this->getSeedBean()->disable_row_level_security = false;
61 61
 
62
-        $campaigns = $this->getSeedBean()->get_full_list("","");
63
-        if ( $campaigns != null )
62
+        $campaigns = $this->getSeedBean()->get_full_list("", "");
63
+        if ($campaigns != null)
64 64
             foreach ($campaigns as $c)
65 65
                 $this->_searchFields['campaign_id']['options'][$c->id] = $c->name;
66 66
         else
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
         $rawData = $this->constructQuery(
78 78
             $GLOBALS['app_list_strings']['roi_type_dom'],
79 79
             $GLOBALS['app_list_strings']['roi_type_dom'],
80
-            $this->campaign_id[0],null,true,true,true,$this->id);
80
+            $this->campaign_id[0], null, true, true, true, $this->id);
81 81
 
82 82
         $currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol'];
83
-        if ($GLOBALS['current_user']->getPreference('currency')){
83
+        if ($GLOBALS['current_user']->getPreference('currency')) {
84 84
 
85 85
             $currency = new Currency();
86 86
             $currency->retrieve($GLOBALS['current_user']->getPreference('currency'));
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $chartHeight    = 500;
94 94
         $autoRefresh = $this->processAutoRefresh();
95 95
 
96
-        $chartReadyData = $this->prepareChartData($rawData,$currency_symbol,$thousands_symbol);
96
+        $chartReadyData = $this->prepareChartData($rawData, $currency_symbol, $thousands_symbol);
97 97
 
98 98
         //$chartReadyData['data'] = [[1.1,2.2],[3.3,4.4]];
99 99
         $jsonData = json_encode($chartReadyData['data']);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         //$colours = "['red','blue','green','orange','yellow','pink']";
108 108
         $colours = "['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928']";
109 109
 
110
-        if(!is_array($chartReadyData['data'])||count($chartReadyData['data']) < 1)
110
+        if (!is_array($chartReadyData['data']) || count($chartReadyData['data']) < 1)
111 111
         {
112 112
             return "<h3 class='noGraphDataPoints'>$this->noDataMessage</h3>";
113 113
         }
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
         //   return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $returnStr . '</div>'. $this->processAutoRefresh();
217 217
     }
218 218
 
219
-    protected function constructQuery($datay= array(),$targets=array(),$campaign_id = null, $cache_file_name='a_file', $refresh=false,$marketing_id='',$is_dashlet=false,$dashlet_id='') {
219
+    protected function constructQuery($datay = array(), $targets = array(), $campaign_id = null, $cache_file_name = 'a_file', $refresh = false, $marketing_id = '', $is_dashlet = false, $dashlet_id = '') {
220 220
         //global $app_strings,$mod_strings, $current_module_strings, $charset, $lang, $app_list_strings, $current_language,$sugar_config;
221 221
         global $mod_strings;
222 222
         
223
-        if(!$campaign_id) {
223
+        if (!$campaign_id) {
224 224
             $GLOBALS['log']->debug('roi chart need a campaign id');
225 225
             return false;
226 226
         }
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
 
232 232
         $focus = new Campaign();
233 233
         $focus->retrieve($campaign_id);
234
-        $opp_count=0;
235
-        $opp_query  = "select count(*) opp_count,sum(" . db_convert("amount_usdollar","IFNULL",array(0)).")  total_value";
234
+        $opp_count = 0;
235
+        $opp_query  = "select count(*) opp_count,sum(".db_convert("amount_usdollar", "IFNULL", array(0)).")  total_value";
236 236
         $opp_query .= " from opportunities";
237 237
         $opp_query .= " where campaign_id='$campaign_id'";
238 238
         $opp_query .= " and sales_stage='Prospecting'";
239 239
         $opp_query .= " and deleted=0";
240 240
 
241
-        $opp_result=$focus->db->query($opp_query);
242
-        $opp_data=$focus->db->fetchByAssoc($opp_result);
243
-        if (empty($opp_data['total_value'])) $opp_data['total_value']=0;
241
+        $opp_result = $focus->db->query($opp_query);
242
+        $opp_data = $focus->db->fetchByAssoc($opp_result);
243
+        if (empty($opp_data['total_value'])) $opp_data['total_value'] = 0;
244 244
 
245
-        $chartData['Total Value']= $opp_data['total_value'];
245
+        $chartData['Total Value'] = $opp_data['total_value'];
246 246
 
247 247
         //report query
248 248
         $opp_query1  = "select SUM(opp.amount) as revenue";
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
         $opp_query1 .= " where opp.sales_stage = 'Closed Won'and camp.id='$campaign_id' and opp.deleted=0";
252 252
         $opp_query1 .= " group by camp.name";
253 253
 
254
-        $opp_result1=$focus->db->query($opp_query1);
255
-        $opp_data1=$focus->db->fetchByAssoc($opp_result1);
254
+        $opp_result1 = $focus->db->query($opp_query1);
255
+        $opp_data1 = $focus->db->fetchByAssoc($opp_result1);
256 256
 
257 257
         //if (empty($opp_data1[]))
258
-        if (empty($opp_data1['revenue'])){
258
+        if (empty($opp_data1['revenue'])) {
259 259
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = 0;
260 260
             unset($opp_data1['revenue']);
261
-        }else{
261
+        } else {
262 262
             $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = $opp_data1['revenue'];
263 263
             unset($opp_data1['revenue']);
264 264
             $not_empty = true;
265 265
         }
266 266
 
267
-        $chartData['Revenue']= $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']];
267
+        $chartData['Revenue'] = $opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']];
268 268
 
269 269
         $camp_query1  = "select camp.name, SUM(camp.actual_cost) as investment,SUM(camp.budget) as budget,SUM(camp.expected_revenue) as expected_revenue";
270 270
         $camp_query1 .= " from campaigns camp";
271 271
         $camp_query1 .= " where camp.id='$campaign_id'";
272 272
         $camp_query1 .= " group by camp.name";
273 273
 
274
-        $camp_result1=$focus->db->query($camp_query1);
275
-        $camp_data1=$focus->db->fetchByAssoc($camp_result1);
274
+        $camp_result1 = $focus->db->query($camp_query1);
275
+        $camp_data1 = $focus->db->fetchByAssoc($camp_result1);
276 276
 
277 277
 
278 278
         if (empty($camp_data1['investment']))
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
         else
289 289
             $not_empty = true;
290 290
 
291
-        $chartData['Investment']= $camp_data1['investment'];
292
-        $chartData['Budget']= $camp_data1['budget'];
293
-        $chartData['Expected Revenue']= $camp_data1['expected_revenue'];
291
+        $chartData['Investment'] = $camp_data1['investment'];
292
+        $chartData['Budget'] = $camp_data1['budget'];
293
+        $chartData['Expected Revenue'] = $camp_data1['expected_revenue'];
294 294
 
295 295
         /*
296 296
             $opp_data1[$mod_strings['LBL_ROI_CHART_INVESTMENT']]=$camp_data1['investment'];
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
         return $chartData;
313 313
     }
314 314
 
315
-    protected function prepareChartData($data,$currency_symbol, $thousands_symbol)
315
+    protected function prepareChartData($data, $currency_symbol, $thousands_symbol)
316 316
     {
317 317
         //Use the  lead_source to categorise the data for the charts
318 318
         $chart['labels'] = array();
319 319
         $chart['data'] = array();
320 320
         //Need to add all elements into the key, as they are stacked (even though the category is not present, the value could be)
321 321
         $chart['key'] = array();
322
-        $chart['tooltips']= array();
322
+        $chart['tooltips'] = array();
323 323
 
324
-        foreach($data as $key=>$value)
324
+        foreach ($data as $key=>$value)
325 325
         {
326 326
             $formattedFloat = (float)number_format((float)$value, 2, '.', '');
327 327
             $chart['labels'][] = $key;
Please login to merge, or discard this patch.