Test Failed
Push — CI ( 785a66...02428e )
by Adam
54:23
created
modules/Opportunities/metadata/detailviewdefs.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -39,117 +39,117 @@
 block discarded – undo
39 39
 
40 40
 $viewdefs ['Opportunities'] = 
41 41
 array (
42
-  'DetailView' => 
43
-  array (
42
+    'DetailView' => 
43
+    array (
44 44
     'templateMeta' => 
45 45
     array (
46
-      'form' => 
47
-      array (
46
+        'form' => 
47
+        array (
48 48
         'buttons' => 
49 49
         array (
50
-          0 => 'EDIT',
51
-          1 => 'DUPLICATE',
52
-          2 => 'DELETE',
53
-          3 => 'FIND_DUPLICATES',
50
+            0 => 'EDIT',
51
+            1 => 'DUPLICATE',
52
+            2 => 'DELETE',
53
+            3 => 'FIND_DUPLICATES',
54 54
         ),
55
-      ),
56
-      'maxColumns' => '2',
57
-      'widths' => 
58
-      array (
55
+        ),
56
+        'maxColumns' => '2',
57
+        'widths' => 
58
+        array (
59 59
         0 => 
60 60
         array (
61
-          'label' => '10',
62
-          'field' => '30',
61
+            'label' => '10',
62
+            'field' => '30',
63 63
         ),
64 64
         1 => 
65 65
         array (
66
-          'label' => '10',
67
-          'field' => '30',
66
+            'label' => '10',
67
+            'field' => '30',
68 68
         ),
69
-      ),
70
-      'useTabs' => true,
71
-      'tabDefs' => 
72
-      array (
69
+        ),
70
+        'useTabs' => true,
71
+        'tabDefs' => 
72
+        array (
73 73
         'DEFAULT' => 
74 74
         array (
75
-          'newTab' => true,
76
-          'panelDefault' => 'expanded',
75
+            'newTab' => true,
76
+            'panelDefault' => 'expanded',
77 77
         ),
78 78
         'LBL_PANEL_ASSIGNMENT' => 
79 79
         array (
80
-          'newTab' => true,
81
-          'panelDefault' => 'expanded',
80
+            'newTab' => true,
81
+            'panelDefault' => 'expanded',
82
+        ),
82 83
         ),
83
-      ),
84 84
     ),
85 85
     'panels' => 
86 86
     array (
87
-      'default' => 
88
-      array (
87
+        'default' => 
88
+        array (
89 89
         0 => 
90 90
         array (
91
-          0 => 'name',
92
-          1 => 'account_name',
91
+            0 => 'name',
92
+            1 => 'account_name',
93 93
         ),
94 94
         1 => 
95 95
         array (
96
-          0 => 
97
-          array (
96
+            0 => 
97
+            array (
98 98
             'name' => 'amount',
99 99
             'label' => '{$MOD.LBL_AMOUNT} ({$CURRENCY})',
100
-          ),
101
-          1 => 'date_closed',
100
+            ),
101
+            1 => 'date_closed',
102 102
         ),
103 103
         2 => 
104 104
         array (
105
-          0 => 'sales_stage',
106
-          1 => 'opportunity_type',
105
+            0 => 'sales_stage',
106
+            1 => 'opportunity_type',
107 107
         ),
108 108
         3 => 
109 109
         array (
110
-          0 => 'probability',
111
-          1 => 'lead_source',
110
+            0 => 'probability',
111
+            1 => 'lead_source',
112 112
         ),
113 113
         4 => 
114 114
         array (
115
-          0 => 'next_step',
116
-          1 => 'campaign_name',
115
+            0 => 'next_step',
116
+            1 => 'campaign_name',
117 117
         ),
118 118
         5 => 
119 119
         array (
120
-          0 => 
121
-          array (
120
+            0 => 
121
+            array (
122 122
             'name' => 'description',
123 123
             'nl2br' => true,
124
-          ),
124
+            ),
125 125
         ),
126 126
         6 => 
127 127
         array (
128
-          0 => 
129
-          array (
128
+            0 => 
129
+            array (
130 130
             'name' => 'assigned_user_name',
131 131
             'label' => 'LBL_ASSIGNED_TO',
132
-          ),
132
+            ),
133
+        ),
133 134
         ),
134
-      ),
135
-      'LBL_PANEL_ASSIGNMENT' => 
136
-      array (
135
+        'LBL_PANEL_ASSIGNMENT' => 
136
+        array (
137 137
         0 => 
138 138
         array (
139
-          0 => 
140
-          array (
139
+            0 => 
140
+            array (
141 141
             'name' => 'date_modified',
142 142
             'label' => 'LBL_DATE_MODIFIED',
143 143
             'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}',
144
-          ),
145
-          1 =>
146
-          array (
144
+            ),
145
+            1 =>
146
+            array (
147 147
             'name' => 'date_entered',
148 148
             'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}',
149
-          ),
149
+            ),
150
+        ),
150 151
         ),
151
-      ),
152 152
     ),
153
-  ),
153
+    ),
154 154
 );
155 155
 ?>
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
  ********************************************************************************/
39 39
 
40 40
 $viewdefs ['Opportunities'] = 
