Test Failed
Push — CI ( 0f01dd...c95a04 )
by Adam
55:13
created
modules/Prospects/metadata/searchdefs.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                        ),
47 47
                 'layout' => array(
48 48
   					'basic_search' => array(
49
- 							array('name'=>'search_name','label' =>'LBL_NAME', 'type' => 'name'),
49
+ 							array('name'=>'search_name', 'label' =>'LBL_NAME', 'type' => 'name'),
50 50
                            array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
51 51
                            
52 52
 						),
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 							array('name' => 'address_street', 'label'=>'LBL_ANY_ADDRESS', 'type' => 'name'),
61 61
 							array('name' => 'address_state', 'label' =>'LBL_STATE', 'type' => 'name'),
62 62
 							array('name' => 'address_postalcode', 'label' =>'LBL_POSTAL_CODE', 'type' => 'name'),
63
-							array('name' => 'primary_address_country', 'label' =>'LBL_COUNTRY', 'type' => 'name', 'options' => 'countries_dom', ), 
63
+							array('name' => 'primary_address_country', 'label' =>'LBL_COUNTRY', 'type' => 'name', 'options' => 'countries_dom',), 
64 64
 							array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
65 65
 							
66 66
 					),
Please login to merge, or discard this patch.
modules/Prospects/metadata/SearchFields.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
  ********************************************************************************/
40 40
 
41 41
 $searchFields['Prospects'] = 
42
-	array (
43
-		'first_name' => array( 'query_type'=>'default'),
42
+	array(
43
+		'first_name' => array('query_type'=>'default'),
44 44
 		'last_name'=> array('query_type'=>'default'),
45
-		'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true),
45
+		'search_name'=> array('query_type'=>'default', 'db_field'=>array('first_name', 'last_name'), 'force_unifiedsearch'=>true),
46 46
 		'do_not_call'=> array('query_type'=>'default', 'operator'=>'='),
47
-		'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','phone_home')),
47
+		'phone'=> array('query_type'=>'default', 'db_field'=>array('phone_mobile', 'phone_work', 'phone_other', 'phone_fax', 'phone_home')),
48 48
 		'email'=> array(
49 49
 			'query_type' => 'default',
50 50
 			'operator' => 'subquery',
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 			),
55 55
 		),
56 56
 		'assistant'=> array('query_type'=>'default'),
57
-		'address_street'=> array('query_type'=>'default','db_field'=>array('primary_address_street','alt_address_street')),
58
-		'address_city'=> array('query_type'=>'default','db_field'=>array('primary_address_city','alt_address_city')),
59
-		'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')),
60
-		'address_postalcode'=> array('query_type'=>'default','db_field'=>array('primary_address_postalcode','alt_address_postalcode')),
61
-		'address_country'=> array('query_type'=>'default','db_field'=>array('primary_address_country','alt_address_country')),
62
-		'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
57
+		'address_street'=> array('query_type'=>'default', 'db_field'=>array('primary_address_street', 'alt_address_street')),
58
+		'address_city'=> array('query_type'=>'default', 'db_field'=>array('primary_address_city', 'alt_address_city')),
59
+		'address_state'=> array('query_type'=>'default', 'db_field'=>array('primary_address_state', 'alt_address_state')),
60
+		'address_postalcode'=> array('query_type'=>'default', 'db_field'=>array('primary_address_postalcode', 'alt_address_postalcode')),
61
+		'address_country'=> array('query_type'=>'default', 'db_field'=>array('primary_address_country', 'alt_address_country')),
62
+		'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
63 63
 		'assigned_user_id'=> array('query_type'=>'default'),
64 64
 	   //Range Search Support 
65
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
-	   'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
67
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
69
-	   'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
65
+	   'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
66
+	   'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
67
+	   'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
+	   'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
69
+	   'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
+       'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
71 71
 	   //Range Search Support
72 72
 	);
73 73
 ?>
Please login to merge, or discard this patch.
modules/Prospects/metadata/detailviewdefs.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
  ********************************************************************************/
39 39
 
40 40
 $viewdefs ['Prospects'] = 
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',
53 53
           3 => 
