Passed
Push — scrutinizer-code-quality ( 09f5a1...c4c5fb )
by Adam
56:05 queued 14:08
created
modules/Cases/Case.php 3 patches
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -61,291 +61,291 @@
 block discarded – undo
61 61
 // Case is used to store customer information.
62 62
 class aCase extends Basic {
63 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
-									);
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 113
 
114 114
     public function __construct() {
115
-		parent::__construct();
116
-		global $sugar_config;
117
-		if(!$sugar_config['require_accounts']){
118
-			unset($this->required_fields['account_name']);
119
-		}
115
+        parent::__construct();
116
+        global $sugar_config;
117
+        if(!$sugar_config['require_accounts']){
118
+            unset($this->required_fields['account_name']);
119
+        }
120 120
 
121
-		$this->setupCustomFields('Cases');
121
+        $this->setupCustomFields('Cases');
122 122
         foreach ($this->field_defs as $name => $field) {
123 123
             $this->field_name_map[$name] = $field;
124 124
         }
125
-	}
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
-	function get_summary_text()
148
-	{
149
-		return "$this->name";
150
-	}
151
-
152
-	function listviewACLHelper(){
153
-		$array_assign = parent::listviewACLHelper();
154
-		$is_owner = false;
155
-		$in_group = false; //SECURITY GROUPS
156
-		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;
125
+    }
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
+    function get_summary_text()
148
+    {
149
+        return "$this->name";
150
+    }
151
+
152
+    function listviewACLHelper(){
153
+        $array_assign = parent::listviewACLHelper();
154
+        $is_owner = false;
155
+        $in_group = false; //SECURITY GROUPS
156
+        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 165
                 $parent_bean = BeanFactory::getBean('Accounts',$this->account_id);
166 166
                 if($parent_bean !== false) {
167
-                	$is_owner = $current_user->id == $parent_bean->assigned_user_id;
167
+                    $is_owner = $current_user->id == $parent_bean->assigned_user_id;
168 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
-			/**
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 176
 			if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)){
177
-			*/
178
-			if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){
179
-        	/* END - SECURITY GROUPS */
180
-				$array_assign['ACCOUNT'] = 'a';
181
-			}else{
182
-				$array_assign['ACCOUNT'] = 'span';
183
-			}
184
-
185
-		return $array_assign;
186
-	}
187
-
188
-	function save_relationship_changes($is_update, $exclude = array())
189
-	{
190
-		parent::save_relationship_changes($is_update, $exclude);
191
-
192
-		if (!empty($this->contact_id)) {
193
-			$this->set_case_contact_relationship($this->contact_id);
194
-		}
195
-	}
196
-
197
-	function set_case_contact_relationship($contact_id)
198
-	{
199
-		global $app_list_strings;
200
-		$default = $app_list_strings['case_relationship_type_default_key'];
201
-		$this->load_relationship('contacts');
202
-		$this->contacts->add($contact_id,array('contact_role'=>$default));
203
-	}
204
-
205
-	function fill_in_additional_list_fields()
206
-	{
207
-		parent::fill_in_additional_list_fields();
208
-		/*// Fill in the assigned_user_name
177
+             */
178
+            if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){
179
+            /* END - SECURITY GROUPS */
180
+                $array_assign['ACCOUNT'] = 'a';
181
+            }else{
182
+                $array_assign['ACCOUNT'] = 'span';
183
+            }
184
+
185
+        return $array_assign;
186
+    }
187
+
188
+    function save_relationship_changes($is_update, $exclude = array())
189
+    {
190
+        parent::save_relationship_changes($is_update, $exclude);
191
+
192
+        if (!empty($this->contact_id)) {
193
+            $this->set_case_contact_relationship($this->contact_id);
194
+        }
195
+    }
196
+
197
+    function set_case_contact_relationship($contact_id)
198
+    {
199
+        global $app_list_strings;
200
+        $default = $app_list_strings['case_relationship_type_default_key'];
201
+        $this->load_relationship('contacts');
202
+        $this->contacts->add($contact_id,array('contact_role'=>$default));
203
+    }
204
+
205
+    function fill_in_additional_list_fields()
206
+    {
207
+        parent::fill_in_additional_list_fields();
208
+        /*// Fill in the assigned_user_name
209 209
 		//$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
210 210
 
211 211
 		$account_info = $this->getAccount($this->id);
212 212
 		$this->account_name = $account_info['account_name'];
213 213
 		$this->account_id = $account_info['account_id'];*/
214
-	}
214
+    }
215 215
 