41
-array (
41
+array(
42 42
   'DetailView' => 
43
-  array (
43
+  array(
44 44
     'templateMeta' => 
45
-    array (
45
+    array(
46 46
       'form' => 
47
-      array (
47
+      array(
48 48
         'buttons' => 
49
-        array (
49
+        array(
50 50
           0 => 'EDIT',
51 51
           1 => 'DUPLICATE',
52 52
           2 => 'DELETE',
@@ -55,95 +55,95 @@  discard block
 block discarded – undo
55 55
       ),
56 56
       'maxColumns' => '2',
57 57
       'widths' => 
58
-      array (
58
+      array(
59 59
         0 => 
60
-        array (
60
+        array(
61 61
           'label' => '10',
62 62
           'field' => '30',
63 63
         ),
64 64
         1 => 
65
-        array (
65
+        array(
66 66
           'label' => '10',
67 67
           'field' => '30',
68 68
         ),
69 69
       ),
70 70
       'useTabs' => true,
71 71
       'tabDefs' => 
72
-      array (
72
+      array(
73 73
         'DEFAULT' => 
74
-        array (
74
+        array(
75 75
           'newTab' => true,
76 76
           'panelDefault' => 'expanded',
77 77
         ),
78 78
         'LBL_PANEL_ASSIGNMENT' => 
79
-        array (
79
+        array(
80 80
           'newTab' => true,
81 81
           'panelDefault' => 'expanded',
82 82
         ),
83 83
       ),
84 84
     ),
85 85
     'panels' => 
86
-    array (
86
+    array(
87 87
       'default' => 
88
-      array (
88
+      array(
89 89
         0 => 
90
-        array (
90
+        array(
91 91
           0 => 'name',
92 92
           1 => 'account_name',
93 93
         ),
94 94
         1 => 
95
-        array (
95
+        array(
96 96
           0 => 
97
-          array (
97
+          array(
98 98
             'name' => 'amount',
99 99
             'label' => '{$MOD.LBL_AMOUNT} ({$CURRENCY})',
100 100
           ),
101 101
           1 => 'date_closed',
102 102
         ),
103 103
         2 => 
104
-        array (
104
+        array(
105 105
           0 => 'sales_stage',
106 106
           1 => 'opportunity_type',
107 107
         ),
108 108
         3 => 
109
-        array (
109
+        array(
110 110
           0 => 'probability',
111 111
           1 => 'lead_source',
112 112
         ),
113 113
         4 => 
114
-        array (
114
+        array(
115 115
           0 => 'next_step',
116 116
           1 => 'campaign_name',
117 117
         ),
118 118
         5 => 
119
-        array (
119
+        array(
120 120
           0 => 
121
-          array (
121
+          array(
122 122
             'name' => 'description',
123 123
             'nl2br' => true,
124 124
           ),
125 125
         ),
126 126
         6 => 
127
-        array (
127
+        array(
128 128
           0 => 
129
-          array (
129
+          array(
130 130
             'name' => 'assigned_user_name',
131 131
             'label' => 'LBL_ASSIGNED_TO',
132 132
           ),
133 133
         ),
134 134
       ),
135 135
       'LBL_PANEL_ASSIGNMENT' => 
136
-      array (
136
+      array(
137 137
         0 => 
138
-        array (
138
+        array(
139 139
           0 => 
140
-          array (
140
+          array(
141 141
             'name' => 'date_modified',
142 142
             'label' => 'LBL_DATE_MODIFIED',
143 143
             'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}',
144 144
           ),
145 145
           1 =>
146
-          array (
146
+          array(
147 147
             'name' => 'date_entered',
148 148
             'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}',
149 149
           ),
Please login to merge, or discard this patch.
modules/Opportunities/metadata/quickcreatedefs.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -46,69 +46,69 @@
 block discarded – undo
46 46
  ********************************************************************************/
47 47
 
48 48
 $viewdefs = array (
49
-  'Opportunities' => 
50
-  array (
49
+    'Opportunities' => 
50
+    array (
51 51
     'QuickCreate' => 
52 52
     array (
53
-      'templateMeta' => 
54
-      array (
53
+        'templateMeta' => 
54
+        array (
55 55
         'maxColumns' => '2',
56 56
         'widths' => 
57 57
         array (
58
-          0 => 
59
-          array (
58
+            0 => 
59
+            array (
60 60
             'label' => '10',
61 61
             'field' => '30',
62
-          ),
63
-          1 => 
64
-          array (
62
+            ),
63
+            1 => 
64
+            array (
65 65
             'label' => '10',
66 66
             'field' => '30',
67
-          ),
67
+            ),
68 68
         ),
69 69
         'javascript' => '{$PROBABILITY_SCRIPT}',
70
-      ),
71
-      'panels' => 
72
-      array (
70
+        ),
71
+        'panels' => 
72
+        array (
73 73
         'DEFAULT' => 
74 74
         array (
75
-          array (
76 75
             array (
77
-              'name' => 'name',
78
-              'displayParams'=>array('required'=>true),
76
+            array (
77
+                'name' => 'name',
78
+                'displayParams'=>array('required'=>true),
79 79
             ),
80 80
             array (
81
-              'name' => 'account_name',
81
+                'name' => 'account_name',
82
+            ),
82 83
             ),
83
-          ),
84
-          array (
85 84
             array (
86
-              'name' => 'currency_id',
85
+            array (
86
+                'name' => 'currency_id',
87 87
             ),
88 88
             array (
89
-              'name' => 'opportunity_type',
89
+                'name' => 'opportunity_type',
90 90
             ),            
91
-          ),
92
-          array (
91
+            ),
92
+            array (
93 93
             'amount',
94 94
             'date_closed'          
95
-          ),
96
-          array (
97
-             'next_step',
98
-             'sales_stage',
99
-          ),
100
-          array (
101
-             'lead_source',
102
-             'probability',
103
-          ),
95
+            ),
96
+            array (
97
+                'next_step',
98
+                'sales_stage',
99
+            ),
100
+            array (
101
+                'lead_source',
102
+                'probability',
103
+            ),
104 104
         array (
105 105
             array (
106
-              'name' => 'assigned_user_name',
106
+                'name' => 'assigned_user_name',
107 107
             ),
108 108
         ),
109 109
         ),
110
-      ),
110
+        ),
111
+    ),
111 112
     ),
112
-  ),
113 113
 );
114 114
 ?>
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.
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
  * Contributor(s): ______________________________________..
46 46
  ********************************************************************************/
47 47
 
48
-$viewdefs = array (
48
+$viewdefs = array(
49 49
   'Opportunities' => 
50
-  array (
50
+  array(
51 51
     'QuickCreate' => 
52
-    array (
52
+    array(
53 53
       'templateMeta' => 
54
-      array (
54
+      array(
55 55
         'maxColumns' => '2',
56 56
         'widths' => 
57
-        array (
57
+        array(
58 58
           0 => 
59
-          array (
59
+          array(
60 60
             'label' => '10',
61 61
             'field' => '30',
62 62
           ),
63 63
           1 => 
64
-          array (
64
+          array(
65 65
             'label' => '10',
66 66
             'field' => '30',
67 67
           ),
@@ -69,40 +69,40 @@  discard block
 block discarded – undo
69 69
         'javascript' => '{$PROBABILITY_SCRIPT}',
70 70
       ),
71 71
       'panels' => 
72
-      array (
72
+      array(
73 73
         'DEFAULT' => 
74
-        array (
75
-          array (
76
-            array (
74
+        array(
75
+          array(
76
+            array(
77 77
               'name' => 'name',
78 78
               'displayParams'=>array('required'=>true),
79 79
             ),
80
-            array (
80
+            array(
81 81
               'name' => 'account_name',
82 82
             ),
83 83
           ),
84
-          array (
85
-            array (
84
+          array(
85
+            array(
86 86
               'name' => 'currency_id',
87 87
             ),
88
-            array (
88
+            array(
89 89
               'name' => 'opportunity_type',
90 90
             ),            
91 91
           ),
92
-          array (
92
+          array(
93 93
             'amount',
94 94
             'date_closed'          
95 95
           ),
96
-          array (
96
+          array(
97 97
              'next_step',
98 98
              'sales_stage',
99 99
           ),
100
-          array (
100
+          array(
101 101
              'lead_source',
102 102
              'probability',
103 103
           ),
104
-        array (
105
-            array (
104
+        array(
105
+            array(
106 106
               'name' => 'assigned_user_name',
107 107
             ),
108 108
         ),
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/Opportunities/metadata/metafiles.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@
 block discarded – undo
43 43
  * To change the template for this generated file go to
44 44
  * Window - Preferences - PHPeclipse - PHP - Code Templates
45 45
  */
46
- $metafiles['Opportunities'] = array(
47
-	'detailviewdefs'  => 	'modules/Opportunities/metadata/detailviewdefs.php', 	
48
-	'editviewdefs'    => 	'modules/Opportunities/metadata/editviewdefs.php',
49
- 	'listviewdefs'    => 	'modules/Opportunities/metadata/listviewdefs.php',
50
- 	'searchdefs'      =>    'modules/Opportunities/metadata/searchdefs.php',
51
- 	'popupdefs'	      =>    'modules/Opportunities/metadata/popupdefs.php',
52
- 	'searchfields'	  =>    'modules/Opportunities/metadata/SearchFields.php',
46
+    $metafiles['Opportunities'] = array(
47
+    'detailviewdefs'  => 	'modules/Opportunities/metadata/detailviewdefs.php', 	
48
+    'editviewdefs'    => 	'modules/Opportunities/metadata/editviewdefs.php',
49
+        'listviewdefs'    => 	'modules/Opportunities/metadata/listviewdefs.php',
50
+        'searchdefs'      =>    'modules/Opportunities/metadata/searchdefs.php',
51
+        'popupdefs'	      =>    'modules/Opportunities/metadata/popupdefs.php',
52
+        'searchfields'	  =>    'modules/Opportunities/metadata/SearchFields.php',
53 53
 
54
- );
54
+    );
55 55
 ?>
Please login to merge, or discard this patch.
modules/Opportunities/metadata/listviewdefs.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -42,43 +42,43 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 $listViewDefs['Opportunities'] = array(
45
-	'NAME' => array(
46
-		'width'   => '30',  
47
-		'label'   => 'LBL_LIST_OPPORTUNITY_NAME', 
48
-		'link'    => true,
45
+    'NAME' => array(
46
+        'width'   => '30',  
47
+        'label'   => 'LBL_LIST_OPPORTUNITY_NAME', 
48
+        'link'    => true,
49 49
         'default' => true),
50
-	'ACCOUNT_NAME' => array(
51
-		'width'   => '20', 
52
-		'label'   => 'LBL_LIST_ACCOUNT_NAME', 
53
-		'id'      => 'ACCOUNT_ID',
50
+    'ACCOUNT_NAME' => array(
51
+        'width'   => '20', 
52
+        'label'   => 'LBL_LIST_ACCOUNT_NAME', 
53
+        'id'      => 'ACCOUNT_ID',
54 54
         'module'  => 'Accounts',
55
-		'link'    => true,
55
+        'link'    => true,
56 56
         'default' => true,
57 57
         'sortable'=> true,
58 58
         'ACLTag' => 'ACCOUNT',
59 59
         'contextMenu' => array('objectType' => 'sugarAccount', 
60
-                               'metaData' => array('return_module' => 'Contacts', 
61
-                                                   'return_action' => 'ListView', 
62
-                                                   'module' => 'Accounts',
63
-                                                   'return_action' => 'ListView', 
64
-                                                   'parent_id' => '{$ACCOUNT_ID}', 
65
-                                                   'parent_name' => '{$ACCOUNT_NAME}', 
66
-                                                   'account_id' => '{$ACCOUNT_ID}', 
67
-                                                   'account_name' => '{$ACCOUNT_NAME}',
68
-                                                   ),
69
-                              ),
60
+                                'metaData' => array('return_module' => 'Contacts', 
61
+                                                    'return_action' => 'ListView', 
62
+                                                    'module' => 'Accounts',
63
+                                                    'return_action' => 'ListView', 
64
+                                                    'parent_id' => '{$ACCOUNT_ID}', 
65
+                                                    'parent_name' => '{$ACCOUNT_NAME}', 
66
+                                                    'account_id' => '{$ACCOUNT_ID}', 
67
+                                                    'account_name' => '{$ACCOUNT_NAME}',
68
+                                                    ),
69
+                                ),
70 70
         'related_fields' => array('account_id')),
71
-	'SALES_STAGE' => array(
72
-		'width'   => '10',  
73
-		'label'   => 'LBL_LIST_SALES_STAGE',
71
+    'SALES_STAGE' => array(
72
+        'width'   => '10',  
73
+        'label'   => 'LBL_LIST_SALES_STAGE',
74 74
         'default' => true), 
75
-	'AMOUNT_USDOLLAR' => array(
76
-		'width'   => '10', 
77
-		'label'   => 'LBL_LIST_AMOUNT_USDOLLAR',
75
+    'AMOUNT_USDOLLAR' => array(
76
+        'width'   => '10', 
77
+        'label'   => 'LBL_LIST_AMOUNT_USDOLLAR',
78 78
         'align'   => 'right',
79 79
         'default' => true,
80 80
         'currency_format' => true,
81
-	),  
81
+    ),  
82 82
     'OPPORTUNITY_TYPE' => array(
83 83
         'width' => '15', 
84 84
         'label' => 'LBL_TYPE'),
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
     'PROBABILITY' => array(
92 92
         'width' => '10', 
93 93
         'label' => 'LBL_PROBABILITY'),
94
-	'DATE_CLOSED' => array(
95
-		'width' => '10', 
96
-		'label' => 'LBL_LIST_DATE_CLOSED',
94
+    'DATE_CLOSED' => array(
95
+        'width' => '10', 
96
+        'label' => 'LBL_LIST_DATE_CLOSED',
97 97
         'default' => true),
98 98
     'CREATED_BY_NAME' => array(
99 99
         'width' => '10', 
100 100
         'label' => 'LBL_CREATED'),
101
-	'ASSIGNED_USER_NAME' => array(
102
-		'width' => '5', 
103
-		'label' => 'LBL_LIST_ASSIGNED_USER',
104
-		'module' => 'Employees',
101
+    'ASSIGNED_USER_NAME' => array(
102
+        'width' => '5', 
103
+        'label' => 'LBL_LIST_ASSIGNED_USER',
104
+        'module' => 'Employees',
105 105
         'id' => 'ASSIGNED_USER_ID',
106 106
         'default' => true),
107 107
     'MODIFIED_BY_NAME' => array(
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     'DATE_ENTERED' => array(
111 111
         'width' => '10', 
112 112
         'label' => 'LBL_DATE_ENTERED',
113
-		'default' => true)
113
+        'default' => true)
114 114
 );
115 115
 
116 116
 ?>
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.
modules/Opportunities/OpportunityFormBase.php 3 patches
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -45,97 +45,97 @@  discard block
 block discarded – undo
45 45
 
46 46
 
47 47
 function checkForDuplicates($prefix){
48
-	require_once('include/formbase.php');
48
+    require_once('include/formbase.php');
49 49
 	
50
-	$focus = new Opportunity();
51
-	$query = '';
52
-	$baseQuery = 'select id, name, sales_stage,amount, date_closed  from opportunities where deleted!=1 and (';
53
-
54
-	if(isset($_POST[$prefix.'name']) && !empty($_POST[$prefix.'name'])){
55
-		$query = $baseQuery ."  name like '%".$_POST[$prefix.'name']."%'";
56
-		$query .= getLikeForEachWord('name', $_POST[$prefix.'name']);
57
-	}
58
-
59
-	if(!empty($query)){
60
-		$rows = array();
61
-		global $db;
62
-		$result = $db->query($query.')');
63
-		$i=-1;
64
-		while(($row=$db->fetchByAssoc($result)) != null) {
65
-			$i++;
66
-			$rows[$i] = $row;
67
-		}
68
-		if ($i==-1) return null;
50
+    $focus = new Opportunity();
51
+    $query = '';
52
+    $baseQuery = 'select id, name, sales_stage,amount, date_closed  from opportunities where deleted!=1 and (';
53
+
54
+    if(isset($_POST[$prefix.'name']) && !empty($_POST[$prefix.'name'])){
55
+        $query = $baseQuery ."  name like '%".$_POST[$prefix.'name']."%'";
56
+        $query .= getLikeForEachWord('name', $_POST[$prefix.'name']);
57
+    }
58
+
59
+    if(!empty($query)){
60
+        $rows = array();
61
+        global $db;
62
+        $result = $db->query($query.')');
63
+        $i=-1;
64
+        while(($row=$db->fetchByAssoc($result)) != null) {
65
+            $i++;
66
+            $rows[$i] = $row;
67
+        }
68
+        if ($i==-1) return null;
69 69
 		
70
-		return $rows;		
71
-	}
72
-	return null;
70
+        return $rows;		
71
+    }
72
+    return null;
73 73
 }
74 74
 
75 75
 
76 76
 function buildTableForm($rows, $mod='Opportunities'){
77
-	if(!empty($mod)){
78
-	global $current_language;
79
-	$mod_strings = return_module_language($current_language, $mod);
80
-	}else global $mod_strings;
81
-	global $app_strings;
82
-	$cols = sizeof($rows[0]) * 2 + 1;
83
-	$form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>';
84
-
85
-	$form .= "<form action='index.php' method='post' name='dupOpps'><input type='hidden' name='selectedOpportunity' value=''>";
86
-	$form .= "<table width='100%' cellpadding='0' cellspacing='0' class='list view'>";
87
-	$form .= "<tr class='pagination'><td colspan='$cols'><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td><input type='submit' class='button' name='ContinueOpportunity' value='${mod_strings['LNK_NEW_OPPORTUNITY']}'></td></tr></table></td></tr><tr>";
88
-	$form .= "<tr><td scope='col'>&nbsp;</td>";
77
+    if(!empty($mod)){
78
+    global $current_language;
79
+    $mod_strings = return_module_language($current_language, $mod);
80
+    }else global $mod_strings;
81
+    global $app_strings;
82
+    $cols = sizeof($rows[0]) * 2 + 1;
83
+    $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>';
84
+
85
+    $form .= "<form action='index.php' method='post' name='dupOpps'><input type='hidden' name='selectedOpportunity' value=''>";
86
+    $form .= "<table width='100%' cellpadding='0' cellspacing='0' class='list view'>";
87
+    $form .= "<tr class='pagination'><td colspan='$cols'><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td><input type='submit' class='button' name='ContinueOpportunity' value='${mod_strings['LNK_NEW_OPPORTUNITY']}'></td></tr></table></td></tr><tr>";
88
+    $form .= "<tr><td scope='col'>&nbsp;</td>";
89 89
     require_once('include/formbase.php');
90
-	$form .= getPostToForm();
91
-	if(isset($rows[0])){
92
-		foreach ($rows[0] as $key=>$value){
93
-			if($key != 'id'){
94
-					$form .= "<td scope='col'>". $mod_strings[$mod_strings['db_'.$key]]. "</td>";
95
-		}}
96
-		$form .= "</tr>";
97
-	}
98
-
99
-	$rowColor = 'oddListRowS1';
100
-	foreach($rows as $row){
101
-
102
-		$form .= "<tr class='$rowColor'>";
103
-
104
-		$form .= "<td width='1%' nowrap='nowrap'><a href='#' onclick='document.dupOpps.selectedOpportunity.value=\"${row['id']}\";document.dupOpps.submit();'>[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a>&nbsp;&nbsp;</td>";
105
-		$wasSet = false;
106
-		foreach ($row as $key=>$value){
107
-				if($key != 'id'){
108
-					if(!$wasSet){
109
-					$form .= "<td scope='row'><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
110
-					$wasSet = true;
111
-					}else{
112
-					$form .= "<td><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
113
-					}
114
-				}}
115
-
116
-		if($rowColor == 'evenListRowS1'){
117
-			$rowColor = 'oddListRowS1';
118
-		}else{
119
-			 $rowColor = 'evenListRowS1';
120
-		}
121
-		$form .= "</tr>";
122
-	}
90
+    $form .= getPostToForm();
91
+    if(isset($rows[0])){
92
+        foreach ($rows[0] as $key=>$value){
93
+            if($key != 'id'){
94
+                    $form .= "<td scope='col'>". $mod_strings[$mod_strings['db_'.$key]]. "</td>";
95
+        }}
96
+        $form .= "</tr>";
97
+    }
98
+
99
+    $rowColor = 'oddListRowS1';
100
+    foreach($rows as $row){
101
+
102
+        $form .= "<tr class='$rowColor'>";
103
+
104
+        $form .= "<td width='1%' nowrap='nowrap'><a href='#' onclick='document.dupOpps.selectedOpportunity.value=\"${row['id']}\";document.dupOpps.submit();'>[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a>&nbsp;&nbsp;</td>";
105
+        $wasSet = false;
106
+        foreach ($row as $key=>$value){
107
+                if($key != 'id'){
108
+                    if(!$wasSet){
109
+                    $form .= "<td scope='row'><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
110
+                    $wasSet = true;
111
+                    }else{
112
+                    $form .= "<td><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
113
+                    }
114
+                }}
115
+
116
+        if($rowColor == 'evenListRowS1'){
117
+            $rowColor = 'oddListRowS1';
118
+        }else{
119
+                $rowColor = 'evenListRowS1';
120
+        }
121
+        $form .= "</tr>";
122
+    }
123 123
     $form .= "<tr class='pagination'><td colspan='$cols'><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td><input type='submit' class='button' name='ContinueOpportunity' value='${mod_strings['LNK_NEW_OPPORTUNITY']}'></td></tr></table></td></tr><tr>";
124
-	$form .= "</table><BR></form>";
124
+    $form .= "</table><BR></form>";
125 125
 
126
-	return $form;
126
+    return $form;
127 127
 
128 128
 
129 129
 
130 130
 }
131 131
 
132 132
 function getForm($prefix, $mod='Opportunities'){
133
-	if(!ACLController::checkAccess('Opportunities', 'edit', true)){
134
-		return '';
135
-	}
133
+    if(!ACLController::checkAccess('Opportunities', 'edit', true)){
134
+        return '';
135
+    }
136 136
 if(!empty($mod)){
137
-	global $current_language;
138
-	$mod_strings = return_module_language($current_language, $mod);
137
+    global $current_language;
138
+    $mod_strings = return_module_language($current_language, $mod);
139 139
 }else global $mod_strings;
140 140
 global $app_strings;
141 141
 global $sugar_version, $sugar_config;
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 function getWideFormBody($prefix, $mod='Opportunities', $formname='', $lead='', $showaccount = true){
168
-	if(!ACLController::checkAccess('Opportunities', 'edit', true)){
169
-		return '';
170
-	}
171
-	if(empty($lead)){
172
-		$lead = new Lead();
173
-	}
168
+    if(!ACLController::checkAccess('Opportunities', 'edit', true)){
169
+        return '';
170
+    }
171
+    if(empty($lead)){
172
+        $lead = new Lead();
173
+    }
174 174
 global $mod_strings, $sugar_config;
175 175
 $showaccount = $showaccount && $sugar_config['require_accounts'];
176 176
 $temp_strings = $mod_strings;
177 177
 if(!empty($mod)){
178
-	global $current_language;
179
-	$mod_strings = return_module_language($current_language, $mod);
178
+    global $current_language;
179
+    $mod_strings = return_module_language($current_language, $mod);
180 180
 }
181 181
 
182 182
 global $app_strings;
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 $ntc_date_format = $timedate->get_user_date_format();
216 216
 $cal_dateformat = $timedate->get_cal_date_format();
217 217
 if (isset($lead->assigned_user_id)) {
218
-	$user_id=$lead->assigned_user_id;
218
+    $user_id=$lead->assigned_user_id;
219 219
 } else {
220
-	$user_id = $current_user->id;
220
+    $user_id = $current_user->id;
221 221
 }
222 222
 
223 223
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 
230 230
 
231 231
 if (isset($lead->opportunity_amount)) {
232
-	$opp_amount=$lead->opportunity_amount;
232
+    $opp_amount=$lead->opportunity_amount;
233 233
 } else {
234
- 	$opp_amount='';
234
+        $opp_amount='';
235 235
 }
236 236
 $jsCalendarImage = SugarThemeRegistry::current()->getImageURL('jscalendar.gif');
237 237
 $the_form .= <<<EOQ
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 </tr>
258 258
 EOQ;
259 259
 if($showaccount){
260
-	$the_form .= <<<EOQ
260
+    $the_form .= <<<EOQ
261 261
 <tr>
262 262
     <td scope="row">${mod_strings['LBL_ACCOUNT_NAME']}&nbsp;<span class="required">${lbl_required_symbol}</span></td>
263 263
 </tr>
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 </tr>
286 286
 EOQ;
287 287
 //carry forward custom lead fields to opportunities during Lead Conversion
288
-	$tempOpp = new Opportunity();
289
-	if (method_exists($lead, 'convertCustomFieldsForm')) $lead->convertCustomFieldsForm($the_form, $tempOpp, $prefix);
290
-	unset($tempOpp);
288
+    $tempOpp = new Opportunity();
289
+    if (method_exists($lead, 'convertCustomFieldsForm')) $lead->convertCustomFieldsForm($the_form, $tempOpp, $prefix);
290
+    unset($tempOpp);
291 291
 
292 292
 $the_form .= <<<EOQ
293 293
 
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
 } // end getWideFormBody
316 316
 
317 317
 function getFormBody($prefix, $mod='Opportunities', $formname=''){
318
-	if(!ACLController::checkAccess('Opportunities', 'edit', true)){
319
-		return '';
320
-	}
318
+    if(!ACLController::checkAccess('Opportunities', 'edit', true)){
319
+        return '';
320
+    }
321 321
 if(!empty($mod)){
322
-	global $current_language;
323
-	$mod_strings = return_module_language($current_language, $mod);
322
+    global $current_language;
323
+    $mod_strings = return_module_language($current_language, $mod);
324 324
 }else global $mod_strings;
325 325
 global $app_strings;
326 326
 global $app_list_strings;
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
 /// SETUP ACCOUNT POPUP
364 364
 
365 365
 $popup_request_data = array(
366
-	'call_back_function' => 'set_return',
367
-	'form_name' => "{$prefix}OppSave",
368
-	'field_to_name_array' => array(
369
-		'id' => 'account_id',
370
-		'name' => 'account_name',
371
-		),
372
-	);
366
+    'call_back_function' => 'set_return',
367
+    'form_name' => "{$prefix}OppSave",
368
+    'field_to_name_array' => array(
369
+        'id' => 'account_id',
370
+        'name' => 'account_name',
371
+        ),
372
+    );
373 373
 
374 374
 $json = getJSONobj();
375 375
 $encoded_popup_request_data = $json->encode($popup_request_data);
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
     global $current_user;
430 430
 	
431 431
 	
432
-	require_once('include/formbase.php');
432
+    require_once('include/formbase.php');
433 433
 	
434
-	$focus = new Opportunity();
435
-	if($useRequired &&  !checkRequired($prefix, array_keys($focus->required_fields))){
436
-		return null;
437
-	}
434
+    $focus = new Opportunity();
435
+    if($useRequired &&  !checkRequired($prefix, array_keys($focus->required_fields))){
436
+        return null;
437
+    }
438 438
 
439 439
     if(empty($_POST['currency_id'])){
440 440
         $currency_id = $current_user->getPreference('currency');
@@ -442,28 +442,28 @@  discard block
 block discarded – undo
442 442
             $focus->currency_id =   $currency_id;
443 443
         }
444 444
     }
445
-	$focus = populateFromPost($prefix, $focus);
446
-	if( !ACLController::checkAccess($focus->module_dir, 'edit', $focus->isOwner($current_user->id))){
447
-		ACLController::displayNoAccess(true);
448
-	}
449
-	$check_notify = FALSE;
450
-	if (isset($GLOBALS['check_notify'])) {
451
-		$check_notify = $GLOBALS['check_notify'];
452
-	}
453
-
454
-	$focus->save($check_notify);
455
-
456
-	if(!empty($_POST['duplicate_parent_id'])){
457
-		clone_relationship($focus->db, array('opportunities_contacts'),'opportunity_id',  $_POST['duplicate_parent_id'], $focus->id);
458
-	}
459
-	$return_id = $focus->id;
445
+    $focus = populateFromPost($prefix, $focus);
446
+    if( !ACLController::checkAccess($focus->module_dir, 'edit', $focus->isOwner($current_user->id))){
447
+        ACLController::displayNoAccess(true);
448
+    }
449
+    $check_notify = FALSE;
450
+    if (isset($GLOBALS['check_notify'])) {
451
+        $check_notify = $GLOBALS['check_notify'];
452
+    }
453
+
454
+    $focus->save($check_notify);
455
+
456
+    if(!empty($_POST['duplicate_parent_id'])){
457
+        clone_relationship($focus->db, array('opportunities_contacts'),'opportunity_id',  $_POST['duplicate_parent_id'], $focus->id);
458
+    }
459
+    $return_id = $focus->id;
460 460
 	
461
-	$GLOBALS['log']->debug("Saved record with id of ".$return_id);
462
-	if($redirect){
463
-		handleRedirect($return_id,"Opportunities" );
464
-	}else{
465
-		return $focus;
466
-	}
461
+    $GLOBALS['log']->debug("Saved record with id of ".$return_id);
462
+    if($redirect){
463
+        handleRedirect($return_id,"Opportunities" );
464
+    }else{
465
+        return $focus;
466
+    }
467 467
 }
468 468
 
469 469
 }
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 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.
@@ -41,31 +41,31 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 
44
-class OpportunityFormBase{
44
+class OpportunityFormBase {
45 45
 
46 46
 
47
-function checkForDuplicates($prefix){
47
+function checkForDuplicates($prefix) {
48 48
 	require_once('include/formbase.php');
49 49
 	
50 50
 	$focus = new Opportunity();
51 51
 	$query = '';
52 52
 	$baseQuery = 'select id, name, sales_stage,amount, date_closed  from opportunities where deleted!=1 and (';
53 53
 
54
-	if(isset($_POST[$prefix.'name']) && !empty($_POST[$prefix.'name'])){
55
-		$query = $baseQuery ."  name like '%".$_POST[$prefix.'name']."%'";
54
+	if (isset($_POST[$prefix.'name']) && !empty($_POST[$prefix.'name'])) {
55
+		$query = $baseQuery."  name like '%".$_POST[$prefix.'name']."%'";
56 56
 		$query .= getLikeForEachWord('name', $_POST[$prefix.'name']);
57 57
 	}
58 58
 
59
-	if(!empty($query)){
59
+	if (!empty($query)) {
60 60
 		$rows = array();
61 61
 		global $db;
62 62
 		$result = $db->query($query.')');
63
-		$i=-1;
64
-		while(($row=$db->fetchByAssoc($result)) != null) {
63
+		$i = -1;
64
+		while (($row = $db->fetchByAssoc($result)) != null) {
65 65
 			$i++;
66 66
 			$rows[$i] = $row;
67 67
 		}
68
-		if ($i==-1) return null;
68
+		if ($i == -1) return null;
69 69
 		
70 70
 		return $rows;		
71 71
 	}
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 }
74 74
 
75 75
 
76
-function buildTableForm($rows, $mod='Opportunities'){
77
-	if(!empty($mod)){
76
+function buildTableForm($rows, $mod = 'Opportunities') {
77
+	if (!empty($mod)) {
78 78
 	global $current_language;
79 79
 	$mod_strings = return_module_language($current_language, $mod);
80
-	}else global $mod_strings;
80
+	} else global $mod_strings;
81 81
 	global $app_strings;
82 82
 	$cols = sizeof($rows[0]) * 2 + 1;
83
-	$form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>';
83
+	$form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE'].'</td></tr><tr><td height="20"></td></tr></table>';
84 84
 
85 85
 	$form .= "<form action='index.php' method='post' name='dupOpps'><input type='hidden' name='selectedOpportunity' value=''>";
86 86
 	$form .= "<table width='100%' cellpadding='0' cellspacing='0' class='list view'>";
@@ -88,34 +88,34 @@  discard block
 block discarded – undo
88 88
 	$form .= "<tr><td scope='col'>&nbsp;</td>";
89 89
     require_once('include/formbase.php');
90 90
 	$form .= getPostToForm();
91
-	if(isset($rows[0])){
92
-		foreach ($rows[0] as $key=>$value){
93
-			if($key != 'id'){
94
-					$form .= "<td scope='col'>". $mod_strings[$mod_strings['db_'.$key]]. "</td>";
91
+	if (isset($rows[0])) {
92
+		foreach ($rows[0] as $key=>$value) {
93
+			if ($key != 'id') {
94
+					$form .= "<td scope='col'>".$mod_strings[$mod_strings['db_'.$key]]."</td>";
95 95
 		}}
96 96
 		$form .= "</tr>";
97 97
 	}
98 98
 
99 99
 	$rowColor = 'oddListRowS1';
100
-	foreach($rows as $row){
100
+	foreach ($rows as $row) {
101 101
 
102 102
 		$form .= "<tr class='$rowColor'>";
103 103
 
104 104
 		$form .= "<td width='1%' nowrap='nowrap'><a href='#' onclick='document.dupOpps.selectedOpportunity.value=\"${row['id']}\";document.dupOpps.submit();'>[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a>&nbsp;&nbsp;</td>";
105 105
 		$wasSet = false;
106
-		foreach ($row as $key=>$value){
107
-				if($key != 'id'){
108
-					if(!$wasSet){
106
+		foreach ($row as $key=>$value) {
107
+				if ($key != 'id') {
108
+					if (!$wasSet) {
109 109
 					$form .= "<td scope='row'><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
110 110
 					$wasSet = true;
111
-					}else{
111
+					} else {
112 112
 					$form .= "<td><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
113 113
 					}
114 114
 				}}
115 115
 
116
-		if($rowColor == 'evenListRowS1'){
116
+		if ($rowColor == 'evenListRowS1') {
117 117
 			$rowColor = 'oddListRowS1';
118
-		}else{
118
+		} else {
119 119
 			 $rowColor = 'evenListRowS1';
120 120
 		}
121 121
 		$form .= "</tr>";
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 
130 130
 }
131 131
 
132
-function getForm($prefix, $mod='Opportunities'){
133
-	if(!ACLController::checkAccess('Opportunities', 'edit', true)){
132
+function getForm($prefix, $mod = 'Opportunities') {
133
+	if (!ACLController::checkAccess('Opportunities', 'edit', true)) {
134 134
 		return '';
135 135
 	}
136
-if(!empty($mod)){
136
+if (!empty($mod)) {
137 137
 	global $current_language;
138 138
 	$mod_strings = return_module_language($current_language, $mod);
139
-}else global $mod_strings;
139
+} else global $mod_strings;
140 140
 global $app_strings;
141 141
 global $sugar_version, $sugar_config;
142 142
 
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
 return $the_form;
165 165
 }
166 166
 
167
-function getWideFormBody($prefix, $mod='Opportunities', $formname='', $lead='', $showaccount = true){
168
-	if(!ACLController::checkAccess('Opportunities', 'edit', true)){
167
+function getWideFormBody($prefix, $mod = 'Opportunities', $formname = '', $lead = '', $showaccount = true) {
168
+	if (!ACLController::checkAccess('Opportunities', 'edit', true)) {
169 169
 		return '';
170 170
 	}
171
-	if(empty($lead)){
171
+	if (empty($lead)) {
172 172
 		$lead = new Lead();
173 173
 	}
174 174
 global $mod_strings, $sugar_config;
175 175
 $showaccount = $showaccount && $sugar_config['require_accounts'];
176 176
 $temp_strings = $mod_strings;
177
-if(!empty($mod)){
177
+if (!empty($mod)) {
178 178
 	global $current_language;
179 179
 	$mod_strings = return_module_language($current_language, $mod);
180 180
 }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 //$prePopProb = '';
201 201
 //if(empty($this->bean->id)) 
202 202
 $prePopProb = 'document.getElementsByName(\''.$prefix.'sales_stage\')[0].onchange();';
203
-$probability_script=<<<EOQ
203
+$probability_script = <<<EOQ
204 204
 	<script>
205 205
 	prob_array = $prob_array;
206 206
 	document.getElementsByName('{$prefix}sales_stage')[0].onchange = function() {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 $ntc_date_format = $timedate->get_user_date_format();
216 216
 $cal_dateformat = $timedate->get_cal_date_format();
217 217
 if (isset($lead->assigned_user_id)) {
218
-	$user_id=$lead->assigned_user_id;
218
+	$user_id = $lead->assigned_user_id;
219 219
 } else {
220 220
 	$user_id = $current_user->id;
221 221
 }
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
226 226
 $cal_lang = "en";
227 227
 
228
-$the_form="";
228
+$the_form = "";
229 229
 
230 230
 
231 231
 if (isset($lead->opportunity_amount)) {
232
-	$opp_amount=$lead->opportunity_amount;
232
+	$opp_amount = $lead->opportunity_amount;
233 233
 } else {
234
- 	$opp_amount='';
234
+ 	$opp_amount = '';
235 235
 }
236 236
 $jsCalendarImage = SugarThemeRegistry::current()->getImageURL('jscalendar.gif');
237 237
 $the_form .= <<<EOQ
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 <td ><input name='{$prefix}date_closed' onblur="parseDate(this, '$cal_dateformat');" size='12' maxlength='10' id='${prefix}jscal_field' type="text" value="">&nbsp;<!--not_in_theme!--><img src="{$jsCalendarImage}" alt="{$app_strings['LBL_ENTER_DATE']}"  id="${prefix}jscal_trigger" align="absmiddle"></td>
257 257
 </tr>
258 258
 EOQ;
259
-if($showaccount){
259
+if ($showaccount) {
260 260
 	$the_form .= <<<EOQ
261 261
 <tr>
262 262
     <td scope="row">${mod_strings['LBL_ACCOUNT_NAME']}&nbsp;<span class="required">${lbl_required_symbol}</span></td>
@@ -308,20 +308,20 @@  discard block
 block discarded – undo
308 308
 $javascript->setFormName($formname);
309 309
 $javascript->setSugarBean(new Opportunity());
310 310
 $javascript->addRequiredFields($prefix);
311
-$the_form .=$javascript->getScript();
311
+$the_form .= $javascript->getScript();
312 312
 $mod_strings = $temp_strings;
313 313
 return $the_form;
314 314
 
315 315
 } // end getWideFormBody
316 316
 
317
-function getFormBody($prefix, $mod='Opportunities', $formname=''){
318
-	if(!ACLController::checkAccess('Opportunities', 'edit', true)){
317
+function getFormBody($prefix, $mod = 'Opportunities', $formname = '') {
318
+	if (!ACLController::checkAccess('Opportunities', 'edit', true)) {
319 319
 		return '';
320 320
 	}
321
-if(!empty($mod)){
321
+if (!empty($mod)) {
322 322
 	global $current_language;
323 323
 	$mod_strings = return_module_language($current_language, $mod);
324
-}else global $mod_strings;
324
+} else global $mod_strings;
325 325
 global $app_strings;
326 326
 global $app_list_strings;
327 327
 global $theme;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 		$lbl_opportunity_name&nbsp;<span class="required">$lbl_required_symbol</span><br>
357 357
 		<input name='{$prefix}name' type="text" value="">
358 358
 EOQ;
359
-if($sugar_config['require_accounts']){
359
+if ($sugar_config['require_accounts']) {
360 360
 
361 361
 ///////////////////////////////////////
362 362
 ///
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 $qsd = QuickSearchDefaults::getQuickSearchDefaults();
409 409
 $sqs_objects = array('qc_account_name' => $qsd->getQSParent());
410 410
 $sqs_objects['qc_account_name']['populate_list'] = array('qc_account_name', 'qc_account_id');
411
-$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
411
+$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = '.$json->encode($sqs_objects).'</script>';
412 412
 $the_form .= $quicksearch_js;
413 413
 
414 414
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 $javascript->setFormName($formname);
418 418
 $javascript->setSugarBean(new Opportunity());
419 419
 $javascript->addRequiredFields($prefix);
420
-$the_form .=$javascript->getScript();
420
+$the_form .= $javascript->getScript();
421 421
 
422 422
 
423 423
 return $the_form;
@@ -425,25 +425,25 @@  discard block
 block discarded – undo
425 425
 }
426 426
 
427 427
 
428
-function handleSave($prefix,$redirect=true, $useRequired=false){
428
+function handleSave($prefix, $redirect = true, $useRequired = false) {
429 429
     global $current_user;
430 430
 	
431 431
 	
432 432
 	require_once('include/formbase.php');
433 433
 	
434 434
 	$focus = new Opportunity();
435
-	if($useRequired &&  !checkRequired($prefix, array_keys($focus->required_fields))){
435
+	if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
436 436
 		return null;
437 437
 	}
438 438
 
439
-    if(empty($_POST['currency_id'])){
439
+    if (empty($_POST['currency_id'])) {
440 440
         $currency_id = $current_user->getPreference('currency');
441
-        if(isset($currency_id)){
442
-            $focus->currency_id =   $currency_id;
441
+        if (isset($currency_id)) {
442
+            $focus->currency_id = $currency_id;
443 443
         }
444 444
     }
445 445
 	$focus = populateFromPost($prefix, $focus);
446
-	if( !ACLController::checkAccess($focus->module_dir, 'edit', $focus->isOwner($current_user->id))){
446
+	if (!ACLController::checkAccess($focus->module_dir, 'edit', $focus->isOwner($current_user->id))) {
447 447
 		ACLController::displayNoAccess(true);
448 448
 	}
449 449
 	$check_notify = FALSE;
@@ -453,15 +453,15 @@  discard block
 block discarded – undo
453 453
 
454 454
 	$focus->save($check_notify);
455 455
 
456
-	if(!empty($_POST['duplicate_parent_id'])){
457
-		clone_relationship($focus->db, array('opportunities_contacts'),'opportunity_id',  $_POST['duplicate_parent_id'], $focus->id);
456
+	if (!empty($_POST['duplicate_parent_id'])) {
457
+		clone_relationship($focus->db, array('opportunities_contacts'), 'opportunity_id', $_POST['duplicate_parent_id'], $focus->id);
458 458
 	}
459 459
 	$return_id = $focus->id;
460 460
 	
461 461
 	$GLOBALS['log']->debug("Saved record with id of ".$return_id);
462
-	if($redirect){
463
-		handleRedirect($return_id,"Opportunities" );
464
-	}else{
462
+	if ($redirect) {
463
+		handleRedirect($return_id, "Opportunities");
464
+	} else {
465 465
 		return $focus;
466 466
 	}
467 467
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 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.
@@ -65,7 +67,9 @@  discard block
 block discarded – undo
65 67
 			$i++;
66 68
 			$rows[$i] = $row;
67 69
 		}
68
-		if ($i==-1) return null;
70
+		if ($i==-1) {
71
+		    return null;
72
+		}
69 73
 		
70 74
 		return $rows;		
71 75
 	}
@@ -77,7 +81,9 @@  discard block
 block discarded – undo
77 81
 	if(!empty($mod)){
78 82
 	global $current_language;
79 83
 	$mod_strings = return_module_language($current_language, $mod);
80
-	}else global $mod_strings;
84
+	} else {
85
+	    global $mod_strings;
86
+	}
81 87
 	global $app_strings;
82 88
 	$cols = sizeof($rows[0]) * 2 + 1;
83 89
 	$form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>';
@@ -108,14 +114,14 @@  discard block
 block discarded – undo
108 114
 					if(!$wasSet){
109 115
 					$form .= "<td scope='row'><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
110 116
 					$wasSet = true;
111
-					}else{
117
+					} else{
112 118
 					$form .= "<td><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>";
113 119
 					}
114 120
 				}}
115 121
 
116 122
 		if($rowColor == 'evenListRowS1'){
117 123
 			$rowColor = 'oddListRowS1';
118
-		}else{
124
+		} else{
119 125
 			 $rowColor = 'evenListRowS1';
120 126
 		}
121 127
 		$form .= "</tr>";
@@ -136,7 +142,9 @@  discard block
 block discarded – undo
136 142
 if(!empty($mod)){
137 143
 	global $current_language;
138 144
 	$mod_strings = return_module_language($current_language, $mod);
139
-}else global $mod_strings;
145
+} else {
146
+    global $mod_strings;
147
+}
140 148
 global $app_strings;
141 149
 global $sugar_version, $sugar_config;
142 150
 
@@ -286,7 +294,9 @@  discard block
 block discarded – undo
286 294
 EOQ;
287 295
 //carry forward custom lead fields to opportunities during Lead Conversion
288 296
 	$tempOpp = new Opportunity();
289
-	if (method_exists($lead, 'convertCustomFieldsForm')) $lead->convertCustomFieldsForm($the_form, $tempOpp, $prefix);
297
+	if (method_exists($lead, 'convertCustomFieldsForm')) {
298
+	    $lead->convertCustomFieldsForm($the_form, $tempOpp, $prefix);
299
+	}
290 300
 	unset($tempOpp);
291 301
 
292 302
 $the_form .= <<<EOQ
@@ -321,7 +331,9 @@  discard block
 block discarded – undo
321 331
 if(!empty($mod)){
322 332
 	global $current_language;
323 333
 	$mod_strings = return_module_language($current_language, $mod);
324
-}else global $mod_strings;
334
+} else {
335
+    global $mod_strings;
336
+}
325 337
 global $app_strings;
326 338
 global $app_list_strings;
327 339
 global $theme;
@@ -461,7 +473,7 @@  discard block
 block discarded – undo
461 473
 	$GLOBALS['log']->debug("Saved record with id of ".$return_id);
462 474
 	if($redirect){
463 475
 		handleRedirect($return_id,"Opportunities" );
464
-	}else{
476
+	} else{
465 477
 		return $focus;
466 478
 	}
467 479
 }
Please login to merge, or discard this patch.
modules/ProspectLists/field_arrays.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,15 +46,15 @@
 block discarded – undo
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48 48
 $fields_array['ProspectList'] = array ('column_fields' => array(
49
-				"id", "date_entered",
50
-				"date_modified", "modified_user_id",
51
-				"assigned_user_id", "created_by",
52
-				"name", "description",'list_type','domain_name',
53
-	),
49
+                "id", "date_entered",
50
+                "date_modified", "modified_user_id",
51
+                "assigned_user_id", "created_by",
52
+                "name", "description",'list_type','domain_name',
53
+    ),
54 54
         'list_fields' =>  array(
55
-				'id', 'name', 'description','list_type',
56
-				'assigned_user_id','assigned_user_name',
57
-	),
55
+                'id', 'name', 'description','list_type',
56
+                'assigned_user_id','assigned_user_name',
57
+    ),
58 58
     'required_fields' =>  array('name'=>1,'list_type'=>2),
59 59
 );
60 60
 ?>
61 61
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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,16 +45,16 @@  discard block
 block discarded – undo
45 45
  * All Rights Reserved.
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48
-$fields_array['ProspectList'] = array ('column_fields' => array(
48
+$fields_array['ProspectList'] = array('column_fields' => array(
49 49
 				"id", "date_entered",
50 50
 				"date_modified", "modified_user_id",
51 51
 				"assigned_user_id", "created_by",
52
-				"name", "description",'list_type','domain_name',
52
+				"name", "description", 'list_type', 'domain_name',
53 53
 	),
54 54
         'list_fields' =>  array(
55
-				'id', 'name', 'description','list_type',
56
-				'assigned_user_id','assigned_user_name',
55
+				'id', 'name', 'description', 'list_type',
56
+				'assigned_user_id', 'assigned_user_name',
57 57
 	),
58
-    'required_fields' =>  array('name'=>1,'list_type'=>2),
58
+    'required_fields' =>  array('name'=>1, 'list_type'=>2),
59 59
 );
60 60
 ?>
61 61
\ No newline at end of file
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/ProspectLists/ProspectListFormBase.php 4 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -52,71 +52,71 @@  discard block
 block discarded – undo
52 52
 
53 53
 function getForm($prefix, $mod='', $form=''){
54 54
 	
55
-	if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
56
-		return '';
57
-	}
55
+    if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
56
+        return '';
57
+    }
58 58
 	
59
-	if(!empty($mod)){
60
-		global $current_language;
61
-		$mod_strings = return_module_language($current_language, $mod);
62
-	} else {
63
-		global $mod_strings;
64
-	}
65
-	global $app_strings,$current_user;
59
+    if(!empty($mod)){
60
+        global $current_language;
61
+        $mod_strings = return_module_language($current_language, $mod);
62
+    } else {
63
+        global $mod_strings;
64
+    }
65
+    global $app_strings,$current_user;
66 66
 	
67
-	$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
68
-	$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
69
-	$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
70
-	$user_id = $current_user->id;
67
+    $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
68
+    $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
69
+    $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
70
+    $user_id = $current_user->id;
71 71
 
72 72
 
73
-	$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
74
-	$the_form .= <<<EOQ
73
+    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
74
+    $the_form .= <<<EOQ
75 75
 		<form name="${prefix}ProspectListSave" onSubmit="return check_form('${prefix}ProspectListSave');" method="POST" action="index.php">
76 76
 			<input type="hidden" name="${prefix}module" value="ProspectLists">
77 77
 			<input type="hidden" name="${prefix}action" value="Save">
78 78
 			<input type="hidden" name="assigned_user_id" value='${user_id}'>
79 79
 EOQ;
80 80
 
81
-	$the_form .= $this->getFormBody($prefix, $mod, $prefix."ProspectListSave");
82
-	$the_form .= <<<EOQ
81
+    $the_form .= $this->getFormBody($prefix, $mod, $prefix."ProspectListSave");
82
+    $the_form .= <<<EOQ
83 83
 		<p><input title="$lbl_save_button_title" accessKey="$lbl_save_button_key" class="button" type="submit" name="button" value="  $lbl_save_button_label  " ></p>
84 84
 		</form>
85 85
 
86 86
 EOQ;
87 87
 
88
-	$the_form .= get_left_form_footer();
89
-	$the_form .= get_validate_record_js();
88
+    $the_form .= get_left_form_footer();
89
+    $the_form .= get_validate_record_js();
90 90
 
91
-	return $the_form;	
91
+    return $the_form;	
92 92
 }
93 93
 
94 94
 function getFormBody($prefix, $mod='',$formname='', $size='30',$script=true) {
95
-	if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
96
-		return '';
97
-	}
98
-	global $mod_strings;
99
-	$temp_strings = $mod_strings;
100
-	if(!empty($mod)){
101
-		global $current_language;
102
-		$mod_strings = return_module_language($current_language, $mod);
103
-	}
104
-	global $app_strings;
105
-	global $current_user;
106
-	global $app_list_strings;
95
+    if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
96
+        return '';
97
+    }
98
+    global $mod_strings;
99
+    $temp_strings = $mod_strings;
100
+    if(!empty($mod)){
101
+        global $current_language;
102
+        $mod_strings = return_module_language($current_language, $mod);
103
+    }
104
+    global $app_strings;
105
+    global $current_user;
106
+    global $app_list_strings;
107 107
 	
108
-	$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
109
-	$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
110
-	$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
111
-	$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
112
-	$user_id = $current_user->id;
108
+    $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
109
+    $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
110
+    $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
111
+    $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
112
+    $user_id = $current_user->id;
113 113
 
114
-	$list_options=get_select_options_with_id($app_list_strings['prospect_list_type_dom'], 'default');
114
+    $list_options=get_select_options_with_id($app_list_strings['prospect_list_type_dom'], 'default');
115 115
 	
116
-	$lbl_prospect_list_name = $mod_strings['LBL_PROSPECT_LIST_NAME'];
117
-	$lbl_list_type = $mod_strings['LBL_LIST_TYPE'];
116
+    $lbl_prospect_list_name = $mod_strings['LBL_PROSPECT_LIST_NAME'];
117
+    $lbl_list_type = $mod_strings['LBL_LIST_TYPE'];
118 118
 	
119
-	$form = <<<EOQ
119
+    $form = <<<EOQ
120 120
 			<p><input type="hidden" name="record" value="">
121 121
 			$lbl_prospect_list_name&nbsp;<span class="required">$lbl_required_symbol</span><br>
122 122
 			<input name='name' type="text" value=""><br>
@@ -126,43 +126,43 @@  discard block
 block discarded – undo
126 126
 
127 127
 	
128 128
 	
129
-	$javascript = new javascript();
130
-	$javascript->setFormName($formname);
131
-	$javascript->setSugarBean(new ProspectList());
132
-	$javascript->addRequiredFields($prefix);
133
-	$form .=$javascript->getScript();
134
-	$mod_strings = $temp_strings;
135
-	return $form;
129
+    $javascript = new javascript();
130
+    $javascript->setFormName($formname);
131
+    $javascript->setSugarBean(new ProspectList());
132
+    $javascript->addRequiredFields($prefix);
133
+    $form .=$javascript->getScript();
134
+    $mod_strings = $temp_strings;
135
+    return $form;
136 136
 }
137 137
 
138
-	function handleSave($prefix,$redirect=true, $useRequired=false){
138
+    function handleSave($prefix,$redirect=true, $useRequired=false){
139 139
 		
140 140
 		
141
-		require_once('include/formbase.php');
141
+        require_once('include/formbase.php');
142 142
 	
143 143
 		
144
-		$focus = new ProspectList();
145
-		if($useRequired &&  !checkRequired($prefix, array_keys($focus->required_fields))){
146
-			return null;
147
-		}
148
-		$focus = populateFromPost($prefix, $focus);
149
-		if(!$focus->ACLAccess('Save')){
150
-			ACLController::displayNoAccess(true);
151
-			sugar_cleanup(true);
152
-		}
153
-		if(empty($focus->name)){
154
-			return null;
155
-		}	
144
+        $focus = new ProspectList();
145
+        if($useRequired &&  !checkRequired($prefix, array_keys($focus->required_fields))){
146
+            return null;
147
+        }
148
+        $focus = populateFromPost($prefix, $focus);
149
+        if(!$focus->ACLAccess('Save')){
150
+            ACLController::displayNoAccess(true);
151
+            sugar_cleanup(true);
152
+        }
153
+        if(empty($focus->name)){
154
+            return null;
155
+        }	
156 156
         if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' )
157 157
             $focus->assigned_user_id = $GLOBALS['current_user']->id;
158 158
 	
159
-		$return_id = $focus->save();
160
-		if($redirect){
161
-			$GLOBALS['log']->debug("Saved record with id of ".$return_id);
162
-			handleRedirect($return_id, "ProspectLists");
163
-		} else { 
164
-			return $focus;
165
-		}
166
-	}
159
+        $return_id = $focus->save();
160
+        if($redirect){
161
+            $GLOBALS['log']->debug("Saved record with id of ".$return_id);
162
+            handleRedirect($return_id, "ProspectLists");
163
+        } else { 
164
+            return $focus;
165
+        }
166
+    }
167 167
 }
168 168
 ?>
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 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.
@@ -50,19 +50,19 @@  discard block
 block discarded – undo
50 50
 class ProspectListFormBase {
51 51
 
52 52
 
53
-function getForm($prefix, $mod='', $form=''){
53
+function getForm($prefix, $mod = '', $form = '') {
54 54
 	
55
-	if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
55
+	if (!ACLController::checkAccess('ProspectLists', 'edit', true)) {
56 56
 		return '';
57 57
 	}
58 58
 	
59
-	if(!empty($mod)){
59
+	if (!empty($mod)) {
60 60
 		global $current_language;
61 61
 		$mod_strings = return_module_language($current_language, $mod);
62 62
 	} else {
63 63
 		global $mod_strings;
64 64
 	}
65
-	global $app_strings,$current_user;
65
+	global $app_strings, $current_user;
66 66
 	
67 67
 	$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
68 68
 	$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	return $the_form;	
92 92
 }
93 93
 
94
-function getFormBody($prefix, $mod='',$formname='', $size='30',$script=true) {
95
-	if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
94
+function getFormBody($prefix, $mod = '', $formname = '', $size = '30', $script = true) {
95
+	if (!ACLController::checkAccess('ProspectLists', 'edit', true)) {
96 96
 		return '';
97 97
 	}
98 98
 	global $mod_strings;
99 99
 	$temp_strings = $mod_strings;
100
-	if(!empty($mod)){
100
+	if (!empty($mod)) {
101 101
 		global $current_language;
102 102
 		$mod_strings = return_module_language($current_language, $mod);
103 103
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
112 112
 	$user_id = $current_user->id;
113 113
 
114
-	$list_options=get_select_options_with_id($app_list_strings['prospect_list_type_dom'], 'default');
114
+	$list_options = get_select_options_with_id($app_list_strings['prospect_list_type_dom'], 'default');
115 115
 	
116 116
 	$lbl_prospect_list_name = $mod_strings['LBL_PROSPECT_LIST_NAME'];
117 117
 	$lbl_list_type = $mod_strings['LBL_LIST_TYPE'];
@@ -130,34 +130,34 @@  discard block
 block discarded – undo
130 130
 	$javascript->setFormName($formname);
131 131
 	$javascript->setSugarBean(new ProspectList());
132 132
 	$javascript->addRequiredFields($prefix);
133
-	$form .=$javascript->getScript();
133
+	$form .= $javascript->getScript();
134 134
 	$mod_strings = $temp_strings;
135 135
 	return $form;
136 136
 }
137 137
 
138
-	function handleSave($prefix,$redirect=true, $useRequired=false){
138
+	function handleSave($prefix, $redirect = true, $useRequired = false) {
139 139
 		
140 140
 		
141 141
 		require_once('include/formbase.php');
142 142
 	
143 143
 		
144 144
 		$focus = new ProspectList();
145
-		if($useRequired &&  !checkRequired($prefix, array_keys($focus->required_fields))){
145
+		if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
146 146
 			return null;
147 147
 		}
148 148
 		$focus = populateFromPost($prefix, $focus);
149
-		if(!$focus->ACLAccess('Save')){
149
+		if (!$focus->ACLAccess('Save')) {
150 150
 			ACLController::displayNoAccess(true);
151 151
 			sugar_cleanup(true);
152 152
 		}
153
-		if(empty($focus->name)){
153
+		if (empty($focus->name)) {
154 154
 			return null;
155 155
 		}	
156
-        if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' )
156
+        if (!isset($focus->assigned_user_id) || $focus->assigned_user_id == '')
157 157
             $focus->assigned_user_id = $GLOBALS['current_user']->id;
158 158
 	
159 159
 		$return_id = $focus->save();
160
-		if($redirect){
160
+		if ($redirect) {
161 161
 			$GLOBALS['log']->debug("Saved record with id of ".$return_id);
162 162
 			handleRedirect($return_id, "ProspectLists");
163 163
 		} else { 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 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.
@@ -153,8 +155,9 @@  discard block
 block discarded – undo
153 155
 		if(empty($focus->name)){
154 156
 			return null;
155 157
 		}	
156
-        if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' )
157
-            $focus->assigned_user_id = $GLOBALS['current_user']->id;
158
+        if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' ) {
159
+                    $focus->assigned_user_id = $GLOBALS['current_user']->id;
160
+        }
158 161
 	
159 162
 		$return_id = $focus->save();
160 163
 		if($redirect){
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -50,6 +50,9 @@
 block discarded – undo
50 50
 class ProspectListFormBase {
51 51
 
52 52
 
53
+/**
54
+ * @param string $prefix
55
+ */
53 56
 function getForm($prefix, $mod='', $form=''){
54 57
 	
55 58
 	if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
Please login to merge, or discard this patch.
modules/ProspectLists/TargetListUpdate.php 3 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -54,42 +54,42 @@
 block discarded – undo
54 54
 
55 55
 $uids = array();
56 56
 if($_REQUEST['select_entire_list'] == '1'){
57
-	$order_by = '';
57
+    $order_by = '';
58 58
 
59
-	require_once('include/MassUpdate.php');
60
-	$mass = new MassUpdate();
61
-	$mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']);
62
-	$ret_array = create_export_query_relate_link_patch($_REQUEST['module'], $mass->searchFields, $mass->where_clauses);
63
-	/* BEGIN - SECURITY GROUPS */
64
-	//need to hijack the $ret_array['where'] of securitygorup required
65
-	if($focus->bean_implements('ACL') && ACLController::requireSecurityGroup($focus->module_dir, 'list') )
66
-	{
67
-		require_once('modules/SecurityGroups/SecurityGroup.php');
68
-		global $current_user;
69
-		$owner_where = $focus->getOwnerWhere($current_user->id);
70
-		$group_where = SecurityGroup::getGroupWhere($focus->table_name,$focus->module_dir,$current_user->id);
71
-		if(!empty($owner_where)){
72
-			if(empty($ret_array['where']))
73
-			{
74
-				$ret_array['where'] = " (".  $owner_where." or ".$group_where.") ";
75
-			} else {
76
-				$ret_array['where'] .= " AND (".  $owner_where." or ".$group_where.") ";
77
-			}
78
-		} else {
79
-			$ret_array['where'] .= ' AND '.  $group_where;
80
-		}
81
-	}
82
-	/* END - SECURITY GROUPS */
83
-	$query = $focus->create_export_query($order_by, $ret_array['where'], $ret_array['join']);
84
-	$result = $GLOBALS['db']->query($query,true);
85
-	$uids = array();
86
-	while($val = $GLOBALS['db']->fetchByAssoc($result,false))
87
-	{
88
-		array_push($uids, $val['id']);
89
-	}
59
+    require_once('include/MassUpdate.php');
60
+    $mass = new MassUpdate();
61
+    $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']);
62
+    $ret_array = create_export_query_relate_link_patch($_REQUEST['module'], $mass->searchFields, $mass->where_clauses);
63
+    /* BEGIN - SECURITY GROUPS */
64
+    //need to hijack the $ret_array['where'] of securitygorup required
65
+    if($focus->bean_implements('ACL') && ACLController::requireSecurityGroup($focus->module_dir, 'list') )
66
+    {
67
+        require_once('modules/SecurityGroups/SecurityGroup.php');
68
+        global $current_user;
69
+        $owner_where = $focus->getOwnerWhere($current_user->id);
70
+        $group_where = SecurityGroup::getGroupWhere($focus->table_name,$focus->module_dir,$current_user->id);
71
+        if(!empty($owner_where)){
72
+            if(empty($ret_array['where']))
73
+            {
74
+                $ret_array['where'] = " (".  $owner_where." or ".$group_where.") ";
75
+            } else {
76
+                $ret_array['where'] .= " AND (".  $owner_where." or ".$group_where.") ";
77
+            }
78
+        } else {
79
+            $ret_array['where'] .= ' AND '.  $group_where;
80
+        }
81
+    }
82
+    /* END - SECURITY GROUPS */
83
+    $query = $focus->create_export_query($order_by, $ret_array['where'], $ret_array['join']);
84
+    $result = $GLOBALS['db']->query($query,true);
85
+    $uids = array();
86
+    while($val = $GLOBALS['db']->fetchByAssoc($result,false))
87
+    {
88
+        array_push($uids, $val['id']);
89
+    }
90 90
 }
91 91
 else{
92
-	$uids = explode ( ',', $_POST['uids'] );
92
+    $uids = explode ( ',', $_POST['uids'] );
93 93
 }
94 94
 
95 95
 // find the relationship to use
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-2012 SugarCRM Inc.
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 
48 48
 require_once 'include/formbase.php';
49 49
 
50
-global $beanFiles,$beanList;
50
+global $beanFiles, $beanList;
51 51
 $bean_name = $beanList[$_REQUEST['module']];
52 52
 require_once($beanFiles[$bean_name]);
53 53
 $focus = new $bean_name();
54 54
 
55 55
 $uids = array();
56
-if($_REQUEST['select_entire_list'] == '1'){
56
+if ($_REQUEST['select_entire_list'] == '1') {
57 57
 	$order_by = '';
58 58
 
59 59
 	require_once('include/MassUpdate.php');
@@ -62,52 +62,52 @@  discard block
 block discarded – undo
62 62
 	$ret_array = create_export_query_relate_link_patch($_REQUEST['module'], $mass->searchFields, $mass->where_clauses);
63 63
 	/* BEGIN - SECURITY GROUPS */
64 64
 	//need to hijack the $ret_array['where'] of securitygorup required
65
-	if($focus->bean_implements('ACL') && ACLController::requireSecurityGroup($focus->module_dir, 'list') )
65
+	if ($focus->bean_implements('ACL') && ACLController::requireSecurityGroup($focus->module_dir, 'list'))
66 66
 	{
67 67
 		require_once('modules/SecurityGroups/SecurityGroup.php');
68 68
 		global $current_user;
69 69
 		$owner_where = $focus->getOwnerWhere($current_user->id);
70
-		$group_where = SecurityGroup::getGroupWhere($focus->table_name,$focus->module_dir,$current_user->id);
71
-		if(!empty($owner_where)){
72
-			if(empty($ret_array['where']))
70
+		$group_where = SecurityGroup::getGroupWhere($focus->table_name, $focus->module_dir, $current_user->id);
71
+		if (!empty($owner_where)) {
72
+			if (empty($ret_array['where']))
73 73
 			{
74
-				$ret_array['where'] = " (".  $owner_where." or ".$group_where.") ";
74
+				$ret_array['where'] = " (".$owner_where." or ".$group_where.") ";
75 75
 			} else {
76
-				$ret_array['where'] .= " AND (".  $owner_where." or ".$group_where.") ";
76
+				$ret_array['where'] .= " AND (".$owner_where." or ".$group_where.") ";
77 77
 			}
78 78
 		} else {
79
-			$ret_array['where'] .= ' AND '.  $group_where;
79
+			$ret_array['where'] .= ' AND '.$group_where;
80 80
 		}
81 81
 	}
82 82
 	/* END - SECURITY GROUPS */
83 83
 	$query = $focus->create_export_query($order_by, $ret_array['where'], $ret_array['join']);
84
-	$result = $GLOBALS['db']->query($query,true);
84
+	$result = $GLOBALS['db']->query($query, true);
85 85
 	$uids = array();
86
-	while($val = $GLOBALS['db']->fetchByAssoc($result,false))
86
+	while ($val = $GLOBALS['db']->fetchByAssoc($result, false))
87 87
 	{
88 88
 		array_push($uids, $val['id']);
89 89
 	}
90 90
 }
91
-else{
92
-	$uids = explode ( ',', $_POST['uids'] );
91
+else {
92
+	$uids = explode(',', $_POST['uids']);
93 93
 }
94 94
 
95 95
 // find the relationship to use
96 96
 $relationship = '';
97
-foreach($focus->get_linked_fields() as $field => $def) {
97
+foreach ($focus->get_linked_fields() as $field => $def) {
98 98
     if ($focus->load_relationship($field)) {
99
-        if ( $focus->$field->getRelatedModuleName() == 'ProspectLists' ) {
99
+        if ($focus->$field->getRelatedModuleName() == 'ProspectLists') {
100 100
             $relationship = $field;
101 101
             break;
102 102
         }
103 103
     }
104 104
 }
105 105
 
106
-if ( $relationship != '' ) {
107
-    foreach ( $uids as $id) {
106
+if ($relationship != '') {
107
+    foreach ($uids as $id) {
108 108
         $focus->retrieve($id);
109 109
         $focus->load_relationship($relationship);
110
-        $focus->prospect_lists->add( $_REQUEST['prospect_list'] );
110
+        $focus->prospect_lists->add($_REQUEST['prospect_list']);
111 111
     }
112 112
 }
113 113
 handleRedirect();
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 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.
@@ -54,8 +56,7 @@  discard block
 block discarded – undo
54 56
     if( $view != "default" && $view != "module" ){
55 57
         die($mod_strings['ERR_UW_INVALID_VIEW']);
56 58
     }
57
-}
58
-else{
59
+} else{
59 60
     die($mod_strings['ERR_UW_NO_VIEW']);
60 61
 }
61 62
 $form_action = "index.php?module=Administration&view=" . $view . "&action=UpgradeWizard";
Please login to merge, or discard this patch.
modules/ProspectLists/ProspectList.php 4 patches
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -50,107 +50,107 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
 class ProspectList extends SugarBean {
53
-	var $field_name_map;
53
+    var $field_name_map;
54 54
 	
55
-	// Stored fields
56
-	var $id;
57
-	var $date_entered;
58
-	var $date_modified;
59
-	var $modified_user_id;
60
-	var $assigned_user_id;
61
-	var $created_by;
62
-	var $created_by_name;
63
-	var $modified_by_name;
64
-	var $list_type;
65
-	var $domain_name;
66
-
67
-	var $name;
68
-	var $description;
55
+    // Stored fields
56
+    var $id;
57
+    var $date_entered;
58
+    var $date_modified;
59
+    var $modified_user_id;
60
+    var $assigned_user_id;
61
+    var $created_by;
62
+    var $created_by_name;
63
+    var $modified_by_name;
64
+    var $list_type;
65
+    var $domain_name;
66
+
67
+    var $name;
68
+    var $description;
69 69
 	
70
-	// These are related
71
-	var $assigned_user_name;
72
-	var $prospect_id;
73
-	var $contact_id;
74
-	var $lead_id;
75
-
76
-	// module name definitions and table relations
77
-	var $table_name = "prospect_lists";
78
-	var $module_dir = 'ProspectLists';
79
-	var $rel_prospects_table = "prospect_lists_prospects";
80
-	var $object_name = "ProspectList";
81
-
82
-	// This is used to retrieve related fields from form posts.
83
-	var $additional_column_fields = array(
84
-		'assigned_user_name', 'assigned_user_id', 'campaign_id',
85
-	);
86
-	var $relationship_fields = array(
87
-		'campaign_id'=>'campaigns',
88
-		'prospect_list_prospects' => 'prospects',
89
-	);
70
+    // These are related
71
+    var $assigned_user_name;
72
+    var $prospect_id;
73
+    var $contact_id;
74
+    var $lead_id;
75
+
76
+    // module name definitions and table relations
77
+    var $table_name = "prospect_lists";
78
+    var $module_dir = 'ProspectLists';
79
+    var $rel_prospects_table = "prospect_lists_prospects";
80
+    var $object_name = "ProspectList";
81
+
82
+    // This is used to retrieve related fields from form posts.
83
+    var $additional_column_fields = array(
84
+        'assigned_user_name', 'assigned_user_id', 'campaign_id',
85
+    );
86
+    var $relationship_fields = array(
87
+        'campaign_id'=>'campaigns',
88
+        'prospect_list_prospects' => 'prospects',
89
+    );
90 90
 
91 91
     var $entry_count;
92 92
     
93
-	function ProspectList() {
94
-		global $sugar_config;
95
-		parent::SugarBean();
93
+    function ProspectList() {
94
+        global $sugar_config;
95
+        parent::SugarBean();
96 96
 		
97
-	}
97
+    }
98 98
 
99
-	var $new_schema = true;
99
+    var $new_schema = true;
100 100
 
101
-	function get_summary_text()
102
-	{
103
-		return "$this->name";
104
-	}
101
+    function get_summary_text()
102
+    {
103
+        return "$this->name";
104
+    }
105 105
 
106
-	function create_list_query($order_by, $where, $show_deleted = 0)
107
-	{
106
+    function create_list_query($order_by, $where, $show_deleted = 0)
107
+    {
108 108
         $custom_join = $this->getCustomJoin();
109 109
 		
110
-		$query = "SELECT ";
111
-		$query .= "users.user_name as assigned_user_name, ";
112
-		$query .= "prospect_lists.*";
110
+        $query = "SELECT ";
111
+        $query .= "users.user_name as assigned_user_name, ";
112
+        $query .= "prospect_lists.*";
113 113
 
114 114
         $query .= $custom_join['select'];
115
-		$query .= " FROM prospect_lists ";
115
+        $query .= " FROM prospect_lists ";
116 116
 
117
-		$query .= "LEFT JOIN users
117
+        $query .= "LEFT JOIN users
118 118
 					ON prospect_lists.assigned_user_id=users.id ";
119 119
 
120 120
         $query .= $custom_join['join'];
121 121
 
122
-			$where_auto = '1=1';
123
-				if($show_deleted == 0){
124
-                	$where_auto = "$this->table_name.deleted=0";
125
-				}else if($show_deleted == 1){
126
-                	$where_auto = "$this->table_name.deleted=1";
127
-				}
122
+            $where_auto = '1=1';
123
+                if($show_deleted == 0){
124
+                    $where_auto = "$this->table_name.deleted=0";
125
+                }else if($show_deleted == 1){
126
+                    $where_auto = "$this->table_name.deleted=1";
127
+                }
128 128
 
129
-		if($where != "")
130
-			$query .= "where $where AND ".$where_auto;
131
-		else
132
-			$query .= "where ".$where_auto;
129
+        if($where != "")
130
+            $query .= "where $where AND ".$where_auto;
131
+        else
132
+            $query .= "where ".$where_auto;
133 133
 
134
-		if($order_by != "")
135
-			$query .= " ORDER BY $order_by";
136
-		else
137
-			$query .= " ORDER BY prospect_lists.name";
134
+        if($order_by != "")
135
+            $query .= " ORDER BY $order_by";
136
+        else
137
+            $query .= " ORDER BY prospect_lists.name";
138 138
 
139
-		return $query;
140
-	}
139
+        return $query;
140
+    }
141 141
 
142 142
 
143
-	function create_export_query($order_by, $where)
144
-	{
143
+    function create_export_query($order_by, $where)
144
+    {
145 145
 
146 146
                                 $query = "SELECT
147 147
                                 prospect_lists.*,
148 148
                                 users.user_name as assigned_user_name ";
149
-	                            $query .= "FROM prospect_lists ";
150
-		$query .= 				"LEFT JOIN users
149
+                                $query .= "FROM prospect_lists ";
150
+        $query .= 				"LEFT JOIN users
151 151
                                 ON prospect_lists.assigned_user_id=users.id ";
152 152
 
153
-		$where_auto = " prospect_lists.deleted=0";
153
+        $where_auto = " prospect_lists.deleted=0";
154 154
 
155 155
         if($where != "")
156 156
                 $query .= " WHERE $where AND ".$where_auto;
@@ -164,47 +164,47 @@  discard block
 block discarded – undo
164 164
         return $query;
165 165
     }
166 166
 
167
-	function create_export_members_query($record_id)
168
-	{
169
-		$members = array(	'Accounts' 	=> array('has_custom_fields' => false, 'fields' => array()), 
170
-					'Contacts' 	=> array('has_custom_fields' => false, 'fields' => array()),
171
-					'Users' 	=> array('has_custom_fields' => false, 'fields' => array()),
172
-					'Prospects' 	=> array('has_custom_fields' => false, 'fields' => array()),
173
-					'Leads' 	=> array('has_custom_fields' => false, 'fields' => array())
174
-				);
175
-
176
-		// query all custom fields in the fields_meta_data table for the modules which are being exported 
177
-		$db = DBManagerFactory::getInstance();
178
-		$result = $db->query("select name, custom_module from fields_meta_data where custom_module in ('" . 
179
-					implode("', '", array_keys($members)) . "')",
180
-					true,
181
-					"ProspectList::create_export_members_query() : error querying custom fields");
182
-
183
-		// cycle through the custom fields and put them in the members array according to 
184
-		// what module the field belongs
185
-		// take into account that the same custom field may exist in more modules
186
-		while($val = $db->fetchByAssoc($result, false)) 
187
-		{
188
-			$fieldname = $val['name'];
189
-
190
-			foreach($members as $membername => &$memberarr)	
191
-			{
192
-				// if the field belongs to this module, then query it in the cstm table
193
-				if ($membername == $val['custom_module'])
194
-				{
195
-					$memberarr['has_custom_fields'] = true;
196
-					$memberarr['fields'][$fieldname] = 
197
-						strtolower($membername) . '_cstm.'.$fieldname . ' AS ' . $fieldname;
198
-				}
199
-				// else, only if for this module no entry exists for this field, query an empty string
200
-				else if (!isset($memberarr['fields'][$val['name']]))
201
-				{
202
-					$memberarr['fields'][$fieldname] = "'' AS " . $fieldname;
203
-				}
204
-			}
205
-		}
206
-
207
-		$leads_query = "SELECT l.id AS id, 'Leads' AS related_type, '' AS \"name\", l.first_name AS first_name, l.last_name AS last_name, l.title AS title, l.salutation AS salutation, 
167
+    function create_export_members_query($record_id)
168
+    {
169
+        $members = array(	'Accounts' 	=> array('has_custom_fields' => false, 'fields' => array()), 
170
+                    'Contacts' 	=> array('has_custom_fields' => false, 'fields' => array()),
171
+                    'Users' 	=> array('has_custom_fields' => false, 'fields' => array()),
172
+                    'Prospects' 	=> array('has_custom_fields' => false, 'fields' => array()),
173
+                    'Leads' 	=> array('has_custom_fields' => false, 'fields' => array())
174
+                );
175
+
176
+        // query all custom fields in the fields_meta_data table for the modules which are being exported 
177
+        $db = DBManagerFactory::getInstance();
178
+        $result = $db->query("select name, custom_module from fields_meta_data where custom_module in ('" . 
179
+                    implode("', '", array_keys($members)) . "')",
180
+                    true,
181
+                    "ProspectList::create_export_members_query() : error querying custom fields");
182
+
183
+        // cycle through the custom fields and put them in the members array according to 
184
+        // what module the field belongs
185
+        // take into account that the same custom field may exist in more modules
186
+        while($val = $db->fetchByAssoc($result, false)) 
187
+        {
188
+            $fieldname = $val['name'];
189
+
190
+            foreach($members as $membername => &$memberarr)	
191
+            {
192
+                // if the field belongs to this module, then query it in the cstm table
193
+                if ($membername == $val['custom_module'])
194
+                {
195
+                    $memberarr['has_custom_fields'] = true;
196
+                    $memberarr['fields'][$fieldname] = 
197
+                        strtolower($membername) . '_cstm.'.$fieldname . ' AS ' . $fieldname;
198
+                }
199
+                // else, only if for this module no entry exists for this field, query an empty string
200
+                else if (!isset($memberarr['fields'][$val['name']]))
201
+                {
202
+                    $memberarr['fields'][$fieldname] = "'' AS " . $fieldname;
203
+                }
204
+            }
205
+        }
206
+
207
+        $leads_query = "SELECT l.id AS id, 'Leads' AS related_type, '' AS \"name\", l.first_name AS first_name, l.last_name AS last_name, l.title AS title, l.salutation AS salutation, 
208 208
 				l.primary_address_street AS primary_address_street,l.primary_address_city AS primary_address_city, l.primary_address_state AS primary_address_state, l.primary_address_postalcode AS primary_address_postalcode, l.primary_address_country AS primary_address_country,
209 209
 				l.account_name AS account_name,
210 210
 				ea.email_address AS primary_email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 				AND l.deleted=0
220 220
 				AND (ear.deleted=0 OR ear.deleted IS NULL)";
221 221
 
222
-		$users_query = "SELECT u.id AS id, 'Users' AS related_type, '' AS \"name\", u.first_name AS first_name, u.last_name AS last_name,u.title AS title, '' AS salutation, 
222
+        $users_query = "SELECT u.id AS id, 'Users' AS related_type, '' AS \"name\", u.first_name AS first_name, u.last_name AS last_name,u.title AS title, '' AS salutation, 
223 223
 				u.address_street AS primary_address_street,u.address_city AS primary_address_city, u.address_state AS primary_address_state,  u.address_postalcode AS primary_address_postalcode, u.address_country AS primary_address_country,
224 224
 				'' AS account_name,
225 225
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				AND u.deleted=0
235 235
 				AND (ear.deleted=0 OR ear.deleted IS NULL)";
236 236
 
237
-		$contacts_query = "SELECT c.id AS id, 'Contacts' AS related_type, '' AS \"name\", c.first_name AS first_name, c.last_name AS last_name,c.title AS title, c.salutation AS salutation, 
237
+        $contacts_query = "SELECT c.id AS id, 'Contacts' AS related_type, '' AS \"name\", c.first_name AS first_name, c.last_name AS last_name,c.title AS title, c.salutation AS salutation, 
238 238
 				c.primary_address_street AS primary_address_street,c.primary_address_city AS primary_address_city, c.primary_address_state AS primary_address_state,  c.primary_address_postalcode AS primary_address_postalcode, c.primary_address_country AS primary_address_country,
239 239
 				a.name AS account_name,
240 240
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 				AND ac.deleted=0
251 251
                 AND (ear.deleted=0 OR ear.deleted IS NULL)";
252 252
 
253
-		$prospects_query = "SELECT p.id AS id, 'Prospects' AS related_type, '' AS \"name\", p.first_name AS first_name, p.last_name AS last_name,p.title AS title, p.salutation AS salutation, 
253
+        $prospects_query = "SELECT p.id AS id, 'Prospects' AS related_type, '' AS \"name\", p.first_name AS first_name, p.last_name AS last_name,p.title AS title, p.salutation AS salutation, 
254 254
 				p.primary_address_street AS primary_address_street,p.primary_address_city AS primary_address_city, p.primary_address_state AS primary_address_state,  p.primary_address_postalcode AS primary_address_postalcode, p.primary_address_country AS primary_address_country,
255 255
 				p.account_name AS account_name,
256 256
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				AND p.deleted=0
266 266
 				AND (ear.deleted=0 OR ear.deleted IS NULL)";
267 267
 
268
-		$accounts_query = "SELECT a.id AS id, 'Accounts' AS related_type, a.name AS \"name\", '' AS first_name, '' AS last_name,'' AS title, '' AS salutation, 
268
+        $accounts_query = "SELECT a.id AS id, 'Accounts' AS related_type, a.name AS \"name\", '' AS first_name, '' AS last_name,'' AS title, '' AS salutation, 
269 269
 				a.billing_address_street AS primary_address_street,a.billing_address_city AS primary_address_city, a.billing_address_state AS primary_address_state, a.billing_address_postalcode AS primary_address_postalcode, a.billing_address_country AS primary_address_country,
270 270
 				'' AS account_name,
271 271
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
@@ -279,115 +279,115 @@  discard block
 block discarded – undo
279 279
 				WHERE plp.prospect_list_id = $record_id  AND plp.deleted=0 
280 280
 				AND a.deleted=0
281 281
 				AND (ear.deleted=0 OR ear.deleted IS NULL)";
282
-		$order_by = "ORDER BY related_type, id, primary_address DESC";
283
-		$query = "$leads_query UNION ALL $users_query UNION ALL $contacts_query UNION ALL $prospects_query UNION ALL $accounts_query $order_by";
284
-		return $query;
285
-	}
282
+        $order_by = "ORDER BY related_type, id, primary_address DESC";
283
+        $query = "$leads_query UNION ALL $users_query UNION ALL $contacts_query UNION ALL $prospects_query UNION ALL $accounts_query $order_by";
284
+        return $query;
285
+    }
286 286
 	
287
-	function save_relationship_changes($is_update, $exclude = array())
287
+    function save_relationship_changes($is_update, $exclude = array())
288 288
     {
289
-    	parent::save_relationship_changes($is_update, $exclude);
290
-		if($this->lead_id != "")
291
-	   		$this->set_prospect_relationship($this->id, $this->lead_id, "lead");
292
-    	if($this->contact_id != "")
293
-    		$this->set_prospect_relationship($this->id, $this->contact_id, "contact");
294
-    	if($this->prospect_id != "")
295
-    		$this->set_prospect_relationship($this->id, $this->contact_id, "prospect");
289
+        parent::save_relationship_changes($is_update, $exclude);
290
+        if($this->lead_id != "")
291
+                $this->set_prospect_relationship($this->id, $this->lead_id, "lead");
292
+        if($this->contact_id != "")
293
+            $this->set_prospect_relationship($this->id, $this->contact_id, "contact");
294
+        if($this->prospect_id != "")
295
+            $this->set_prospect_relationship($this->id, $this->contact_id, "prospect");
296 296
     }
297 297
 
298
-	function set_prospect_relationship($prospect_list_id, &$link_ids, $link_name)
299
-	{
300
-		$link_field = sprintf("%s_id", $link_name);
298
+    function set_prospect_relationship($prospect_list_id, &$link_ids, $link_name)
299
+    {
300
+        $link_field = sprintf("%s_id", $link_name);
301 301
 		
302
-		foreach($link_ids as $link_id)
303
-		{
304
-			$this->set_relationship('prospect_lists_prospects', array( $link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id ));
305
-		}
306
-	}
307
-
308
-	function set_prospect_relationship_single($prospect_list_id, $link_id, $link_name)
309
-	{
310
-		$link_field = sprintf("%s_id", $link_name);
302
+        foreach($link_ids as $link_id)
303
+        {
304
+            $this->set_relationship('prospect_lists_prospects', array( $link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id ));
305
+        }
306
+    }
307
+
308
+    function set_prospect_relationship_single($prospect_list_id, $link_id, $link_name)
309
+    {
310
+        $link_field = sprintf("%s_id", $link_name);
311 311
 		
312
-		$this->set_relationship('prospect_lists_prospects', array( $link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id ));
313
-	}
312
+        $this->set_relationship('prospect_lists_prospects', array( $link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id ));
313
+    }
314 314
 
315 315
 
316
-	function clear_prospect_relationship($prospect_list_id, $link_id, $link_name)
317
-	{
318
-		$link_field = sprintf("%s_id", $link_name);
319
-		$where_clause = " AND $link_field = '$link_id' ";
316
+    function clear_prospect_relationship($prospect_list_id, $link_id, $link_name)
317
+    {
318
+        $link_field = sprintf("%s_id", $link_name);
319
+        $where_clause = " AND $link_field = '$link_id' ";
320 320
 		
321
-		$query = sprintf("DELETE FROM prospect_lists_prospects WHERE prospect_list_id='%s' AND deleted = '0' %s", $prospect_list_id, $where_clause);
321
+        $query = sprintf("DELETE FROM prospect_lists_prospects WHERE prospect_list_id='%s' AND deleted = '0' %s", $prospect_list_id, $where_clause);
322 322
 	
323
-		$this->db->query($query, true, "Error clearing prospect/prospect_list relationship: ");
324
-	}
323
+        $this->db->query($query, true, "Error clearing prospect/prospect_list relationship: ");
324
+    }
325 325
 	
326 326
 
327
-	function mark_relationships_deleted($id)
328
-	{
329
-	}
327
+    function mark_relationships_deleted($id)
328
+    {
329
+    }
330 330
 
331
-	function fill_in_additional_list_fields()
332
-	{
333
-	}
331
+    function fill_in_additional_list_fields()
332
+    {
333
+    }
334 334
 
335
-	function fill_in_additional_detail_fields()
336
-	{
337
-		parent::fill_in_additional_detail_fields();
335
+    function fill_in_additional_detail_fields()
336
+    {
337
+        parent::fill_in_additional_detail_fields();
338 338
         $this->entry_count = $this->get_entry_count();
339
-	}
339
+    }
340 340
 
341 341
 	
342
-	function update_currency_id($fromid, $toid){
343
-	}
342
+    function update_currency_id($fromid, $toid){
343
+    }
344 344
 
345 345
 
346
-	function get_entry_count()
347
-	{
348
-		$query = "SELECT count(*) AS num FROM prospect_lists_prospects WHERE prospect_list_id='$this->id' AND deleted = '0'";
349
-		$result = $this->db->query($query, true, "Grabbing prospect_list entry count");
346
+    function get_entry_count()
347
+    {
348
+        $query = "SELECT count(*) AS num FROM prospect_lists_prospects WHERE prospect_list_id='$this->id' AND deleted = '0'";
349
+        $result = $this->db->query($query, true, "Grabbing prospect_list entry count");
350 350
 		
351
-		$row = $this->db->fetchByAssoc($result);
351
+        $row = $this->db->fetchByAssoc($result);
352 352
 
353
-		if($row)
354
-			return $row['num'];
355
-		else
356
-			return 0;
357
-	}
353
+        if($row)
354
+            return $row['num'];
355
+        else
356
+            return 0;
357
+    }
358 358
 		
359 359
 		
360
-	function get_list_view_data(){
361
-		$temp_array = $this->get_list_view_array();
362
-		$temp_array["ENTRY_COUNT"] = $this->get_entry_count();		
363
-		return $temp_array;
364
-	}
365
-	/**
360
+    function get_list_view_data(){
361
+        $temp_array = $this->get_list_view_array();
362
+        $temp_array["ENTRY_COUNT"] = $this->get_entry_count();		
363
+        return $temp_array;
364
+    }
365
+    /**
366 366
 		builds a generic search based on the query string using or
367 367
 		do not include any $this-> because this is called on without having the class instantiated
368
-	*/
369
-	function build_generic_where_clause ($the_query_string) 
370
-	{
371
-		$where_clauses = Array();
372
-		$the_query_string = $GLOBALS['db']->quote($the_query_string);
373
-		array_push($where_clauses, "prospect_lists.name like '$the_query_string%'");
368
+     */
369
+    function build_generic_where_clause ($the_query_string) 
370
+    {
371
+        $where_clauses = Array();
372
+        $the_query_string = $GLOBALS['db']->quote($the_query_string);
373
+        array_push($where_clauses, "prospect_lists.name like '$the_query_string%'");
374 374
 
375
-		$the_where = "";
376
-		foreach($where_clauses as $clause)
377
-		{
378
-			if($the_where != "") $the_where .= " or ";
379
-			$the_where .= $clause;
380
-		}
375
+        $the_where = "";
376
+        foreach($where_clauses as $clause)
377
+        {
378
+            if($the_where != "") $the_where .= " or ";
379
+            $the_where .= $clause;
380
+        }
381 381
 
382 382
 
383
-		return $the_where;
384
-	}
383
+        return $the_where;
384
+    }
385 385
 
386
-	function save($check_notify = FALSE) {
386
+    function save($check_notify = FALSE) {
387 387
 
388
-		return parent::save($check_notify);
388
+        return parent::save($check_notify);
389 389
 
390
-	}
390
+    }
391 391
 
392 392
     function mark_deleted($id){
393 393
         $query = "UPDATE prospect_lists_prospects SET deleted = 1 WHERE prospect_list_id = '{$id}' ";
@@ -395,12 +395,12 @@  discard block
 block discarded – undo
395 395
         return parent::mark_deleted($id);
396 396
     }
397 397
 	
398
-	 function bean_implements($interface){
399
-		switch($interface){
400
-			case 'ACL':return true;
401
-		}
402
-		return false;
403
-	}
398
+        function bean_implements($interface){
399
+        switch($interface){
400
+            case 'ACL':return true;
401
+        }
402
+        return false;
403
+    }
404 404
 
405 405
 }
406 406
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 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.
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
         $query .= $custom_join['join'];
121 121
 
122 122
 			$where_auto = '1=1';
123
-				if($show_deleted == 0){
123
+				if ($show_deleted == 0) {
124 124
                 	$where_auto = "$this->table_name.deleted=0";
125
-				}else if($show_deleted == 1){
125
+				} else if ($show_deleted == 1) {
126 126
                 	$where_auto = "$this->table_name.deleted=1";
127 127
 				}
128 128
 
129
-		if($where != "")
129
+		if ($where != "")
130 130
 			$query .= "where $where AND ".$where_auto;
131 131
 		else
132 132
 			$query .= "where ".$where_auto;
133 133
 
134
-		if($order_by != "")
134
+		if ($order_by != "")
135 135
 			$query .= " ORDER BY $order_by";
136 136
 		else
137 137
 			$query .= " ORDER BY prospect_lists.name";
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
                                 prospect_lists.*,
148 148
                                 users.user_name as assigned_user_name ";
149 149
 	                            $query .= "FROM prospect_lists ";
150
-		$query .= 				"LEFT JOIN users
150
+		$query .= "LEFT JOIN users
151 151
                                 ON prospect_lists.assigned_user_id=users.id ";
152 152
 
153 153
 		$where_auto = " prospect_lists.deleted=0";
154 154
 
155
-        if($where != "")
155
+        if ($where != "")
156 156
                 $query .= " WHERE $where AND ".$where_auto;
157 157
         else
158 158
                 $query .= " WHERE ".$where_auto;
159 159
 
160
-        if($order_by != "")
160
+        if ($order_by != "")
161 161
                 $query .= " ORDER BY $order_by";
162 162
         else
163 163
                 $query .= " ORDER BY prospect_lists.name";
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
 	function create_export_members_query($record_id)
168 168
 	{
169
-		$members = array(	'Accounts' 	=> array('has_custom_fields' => false, 'fields' => array()), 
169
+		$members = array('Accounts' 	=> array('has_custom_fields' => false, 'fields' => array()), 
170 170
 					'Contacts' 	=> array('has_custom_fields' => false, 'fields' => array()),
171 171
 					'Users' 	=> array('has_custom_fields' => false, 'fields' => array()),
172 172
 					'Prospects' 	=> array('has_custom_fields' => false, 'fields' => array()),
@@ -175,31 +175,31 @@  discard block
 block discarded – undo
175 175
 
176 176
 		// query all custom fields in the fields_meta_data table for the modules which are being exported 
177 177
 		$db = DBManagerFactory::getInstance();
178
-		$result = $db->query("select name, custom_module from fields_meta_data where custom_module in ('" . 
179
-					implode("', '", array_keys($members)) . "')",
178
+		$result = $db->query("select name, custom_module from fields_meta_data where custom_module in ('". 
179
+					implode("', '", array_keys($members))."')",
180 180
 					true,
181 181
 					"ProspectList::create_export_members_query() : error querying custom fields");
182 182
 
183 183
 		// cycle through the custom fields and put them in the members array according to 
184 184
 		// what module the field belongs
185 185
 		// take into account that the same custom field may exist in more modules
186
-		while($val = $db->fetchByAssoc($result, false)) 
186
+		while ($val = $db->fetchByAssoc($result, false)) 
187 187
 		{
188 188
 			$fieldname = $val['name'];
189 189
 
190
-			foreach($members as $membername => &$memberarr)	
190
+			foreach ($members as $membername => &$memberarr)	
191 191
 			{
192 192
 				// if the field belongs to this module, then query it in the cstm table
193 193
 				if ($membername == $val['custom_module'])
194 194
 				{
195 195
 					$memberarr['has_custom_fields'] = true;
196 196
 					$memberarr['fields'][$fieldname] = 
197
-						strtolower($membername) . '_cstm.'.$fieldname . ' AS ' . $fieldname;
197
+						strtolower($membername).'_cstm.'.$fieldname.' AS '.$fieldname;
198 198
 				}
199 199
 				// else, only if for this module no entry exists for this field, query an empty string
200 200
 				else if (!isset($memberarr['fields'][$val['name']]))
201 201
 				{
202
-					$memberarr['fields'][$fieldname] = "'' AS " . $fieldname;
202
+					$memberarr['fields'][$fieldname] = "'' AS ".$fieldname;
203 203
 				}
204 204
 			}
205 205
 		}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 				l.account_name AS account_name,
210 210
 				ea.email_address AS primary_email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
211 211
 				l.do_not_call AS do_not_call, l.phone_fax AS phone_fax, l.phone_other AS phone_other, l.phone_home AS phone_home, l.phone_mobile AS phone_mobile, l.phone_work AS phone_work
212
-				".(count($members['Leads']['fields']) ? ', ' : '') . implode(', ', $members['Leads']['fields'])."
212
+				".(count($members['Leads']['fields']) ? ', ' : '').implode(', ', $members['Leads']['fields'])."
213 213
 				FROM prospect_lists_prospects plp
214 214
 				INNER JOIN leads l ON plp.related_id=l.id
215 215
 				".($members['Leads']['has_custom_fields'] ? 'LEFT join leads_cstm ON l.id = leads_cstm.id_c' : '')."
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				'' AS account_name,
225 225
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
226 226
 				0 AS do_not_call, u.phone_fax AS phone_fax, u.phone_other AS phone_other, u.phone_home AS phone_home, u.phone_mobile AS phone_mobile, u.phone_work AS phone_work
227
-				".(count($members['Users']['fields']) ? ', ' : '') . implode(', ', $members['Users']['fields'])."
227
+				".(count($members['Users']['fields']) ? ', ' : '').implode(', ', $members['Users']['fields'])."
228 228
 				FROM prospect_lists_prospects plp
229 229
 				INNER JOIN users u ON plp.related_id=u.id
230 230
 				".($members['Users']['has_custom_fields'] ? 'LEFT join users_cstm ON u.id = users_cstm.id_c' : '')."
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 				a.name AS account_name,
240 240
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
241 241
 				c.do_not_call AS do_not_call, c.phone_fax AS phone_fax, c.phone_other AS phone_other, c.phone_home AS phone_home, c.phone_mobile AS phone_mobile, c.phone_work AS phone_work
242
-				".(count($members['Contacts']['fields']) ? ', ' : '') . implode(', ', $members['Contacts']['fields'])."
242
+				".(count($members['Contacts']['fields']) ? ', ' : '').implode(', ', $members['Contacts']['fields'])."
243 243
 FROM prospect_lists_prospects plp
244 244
 				INNER JOIN contacts c ON plp.related_id=c.id LEFT JOIN accounts_contacts ac ON ac.contact_id=c.id LEFT JOIN accounts a ON ac.account_id=a.id
245 245
 				".($members['Contacts']['has_custom_fields'] ? 'LEFT join contacts_cstm ON c.id = contacts_cstm.id_c' : '')."
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				p.account_name AS account_name,
256 256
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
257 257
 				p.do_not_call AS do_not_call, p.phone_fax AS phone_fax, p.phone_other AS phone_other, p.phone_home AS phone_home, p.phone_mobile AS phone_mobile, p.phone_work AS phone_work
258
-				".(count($members['Prospects']['fields']) ? ', ' : '') . implode(', ', $members['Prospects']['fields'])."
258
+				".(count($members['Prospects']['fields']) ? ', ' : '').implode(', ', $members['Prospects']['fields'])."
259 259
 				FROM prospect_lists_prospects plp
260 260
 				INNER JOIN prospects p ON plp.related_id=p.id
261 261
 				".($members['Prospects']['has_custom_fields'] ? 'LEFT join prospects_cstm ON p.id = prospects_cstm.id_c' : '')."
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				'' AS account_name,
271 271
 				ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
272 272
 				0 AS do_not_call, a.phone_fax as phone_fax, a.phone_alternate AS phone_other, '' AS phone_home, '' AS phone_mobile, a.phone_office AS phone_office
273
-				".(count($members['Accounts']['fields']) ? ', ' : '') . implode(', ', $members['Accounts']['fields'])."
273
+				".(count($members['Accounts']['fields']) ? ', ' : '').implode(', ', $members['Accounts']['fields'])."
274 274
 				FROM prospect_lists_prospects plp
275 275
 				INNER JOIN accounts a ON plp.related_id=a.id
276 276
 				".($members['Accounts']['has_custom_fields'] ? 'LEFT join accounts_cstm ON a.id = accounts_cstm.id_c' : '')."
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
 	function save_relationship_changes($is_update, $exclude = array())
288 288
     {
289 289
     	parent::save_relationship_changes($is_update, $exclude);
290
-		if($this->lead_id != "")
290
+		if ($this->lead_id != "")
291 291
 	   		$this->set_prospect_relationship($this->id, $this->lead_id, "lead");
292
-    	if($this->contact_id != "")
292
+    	if ($this->contact_id != "")
293 293
     		$this->set_prospect_relationship($this->id, $this->contact_id, "contact");
294
-    	if($this->prospect_id != "")
294
+    	if ($this->prospect_id != "")
295 295
     		$this->set_prospect_relationship($this->id, $this->contact_id, "prospect");
296 296
     }
297 297
 
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 	{
300 300
 		$link_field = sprintf("%s_id", $link_name);
301 301
 		
302
-		foreach($link_ids as $link_id)
302
+		foreach ($link_ids as $link_id)
303 303
 		{
304
-			$this->set_relationship('prospect_lists_prospects', array( $link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id ));
304
+			$this->set_relationship('prospect_lists_prospects', array($link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id));
305 305
 		}
306 306
 	}
307 307
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	{
310 310
 		$link_field = sprintf("%s_id", $link_name);
311 311
 		
312
-		$this->set_relationship('prospect_lists_prospects', array( $link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id ));
312
+		$this->set_relationship('prospect_lists_prospects', array($link_field=>$link_id, 'prospect_list_id'=>$prospect_list_id));
313 313
 	}
314 314
 
315 315
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	}
340 340
 
341 341
 	
342
-	function update_currency_id($fromid, $toid){
342
+	function update_currency_id($fromid, $toid) {
343 343
 	}
344 344
 
345 345
 
@@ -350,14 +350,14 @@  discard block
 block discarded – undo
350 350
 		
351 351
 		$row = $this->db->fetchByAssoc($result);
352 352
 
353
-		if($row)
353
+		if ($row)
354 354
 			return $row['num'];
355 355
 		else
356 356
 			return 0;
357 357
 	}
358 358
 		
359 359
 		
360
-	function get_list_view_data(){
360
+	function get_list_view_data() {
361 361
 		$temp_array = $this->get_list_view_array();
362 362
 		$temp_array["ENTRY_COUNT"] = $this->get_entry_count();		
363 363
 		return $temp_array;
@@ -366,16 +366,16 @@  discard block
 block discarded – undo
366 366
 		builds a generic search based on the query string using or
367 367
 		do not include any $this-> because this is called on without having the class instantiated
368 368
 	*/
369
-	function build_generic_where_clause ($the_query_string) 
369
+	function build_generic_where_clause($the_query_string) 
370 370
 	{
371 371
 		$where_clauses = Array();
372 372
 		$the_query_string = $GLOBALS['db']->quote($the_query_string);
373 373
 		array_push($where_clauses, "prospect_lists.name like '$the_query_string%'");
374 374
 
375 375
 		$the_where = "";
376
-		foreach($where_clauses as $clause)
376
+		foreach ($where_clauses as $clause)
377 377
 		{
378
-			if($the_where != "") $the_where .= " or ";
378
+			if ($the_where != "") $the_where .= " or ";
379 379
 			$the_where .= $clause;
380 380
 		}
381 381
 
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
 
390 390
 	}
391 391
 
392
-    function mark_deleted($id){
392
+    function mark_deleted($id) {
393 393
         $query = "UPDATE prospect_lists_prospects SET deleted = 1 WHERE prospect_list_id = '{$id}' ";
394 394
         $this->db->query($query);
395 395
         return parent::mark_deleted($id);
396 396
     }
397 397
 	
398
-	 function bean_implements($interface){
399
-		switch($interface){
398
+	 function bean_implements($interface) {
399
+		switch ($interface) {
400 400
 			case 'ACL':return true;
401 401
 		}
402 402
 		return false;
Please login to merge, or discard this patch.
Braces   +42 added lines, -30 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.
@@ -122,19 +124,21 @@  discard block
 block discarded – undo
122 124
 			$where_auto = '1=1';
123 125
 				if($show_deleted == 0){
124 126
                 	$where_auto = "$this->table_name.deleted=0";
125
-				}else if($show_deleted == 1){
127
+				} else if($show_deleted == 1){
126 128
                 	$where_auto = "$this->table_name.deleted=1";
127 129
 				}
128 130
 
129
-		if($where != "")
130
-			$query .= "where $where AND ".$where_auto;
131
-		else
132
-			$query .= "where ".$where_auto;
131
+		if($where != "") {
132
+					$query .= "where $where AND ".$where_auto;
133
+		} else {
134
+					$query .= "where ".$where_auto;
135
+		}
133 136
 
134
-		if($order_by != "")
135
-			$query .= " ORDER BY $order_by";
136
-		else
137
-			$query .= " ORDER BY prospect_lists.name";
137
+		if($order_by != "") {
138
+					$query .= " ORDER BY $order_by";
139
+		} else {
140
+					$query .= " ORDER BY prospect_lists.name";
141
+		}
138 142
 
139 143
 		return $query;
140 144
 	}
@@ -152,15 +156,17 @@  discard block
 block discarded – undo
152 156
 
153 157
 		$where_auto = " prospect_lists.deleted=0";
154 158
 
155
-        if($where != "")
156
-                $query .= " WHERE $where AND ".$where_auto;
157
-        else
158
-                $query .= " WHERE ".$where_auto;
159
-
160
-        if($order_by != "")
161
-                $query .= " ORDER BY $order_by";
162
-        else
163
-                $query .= " ORDER BY prospect_lists.name";
159
+        if($where != "") {
160
+                        $query .= " WHERE $where AND ".$where_auto;
161
+        } else {
162
+                        $query .= " WHERE ".$where_auto;
163
+        }
164
+
165
+        if($order_by != "") {
166
+                        $query .= " ORDER BY $order_by";
167
+        } else {
168
+                        $query .= " ORDER BY prospect_lists.name";
169
+        }
164 170
         return $query;
165 171
     }
166 172
 
@@ -287,12 +293,15 @@  discard block
 block discarded – undo
287 293
 	function save_relationship_changes($is_update, $exclude = array())
288 294
     {
289 295
     	parent::save_relationship_changes($is_update, $exclude);
290
-		if($this->lead_id != "")
291
-	   		$this->set_prospect_relationship($this->id, $this->lead_id, "lead");
292
-    	if($this->contact_id != "")
293
-    		$this->set_prospect_relationship($this->id, $this->contact_id, "contact");
294
-    	if($this->prospect_id != "")
295
-    		$this->set_prospect_relationship($this->id, $this->contact_id, "prospect");
296
+		if($this->lead_id != "") {
297
+			   		$this->set_prospect_relationship($this->id, $this->lead_id, "lead");
298
+		}
299
+    	if($this->contact_id != "") {
300
+    	    		$this->set_prospect_relationship($this->id, $this->contact_id, "contact");
301
+    	}
302
+    	if($this->prospect_id != "") {
303
+    	    		$this->set_prospect_relationship($this->id, $this->contact_id, "prospect");
304
+    	}
296 305
     }
297 306
 
298 307
 	function set_prospect_relationship($prospect_list_id, &$link_ids, $link_name)
@@ -350,10 +359,11 @@  discard block
 block discarded – undo
350 359
 		
351 360
 		$row = $this->db->fetchByAssoc($result);
352 361
 
353
-		if($row)
354
-			return $row['num'];
355
-		else
356
-			return 0;
362
+		if($row) {
363
+					return $row['num'];
364
+		} else {
365
+					return 0;
366
+		}
357 367
 	}
358 368
 		
359 369
 		
@@ -375,7 +385,9 @@  discard block
 block discarded – undo
375 385
 		$the_where = "";
376 386
 		foreach($where_clauses as $clause)
377 387
 		{
378
-			if($the_where != "") $the_where .= " or ";
388
+			if($the_where != "") {
389
+			    $the_where .= " or ";
390
+			}
379 391
 			$the_where .= $clause;
380 392
 		}
381 393
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -295,6 +295,10 @@
 block discarded – undo
295 295
     		$this->set_prospect_relationship($this->id, $this->contact_id, "prospect");
296 296
     }
297 297
 
298
+	/**
299
+	 * @param string $prospect_list_id
300
+	 * @param string $link_name
301
+	 */
298 302
 	function set_prospect_relationship($prospect_list_id, &$link_ids, $link_name)
299 303
 	{
300 304
 		$link_field = sprintf("%s_id", $link_name);
Please login to merge, or discard this patch.