2 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-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
39 require_once('include/MVC/View/views/view.edit.php');
40 require_once('modules/Users/UserViewHelper.php');
43 class UsersViewEdit extends ViewEdit {
45 function UsersViewEdit(){
49 function preDisplay() {
50 $this->fieldHelper = new UserViewHelper($this->ss, $this->bean, 'EditView');
51 $this->fieldHelper->setupAdditionalFields();
56 public function getMetaDataFile() {
57 $userType = 'Regular';
58 if($this->fieldHelper->usertype == 'GROUP'){
62 if ( $userType != 'Regular' ) {
63 $oldType = $this->type;
64 $this->type = $oldType.'group';
66 $metadataFile = parent::getMetaDataFile();
67 if ( $userType != 'Regular' ) {
68 $this->type = $oldType;
74 global $current_user, $app_list_strings;
77 //lets set the return values
78 if(isset($_REQUEST['return_module'])){
79 $this->ss->assign('RETURN_MODULE',$_REQUEST['return_module']);
82 //Set the return_action if it is provided
83 if(!empty($_REQUEST['return_action'])){
84 $this->ss->assign('RETURN_ACTION',$_REQUEST['return_action']);
85 //Set the return_id form value if record entry was provided
86 if(!empty($_REQUEST['record']))
88 $this->ss->assign('RETURN_ID', $_REQUEST['record']);
92 //reset the id if this is a duplicate bean
93 if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
95 $this->bean->user_name = "";
96 $this->ss->assign('ID','');
99 ///////////////////////////////////////////////////////////////////////////////
100 //// REDIRECTS FROM COMPOSE EMAIL SCREEN
101 if(isset($_REQUEST['type']) && (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Emails')) {
102 $this->ss->assign('REDIRECT_EMAILS_TYPE', $_REQUEST['type']);
104 //// END REDIRECTS FROM COMPOSE EMAIL SCREEN
105 ///////////////////////////////////////////////////////////////////////////////
107 ///////////////////////////////////////////////////////////////////////////////
108 //// NEW USER CREATION ONLY
109 if(empty($this->bean->id)) {
110 $this->ss->assign('SHOW_ADMIN_CHECKBOX','height="30"');
111 $this->ss->assign('NEW_USER','1');
113 $this->ss->assign('NEW_USER','0');
114 $this->ss->assign('NEW_USER_TYPE','DISABLED');
117 //// END NEW USER CREATION ONLY
118 ///////////////////////////////////////////////////////////////////////////////
124 // FIXME: Translate error prefix
125 if(isset($_REQUEST['error_string'])) $this->ss->assign('ERROR_STRING', '<span class="error">Error: '.$_REQUEST['error_string'].'</span>');
126 if(isset($_REQUEST['error_password'])) $this->ss->assign('ERROR_PASSWORD', '<span id="error_pwd" class="error">Error: '.$_REQUEST['error_password'].'</span>');
131 // Build viewable versions of a few fields for non-admins
132 if(!empty($this->bean->id)) {
133 if( !empty($this->bean->status) ) {
134 $this->ss->assign('STATUS_READONLY',$app_list_strings['user_status_dom'][$this->bean->status]); }
135 if( !empty($this->bean->employee_status) ) {
136 $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]);
138 if( !empty($this->bean->reports_to_id) ) {
139 $this->ss->assign('REPORTS_TO_READONLY', get_assigned_user_name($this->bean->reports_to_id));
143 $processSpecial = false;
144 $processFormName = '';
145 if ( $this->fieldHelper->usertype == 'GROUP'
147 $this->ev->formName = 'EditViewGroup';
149 $processSpecial = true;
150 $processFormName = 'EditViewGroup';
153 $this->ev->process($processSpecial,$processFormName);
155 echo $this->ev->display($this->showTitle);