You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I installed ospos for managing inventory in a local store.At first everything was working fine until when I tried to add a new employee and I received error message Employee add or update failed. I am using ospos 3.3.4
IMPORTANT: If you choose to ignore this issue report template, your issue will be closed as we cannot help without the requested information.
Please make sure you tick (add an x between the square brackets with no spaces) the following check boxes:
Reporting an issue of an unmodified OSPOS installation
Checked open and closed issues and no similar issue was already reported (please make sure you searched!)
OS and version is: Linux 4.19.150-76.ELK.el7.x86_64
WebServer is: Apache
Selected language is: English-GB
(If applicable) Docker installation:
(If applicable) Installation package for the LAMP/LEMP stack is:
Issue / Bug / Question / New Feature
At first everything was working fine until when I tried to add a new employee and I received error message Employee add or update failed. I am using ospos 3.3.4
Please write your issue here. If a bug, please make sure to provide as much information as possible including configuration settings (e.g. Decimals set, Tax mode), language and steps to reproduce the bug.
In application/config/config line 251 $config['log_threshold'] = 1; // was 0. Then in application/logs you may see something showing in there.
Thanks and appologies for the delay;
This is the text I receive in the log.
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "items_Kakola_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "items_Masumbwe_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "receivings_Kakola_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "receivings_Masumbwe_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "sales_Kakola_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "sales_Masumbwe_Branch (TBD)"
ERROR - 2021-07-12 18:59:27 --> Query error: Duplicate entry 'Dickson' for key 'username' - Invalid query: INSERT INTO ospos_employees (username, password, hash_version, language_code, language, person_id) VALUES ('Dickson', '$2y$10$56n4uGpA9JJQRB5SZO/j..UUL6zZonC9FiwTiZ19IjgA9LEbQFkOi', 2, '', '', 393)
So you should already have one user with this username in the db. Creating a second duplicate one is not allowed.
Thanks;
I have tried the solution of adding a different user name and it worked.I hope in the future edition we might have a way for the error message to the user to be more specific so as to help in taking a proper action.Thanks and all the best
@jekkos Thanks alot for the response and action taken so far.I believe to gether we can make OSPOS better.Will the fix be available in the next update or will I have to implement the fix in the current version?
Activity
odiea commentedon Jul 9, 2021
Check to see if there are any errors in the Login tab. You must also check the grants or permissions tab for errors
kizitox2 commentedon Jul 9, 2021
Checked no error message. Where can find system errors logs in ospos?Thanks
odiea commentedon Jul 9, 2021
In application/config/config line 251 $config['log_threshold'] = 1; // was 0. Then in application/logs you may see something showing in there.
kizitox2 commentedon Jul 13, 2021
Thanks and appologies for the delay;
This is the text I receive in the log.
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "items_Kakola_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "items_Masumbwe_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "receivings_Kakola_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "receivings_Masumbwe_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "sales_Kakola_Branch (TBD)"
ERROR - 2021-07-12 18:58:06 --> Could not find the language line "sales_Masumbwe_Branch (TBD)"
ERROR - 2021-07-12 18:59:27 --> Query error: Duplicate entry 'Dickson' for key 'username' - Invalid query: INSERT INTO
ospos_employees(username,password,hash_version,language_code,language,person_id) VALUES ('Dickson', '$2y$10$56n4uGpA9JJQRB5SZO/j..UUL6zZonC9FiwTiZ19IjgA9LEbQFkOi', 2, '', '', 393)odiea commentedon Jul 13, 2021
This may be the issue.
ERROR - 2021-07-12 18:59:27 --> Query error: Duplicate entry 'Dickson' for key 'username' - Invalid query: INSERT INTO ospos_employees (username, password, hash_version, language_code, language, person_id) VALUES ('Dickson', '$2y$10$56n4uGpA9JJQRB5SZO/j..UUL6zZonC9FiwTiZ19IjgA9LEbQFkOi', 2, '', '', 393)
jekkos commentedon Jul 14, 2021
Good catch @odiea . We do not have any UI handling of this case.
kizitox2 commentedon Jul 14, 2021
Thanks,But I have tried to go to the database via phpmydmin but cannot find a duplicate.
jekkos commentedon Jul 14, 2021
The db constraint has prevented you from adding that duplicate.
jekkos commentedon Jul 14, 2021
So you should already have one user with this username in the db. Creating a second duplicate one is not allowed.
kizitox2 commentedon Jul 20, 2021
Thanks;
I have tried the solution of adding a different user name and it worked.I hope in the future edition we might have a way for the error message to the user to be more specific so as to help in taking a proper action.Thanks and all the best
jekkos commentedon Jul 21, 2021
Yes I guess we should add aa callback that checks whether the username already exists before the save trigger.
jekkos commentedon Jul 21, 2021
Just checked the code real quick. It's weird that this case is not handled gracefully as if the query fails we should at least show an error popup
jekkos commentedon Jul 21, 2021
Just checked the code real quick. It's weird that this case is not handled gracefully as if the query fails we should at least show an error popup
5 remaining items
kizitox2 commentedon Jul 22, 2021
@jekkos Thanks alot for the response and action taken so far.I believe to gether we can make OSPOS better.Will the fix be available in the next update or will I have to implement the fix in the current version?
Check username before employee creation (#3239)
jekkos commentedon Jul 22, 2021
The fix is in master now, you can download the last build within half an hour.
Fix employee username duplication check (#3239)
Fix duplicate username error message (#3239)
jekkos commentedon Jul 30, 2021
Fix in master.
Fix employee update (#3239)
Fix employee update (#3239)
Fix username verification on insert/update (#3239)
Fix employee update (#3239)
Fix employee update (#3239)
Fix username verification on insert/update (#3239)