54
-          array (
54
+          array(
55 55
             'customCode' => '<input title="{$MOD.LBL_CONVERT_BUTTON_TITLE}" class="button" onclick="this.form.return_module.value=\'Prospects\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$fields.id.value}\';this.form.module.value=\'Leads\';this.form.action.value=\'EditView\';" type="submit" name="CONVERT_LEAD_BTN" value="{$MOD.LBL_CONVERT_BUTTON_LABEL}"/>',
56 56
             'sugar_html' => 
57
-            array (
57
+            array(
58 58
               'type' => 'submit',
59 59
               'value' => '{$MOD.LBL_CONVERT_BUTTON_LABEL}',
60 60
               'htmlOptions' => 
61
-              array (
61
+              array(
62 62
                 'class' => 'button',
63 63
                 'name' => 'CONVERT_LEAD_BTN',
64 64
                 'id' => 'convert_target_button',
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
             ),
69 69
           ),
70 70
           4 => 
71
-          array (
71
+          array(
72 72
             'customCode' => '<input title="{$APP.LBL_MANAGE_SUBSCRIPTIONS}" class="button" onclick="this.form.return_module.value=\'Prospects\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$fields.id.value}\'; this.form.action.value=\'Subscriptions\'; this.form.module.value=\'Campaigns\';" type="submit" name="Manage Subscriptions" value="{$APP.LBL_MANAGE_SUBSCRIPTIONS}"/>',
73 73
             'sugar_html' => 
74
-            array (
74
+            array(
75 75
               'type' => 'submit',
76 76
               'value' => '{$APP.LBL_MANAGE_SUBSCRIPTIONS}',
77 77
               'htmlOptions' => 
78
-              array (
78
+              array(
79 79
                 'class' => 'button',
80 80
                 'id' => 'manage_subscriptions_button',
81 81
                 'name' => 'Manage Subscriptions',
@@ -86,134 +86,134 @@  discard block
 block discarded – undo
86 86
           ),
87 87
         ),
88 88
         'hidden' => 
89
-        array (
89
+        array(
90 90
           0 => '<input type="hidden" name="prospect_id" value="{$fields.id.value}">',
91 91
         ),
92 92
         'headerTpl' => 'modules/Prospects/tpls/DetailViewHeader.tpl',
93 93
       ),
94 94
       'maxColumns' => '2',
95 95
       'widths' => 
96
-      array (
96
+      array(
97 97
         0 => 
98
-        array (
98
+        array(
99 99
           'label' => '10',
100 100
           'field' => '30',
101 101
         ),
102 102
         1 => 
103
-        array (
103
+        array(
104 104
           'label' => '10',
105 105
           'field' => '30',
106 106
         ),
107 107
       ),
108 108
       'useTabs' => true,
109 109
       'tabDefs' => 
110
-      array (
110
+      array(
111 111
         'LBL_PROSPECT_INFORMATION' => 
112
-        array (
112
+        array(
113 113
           'newTab' => true,
114 114
           'panelDefault' => 'expanded',
115 115
         ),
116 116
         'LBL_MORE_INFORMATION' => 
117
-        array (
117
+        array(
118 118
           'newTab' => true,
119 119
           'panelDefault' => 'expanded',
120 120
         ),
121 121
         'LBL_PANEL_ASSIGNMENT' => 
122
-        array (
122
+        array(
123 123
           'newTab' => true,
124 124
           'panelDefault' => 'expanded',
125 125
         ),
126 126
       ),
127 127
     ),
128 128
     'panels' => 
129
-    array (
129
+    array(
130 130
       'lbl_prospect_information' => 
131
-      array (
131
+      array(
132 132
         0 => 
133
-        array (
133
+        array(
134 134
           0 => 
135
-          array (
135
+          array(
136 136
             'name' => 'full_name',
137 137
           ),
138 138
         ),
139 139
         1 => 
140
-        array (
140
+        array(
141 141
           0 => 'title',
142 142
           1 => 
143
-          array (
143
+          array(
144 144
             'name' => 'phone_work',
145 145
             'label' => 'LBL_OFFICE_PHONE',
146 146
           ),
147 147
         ),
148 148
         2 => 
149
-        array (
149
+        array(
150 150
           0 => 'department',
151 151
           1 => 'phone_mobile',
152 152
         ),
153 153
         3 => 
154
-        array (
154
+        array(
155 155
           0 => 
156
-          array (
156
+          array(
157 157
             'name' => 'account_name',
158 158
           ),
159 159
           1 => 'phone_fax',
160 160
         ),
161 161
         4 => 
162
-        array (
162
+        array(
163 163
           0 => 
164
-          array (
164
+          array(
165 165
             'name' => 'primary_address_street',
166 166
             'label' => 'LBL_PRIMARY_ADDRESS',
167 167
             'type' => 'address',
168 168
             'displayParams' => 
169
-            array (
169
+            array(
170 170
               'key' => 'primary',
171 171
             ),
172 172
           ),
173 173
           1 => 
174
-          array (
174
+          array(
175 175
             'name' => 'alt_address_street',
176 176
             'label' => 'LBL_ALTERNATE_ADDRESS',
177 177
             'type' => 'address',
178 178
             'displayParams' => 
179
-            array (
179
+            array(
180 180
               'key' => 'alt',
181 181
             ),
182 182
           ),
183 183
         ),
184 184
         5 => 
185
-        array (
185
+        array(
186 186
           0 => 'email1',
187 187
         ),
188 188
         6 => 
189
-        array (
189
+        array(
190 190
           0 => 'description',
191 191
         ),
192 192
         7 => 
193
-        array (
193
+        array(
194 194
           0 => 'assigned_user_name',
195 195
         ),
196 196
       ),
197 197
       'LBL_MORE_INFORMATION' => 
198
-      array (
198
+      array(
199 199
         0 => 
200
-        array (
200
+        array(
201 201
           0 => 'email_opt_out',
202 202
           1 => 'do_not_call',
203 203
         ),
204 204
       ),
205 205
       'LBL_PANEL_ASSIGNMENT' => 
206
-      array (
206
+      array(
207 207
         0 => 
208
-        array (
208
+        array(
209 209
           0 => 
210
-          array (
210
+          array(
211 211
             'name' => 'modified_by_name',
212 212
             'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}&nbsp;',
213 213
             'label' => 'LBL_DATE_MODIFIED',
214 214
           ),
215 215
           1 =>
216
-          array (
216
+          array(
217 217
             'name' => 'created_by_name',
218 218
             'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}&nbsp;',
219 219
             'label' => 'LBL_DATE_ENTERED',
Please login to merge, or discard this patch.
modules/Prospects/metadata/quickcreatedefs.php 1 patch
Spacing   +34 added lines, -34 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,116 +45,116 @@  discard block
 block discarded – undo
45 45
  * Contributor(s): ______________________________________..
46 46
  ********************************************************************************/
47 47
 
48
-$viewdefs = array (
48
+$viewdefs = array(
49 49
   'Prospects' => 
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
           ),
68 68
         ),
69 69
       ),
70 70
       'panels' => 
71
-      array (
71
+      array(
72 72
         'LBL_PROSPECT_INFORMATION' => 
73
-        array (
73
+        array(
74 74
           0 => 
75
-          array (
75
+          array(
76 76
             0 => 
77
-            array (
77
+            array(
78 78
               'name' => 'first_name',
79 79
             ),
80 80
             1 => 
81
-            array (
81
+            array(
82 82
               'name' => 'phone_work',
83 83
             ),
84 84
           ),
85 85
           1 => 
86
-          array (
86
+          array(
87 87
             0 => 
88
-            array (
88
+            array(
89 89
               'name' => 'last_name',
90 90
               'displayParams'=>array('required'=>true)
91 91
             ),
92 92
             1 => 
93
-            array (
93
+            array(
94 94
               'name' => 'phone_mobile',
95 95
             ),
96 96
           ),
97 97
           2 => 
98
-          array (
98
+          array(
99 99
             0 => 
100
-            array (
100
+            array(
101 101
               'name' => 'account_name',
102 102
             ),
103 103
             1 => 
104
-            array (
104
+            array(
105 105
               'name' => 'phone_fax',
106 106
             ),
107 107
           ),
108 108
           3 => 
109
-          array (
109
+          array(
110 110
             0 => 
111
-            array (
111
+            array(
112 112
               'name' => 'title',
113 113
             ),
114 114
             1 => 
115
-            array (
115
+            array(
116 116
               'name' => 'department',
117 117
             ),
118 118
           ),
119 119
           4 => 
120
-          array (
120
+          array(
121 121
             0 => 
122
-            array (
122
+            array(
123 123
               'name' => 'team_name',
124 124
             ),
125 125
             1 => 
126
-            array (
126
+            array(
127 127
               'name' => 'do_not_call',
128 128
             ),
129 129
           ),
130 130
           5 => 
131
-          array (
131
+          array(
132 132
             0 => 
133
-            array (
133
+            array(
134 134
               'name' => 'assigned_user_name',
135 135
             ),
136 136
           ),
137 137
         ),
138 138
         'lbl_email_addresses' => 
139
-        array (
139
+        array(
140 140
           0 => 
141
-          array (
141
+          array(
142 142
             0 => 
143
-            array (
143
+            array(
144 144
               'name' => 'email1',
145 145
             ),
146 146
           ),
147 147
         ),
148 148
         'LBL_ADDRESS_INFORMATION' => 
149
-        array (
149
+        array(
150 150
           0 => 
151
-          array (
151
+          array(
152 152
             0 => 
153
-            array (
153
+            array(
154 154
               'name' => 'primary_address_street',
155 155
             ),
156 156
             1 => 
157
-            array (
157
+            array(
158 158
               'name' => 'alt_address_street',
159 159
             ),
160 160
           ),
Please login to merge, or discard this patch.
modules/Reminders/vardefs.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
38 38
  ********************************************************************************/
39 39
 
40
-$dictionary['Reminder']['table']= 'reminders';
41
-$dictionary['Reminder']['audited']= false;
42
-$dictionary['Reminder']['fields']= array(
40
+$dictionary['Reminder']['table'] = 'reminders';
41
+$dictionary['Reminder']['audited'] = false;
42
+$dictionary['Reminder']['fields'] = array(
43 43
     'popup' => array(
44 44
         'name' => 'popup',
45 45
         'vname' => 'LBL_POPUP',
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 );
103 103
 
104 104
 
105
-if (!class_exists('VardefManager')){
105
+if (!class_exists('VardefManager')) {
106 106
     require_once('include/SugarObjects/VardefManager.php');
107 107
 }
108
-VardefManager::createVardef('Reminders','Reminder', array('basic','assignable'));
108
+VardefManager::createVardef('Reminders', 'Reminder', array('basic', 'assignable'));
109 109
 
110 110
 ?>
111 111
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Reminders/Reminder.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
         parent::Basic();
70 70
     }
71 71
 
72
-    public function bean_implements($interface){
73
-        switch($interface){
72
+    public function bean_implements($interface) {
73
+        switch ($interface) {
74 74
             case 'ACL': return true;
75 75
         }
76 76
         return false;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
     public static function saveRemindersDataJson($eventModule, $eventModuleId, $remindersDataJson) {
91 91
         $reminderData = json_decode($remindersDataJson);
92
-        if(!json_last_error()) {
92
+        if (!json_last_error()) {
93 93
             Reminder::saveRemindersData($eventModule, $eventModuleId, $reminderData);
94 94
         }
95 95
         else {
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	
100 100
     private static function saveRemindersData($eventModule, $eventModuleId, $remindersData) {
101 101
         $savedReminderIds = array();
102
-        foreach($remindersData as $reminderData) {
103
-			if(isset($_POST['isDuplicate']) && $_POST['isDuplicate']) $reminderData->id = '';
102
+        foreach ($remindersData as $reminderData) {
103
+			if (isset($_POST['isDuplicate']) && $_POST['isDuplicate']) $reminderData->id = '';
104 104
             $reminderBean = BeanFactory::getBean('Reminders', $reminderData->id);
105 105
             $reminderBean->popup = $reminderData->popup;
106 106
             $reminderBean->email = $reminderData->email;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             Reminder_Invitee::saveRemindersInviteesData($reminderId, $reminderData->invitees);
115 115
         }
116 116
         $reminders = BeanFactory::getBean('Reminders')->get_full_list("", "reminders.related_event_module = '$eventModule' AND reminders.related_event_module_id = '$eventModuleId'");
117
-        if($reminders) {
117
+        if ($reminders) {
118 118
             foreach ($reminders as $reminder) {
119 119
                 if (!in_array($reminder->id, $savedReminderIds)) {
120 120
                     Reminder_Invitee::deleteRemindersInviteesMultiple($reminder->id);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public static function loadRemindersDataJson($eventModule, $eventModuleId, $isDuplicate = false) {
139 139
         $remindersData = self::loadRemindersData($eventModule, $eventModuleId, $isDuplicate);
140 140
         $remindersDataJson = json_encode($remindersData);
141
-        if(!$remindersDataJson && json_last_error()) {
141
+        if (!$remindersDataJson && json_last_error()) {
142 142
             throw new Exception(json_last_error_msg());
143 143
         }
144 144
         return $remindersDataJson;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @throws Exception
155 155
 	 */
156 156
 	public static function loadRemindersData($eventModule, $eventModuleId, $isDuplicate = false) {
157
-		if(!isset(self::$remindersData[$eventModule][$eventModuleId]) || !$eventModuleId || $isDuplicate) {
157
+		if (!isset(self::$remindersData[$eventModule][$eventModuleId]) || !$eventModuleId || $isDuplicate) {
158 158
 			$ret = array();
159 159
 			$reminders = BeanFactory::getBean('Reminders')->get_full_list("reminders.date_entered", "reminders.related_event_module = '$eventModule' AND reminders.related_event_module_id = '$eventModuleId'");
160 160
 			if ($reminders) {
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 * @param boolean $checkDecline (optional) Send email if user accept status is not decline. Default is TRUE.
186 186
 	 */
187 187
 	public static function sendEmailReminders(EmailReminder $emailReminder, Administration $admin, $checkDecline = true) {
188
-        if($reminders = self::getUnsentEmailReminders()) {
189
-            foreach($reminders as $reminderId => $reminder) {
188
+        if ($reminders = self::getUnsentEmailReminders()) {
189
+            foreach ($reminders as $reminderId => $reminder) {
190 190
 				$recipients = self::getEmailReminderInviteesRecipients($reminderId, $checkDecline);
191 191
 				$eventBean = BeanFactory::getBean($reminder->related_event_module, $reminder->related_event_module_id);
192
-				if ( $emailReminder->sendReminders($eventBean, $admin, $recipients) ) {
192
+				if ($emailReminder->sendReminders($eventBean, $admin, $recipients)) {
193 193
 					$reminder->email_sent = 1;
194 194
 					$reminder->save();
195 195
 				}
@@ -203,15 +203,15 @@  discard block
 block discarded – undo
203 203
 		$eventModule = $reminder->related_event_module;
204 204
 		$eventModuleId = $reminder->related_event_module_id;		
205 205
 		$event = BeanFactory::getBean($eventModule, $eventModuleId);
206
-		if(!isset($event->status) || $event->status != 'Held') {
206
+		if (!isset($event->status) || $event->status != 'Held') {
207 207
 			$invitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list('', "reminders_invitees.reminder_id = '$reminderId'");
208
-			foreach($invitees as $invitee) {
208
+			foreach ($invitees as $invitee) {
209 209
 				$inviteeModule = $invitee->related_invitee_module;
210 210
 				$inviteeModuleId = $invitee->related_invitee_module_id;
211 211
 				$personBean = BeanFactory::getBean($inviteeModule, $inviteeModuleId);
212 212
 				// The original email reminders check the accept_status field in related users/leads/contacts etc. and filtered these users who not decline this event.
213
-				if($checkDecline && !self::isDecline($event, $personBean)) {
214
-					if ( !empty($personBean->email1) ) {
213
+				if ($checkDecline && !self::isDecline($event, $personBean)) {
214
+					if (!empty($personBean->email1)) {
215 215
 						$arr = array(
216 216
 							'type' => $inviteeModule,
217 217
 							'name' => $personBean->full_name,
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
         global $db;
230 230
 		$reminders = array();
231 231
 		$reminderBeans = BeanFactory::getBean('Reminders')->get_full_list('', "reminders.email = 1 AND reminders.email_sent = 0");
232
-		foreach($reminderBeans as $reminderBean) {
232
+		foreach ($reminderBeans as $reminderBean) {
233 233
 			$eventBean = BeanFactory::getBean($reminderBean->related_event_module, $reminderBean->related_event_module_id);
234 234
 			$dateStart = $eventBean->date_start;
235
-			$time = strtotime($db->fromConvert($dateStart,'datetime'));
235
+			$time = strtotime($db->fromConvert($dateStart, 'datetime'));
236 236
 			$dateStart = date(TimeDate::DB_DATETIME_FORMAT, $time);
237
-			$remind_ts = $GLOBALS['timedate']->fromDb($db->fromConvert($dateStart,'datetime'))->modify("-{$reminderBean->timer_email} seconds")->ts;
237
+			$remind_ts = $GLOBALS['timedate']->fromDb($db->fromConvert($dateStart, 'datetime'))->modify("-{$reminderBean->timer_email} seconds")->ts;
238 238
             $now_ts = $GLOBALS['timedate']->getNow()->ts;
239
-            if ( $now_ts >= $remind_ts ) {
239
+            if ($now_ts >= $remind_ts) {
240 240
                 $reminders[$reminderBean->id] = $reminderBean;
241 241
             }
242 242
 		}
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 		///////////////////////////////////////////////////////////////////////
282 282
 		////	MEETING INTEGRATION
283 283
 		$meetingIntegration = null;
284
-		if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) {
285
-			if(!class_exists($sugar_config['meeting_integration'])) {
284
+		if (isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) {
285
+			if (!class_exists($sugar_config['meeting_integration'])) {
286 286
 				require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php");
287 287
 			}
288 288
 			$meetingIntegration = new $sugar_config['meeting_integration']();
@@ -292,31 +292,31 @@  discard block
 block discarded – undo
292 292
 		
293 293
 		$popupReminders = BeanFactory::getBean('Reminders')->get_full_list('', "reminders.popup = 1");
294 294
 
295
-		if($popupReminders) {
296
-			foreach($popupReminders as $popupReminder) {
295
+		if ($popupReminders) {
296
+			foreach ($popupReminders as $popupReminder) {
297 297
 				$relatedEvent = BeanFactory::getBean($popupReminder->related_event_module, $popupReminder->related_event_module_id);
298
-				if( $relatedEvent &&
298
+				if ($relatedEvent &&
299 299
 					(!isset($relatedEvent->status) || $relatedEvent->status == 'Planned') &&
300
-					(!isset($relatedEvent->date_start) || (strtotime($relatedEvent->date_start) >= strtotime(self::unQuoteTime($dateTimeNow)) && strtotime($relatedEvent->date_start) <= strtotime(self::unQuoteTime($dateTimeMax))) ) &&
300
+					(!isset($relatedEvent->date_start) || (strtotime($relatedEvent->date_start) >= strtotime(self::unQuoteTime($dateTimeNow)) && strtotime($relatedEvent->date_start) <= strtotime(self::unQuoteTime($dateTimeMax)))) &&
301 301
 					(!$checkDecline || ($checkDecline && !self::isDecline($relatedEvent, BeanFactory::getBean('Users', $current_user->id))))
302 302
 				) {
303 303
 					// The original popup/alert reminders check the accept_status field in related users/leads/contacts etc. and filtered these users who not decline this event.
304 304
 					$invitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list('', "reminders_invitees.reminder_id = '{$popupReminder->id}' AND reminders_invitees.related_invitee_module_id = '{$current_user->id}'");
305
-					if($invitees) {
306
-						foreach($invitees as $invitee) {
305
+					if ($invitees) {
306
+						foreach ($invitees as $invitee) {
307 307
 							// need to concatenate since GMT times can bridge two local days
308 308
 							$timeStart = strtotime($db->fromConvert(isset($relatedEvent->date_start) ? $relatedEvent->date_start : date(TimeDate::DB_DATETIME_FORMAT), 'datetime'));
309 309
 							$timeRemind = $popupReminder->timer_popup;
310 310
 							$timeStart -= $timeRemind;
311 311
 
312
-							$url = 'index.php?action=DetailView&module=' . $popupReminder->related_event_module . '&record=' . $popupReminder->related_event_module_id;
312
+							$url = 'index.php?action=DetailView&module='.$popupReminder->related_event_module.'&record='.$popupReminder->related_event_module_id;
313 313
 							$instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG'];
314 314
 
315
-							if($popupReminder->related_event_module == 'Meetings') {
315
+							if ($popupReminder->related_event_module == 'Meetings') {
316 316
 								///////////////////////////////////////////////////////////////////
317 317
 								////	MEETING INTEGRATION
318
-								if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($popupReminder->related_event_module_id)) {
319
-									$url = $meetingIntegration->miUrlGetJsAlert((array) $popupReminder);
318
+								if (!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($popupReminder->related_event_module_id)) {
319
+									$url = $meetingIntegration->miUrlGetJsAlert((array)$popupReminder);
320 320
 									$instructions = $meetingIntegration->miGetJsAlertInstructions();
321 321
 								}
322 322
 								////	END MEETING INTEGRATION
@@ -330,16 +330,16 @@  discard block
 block discarded – undo
330 330
 							$relatedToMeeting = $alert->getRelatedName($popupReminder->related_event_module, $popupReminder->related_event_module_id);
331 331
 							
332 332
 							$description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n";
333
-							$description = $description  ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . (isset($relatedEvent->status) ? $relatedEvent->status : '') ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToMeeting;
333
+							$description = $description."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'].(isset($relatedEvent->status) ? $relatedEvent->status : '')."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO'].$relatedToMeeting;
334 334
 
335 335
 
336
-							if(isset($relatedEvent->date_start)) {
336
+							if (isset($relatedEvent->date_start)) {
337 337
 								$time_dbFromConvert = $db->fromConvert($relatedEvent->date_start, 'datetime');
338 338
 								$time = $timedate->to_display_date_time($time_dbFromConvert);
339
-								if(!$time) {
339
+								if (!$time) {
340 340
 									$time = $relatedEvent->date_start;
341 341
 								}
342
-								if(!$time) {
342
+								if (!$time) {
343 343
 									$time = $app_strings['MSG_JS_ALERT_MTG_REMINDER_NO_START_DATE'];
344 344
 								}
345 345
 							}
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 
366 366
 	private static function unQuoteTime($timestr) {
367 367
 		$ret = '';
368
-		for($i=0; $i<strlen($timestr); $i++) {
369
-			if($timestr[$i]!="'") $ret .= $timestr[$i];
368
+		for ($i = 0; $i < strlen($timestr); $i++) {
369
+			if ($timestr[$i] != "'") $ret .= $timestr[$i];
370 370
 		}
371 371
 		return $ret;
372 372
 	}
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
 	}
379 379
 	
380 380
 	private static function testEventPersonAcceptStatus(SugarBean $event, SugarBean $person, $acceptStatus = 'decline') {
381
-		if($acceptStats = self::getEventPersonAcceptStatus($event, $person)) {
381
+		if ($acceptStats = self::getEventPersonAcceptStatus($event, $person)) {
382 382
 			$acceptStatusLower = strtolower($acceptStatus);
383
-			foreach((array) $acceptStats as $acceptStat) {
384
-				if(strtolower($acceptStat) == $acceptStatusLower) {
383
+			foreach ((array)$acceptStats as $acceptStat) {
384
+				if (strtolower($acceptStat) == $acceptStatusLower) {
385 385
 					return true;
386 386
 				}
387 387
 			}
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 		global $db;
394 394
 		$rel_person_table_Key = "rel_{$person->table_name}_table";
395 395
 		$rel_person_table_Value = "{$event->table_name}_{$person->table_name}";
396
-		if(isset($event->$rel_person_table_Key) && $event->$rel_person_table_Key == $rel_person_table_Value) {
396
+		if (isset($event->$rel_person_table_Key) && $event->$rel_person_table_Key == $rel_person_table_Value) {
397 397
 			$query = self::getEventPersonQuery($event, $person);
398 398
 			$re = $db->query($query);
399 399
 			$ret = array();
400
-			while($row = $db->fetchByAssoc($re) ) {
401
-				if(!isset($row['accept_status'])) {
400
+			while ($row = $db->fetchByAssoc($re)) {
401
+				if (!isset($row['accept_status'])) {
402 402
 					return null;
403 403
 				}
404 404
 				$ret[] = $row['accept_status'];
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 
422 422
 	private static function getEventPersonQuery(SugarBean $event, SugarBean $person) {
423 423
 		$eventIdField = array_search($event->table_name, $event->relationship_fields);
424
-		if(!$eventIdField) {
425
-			$eventIdField = strtolower($event->object_name . '_id');
424
+		if (!$eventIdField) {
425
+			$eventIdField = strtolower($event->object_name.'_id');
426 426
 		}
427
-		$personIdField = strtolower($person->object_name) . '_id';
427
+		$personIdField = strtolower($person->object_name).'_id';
428 428
 		$query = "
429 429
 			SELECT * FROM {$event->table_name}_{$person->table_name}
430 430
 			WHERE
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 */
445 445
 	public static function loadRemindersDefaultValuesDataJson() {
446 446
 		$ret = json_encode(self::loadRemindersDefaultValuesData());
447
-		if(!$ret && json_last_error()) {
447
+		if (!$ret && json_last_error()) {
448 448
             throw new Exception(json_last_error_msg());
449 449
         }
450 450
 		return $ret;
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
 	}
485 485
 
486 486
 	private static function upgradeRestoreReminders() {
487
-		if($reminders = BeanFactory::getBean('Reminders')->get_full_list('', 'reminders.deleted = 1')) {
488
-			foreach($reminders as $reminder) {
487
+		if ($reminders = BeanFactory::getBean('Reminders')->get_full_list('', 'reminders.deleted = 1')) {
488
+			foreach ($reminders as $reminder) {
489 489
 				$reminder->deleted = 0;
490 490
 				$reminder->save();
491 491
 			}
492 492
 		}
493
-		if($reminderInvitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list('', 'reminders_invitees.deleted = 1')) {
494
-			foreach($reminderInvitees as $invitee) {
493
+		if ($reminderInvitees = BeanFactory::getBean('Reminders_Invitees')->get_full_list('', 'reminders_invitees.deleted = 1')) {
494
+			foreach ($reminderInvitees as $invitee) {
495 495
 				$invitee->deleted = 0;
496 496
 				$invitee->save();
497 497
 			}
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 	private static function upgradeUserPreferences() {
507 507
 		$users = User::getActiveUsers();
508
-		foreach($users as $user_id => $user_name) {
508
+		foreach ($users as $user_id => $user_name) {
509 509
 			$user = new User();
510 510
 			$user->retrieve($user_id);
511 511
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 
547 547
 				$oldReminderEmailSent = $event->email_reminder_sent;
548 548
 
549
-				if( ($oldInvitees = self::getOldEventInvitees($event)) && ($event->reminder_time != -1 || ($event->email_reminder_time != -1 && $event->email_reminder_sent != 1)) ) {
549
+				if (($oldInvitees = self::getOldEventInvitees($event)) && ($event->reminder_time != -1 || ($event->email_reminder_time != -1 && $event->email_reminder_sent != 1))) {
550 550
 
551 551
 					self::migrateReminder(
552 552
 							$eventModule,
@@ -569,11 +569,11 @@  discard block
 block discarded – undo
569 569
 	private static function getOldEventInvitees(SugarBean $event) {
570 570
 		global $db;
571 571
 		$ret = array();
572
-		$persons = array('users','contacts','leads');
573
-		foreach($persons as $person){
572
+		$persons = array('users', 'contacts', 'leads');
573
+		foreach ($persons as $person) {
574 574
 			$query = self::upgradeEventPersonQuery($event, $person);
575 575
 			$re = $db->query($query);
576
-			while($row = $db->fetchByAssoc($re) ) {
576
+			while ($row = $db->fetchByAssoc($re)) {
577 577
 				$ret[] = $row;
578 578
 			}
579 579
 		}
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
 	private static function migrateReminderInvitees($reminderId, $invitees) {
610 610
 		$ret = array();
611
-		foreach((array) $invitees as $invitee) {
611
+		foreach ((array)$invitees as $invitee) {
612 612
 			$newInvitee = BeanFactory::getBean('Reminders_Invitees');
613 613
 			$newInvitee->reminder_id = $reminderId;
614 614
 			$newInvitee->related_invitee_module = self::getRelatedInviteeModuleFromInviteeArray($invitee);
@@ -619,13 +619,13 @@  discard block
 block discarded – undo
619 619
 	}
620 620
 
621 621
 	private static function getRelatedInviteeModuleFromInviteeArray($invitee) {
622
-		if(array_key_exists('user_id', $invitee)) {
622
+		if (array_key_exists('user_id', $invitee)) {
623 623
 			return 'Users';
624 624
 		}
625
-		if(array_key_exists('lead_id', $invitee)) {
625
+		if (array_key_exists('lead_id', $invitee)) {
626 626
 			return 'Leads';
627 627
 		}
628
-		if(array_key_exists('contact_id', $invitee)) {
628
+		if (array_key_exists('contact_id', $invitee)) {
629 629
 			return 'Contacts';
630 630
 		}
631 631
 		// TODO:!!!!
@@ -634,13 +634,13 @@  discard block
 block discarded – undo
634 634
 	}
635 635
 
636 636
 	private static function getRelatedInviteeModuleIdFromInviteeArray($invitee) {
637
-		if(array_key_exists('user_id', $invitee)) {
637
+		if (array_key_exists('user_id', $invitee)) {
638 638
 			return $invitee['user_id'];
639 639
 		}
640
-		if(array_key_exists('lead_id', $invitee)) {
640
+		if (array_key_exists('lead_id', $invitee)) {
641 641
 			return $invitee['lead_id'];
642 642
 		}
643
-		if(array_key_exists('contact_id', $invitee)) {
643
+		if (array_key_exists('contact_id', $invitee)) {
644 644
 			return $invitee['contact_id'];
645 645
 		}
646 646
 		// TODO:!!!!
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	 */
686 686
 	public static function getRemindersListInlineEditView(SugarBean $event) {
687 687
 		// TODO: getEditFieldHTML() function in InlineEditing.php:218 doesn't pass the Bean ID to this custom inline edit view function but we have to know which Bean are in the focus to editing.
688
-		if(!$event->id) {
688
+		if (!$event->id) {
689 689
 			throw new Exception("No GUID for edit.");
690 690
 		}
691 691
 	}
Please login to merge, or discard this patch.
modules/Documents/GetLatestRevision.php 1 patch
Spacing   +3 added lines, -3 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.
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 
48 48
 	$document = new Document();
49 49
 	$document->retrieve($_REQUEST['record']);
50
-	if (!empty($document->document_revision_id) && !empty($_REQUEST['get_latest_for_id']))  {
51
-		$query="update linked_documents set document_revision_id='{$document->document_revision_id}', date_modified='".TimeDate::getInstance()->nowDb()."' where id ='{$_REQUEST['get_latest_for_id']}' ";
50
+	if (!empty($document->document_revision_id) && !empty($_REQUEST['get_latest_for_id'])) {
51
+		$query = "update linked_documents set document_revision_id='{$document->document_revision_id}', date_modified='".TimeDate::getInstance()->nowDb()."' where id ='{$_REQUEST['get_latest_for_id']}' ";
52 52
 		$document->db->query($query);
53 53
 	}	
54 54
 }
Please login to merge, or discard this patch.
modules/Documents/DocumentExternalApiDropDown.php 1 patch
Spacing   +3 added lines, -3 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)
2
+if (!defined('sugarEntry') || !sugarEntry)
3 3
 	die('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
     $apiList = ExternalAPIFactory::getModuleDropDown('Documents');
46 46
 
47
-    $apiList = array_merge(array('Sugar'=>$GLOBALS['app_list_strings']['eapm_list']['Sugar']),$apiList);
48
-    if(!empty($value) && empty($apiList[$value])){
47
+    $apiList = array_merge(array('Sugar'=>$GLOBALS['app_list_strings']['eapm_list']['Sugar']), $apiList);
48
+    if (!empty($value) && empty($apiList[$value])) {
49 49
         $apiList[$value] = $value;
50 50
     }
51 51
     return $apiList;
Please login to merge, or discard this patch.
modules/Documents/Document.php 1 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)
2
+if (!defined('sugarEntry') || !sugarEntry)
3 3
 	die('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 	var $object_name = "Document";
85 85
 	var $user_preferences;
86 86
 
87
-	var $encodeFields = Array ();
87
+	var $encodeFields = Array();
88 88
 
89 89
 	// This is used to retrieve related fields from form posts.
90
-	var $additional_column_fields = Array ('revision');
90
+	var $additional_column_fields = Array('revision');
91 91
 
92 92
 	var $new_schema = true;
93 93
 	var $module_dir = 'Documents';
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                 $this->new_with_id = true;
116 116
             }
117 117
 
118
-            if ( isset($_REQUEST) && isset($_REQUEST['duplicateSave']) && $_REQUEST['duplicateSave'] == true && isset($_REQUEST['filename_old_doctype']) ) {
118
+            if (isset($_REQUEST) && isset($_REQUEST['duplicateSave']) && $_REQUEST['duplicateSave'] == true && isset($_REQUEST['filename_old_doctype'])) {
119 119
                 $this->doc_type = $_REQUEST['filename_old_doctype'];
120 120
                 $isDuplicate = true;
121 121
             } else {
@@ -128,26 +128,26 @@  discard block
 block discarded – undo
128 128
             $Revision->not_use_rel_in_req = true;
129 129
             $Revision->new_rel_id = $this->id;
130 130
             $Revision->new_rel_relname = 'Documents';
131
-            $Revision->change_log = translate('DEF_CREATE_LOG','Documents');
131
+            $Revision->change_log = translate('DEF_CREATE_LOG', 'Documents');
132 132
             $Revision->revision = $this->revision;
133 133
             $Revision->document_id = $this->id;
134 134
             $Revision->filename = $this->filename;
135 135
 
136
-            if(isset($this->file_ext))
136
+            if (isset($this->file_ext))
137 137
             {
138 138
             	$Revision->file_ext = $this->file_ext;
139 139
             }
140 140
 
141
-            if(isset($this->file_mime_type))
141
+            if (isset($this->file_mime_type))
142 142
             {
143 143
             	$Revision->file_mime_type = $this->file_mime_type;
144 144
             }
145 145
 
146 146
             $Revision->doc_type = $this->doc_type;
147
-            if ( isset($this->doc_id) ) {
147
+            if (isset($this->doc_id)) {
148 148
                 $Revision->doc_id = $this->doc_id;
149 149
             }
150
-            if ( isset($this->doc_url) ) {
150
+            if (isset($this->doc_url)) {
151 151
                 $Revision->doc_url = $this->doc_url;
152 152
             }
153 153
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             if (!empty($_FILES['filename_file'])) {
160 160
                 rename("upload://{$this->id}", "upload://{$Revision->id}");
161 161
                 $createRevision = true;
162
-            } else if ( $isDuplicate && ( empty($this->doc_type) || $this->doc_type == 'Sugar' ) ) {
162
+            } else if ($isDuplicate && (empty($this->doc_type) || $this->doc_type == 'Sugar')) {
163 163
                 // Looks like we need to duplicate a file, this is tricky
164 164
                 $oldDocument = new Document();
165 165
                 $oldDocument->retrieve($_REQUEST['duplicateId']);
@@ -171,27 +171,27 @@  discard block
 block discarded – undo
171 171
             }
172 172
 
173 173
             // For external documents, we just need to make sure we have a doc_id
174
-            if ( !empty($this->doc_id) && $this->doc_type != 'Sugar' ) {
174
+            if (!empty($this->doc_id) && $this->doc_type != 'Sugar') {
175 175
                 $createRevision = true;
176 176
             }
177 177
 
178
-            if ( $createRevision ) {
178
+            if ($createRevision) {
179 179
                 $Revision->save();
180 180
                 //update document with latest revision id
181
-                $this->process_save_dates=false; //make sure that conversion does not happen again.
181
+                $this->process_save_dates = false; //make sure that conversion does not happen again.
182 182
                 $this->document_revision_id = $Revision->id;
183 183
             }
184 184
 
185 185
 
186 186
             //set relationship field values if contract_id is passed (via subpanel create)
187 187
             if (!empty($_POST['contract_id'])) {
188
-                $save_revision['document_revision_id']=$this->document_revision_id;
188
+                $save_revision['document_revision_id'] = $this->document_revision_id;
189 189
                 $this->load_relationship('contracts');
190
-                $this->contracts->add($_POST['contract_id'],$save_revision);
190
+                $this->contracts->add($_POST['contract_id'], $save_revision);
191 191
             }
192 192
 
193 193
             if ((isset($_POST['load_signed_id']) and !empty($_POST['load_signed_id']))) {
194
-                $query="update linked_documents set deleted=1 where id='".$_POST['load_signed_id']."'";
194
+                $query = "update linked_documents set deleted=1 where id='".$_POST['load_signed_id']."'";
195 195
                 $this->db->query($query);
196 196
             }
197 197
         }
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
             $row = $this->db->fetchByAssoc($result);
233 233
 
234 234
             //populate name
235
-            if(isset($this->document_name))
235
+            if (isset($this->document_name))
236 236
             {
237 237
             	$this->name = $this->document_name;
238 238
             }
239 239
 
240
-            if(isset($row['filename']))$this->filename = $row['filename'];
240
+            if (isset($row['filename']))$this->filename = $row['filename'];
241 241
             //$this->latest_revision = $row['revision'];
242
-            if(isset($row['revision']))$this->revision = $row['revision'];
242
+            if (isset($row['revision']))$this->revision = $row['revision'];
243 243
 
244 244
             //image is selected based on the extension name <ext>_icon_inline, extension is stored in document_revisions.
245 245
             //if file is not found then default image file will be used.
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 		} else {
258 258
 			$img_name = "def_image_inline"; //todo change the default image.
259 259
 		}
260
-		if($this->ACLAccess('DetailView')) {
261
-			if(!empty($this->doc_type) && $this->doc_type != 'Sugar' && !empty($this->doc_url)) {
262
-                $file_url= "<a href='".$this->doc_url."' target='_blank'>".SugarThemeRegistry::current()->getImage($this->doc_type.'_image_inline', 'border="0"',null,null,'.png',$mod_strings['LBL_LIST_VIEW_DOCUMENT'])."</a>";
260
+		if ($this->ACLAccess('DetailView')) {
261
+			if (!empty($this->doc_type) && $this->doc_type != 'Sugar' && !empty($this->doc_url)) {
262
+                $file_url = "<a href='".$this->doc_url."' target='_blank'>".SugarThemeRegistry::current()->getImage($this->doc_type.'_image_inline', 'border="0"', null, null, '.png', $mod_strings['LBL_LIST_VIEW_DOCUMENT'])."</a>";
263 263
 			} else {
264
-			    $file_url = "<a href='index.php?entryPoint=download&id={$this->document_revision_id}&type=Documents' target='_blank'>".SugarThemeRegistry::current()->getImage($img_name, 'border="0"', null,null,'.gif',$mod_strings['LBL_LIST_VIEW_DOCUMENT'])."</a>";
264
+			    $file_url = "<a href='index.php?entryPoint=download&id={$this->document_revision_id}&type=Documents' target='_blank'>".SugarThemeRegistry::current()->getImage($img_name, 'border="0"', null, null, '.gif', $mod_strings['LBL_LIST_VIEW_DOCUMENT'])."</a>";
265 265
 			}
266 266
 
267 267
     		$this->file_url = $file_url;
268 268
     		$this->file_url_noimage = "index.php?entryPoint=download&type=Documents&id={$this->document_revision_id}";
269
-		}else{
269
+		} else {
270 270
             $this->file_url = "";
271 271
             $this->file_url_noimage = "";
272 272
 		}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		}
281 281
 
282 282
 		global $app_list_strings;
283
-	    if(!empty($this->status_id)) {
283
+	    if (!empty($this->status_id)) {
284 284
 	       //_pp($this->status_id);
285 285
 	       $this->status = $app_list_strings['document_status_dom'][$this->status_id];
286 286
 	    }
@@ -294,15 +294,15 @@  discard block
 block discarded – undo
294 294
 		return $list_form;
295 295
 	}
296 296
 
297
-    function create_export_query($order_by, $where, $relate_link_join='')
297
+    function create_export_query($order_by, $where, $relate_link_join = '')
298 298
     {
299 299
         $custom_join = $this->getCustomJoin(true, true, $where);
300 300
         $custom_join['join'] .= $relate_link_join;
301 301
 		$query = "SELECT
302 302
 						documents.*";
303
-        $query .=  $custom_join['select'];
303
+        $query .= $custom_join['select'];
304 304
 		$query .= " FROM documents ";
305
-        $query .=  $custom_join['join'];
305
+        $query .= $custom_join['join'];
306 306
 
307 307
 		$where_auto = " documents.deleted = 0";
308 308
 
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 	function mark_relationships_deleted($id)
352 352
     {
353 353
         $this->load_relationships('revisions');
354
-       	$revisions= $this->get_linked_beans('revisions','DocumentRevision');
354
+       	$revisions = $this->get_linked_beans('revisions', 'DocumentRevision');
355 355
 
356 356
        	if (!empty($revisions) && is_array($revisions)) {
357
-       		foreach($revisions as $key=>$version) {
358
-       			UploadFile::unlink_file($version->id,$version->filename);
357
+       		foreach ($revisions as $key=>$version) {
358
+       			UploadFile::unlink_file($version->id, $version->filename);
359 359
        			//mark the version deleted.
360 360
        			$version->mark_deleted($version->id);
361 361
        		}
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
 	}
374 374
 
375 375
 	//static function.
376
-	function get_document_name($doc_id){
376
+	function get_document_name($doc_id) {
377 377
 		if (empty($doc_id)) return null;
378 378
 
379 379
 		$db = DBManagerFactory::getInstance();
380
-		$query="select document_name from documents where id='$doc_id'  and deleted=0";
381
-		$result=$db->query($query);
380
+		$query = "select document_name from documents where id='$doc_id'  and deleted=0";
381
+		$result = $db->query($query);
382 382
 		if (!empty($result)) {
383
-			$row=$db->fetchByAssoc($result);
383
+			$row = $db->fetchByAssoc($result);
384 384
 			if (!empty($row)) {
385 385
 				return $row['document_name'];
386 386
 			}
Please login to merge, or discard this patch.