This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | 1 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | /********************************************************************************* |
||
4 | * SugarCRM Community Edition is a customer relationship management program developed by |
||
5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
||
6 | |||
7 | * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
||
8 | * Copyright (C) 2011 - 2014 Salesagility Ltd. |
||
9 | * |
||
10 | * This program is free software; you can redistribute it and/or modify it under |
||
11 | * the terms of the GNU Affero General Public License version 3 as published by the |
||
12 | * Free Software Foundation with the addition of the following permission added |
||
13 | * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
||
14 | * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
||
15 | * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
||
16 | * |
||
17 | * This program is distributed in the hope that it will be useful, but WITHOUT |
||
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
19 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
||
20 | * details. |
||
21 | * |
||
22 | * You should have received a copy of the GNU Affero General Public License along with |
||
23 | * this program; if not, see http://www.gnu.org/licenses or write to the Free |
||
24 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
25 | * 02110-1301 USA. |
||
26 | * |
||
27 | * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
||
28 | * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
||
29 | * |
||
30 | * The interactive user interfaces in modified source and object code versions |
||
31 | * of this program must display Appropriate Legal Notices, as required under |
||
32 | * Section 5 of the GNU Affero General Public License version 3. |
||
33 | * |
||
34 | * In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
||
35 | * these Appropriate Legal Notices must retain the display of the "Powered by |
||
36 | * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
||
37 | * reasonably feasible for technical reasons, the Appropriate Legal Notices must |
||
38 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
||
39 | ********************************************************************************/ |
||
40 | |||
41 | /********************************************************************************* |
||
42 | |||
43 | * Description: TODO: To be written. |
||
44 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
||
45 | * All Rights Reserved. |
||
46 | * Contributor(s): ______________________________________.. |
||
47 | ********************************************************************************/ |
||
48 | |||
49 | |||
50 | |||
51 | |||
52 | |||
53 | |||
54 | |||
55 | |||
56 | |||
57 | |||
58 | |||
59 | |||
60 | |||
61 | // Case is used to store customer information. |
||
62 | class aCase extends Basic { |
||
63 | var $field_name_map = array(); |
||
64 | // Stored fields |
||
65 | var $id; |
||
66 | var $date_entered; |
||
67 | var $date_modified; |
||
68 | var $modified_user_id; |
||
69 | var $assigned_user_id; |
||
70 | var $case_number; |
||
71 | var $resolution; |
||
72 | var $description; |
||
73 | var $name; |
||
74 | var $status; |
||
75 | var $priority; |
||
76 | |||
77 | |||
78 | var $created_by; |
||
79 | var $created_by_name; |
||
80 | var $modified_by_name; |
||
81 | |||
82 | // These are related |
||
83 | var $bug_id; |
||
84 | var $account_name; |
||
85 | var $account_id; |
||
86 | var $contact_id; |
||
87 | var $task_id; |
||
88 | var $note_id; |
||
89 | var $meeting_id; |
||
90 | var $call_id; |
||
91 | var $email_id; |
||
92 | var $assigned_user_name; |
||
93 | var $account_name1; |
||
94 | |||
95 | var $table_name = "cases"; |
||
96 | var $rel_account_table = "accounts_cases"; |
||
97 | var $rel_contact_table = "contacts_cases"; |
||
98 | var $module_dir = 'Cases'; |
||
99 | var $object_name = "Case"; |
||
100 | var $importable = true; |
||
101 | /** "%1" is the case_number, for emails |
||
102 | * leave the %1 in if you customize this |
||
103 | * YOU MUST LEAVE THE BRACKETS AS WELL*/ |
||
104 | var $emailSubjectMacro = '[CASE:%1]'; |
||
105 | |||
106 | // This is used to retrieve related fields from form posts. |
||
107 | var $additional_column_fields = Array('bug_id', 'assigned_user_name', 'assigned_user_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id'); |
||
108 | |||
109 | var $relationship_fields = Array('account_id'=>'accounts', 'bug_id' => 'bugs', |
||
110 | 'task_id'=>'tasks', 'note_id'=>'notes', |
||
111 | 'meeting_id'=>'meetings', 'call_id'=>'calls', 'email_id'=>'emails', |
||
112 | ); |
||
113 | |||
114 | 32 | public function __construct() { |
|
115 | 32 | parent::__construct(); |
|
116 | 32 | global $sugar_config; |
|
117 | 32 | if(!$sugar_config['require_accounts']){ |
|
118 | unset($this->required_fields['account_name']); |
||
119 | } |
||
120 | |||
121 | 32 | $this->setupCustomFields('Cases'); |
|
122 | 32 | foreach ($this->field_defs as $name => $field) { |
|
123 | 32 | $this->field_name_map[$name] = $field; |
|
124 | } |
||
125 | 32 | } |
|
126 | |||
127 | /** |
||
128 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
||
129 | */ |
||
130 | function aCase(){ |
||
131 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
||
132 | if(isset($GLOBALS['log'])) { |
||
133 | $GLOBALS['log']->deprecated($deprecatedMessage); |
||
134 | } |
||
135 | else { |
||
136 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
||
137 | } |
||
138 | self::__construct(); |
||
139 | } |
||
140 | |||
141 | var $new_schema = true; |
||
142 | |||
143 | |||
144 | |||
145 | |||
146 | |||
147 | 2 | function get_summary_text() |
|
148 | { |
||
149 | 2 | return "$this->name"; |
|
150 | } |
||
151 | |||
152 | 1 | function listviewACLHelper(){ |
|
153 | 1 | $array_assign = parent::listviewACLHelper(); |
|
154 | 1 | $is_owner = false; |
|
155 | 1 | $in_group = false; //SECURITY GROUPS |
|
156 | 1 | if(!empty($this->account_id)){ |
|
157 | |||
158 | if(!empty($this->account_id_owner)){ |
||
159 | global $current_user; |
||
160 | $is_owner = $current_user->id == $this->account_id_owner; |
||
161 | } |
||
162 | /* BEGIN - SECURITY GROUPS */ |
||
163 | else { |
||
164 | global $current_user; |
||
165 | $parent_bean = BeanFactory::getBean('Accounts',$this->account_id); |
||
166 | if($parent_bean !== false) { |
||
167 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
||
168 | } |
||
169 | } |
||
170 | require_once("modules/SecurityGroups/SecurityGroup.php"); |
||
171 | $in_group = SecurityGroup::groupHasAccess('Accounts', $this->account_id, 'view'); |
||
172 | /* END - SECURITY GROUPS */ |
||
173 | } |
||
174 | /* BEGIN - SECURITY GROUPS */ |
||
175 | /** |
||
176 | if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)){ |
||
177 | */ |
||
178 | 1 | if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
|
179 | /* END - SECURITY GROUPS */ |
||
180 | 1 | $array_assign['ACCOUNT'] = 'a'; |
|
181 | }else{ |
||
182 | $array_assign['ACCOUNT'] = 'span'; |
||
183 | } |
||
184 | |||
185 | 1 | return $array_assign; |
|
186 | } |
||
187 | |||
188 | 2 | function save_relationship_changes($is_update, $exclude = array()) |
|
189 | { |
||
190 | 2 | parent::save_relationship_changes($is_update, $exclude); |
|
191 | |||
192 | 2 | if (!empty($this->contact_id)) { |
|
193 | $this->set_case_contact_relationship($this->contact_id); |
||
194 | } |
||
195 | 2 | } |
|
196 | |||
197 | 1 | function set_case_contact_relationship($contact_id) |
|
198 | { |
||
199 | 1 | global $app_list_strings; |
|
200 | 1 | $default = $app_list_strings['case_relationship_type_default_key']; |
|
201 | 1 | $this->load_relationship('contacts'); |
|
202 | 1 | $this->contacts->add($contact_id,array('contact_role'=>$default)); |
|
203 | 1 | } |
|
204 | |||
205 | 1 | function fill_in_additional_list_fields() |
|
206 | { |
||
207 | 1 | parent::fill_in_additional_list_fields(); |
|
208 | /*// Fill in the assigned_user_name |
||
209 | //$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); |
||
210 | |||
211 | $account_info = $this->getAccount($this->id); |
||
212 | $this->account_name = $account_info['account_name']; |
||
213 | $this->account_id = $account_info['account_id'];*/ |
||
214 | 1 | } |
|
215 | |||
216 | 2 | function fill_in_additional_detail_fields() |
|
217 | { |
||
218 | 2 | parent::fill_in_additional_detail_fields(); |
|
219 | // Fill in the assigned_user_name |
||
220 | 2 | $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); |
|
221 | |||
222 | 2 | $this->created_by_name = get_assigned_user_name($this->created_by); |
|
223 | 2 | $this->modified_by_name = get_assigned_user_name($this->modified_user_id); |
|
224 | |||
225 | 2 | if(!empty($this->id)) { |
|
226 | 1 | $account_info = $this->getAccount($this->id); |
|
227 | 1 | if(!empty($account_info)) { |
|
228 | 1 | $this->account_name = $account_info['account_name']; |
|
229 | 1 | $this->account_id = $account_info['account_id']; |
|
230 | } |
||
231 | } |
||
232 | 2 | } |
|
233 | |||
234 | |||
235 | /** Returns a list of the associated contacts |
||
236 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
||
237 | * All Rights Reserved.. |
||
238 | * Contributor(s): ______________________________________.. |
||
239 | */ |
||
240 | 1 | function get_contacts() |
|
241 | { |
||
242 | 1 | $this->load_relationship('contacts'); |
|
243 | 1 | $query_array=$this->contacts->getQuery(true); |
|
244 | |||
245 | //update the select clause in the retruned query. |
||
246 | 1 | $query_array['select']="SELECT contacts.id, contacts.first_name, contacts.last_name, contacts.title, contacts.email1, contacts.phone_work, contacts_cases.contact_role as case_role, contacts_cases.id as case_rel_id "; |
|
247 | |||
248 | 1 | $query=''; |
|
249 | 1 | foreach ($query_array as $qstring) { |
|
250 | $query.=' '.$qstring; |
||
251 | } |
||
252 | 1 | $temp = Array('id', 'first_name', 'last_name', 'title', 'email1', 'phone_work', 'case_role', 'case_rel_id'); |
|
253 | 1 | return $this->build_related_list2($query, new Contact(), $temp); |
|
254 | } |
||
255 | |||
256 | 1 | function get_list_view_data(){ |
|
257 | 1 | global $current_language; |
|
258 | 1 | $app_list_strings = return_app_list_strings_language($current_language); |
|
259 | |||
260 | 1 | $temp_array = $this->get_list_view_array(); |
|
261 | 1 | $temp_array['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name); |
|
262 | 1 | $temp_array['PRIORITY'] = empty($this->priority)? "" : (!isset($app_list_strings[$this->field_name_map['priority']['options']][$this->priority]) ? $this->priority : $app_list_strings[$this->field_name_map['priority']['options']][$this->priority]); |
|
263 | 1 | $temp_array['STATUS'] = empty($this->status)? "" : (!isset($app_list_strings[$this->field_name_map['status']['options']][$this->status]) ? $this->status : $app_list_strings[$this->field_name_map['status']['options']][$this->status]); |
|
264 | 1 | $temp_array['ENCODED_NAME'] = $this->name; |
|
265 | 1 | $temp_array['CASE_NUMBER'] = $this->case_number; |
|
266 | 1 | $temp_array['SET_COMPLETE'] = "<a href='index.php?return_module=Home&return_action=index&action=EditView&module=Cases&record=$this->id&status=Closed'>".SugarThemeRegistry::current()->getImage("close_inline","title=".translate('LBL_LIST_CLOSE','Cases')." border='0'",null,null,'.gif',translate('LBL_LIST_CLOSE','Cases'))."</a>"; |
|
267 | //$temp_array['ACCOUNT_NAME'] = $this->account_name; //overwrites the account_name value returned from the cases table. |
||
268 | 1 | return $temp_array; |
|
269 | } |
||
270 | |||
271 | /** |
||
272 | builds a generic search based on the query string using or |
||
273 | do not include any $this-> because this is called on without having the class instantiated |
||
274 | */ |
||
275 | 1 | function build_generic_where_clause ($the_query_string) { |
|
276 | 1 | $where_clauses = Array(); |
|
277 | 1 | $the_query_string = $this->db->quote($the_query_string); |
|
278 | 1 | array_push($where_clauses, "cases.name like '$the_query_string%'"); |
|
279 | 1 | array_push($where_clauses, "accounts.name like '$the_query_string%'"); |
|
280 | |||
281 | 1 | if (is_numeric($the_query_string)) array_push($where_clauses, "cases.case_number like '$the_query_string%'"); |
|
282 | |||
283 | 1 | $the_where = ""; |
|
284 | |||
285 | 1 | foreach($where_clauses as $clause) |
|
286 | { |
||
287 | 1 | if($the_where != "") $the_where .= " or "; |
|
288 | 1 | $the_where .= $clause; |
|
289 | } |
||
290 | |||
291 | 1 | if($the_where != ""){ |
|
292 | 1 | $the_where = "(".$the_where.")"; |
|
293 | } |
||
294 | |||
295 | 1 | return $the_where; |
|
296 | } |
||
297 | |||
298 | 1 | function set_notification_body($xtpl, $case) |
|
299 | { |
||
300 | 1 | global $app_list_strings; |
|
301 | |||
302 | 1 | $xtpl->assign("CASE_SUBJECT", $case->name); |
|
303 | 1 | $xtpl->assign("CASE_PRIORITY", (isset($case->priority) ? $app_list_strings['case_priority_dom'][$case->priority]:"")); |
|
304 | 1 | $xtpl->assign("CASE_STATUS", (isset($case->status) ? $app_list_strings['case_status_dom'][$case->status]:"")); |
|
305 | 1 | $xtpl->assign("CASE_DESCRIPTION", $case->description); |
|
306 | |||
307 | 1 | return $xtpl; |
|
308 | } |
||
309 | |||
310 | 32 | function bean_implements($interface){ |
|
311 | switch($interface){ |
||
312 | 32 | case 'ACL':return true; |
|
0 ignored issues
–
show
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
313 | } |
||
314 | 2 | return false; |
|
315 | } |
||
316 | |||
317 | 1 | function save($check_notify = FALSE){ |
|
318 | 1 | return parent::save($check_notify); |
|
319 | } |
||
320 | |||
321 | /** |
||
322 | * retrieves the Subject line macro for InboundEmail parsing |
||
323 | * @return string |
||
324 | */ |
||
325 | 6 | function getEmailSubjectMacro() { |
|
326 | 6 | global $sugar_config; |
|
327 | 6 | return (isset($sugar_config['inbound_email_case_subject_macro']) && !empty($sugar_config['inbound_email_case_subject_macro'])) ? |
|
328 | 6 | $sugar_config['inbound_email_case_subject_macro'] : $this->emailSubjectMacro; |
|
329 | } |
||
330 | |||
331 | 2 | function getAccount($case_id){ |
|
332 | 2 | if(empty($case_id)) return array(); |
|
333 | 2 | $ret_array = array(); |
|
334 | 2 | $query = "SELECT acc.id, acc.name from accounts acc, cases where acc.id = cases.account_id and cases.id = '" . $case_id . "' and cases.deleted=0 and acc.deleted=0"; |
|
335 | 2 | $result = $this->db->query($query,true," Error filling in additional detail fields: "); |
|
336 | |||
337 | // Get the id and the name. |
||
338 | 2 | $row = $this->db->fetchByAssoc($result); |
|
339 | |||
340 | 2 | if($row != null){ |
|
341 | $ret_array['account_name'] = stripslashes($row['name']); |
||
342 | $ret_array['account_id'] = $row['id']; |
||
343 | } |
||
344 | else{ |
||
345 | 2 | $ret_array['account_name'] = ''; |
|
346 | 2 | $ret_array['account_id'] = ''; |
|
347 | } |
||
348 | 2 | return $ret_array; |
|
349 | } |
||
350 | } |
||
351 | ?> |
||
352 |
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.