EmployeeStatus.php ➔ getEmployeeStatusOptions()   D
last analyzed

Complexity

Conditions 9
Paths 4

Size

Total Lines 28
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 35.321
Metric Value
cc 9
eloc 16
nc 4
nop 4
dl 0
loc 28
ccs 5
cts 16
cp 0.3125
crap 35.321
rs 4.909
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
 ********************************************************************************/
44
45
/**
46
 * EmployeeStatus.php
47
 * This is a helper file used by the meta-data framework
48
 * @see modules/Users/vardefs.php (employee_status)
49
 * @author Collin Lee
50
 */
51
52 1
function getEmployeeStatusOptions($focus, $name = 'employee_status', $value, $view = 'DetailView') {
53
54
	
55 2
	global $current_user, $app_list_strings;
56 2
    if(($view == 'EditView' || $view == 'MassUpdate') && is_admin($current_user)) {
57
	   
58
	   	$employee_status  = "<select name='$name'";
59
		if(!empty($sugar_config['default_user_name']) 
0 ignored issues
show
Bug introduced by
The variable $sugar_config seems to never exist, and therefore empty should always return true. Did you maybe rename this variable?

This check looks for calls to isset(...) or empty() on variables that are yet undefined. These calls will always produce the same result and can be removed.

This is most likely caused by the renaming of a variable or the removal of a function/method parameter.

Loading history...
60
			&& $sugar_config['default_user_name'] == $focus->user_name 
61
			&& isset($sugar_config['lock_default_user_name']) 
62
			&& $sugar_config['lock_default_user_name'])
63
		    {
64
				$employee_status .= " disabled ";
65
			}
66
			$employee_status .= ">";
67
			$employee_status .= get_select_options_with_id($app_list_strings['employee_status_dom'], $focus->employee_status);
68
			$employee_status .= "</select>\n";
69
			return $employee_status;
70
	 }
71
	   	
72 2
	 if ( isset($app_list_strings['employee_status_dom'][$focus->employee_status]) )
73
	 {
74
        return $app_list_strings['employee_status_dom'][$focus->employee_status];
75
	 }
76
	  
77 2
	 return $focus->employee_status;
78
		
79
}
80
81 1
function getMessengerTypeOptions($focus, $name = 'messenger_type', $value, $view = 'DetailView') {
82
   global $current_user, $app_list_strings;
83
   if($view == 'EditView' || $view == 'MassUpdate') {
84
   	  $messenger_type = "<select name=\"$name\">";
85
      $messenger_type .= get_select_options_with_id($app_list_strings['messenger_type_dom'], $focus->messenger_type);
86
      $messenger_type .= '</select>';
87
   	  return $messenger_type;
88
   } 
89
   
90
   return $app_list_strings['messenger_type_dom'][$focus->messenger_type];
91 1
}
92
93
?>
94