216
-	function fill_in_additional_detail_fields()
217
-	{
218
-		parent::fill_in_additional_detail_fields();
219
-		// Fill in the assigned_user_name
220
-		$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
216
+    function fill_in_additional_detail_fields()
217
+    {
218
+        parent::fill_in_additional_detail_fields();
219
+        // Fill in the assigned_user_name
220
+        $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
221 221
 
222
-		$this->created_by_name = get_assigned_user_name($this->created_by);
223
-		$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
222
+        $this->created_by_name = get_assigned_user_name($this->created_by);
223
+        $this->modified_by_name = get_assigned_user_name($this->modified_user_id);
224 224
 
225 225
         if(!empty($this->id)) {
226
-		    $account_info = $this->getAccount($this->id);
226
+            $account_info = $this->getAccount($this->id);
227 227
             if(!empty($account_info)) {
228 228
                 $this->account_name = $account_info['account_name'];
229 229
                 $this->account_id = $account_info['account_id'];
230 230
             }
231 231
         }
232
-	}
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
-	function get_contacts()
241
-	{
242
-		$this->load_relationship('contacts');
243
-		$query_array=$this->contacts->getQuery(true);
244
-
245
-		//update the select clause in the retruned query.
246
-		$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
-		$query='';
249
-		foreach ($query_array as $qstring) {
250
-			$query.=' '.$qstring;
251
-		}
252
-	    $temp = Array('id', 'first_name', 'last_name', 'title', 'email1', 'phone_work', 'case_role', 'case_rel_id');
253
-		return $this->build_related_list2($query, new Contact(), $temp);
254
-	}
255
-
256
-	function get_list_view_data(){
257
-		global $current_language;
258
-		$app_list_strings = return_app_list_strings_language($current_language);
259
-
260
-		$temp_array = $this->get_list_view_array();
261
-		$temp_array['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name);
232
+    }
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
+    function get_contacts()
241
+    {
242
+        $this->load_relationship('contacts');
243
+        $query_array=$this->contacts->getQuery(true);
244
+
245
+        //update the select clause in the retruned query.
246
+        $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
+        $query='';
249
+        foreach ($query_array as $qstring) {
250
+            $query.=' '.$qstring;
251
+        }
252
+        $temp = Array('id', 'first_name', 'last_name', 'title', 'email1', 'phone_work', 'case_role', 'case_rel_id');
253
+        return $this->build_related_list2($query, new Contact(), $temp);
254
+    }
255
+
256
+    function get_list_view_data(){
257
+        global $current_language;
258
+        $app_list_strings = return_app_list_strings_language($current_language);
259
+
260
+        $temp_array = $this->get_list_view_array();
261
+        $temp_array['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name);
262 262
         $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 263
         $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
-		$temp_array['ENCODED_NAME'] = $this->name;
265
-		$temp_array['CASE_NUMBER'] = $this->case_number;
266
-		$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
-		return $temp_array;
269
-	}
270
-
271
-	/**
264
+        $temp_array['ENCODED_NAME'] = $this->name;
265
+        $temp_array['CASE_NUMBER'] = $this->case_number;
266
+        $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
+        return $temp_array;
269
+    }
270
+
271
+    /**
272 272
 		builds a generic search based on the query string using or
273 273
 		do not include any $this-> because this is called on without having the class instantiated
274
-	*/
275
-	function build_generic_where_clause ($the_query_string) {
276
-	$where_clauses = Array();
277
-	$the_query_string = $this->db->quote($the_query_string);
278
-	array_push($where_clauses, "cases.name like '$the_query_string%'");
279
-	array_push($where_clauses, "accounts.name like '$the_query_string%'");
280
-
281
-	if (is_numeric($the_query_string)) array_push($where_clauses, "cases.case_number like '$the_query_string%'");
282
-
283
-	$the_where = "";
284
-
285
-	foreach($where_clauses as $clause)
286
-	{
287
-		if($the_where != "") $the_where .= " or ";
288
-		$the_where .= $clause;
289
-	}
290
-
291
-	if($the_where != ""){
292
-		$the_where = "(".$the_where.")";
293
-	}
294
-
295
-	return $the_where;
296
-	}
297
-
298
-	function set_notification_body($xtpl, $case)
299
-	{
300
-		global $app_list_strings;
301
-
302
-		$xtpl->assign("CASE_SUBJECT", $case->name);
303
-		$xtpl->assign("CASE_PRIORITY", (isset($case->priority) ? $app_list_strings['case_priority_dom'][$case->priority]:""));
304
-		$xtpl->assign("CASE_STATUS", (isset($case->status) ? $app_list_strings['case_status_dom'][$case->status]:""));
305
-		$xtpl->assign("CASE_DESCRIPTION", $case->description);
306
-
307
-		return $xtpl;
308
-	}
309
-
310
-		function bean_implements($interface){
311
-		switch($interface){
312
-			case 'ACL':return true;
313
-		}
314
-		return false;
315
-	}
316
-
317
-	function save($check_notify = FALSE){
318
-		return parent::save($check_notify);
319
-	}
320
-
321
-	/**
322
-	 * retrieves the Subject line macro for InboundEmail parsing
323
-	 * @return string
324
-	 */
325
-	function getEmailSubjectMacro() {
326
-		global $sugar_config;
327
-		return (isset($sugar_config['inbound_email_case_subject_macro']) && !empty($sugar_config['inbound_email_case_subject_macro'])) ?
328
-			$sugar_config['inbound_email_case_subject_macro'] : $this->emailSubjectMacro;
329
-	}
330
-
331
-	function getAccount($case_id){
332
-		if(empty($case_id)) return array();
333
-	    $ret_array = array();
334
-		$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
-		$result = $this->db->query($query,true," Error filling in additional detail fields: ");
336
-
337
-		// Get the id and the name.
338
-		$row = $this->db->fetchByAssoc($result);
339
-
340
-		if($row != null){
341
-			$ret_array['account_name'] = stripslashes($row['name']);
342
-			$ret_array['account_id'] 	= $row['id'];
343
-		}
344
-		else{
345
-			$ret_array['account_name'] = '';
346
-			$ret_array['account_id'] 	= '';
347
-		}
348
-		return $ret_array;
349
-	}
274
+     */
275
+    function build_generic_where_clause ($the_query_string) {
276
+    $where_clauses = Array();
277
+    $the_query_string = $this->db->quote($the_query_string);
278
+    array_push($where_clauses, "cases.name like '$the_query_string%'");
279
+    array_push($where_clauses, "accounts.name like '$the_query_string%'");
280
+
281
+    if (is_numeric($the_query_string)) array_push($where_clauses, "cases.case_number like '$the_query_string%'");
282
+
283
+    $the_where = "";
284
+
285
+    foreach($where_clauses as $clause)
286
+    {
287
+        if($the_where != "") $the_where .= " or ";
288
+        $the_where .= $clause;
289
+    }
290
+
291
+    if($the_where != ""){
292
+        $the_where = "(".$the_where.")";
293
+    }
294
+
295
+    return $the_where;
296
+    }
297
+
298
+    function set_notification_body($xtpl, $case)
299
+    {
300
+        global $app_list_strings;
301
+
302
+        $xtpl->assign("CASE_SUBJECT", $case->name);
303
+        $xtpl->assign("CASE_PRIORITY", (isset($case->priority) ? $app_list_strings['case_priority_dom'][$case->priority]:""));
304
+        $xtpl->assign("CASE_STATUS", (isset($case->status) ? $app_list_strings['case_status_dom'][$case->status]:""));
305
+        $xtpl->assign("CASE_DESCRIPTION", $case->description);
306
+
307
+        return $xtpl;
308
+    }
309
+
310
+        function bean_implements($interface){
311
+        switch($interface){
312
+            case 'ACL':return true;
313
+        }
314
+        return false;
315
+    }
316
+
317
+    function save($check_notify = FALSE){
318
+        return parent::save($check_notify);
319
+    }
320
+
321
+    /**
322
+     * retrieves the Subject line macro for InboundEmail parsing
323
+     * @return string
324
+     */
325
+    function getEmailSubjectMacro() {
326
+        global $sugar_config;
327
+        return (isset($sugar_config['inbound_email_case_subject_macro']) && !empty($sugar_config['inbound_email_case_subject_macro'])) ?
328
+            $sugar_config['inbound_email_case_subject_macro'] : $this->emailSubjectMacro;
329
+    }
330
+
331
+    function getAccount($case_id){
332
+        if(empty($case_id)) return array();
333
+        $ret_array = array();
334
+        $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
+        $result = $this->db->query($query,true," Error filling in additional detail fields: ");
336
+
337
+        // Get the id and the name.
338
+        $row = $this->db->fetchByAssoc($result);
339
+
340
+        if($row != null){
341
+            $ret_array['account_name'] = stripslashes($row['name']);
342
+            $ret_array['account_id'] 	= $row['id'];
343
+        }
344
+        else{
345
+            $ret_array['account_name'] = '';
346
+            $ret_array['account_id'] 	= '';
347
+        }
348
+        return $ret_array;
349
+    }
350 350
 }
351 351
 ?>
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     public function __construct() {
115 115
 		parent::__construct();
116 116
 		global $sugar_config;
117
-		if(!$sugar_config['require_accounts']){
117
+		if (!$sugar_config['require_accounts']) {
118 118
 			unset($this->required_fields['account_name']);
119 119
 		}
120 120
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	/**
128 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 129
 	 */
130
-	function aCase(){
130
+	function aCase() {
131 131
 		$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
132
-		if(isset($GLOBALS['log'])) {
132
+		if (isset($GLOBALS['log'])) {
133 133
 			$GLOBALS['log']->deprecated($deprecatedMessage);
134 134
 		}
135 135
 		else {
@@ -149,21 +149,21 @@  discard block
 block discarded – undo
149 149
 		return "$this->name";
150 150
 	}
151 151
 
152
-	function listviewACLHelper(){
152
+	function listviewACLHelper() {
153 153
 		$array_assign = parent::listviewACLHelper();
154 154
 		$is_owner = false;
155 155
 		$in_group = false; //SECURITY GROUPS
156
-		if(!empty($this->account_id)){
156
+		if (!empty($this->account_id)) {
157 157
 
158
-			if(!empty($this->account_id_owner)){
158
+			if (!empty($this->account_id_owner)) {
159 159
 				global $current_user;
160 160
 				$is_owner = $current_user->id == $this->account_id_owner;
161 161
 			}
162 162
 			/* BEGIN - SECURITY GROUPS */
163 163
 			else {
164 164
 				global $current_user;
165
-                $parent_bean = BeanFactory::getBean('Accounts',$this->account_id);
166
-                if($parent_bean !== false) {
165
+                $parent_bean = BeanFactory::getBean('Accounts', $this->account_id);
166
+                if ($parent_bean !== false) {
167 167
                 	$is_owner = $current_user->id == $parent_bean->assigned_user_id;
168 168
                 }
169 169
 			}
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 			/**
176 176
 			if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)){
177 177
 			*/
178
-			if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){
178
+			if (!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)) {
179 179
         	/* END - SECURITY GROUPS */
180 180
 				$array_assign['ACCOUNT'] = 'a';
181
-			}else{
181
+			} else {
182 182
 				$array_assign['ACCOUNT'] = 'span';
183 183
 			}
184 184
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		global $app_list_strings;
200 200
 		$default = $app_list_strings['case_relationship_type_default_key'];
201 201
 		$this->load_relationship('contacts');
202
-		$this->contacts->add($contact_id,array('contact_role'=>$default));
202
+		$this->contacts->add($contact_id, array('contact_role'=>$default));
203 203
 	}
204 204
 
205 205
 	function fill_in_additional_list_fields()
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 		$this->created_by_name = get_assigned_user_name($this->created_by);
223 223
 		$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
224 224
 
225
-        if(!empty($this->id)) {
225
+        if (!empty($this->id)) {
226 226
 		    $account_info = $this->getAccount($this->id);
227
-            if(!empty($account_info)) {
227
+            if (!empty($account_info)) {
228 228
                 $this->account_name = $account_info['account_name'];
229 229
                 $this->account_id = $account_info['account_id'];
230 230
             }
@@ -240,30 +240,30 @@  discard block
 block discarded – undo
240 240
 	function get_contacts()
241 241
 	{
242 242
 		$this->load_relationship('contacts');
243
-		$query_array=$this->contacts->getQuery(true);
243
+		$query_array = $this->contacts->getQuery(true);
244 244
 
245 245
 		//update the select clause in the retruned query.
246
-		$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 ";
246
+		$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 247
 
248
-		$query='';
248
+		$query = '';
249 249
 		foreach ($query_array as $qstring) {
250
-			$query.=' '.$qstring;
250
+			$query .= ' '.$qstring;
251 251
 		}
252 252
 	    $temp = Array('id', 'first_name', 'last_name', 'title', 'email1', 'phone_work', 'case_role', 'case_rel_id');
253 253
 		return $this->build_related_list2($query, new Contact(), $temp);
254 254
 	}
255 255
 
256
-	function get_list_view_data(){
256
+	function get_list_view_data() {
257 257
 		global $current_language;
258 258
 		$app_list_strings = return_app_list_strings_language($current_language);
259 259
 
260 260
 		$temp_array = $this->get_list_view_array();
261 261
 		$temp_array['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name);
262
-        $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
-        $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]);
262
+        $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
+        $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 264
 		$temp_array['ENCODED_NAME'] = $this->name;
265 265
 		$temp_array['CASE_NUMBER'] = $this->case_number;
266
-		$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>";
266
+		$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 267
 		//$temp_array['ACCOUNT_NAME'] = $this->account_name; //overwrites the account_name value returned from the cases table.
268 268
 		return $temp_array;
269 269
 	}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		builds a generic search based on the query string using or
273 273
 		do not include any $this-> because this is called on without having the class instantiated
274 274
 	*/
275
-	function build_generic_where_clause ($the_query_string) {
275
+	function build_generic_where_clause($the_query_string) {
276 276
 	$where_clauses = Array();
277 277
 	$the_query_string = $this->db->quote($the_query_string);
278 278
 	array_push($where_clauses, "cases.name like '$the_query_string%'");
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
 
283 283
 	$the_where = "";
284 284
 
285
-	foreach($where_clauses as $clause)
285
+	foreach ($where_clauses as $clause)
286 286
 	{
287
-		if($the_where != "") $the_where .= " or ";
287
+		if ($the_where != "") $the_where .= " or ";
288 288
 		$the_where .= $clause;
289 289
 	}
290 290
 
291
-	if($the_where != ""){
291
+	if ($the_where != "") {
292 292
 		$the_where = "(".$the_where.")";
293 293
 	}
294 294
 
@@ -300,21 +300,21 @@  discard block
 block discarded – undo
300 300
 		global $app_list_strings;
301 301
 
302 302
 		$xtpl->assign("CASE_SUBJECT", $case->name);
303
-		$xtpl->assign("CASE_PRIORITY", (isset($case->priority) ? $app_list_strings['case_priority_dom'][$case->priority]:""));
304
-		$xtpl->assign("CASE_STATUS", (isset($case->status) ? $app_list_strings['case_status_dom'][$case->status]:""));
303
+		$xtpl->assign("CASE_PRIORITY", (isset($case->priority) ? $app_list_strings['case_priority_dom'][$case->priority] : ""));
304
+		$xtpl->assign("CASE_STATUS", (isset($case->status) ? $app_list_strings['case_status_dom'][$case->status] : ""));
305 305
 		$xtpl->assign("CASE_DESCRIPTION", $case->description);
306 306
 
307 307
 		return $xtpl;
308 308
 	}
309 309
 
310
-		function bean_implements($interface){
311
-		switch($interface){
310
+		function bean_implements($interface) {
311
+		switch ($interface) {
312 312
 			case 'ACL':return true;
313 313
 		}
314 314
 		return false;
315 315
 	}
316 316
 
317
-	function save($check_notify = FALSE){
317
+	function save($check_notify = FALSE) {
318 318
 		return parent::save($check_notify);
319 319
 	}
320 320
 
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
 			$sugar_config['inbound_email_case_subject_macro'] : $this->emailSubjectMacro;
329 329
 	}
330 330
 
331
-	function getAccount($case_id){
332
-		if(empty($case_id)) return array();
331
+	function getAccount($case_id) {
332
+		if (empty($case_id)) return array();
333 333
 	    $ret_array = array();
334
-		$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
-		$result = $this->db->query($query,true," Error filling in additional detail fields: ");
334
+		$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
+		$result = $this->db->query($query, true, " Error filling in additional detail fields: ");
336 336
 
337 337
 		// Get the id and the name.
338 338
 		$row = $this->db->fetchByAssoc($result);
339 339
 
340
-		if($row != null){
340
+		if ($row != null) {
341 341
 			$ret_array['account_name'] = stripslashes($row['name']);
342
-			$ret_array['account_id'] 	= $row['id'];
342
+			$ret_array['account_id'] = $row['id'];
343 343
 		}
344
-		else{
344
+		else {
345 345
 			$ret_array['account_name'] = '';
346
-			$ret_array['account_id'] 	= '';
346
+			$ret_array['account_id'] = '';
347 347
 		}
348 348
 		return $ret_array;
349 349
 	}
Please login to merge, or discard this patch.
Braces   +15 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.
@@ -131,8 +133,7 @@  discard block
 block discarded – undo
131 133
 		$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
132 134
 		if(isset($GLOBALS['log'])) {
133 135
 			$GLOBALS['log']->deprecated($deprecatedMessage);
134
-		}
135
-		else {
136
+		} else {
136 137
 			trigger_error($deprecatedMessage, E_USER_DEPRECATED);
137 138
 		}
138 139
 		self::__construct();
@@ -178,7 +179,7 @@  discard block
 block discarded – undo
178 179
 			if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){
179 180
         	/* END - SECURITY GROUPS */
180 181
 				$array_assign['ACCOUNT'] = 'a';
181
-			}else{
182
+			} else{
182 183
 				$array_assign['ACCOUNT'] = 'span';
183 184
 			}
184 185
 
@@ -278,13 +279,17 @@  discard block
 block discarded – undo
278 279
 	array_push($where_clauses, "cases.name like '$the_query_string%'");
279 280
 	array_push($where_clauses, "accounts.name like '$the_query_string%'");
280 281
 
281
-	if (is_numeric($the_query_string)) array_push($where_clauses, "cases.case_number like '$the_query_string%'");
282
+	if (is_numeric($the_query_string)) {
283
+	    array_push($where_clauses, "cases.case_number like '$the_query_string%'");
284
+	}
282 285
 
283 286
 	$the_where = "";
284 287
 
285 288
 	foreach($where_clauses as $clause)
286 289
 	{
287
-		if($the_where != "") $the_where .= " or ";
290
+		if($the_where != "") {
291
+		    $the_where .= " or ";
292
+		}
288 293
 		$the_where .= $clause;
289 294
 	}
290 295
 
@@ -329,7 +334,9 @@  discard block
 block discarded – undo
329 334
 	}
330 335
 
331 336
 	function getAccount($case_id){
332
-		if(empty($case_id)) return array();
337
+		if(empty($case_id)) {
338
+		    return array();
339
+		}
333 340
 	    $ret_array = array();
334 341
 		$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 342
 		$result = $this->db->query($query,true," Error filling in additional detail fields: ");
@@ -340,8 +347,7 @@  discard block
 block discarded – undo
340 347
 		if($row != null){
341 348
 			$ret_array['account_name'] = stripslashes($row['name']);
342 349
 			$ret_array['account_id'] 	= $row['id'];
343
-		}
344
-		else{
350
+		} else{
345 351
 			$ret_array['account_name'] = '';
346 352
 			$ret_array['account_id'] 	= '';
347 353
 		}
Please login to merge, or discard this patch.
modules/Cases/views/view.edit.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 
42 42
 class CasesViewEdit extends ViewEdit {
43 43
 
44
-    function __construct(){
44
+    function __construct() {
45 45
         parent::__construct();
46 46
     }
47 47
 
48 48
     /**
49 49
      * @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
50 50
      */
51
-    function CasesViewEdit(){
51
+    function CasesViewEdit() {
52 52
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
53
-        if(isset($GLOBALS['log'])) {
53
+        if (isset($GLOBALS['log'])) {
54 54
             $GLOBALS['log']->deprecated($deprecatedMessage);
55 55
         }
56 56
         else {
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
     }
61 61
 
62 62
 
63
-    function display(){
63
+    function display() {
64 64
         parent::display();
65 65
         global $sugar_config;
66 66
         $new = empty($this->bean->id);
67
-        if($new){
67
+        if ($new) {
68 68
             ?>
69 69
             <script>
70 70
                 $(document).ready(function(){
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
24 24
         if(isset($GLOBALS['log'])) {
25 25
             $GLOBALS['log']->deprecated($deprecatedMessage);
26
-        }
27
-        else {
26
+        } else {
28 27
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
29 28
         }
30 29
         self::__construct($seed, $module, $subPanel, $options);
Please login to merge, or discard this patch.
modules/Cases/views/view.list.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
 
6 6
 class CasesViewList extends ViewList {
7 7
 
8
-	function __construct(){
8
+	function __construct() {
9 9
 		parent::__construct();
10 10
 	}
11 11
 
12 12
     /**
13 13
      * @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
14 14
      */
15
-    function CasesViewList(){
15
+    function CasesViewList() {
16 16
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
17
-        if(isset($GLOBALS['log'])) {
17
+        if (isset($GLOBALS['log'])) {
18 18
             $GLOBALS['log']->deprecated($deprecatedMessage);
19 19
         }
20 20
         else {
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     }
25 25
 
26 26
 
27
-	function preDisplay(){
27
+	function preDisplay() {
28 28
 		$this->lv = new CasesListViewSmarty();
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
24 24
         if(isset($GLOBALS['log'])) {
25 25
             $GLOBALS['log']->deprecated($deprecatedMessage);
26
-        }
27
-        else {
26
+        } else {
28 27
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
29 28
         }
30 29
         self::__construct($seed, $module, $subPanel, $options);
Please login to merge, or discard this patch.
modules/Cases/Dashlets/MyCasesDashlet/MyCasesDashlet.php 2 patches
Spacing   +4 added lines, -4 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.
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         parent::__construct($id, $def);
53 53
 
54
-        if(empty($def['title'])) $this->title = translate('LBL_LIST_MY_CASES', 'Cases');
54
+        if (empty($def['title'])) $this->title = translate('LBL_LIST_MY_CASES', 'Cases');
55 55
         $this->searchFields = $dashletData['MyCasesDashlet']['searchFields'];
56 56
         $this->columns = $dashletData['MyCasesDashlet']['columns'];
57 57
         $this->seedBean = new aCase();
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @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
62 62
      */
63
-    function MyCasesDashlet($id, $def = null){
63
+    function MyCasesDashlet($id, $def = null) {
64 64
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
65
-        if(isset($GLOBALS['log'])) {
65
+        if (isset($GLOBALS['log'])) {
66 66
             $GLOBALS['log']->deprecated($deprecatedMessage);
67 67
         }
68 68
         else {
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 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.
@@ -51,7 +53,9 @@  discard block
 block discarded – undo
51 53
 
52 54
         parent::__construct($id, $def);
53 55
 
54
-        if(empty($def['title'])) $this->title = translate('LBL_LIST_MY_CASES', 'Cases');
56
+        if(empty($def['title'])) {
57
+            $this->title = translate('LBL_LIST_MY_CASES', 'Cases');
58
+        }
55 59
         $this->searchFields = $dashletData['MyCasesDashlet']['searchFields'];
56 60
         $this->columns = $dashletData['MyCasesDashlet']['columns'];
57 61
         $this->seedBean = new aCase();
@@ -64,8 +68,7 @@  discard block
 block discarded – undo
64 68
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
65 69
         if(isset($GLOBALS['log'])) {
66 70
             $GLOBALS['log']->deprecated($deprecatedMessage);
67
-        }
68
-        else {
71
+        } else {
69 72
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
70 73
         }
71 74
         self::__construct($id, $def);
Please login to merge, or discard this patch.
modules/Cases/CasesListViewSmarty.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
     /**
13 13
      * @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
14 14
      */
15
-    function CasesListViewSmarty(){
15
+    function CasesListViewSmarty() {
16 16
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
17
-        if(isset($GLOBALS['log'])) {
17
+        if (isset($GLOBALS['log'])) {
18 18
             $GLOBALS['log']->deprecated($deprecatedMessage);
19 19
         }
20 20
         else {
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
         global $app_strings;
30 30
 
31 31
         $script = "<a href='javascript:void(0)' id='export_listview_top' ".
32
-                "onclick=\"return sListView.send_form(true, '{$_REQUEST['module']}', " .
33
-                "'index.php?entryPoint=export', " .
34
-                "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_EXPORT']}</a>" .
35
-                "</li><li>". // List item hack
36
-                "<a href='javascript:void(0)' id='map_listview_top' " .
37
-                " onclick=\"return sListView.send_form(true, 'jjwg_Maps', " .
38
-                "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', " .
32
+                "onclick=\"return sListView.send_form(true, '{$_REQUEST['module']}', ".
33
+                "'index.php?entryPoint=export', ".
34
+                "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_EXPORT']}</a>".
35
+                "</li><li>".// List item hack
36
+                "<a href='javascript:void(0)' id='map_listview_top' ".
37
+                " onclick=\"return sListView.send_form(true, 'jjwg_Maps', ".
38
+                "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', ".
39 39
                 "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_MAP']}</a>";
40 40
 
41 41
         return $script;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
24 24
         if(isset($GLOBALS['log'])) {
25 25
             $GLOBALS['log']->deprecated($deprecatedMessage);
26
-        }
27
-        else {
26
+        } else {
28 27
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
29 28
         }
30 29
         self::__construct($seed, $module, $subPanel, $options);
Please login to merge, or discard this patch.
modules/Prospects/views/view.detail.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 class ProspectsViewDetail extends ViewDetail {
46 46
 
47
- 	function __construct(){
48
- 		parent::__construct();
49
- 	}
47
+        function __construct(){
48
+            parent::__construct();
49
+        }
50 50
 
51 51
     /**
52 52
      * @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
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
 
66
- 	function display() {
67
-		if(isset($this->bean->lead_id) && !empty($this->bean->lead_id)){
66
+        function display() {
67
+        if(isset($this->bean->lead_id) && !empty($this->bean->lead_id)){
68 68
 
69
-			//get lead name
70
-			$lead = new Lead();
71
-			$lead->retrieve($this->bean->lead_id);
72
-			$this->ss->assign('lead', $lead);
73
-		}
74
- 		parent::display();
75
- 	}
69
+            //get lead name
70
+            $lead = new Lead();
71
+            $lead->retrieve($this->bean->lead_id);
72
+            $this->ss->assign('lead', $lead);
73
+        }
74
+            parent::display();
75
+        }
76 76
 }
77 77
 ?>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 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
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
 
45 45
 class ProspectsViewDetail extends ViewDetail {
46 46
 
47
- 	function __construct(){
47
+ 	function __construct() {
48 48
  		parent::__construct();
49 49
  	}
50 50
 
51 51
     /**
52 52
      * @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
53 53
      */
54
-    function ProspectsViewDetail(){
54
+    function ProspectsViewDetail() {
55 55
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
56
-        if(isset($GLOBALS['log'])) {
56
+        if (isset($GLOBALS['log'])) {
57 57
             $GLOBALS['log']->deprecated($deprecatedMessage);
58 58
         }
59 59
         else {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
  	function display() {
67
-		if(isset($this->bean->lead_id) && !empty($this->bean->lead_id)){
67
+		if (isset($this->bean->lead_id) && !empty($this->bean->lead_id)) {
68 68
 
69 69
 			//get lead name
70 70
 			$lead = new Lead();
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
  * Date: 06/03/15
44 44
  * Comments
45 45
  */
46
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
46
+if(!defined('sugarEntry') || !sugarEntry) {
47
+    die('Not A Valid Entry Point');
48
+}
47 49
 
48 50
 class CasesController extends SugarController {
49 51
 
@@ -90,8 +92,7 @@  discard block
 block discarded – undo
90 92
                 $count++;
91 93
             }
92 94
             echo '</table>';
93
-        }
94
-        else {
95
+        } else {
95 96
             echo $mod_strings['LBL_NO_SUGGESTIONS'];
96 97
         }
97 98
         die();
Please login to merge, or discard this patch.
modules/Prospects/Prospect.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
     /**
115 115
      * @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
116 116
      */
117
-    function Prospect(){
117
+    function Prospect() {
118 118
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
119
-        if(isset($GLOBALS['log'])) {
119
+        if (isset($GLOBALS['log'])) {
120 120
             $GLOBALS['log']->deprecated($deprecatedMessage);
121 121
         }
122 122
         else {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		builds a generic search based on the query string using or
144 144
 		do not include any $this-> because this is called on without having the class instantiated
145 145
 	*/
146
-	function build_generic_where_clause ($the_query_string)
146
+	function build_generic_where_clause($the_query_string)
147 147
 	{
148 148
 		$where_clauses = Array();
149 149
 		$the_query_string = $GLOBALS['db']->quote($the_query_string);
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 		}
164 164
 
165 165
 		$the_where = "";
166
-		foreach($where_clauses as $clause)
166
+		foreach ($where_clauses as $clause)
167 167
 		{
168
-			if($the_where != "") $the_where .= " or ";
168
+			if ($the_where != "") $the_where .= " or ";
169 169
 			$the_where .= $clause;
170 170
 		}
171 171
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 		return $the_where;
174 174
 	}
175 175
 
176
-    function converted_prospect($prospectid, $contactid, $accountid, $opportunityid){
176
+    function converted_prospect($prospectid, $contactid, $accountid, $opportunityid) {
177 177
     	$query = "UPDATE prospects set  contact_id=$contactid, account_id=$accountid, opportunity_id=$opportunityid where  id=$prospectid and deleted=0";
178
-		$this->db->query($query,true,"Error converting prospect: ");
178
+		$this->db->query($query, true, "Error converting prospect: ");
179 179
 		//todo--status='Converted', converted='1',
180 180
     }
181
-     function bean_implements($interface){
182
-		switch($interface){
181
+     function bean_implements($interface) {
182
+		switch ($interface) {
183 183
 			case 'ACL':return true;
184 184
 		}
185 185
 		return false;
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
      *  This method will be used by Mail Merge in order to retieve the targets as specified in the query
190 190
      *  @param query String - this is the query which contains the where clause for the query
191 191
      */
192
-    function retrieveTargetList($query, $fields, $offset = 0, $limit= -99, $max = -99, $deleted = 0, $module = ''){
192
+    function retrieveTargetList($query, $fields, $offset = 0, $limit = -99, $max = -99, $deleted = 0, $module = '') {
193 193
         global  $beanList, $beanFiles;
194 194
         $module_name = $this->module_dir;
195 195
 
196
-        if(empty($module))
196
+        if (empty($module))
197 197
         {
198 198
             //The call to retrieveTargetList contains a query that may contain a pound token
199 199
             $pattern = '/AND related_type = [\'#]([a-zA-Z]+)[\'#]/i';
200
-            if(preg_match($pattern, $query, $matches))
200
+            if (preg_match($pattern, $query, $matches))
201 201
             {
202 202
                 $module_name = $matches[1];
203 203
                 $query = preg_replace($pattern, "", $query);
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
         $count = count($fields);
208 208
         $index = 1;
209 209
         $sel_fields = "";
210
-        if(!empty($fields))
210
+        if (!empty($fields))
211 211
         {
212
-            foreach($fields as $field){
213
-                if($field == 'id'){
212
+            foreach ($fields as $field) {
213
+                if ($field == 'id') {
214 214
                 	$sel_fields .= 'prospect_lists_prospects.id id';
215
-                }else{
215
+                } else {
216 216
                 	$sel_fields .= strtolower($module_name).".".$field;
217 217
                 }
218
-                if($index < $count){
218
+                if ($index < $count) {
219 219
                     $sel_fields .= ",";
220 220
                 }
221 221
                 $index++;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $class_name = $beanList[$module_name];
227 227
         require_once($beanFiles[$class_name]);
228 228
         $seed = new $class_name();
229
-        if(empty($sel_fields)){
229
+        if (empty($sel_fields)) {
230 230
             $sel_fields = $seed->table_name.'.*';
231 231
         }
232 232
         $select = "SELECT ".$sel_fields." FROM ".$seed->table_name;
@@ -248,23 +248,23 @@  discard block
 block discarded – undo
248 248
      *  Given an id, looks up in the prospect_lists_prospects table
249 249
      *  and retrieve the correct type for this id
250 250
      */
251
-    function retrieveTarget($id){
251
+    function retrieveTarget($id) {
252 252
         $query = "SELECT related_id, related_type FROM prospect_lists_prospects WHERE id = '".$this->db->quote($id)."'";
253 253
         $result = $this->db->query($query);
254
-        if(($row = $this->db->fetchByAssoc($result))){
254
+        if (($row = $this->db->fetchByAssoc($result))) {
255 255
              global  $beanList, $beanFiles;
256 256
              $module_name = $row['related_type'];
257 257
              $class_name = $beanList[$module_name];
258 258
              require_once($beanFiles[$class_name]);
259 259
              $seed = new $class_name();
260 260
              return $seed->retrieve($row['related_id']);
261
-        }else{
261
+        } else {
262 262
             return null;
263 263
         }
264 264
     }
265 265
 
266 266
 
267
-	function get_unlinked_email_query($type=array()) {
267
+	function get_unlinked_email_query($type = array()) {
268 268
 
269 269
 		return get_unlinked_email_query($type, $this);
270 270
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 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.
@@ -118,8 +120,7 @@  discard block
 block discarded – undo
118 120
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
119 121
         if(isset($GLOBALS['log'])) {
120 122
             $GLOBALS['log']->deprecated($deprecatedMessage);
121
-        }
122
-        else {
123
+        } else {
123 124
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
124 125
         }
125 126
         self::__construct();
@@ -165,7 +166,9 @@  discard block
 block discarded – undo
165 166
 		$the_where = "";
166 167
 		foreach($where_clauses as $clause)
167 168
 		{
168
-			if($the_where != "") $the_where .= " or ";
169
+			if($the_where != "") {
170
+			    $the_where .= " or ";
171
+			}
169 172
 			$the_where .= $clause;
170 173
 		}
171 174
 
@@ -212,7 +215,7 @@  discard block
 block discarded – undo
212 215
             foreach($fields as $field){
213 216
                 if($field == 'id'){
214 217
                 	$sel_fields .= 'prospect_lists_prospects.id id';
215
-                }else{
218
+                } else{
216 219
                 	$sel_fields .= strtolower($module_name).".".$field;
217 220
                 }
218 221
                 if($index < $count){
@@ -258,7 +261,7 @@  discard block
 block discarded – undo
258 261
              require_once($beanFiles[$class_name]);
259 262
              $seed = new $class_name();
260 263
              return $seed->retrieve($row['related_id']);
261
-        }else{
264
+        } else{
262 265
             return null;
263 266
         }
264 267
     }
Please login to merge, or discard this patch.
modules/CampaignTrackers/CampaignTracker.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     var $additional_column_fields = Array('campaign_id');
101 101
     var $relationship_fields = Array('campaing_id'=>'campaign');
102 102
 
103
-    var $required_fields =  array('tracker_name'=>1,'tracker_url'=>1);
103
+    var $required_fields = array('tracker_name'=>1, 'tracker_url'=>1);
104 104
 
105 105
     /*This bean's constructor*/
106 106
     public function __construct() {
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
     /**
111 111
      * @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
112 112
      */
113
-    public function CampaignTracker(){
113
+    public function CampaignTracker() {
114 114
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
115
-        if(isset($GLOBALS['log'])) {
115
+        if (isset($GLOBALS['log'])) {
116 116
             $GLOBALS['log']->deprecated($deprecatedMessage);
117 117
         }
118 118
         else {
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 
125 125
     function save($check_notify = false) {
126 126
         //make sure that the url has a scheme, if not then add http:// scheme
127
-        if ($this->is_optout!=1 ){
127
+        if ($this->is_optout != 1) {
128 128
             $url = strtolower(trim($this->tracker_url));
129
-            if(!preg_match('/^(http|https|ftp):\/\//i', $url)){
129
+            if (!preg_match('/^(http|https|ftp):\/\//i', $url)) {
130 130
                 $this->tracker_url = 'http://'.$url;
131 131
             }
132 132
         }
@@ -152,28 +152,28 @@  discard block
 block discarded – undo
152 152
 
153 153
         //setup campaign name.
154 154
         $query = "SELECT name from campaigns where id = '$this->campaign_id'";
155
-        $result =$this->db->query($query,true," Error filling in additional detail fields: ");
155
+        $result = $this->db->query($query, true, " Error filling in additional detail fields: ");
156 156
 
157 157
         // Get the id and the name.
158 158
         $row = $this->db->fetchByAssoc($result);
159
-        if($row != null) {
160
-            $this->campaign_name=$row['name'];
159
+        if ($row != null) {
160
+            $this->campaign_name = $row['name'];
161 161
         }
162 162
 
163 163
         if (!class_exists('Administration')) {
164 164
 
165 165
         }
166
-        $admin=new Administration();
166
+        $admin = new Administration();
167 167
         $admin->retrieveSettings('massemailer'); //retrieve all admin settings.
168
-        if (isset($admin->settings['massemailer_tracking_entities_location_type']) and $admin->settings['massemailer_tracking_entities_location_type']=='2'  and isset($admin->settings['massemailer_tracking_entities_location']) ) {
169
-            $this->message_url=$admin->settings['massemailer_tracking_entities_location'];
168
+        if (isset($admin->settings['massemailer_tracking_entities_location_type']) and $admin->settings['massemailer_tracking_entities_location_type'] == '2' and isset($admin->settings['massemailer_tracking_entities_location'])) {
169
+            $this->message_url = $admin->settings['massemailer_tracking_entities_location'];
170 170
         } else {
171
-            $this->message_url=$sugar_config['site_url'];
171
+            $this->message_url = $sugar_config['site_url'];
172 172
         }
173 173
         if ($this->is_optout == 1) {
174 174
             $this->message_url .= '/index.php?entryPoint=removeme&identifier={MESSAGE_ID}';
175 175
         } else {
176
-            $this->message_url .= '/index.php?entryPoint=campaign_trackerv2&track=' . $this->id;
176
+            $this->message_url .= '/index.php?entryPoint=campaign_trackerv2&track='.$this->id;
177 177
         }
178 178
     }
179 179
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
24 24
         if(isset($GLOBALS['log'])) {
25 25
             $GLOBALS['log']->deprecated($deprecatedMessage);
26
-        }
27
-        else {
26
+        } else {
28 27
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
29 28
         }
30 29
         self::__construct($seed, $module, $subPanel, $options);
Please login to merge, or discard this patch.
modules/Calls_Reschedule/Calls_Reschedule_sugar.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	var $table_name = 'calls_reschedule';
52 52
 	var $importable = true;
53 53
 	var $tracker_visibility = false;
54
-	var $disable_row_level_security = true ; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO
54
+	var $disable_row_level_security = true; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO
55 55
 		var $id;
56 56
 		var $name;
57 57
 		var $date_entered;
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 		var $call_id_c;
72 72
 		var $calls;
73 73
 
74
-    function __construct(){
74
+    function __construct() {
75 75
 		parent::__construct();
76 76
 	}
77 77
 
78 78
     /**
79 79
      * @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
80 80
      */
81
-    function Calls_Reschedule_sugar(){
81
+    function Calls_Reschedule_sugar() {
82 82
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
83
-        if(isset($GLOBALS['log'])) {
83
+        if (isset($GLOBALS['log'])) {
84 84
             $GLOBALS['log']->deprecated($deprecatedMessage);
85 85
         }
86 86
         else {
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
     }
91 91
 
92 92
 
93
-	function bean_implements($interface){
94
-		switch($interface){
93
+	function bean_implements($interface) {
94
+		switch ($interface) {
95 95
 			case 'ACL': return true;
96 96
 		}
97 97
 		return false;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
24 24
         if(isset($GLOBALS['log'])) {
25 25
             $GLOBALS['log']->deprecated($deprecatedMessage);
26
-        }
27
-        else {
26
+        } else {
28 27
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
29 28
         }
30 29
         self::__construct($seed, $module, $subPanel, $options);
Please login to merge, or discard this patch.