mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-07-13 08:22:52 -04:00
Fix employee username duplication check (#3239)
This commit is contained in:
@@ -190,5 +190,11 @@ class Employees extends Persons
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('employees_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
public function check_username()
|
||||
{
|
||||
$exists = $this->Employee->username_exists($this->input->get('username'));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -8,6 +8,7 @@ $lang["employees_confirm_restore"] = "Are you sure you want to restore the selec
|
||||
$lang["employees_current_password"] = "Current Password";
|
||||
$lang["employees_current_password_invalid"] = "Current Password is invalid";
|
||||
$lang["employees_employee"] = "Employee";
|
||||
$lang["employees_employee_username_duplicate"] = "Employee username is already in use. Please choose another one.";
|
||||
$lang["employees_error_adding_updating"] = "Employee add or update failed";
|
||||
$lang["employees_error_deleting_demo_admin"] = "You cannot delete the demo admin user";
|
||||
$lang["employees_error_updating_demo_admin"] = "You cannot change the demo admin user";
|
||||
|
||||
@@ -8,6 +8,7 @@ $lang["employees_confirm_restore"] = "Are you sure you want to restore selected
|
||||
$lang["employees_current_password"] = "Current Password";
|
||||
$lang["employees_current_password_invalid"] = "Current Password is invalid.";
|
||||
$lang["employees_employee"] = "Employee";
|
||||
$lang["employees_employee_username_duplicate"] = "Employee username is already in use. Please choose another one.";
|
||||
$lang["employees_error_adding_updating"] = "Employee add or update failed.";
|
||||
$lang["employees_error_deleting_demo_admin"] = "You can not delete the demo admin user.";
|
||||
$lang["employees_error_updating_demo_admin"] = "You can not change the demo admin user.";
|
||||
|
||||
@@ -105,7 +105,7 @@ class Employee extends Person
|
||||
//Run these queries as a transaction, we want to make sure we do all or nothing
|
||||
$this->db->trans_start();
|
||||
|
||||
if(ENVIRONMENT != 'testing' && !$this->username_exists($employee_data['username']) && parent::save($person_data, $employee_id))
|
||||
if(ENVIRONMENT != 'testing' && parent::save($person_data, $employee_id))
|
||||
{
|
||||
if(!$employee_id || !$this->exists($employee_id))
|
||||
{
|
||||
|
||||
@@ -210,7 +210,8 @@ $(document).ready(function()
|
||||
username:
|
||||
{
|
||||
required: true,
|
||||
minlength: 5
|
||||
minlength: 5,
|
||||
remote: "<?php echo site_url($controller_name . '/check_username')?>"
|
||||
},
|
||||
password:
|
||||
{
|
||||
@@ -238,8 +239,9 @@ $(document).ready(function()
|
||||
username:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('employees_username_required'); ?>",
|
||||
minlength: "<?php echo $this->lang->line('employees_username_minlength'); ?>"
|
||||
},
|
||||
minlength: "<?php echo $this->lang->line('employees_username_minlength'); ?>",
|
||||
username: "<?php echo $this->lang->line('employees_employee_username_duplicate'); ?>"
|
||||
},
|
||||
password:
|
||||
{
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user