Reputation: 8773
I've been working with vTiger CRM for a small company to simplify their administration. So far everything works great. But I've stumbled upon the following issue:
For some unknown reason, I'm unable to add new users to the CRM. The username field is set to mandatory, but grayed out, as shown in the following image:
I've tried a couple of things before asking what to do here:
SELECT * FROM vtiger_field WHERE uitype = 4
, but it only returned fields that are supposed to be disabled. Not the username one.After inspecting the element, I figured it was set to readonly=""
. However, searching any template file in layouts/vlayout/modules/Users/*.tpl
revealed nothing. So I think some php, or json in combination with javascript is changing this. The full code of the element is:
<input id="Users_editView_fieldName_user_name" class="input-large " data-validation-engine="validate[required,funcCall[Vtiger_Base_Validator_Js.invokeValidation]]" name="user_name" value="" readonly="" data-fieldinfo="{"mandatory":true,"presence":true,"quickcreate":false,"masseditable":true,"defaultvalue":false,"type":"string","name":"user_name","label":"Gebruikersnaam"}" type="text">
So right now I'm a bit at a loss on how to fix this issue. Does anyone have experience with this or knows how to fix it?
Upvotes: 1
Views: 511
Reputation: 8773
It turns out that the username field's uitype
is set to 106
. After diving around in vTigers code, I figured one of my modules bugged this out inside modules/Users/models/View.php
:
/**
* Function to check whether the current field is read-only
* @return <Boolean> - true/false
*/
public function isReadOnly() {
$currentUserModel = Users_Record_Model::getCurrentUserModel();
if(($currentUserModel->isAdminUser() == false && $this->get('uitype') == 98) || $this->get('uitype') == 106 || $this->get('uitype') == 156 || $this->get('uitype') == 115) {
return true;
}
}
As you can see, it disables fields with uitype = 106
: $this->get('uitype') == 106
. The solution was to simply remove that condition from the if statement.
Upvotes: 1