Skip to content

Employee add or update failed OSPOS #3239

Closed

Description

@kizitox2

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!)
  • Read README, WHATS_NEW, INSTALL.md and UPGRADE
  • [] Read the FAQ for any known install and/or upgrade gotchas (in specific PHP extensions installed)
  • [] Read the wiki
  • [] Executed any database upgrade scripts if an upgrade pre 3.0.0 (e.g. database/2.4_to_3.0.sql)
  • [] Aware the installation code is in bintray (see README), and GitHub master is for developers only and therefore not complete nor stable

Installation information

  • OSPOS version is: 3.3.4
  • OSPOS git commit hash is:
  • PHP version is: 7.3.29
  • MySQL or MariaDB version is: 5.7.23-23
  • 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.

Activity

  1. odiea commented on Jul 9, 2021

    @odiea
    Collaborator

    Check to see if there are any errors in the Login tab. You must also check the grants or permissions tab for errors

  2. kizitox2 commented on Jul 9, 2021

    @kizitox2
    Author

    Check to see if there are any errors in the Login tab. You must also check the grants or permissions tab for errors

    Checked no error message. Where can find system errors logs in ospos?Thanks

  3. odiea commented on Jul 9, 2021

    @odiea
    Collaborator

    In application/config/config line 251 $config['log_threshold'] = 1; // was 0. Then in application/logs you may see something showing in there.

  4. kizitox2 commented on Jul 13, 2021

    @kizitox2
    Author

    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)

  5. odiea commented on Jul 13, 2021

    @odiea
    Collaborator

    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)

  6. jekkos commented on Jul 14, 2021

    @jekkos
    Member

    Good catch @odiea . We do not have any UI handling of this case.

  7. kizitox2 commented on Jul 14, 2021

    @kizitox2
    Author

    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)

    Thanks,But I have tried to go to the database via phpmydmin but cannot find a duplicate.

  8. jekkos commented on Jul 14, 2021

    @jekkos
    Member

    The db constraint has prevented you from adding that duplicate.

  9. jekkos commented on Jul 14, 2021

    @jekkos
    Member

    So you should already have one user with this username in the db. Creating a second duplicate one is not allowed.

  10. kizitox2 commented on Jul 20, 2021

    @kizitox2
    Author

    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

  11. jekkos commented on Jul 21, 2021

    @jekkos
    Member

    Yes I guess we should add aa callback that checks whether the username already exists before the save trigger.

  12. jekkos commented on Jul 21, 2021

    @jekkos
    Member

    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

  13. jekkos commented on Jul 21, 2021

    @jekkos
    Member

    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

  14. 5 remaining items

  15. kizitox2 commented on Jul 22, 2021

    @kizitox2
    Author

    @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?

  16. jekkos commented on Jul 22, 2021

    @jekkos
    Member

    The fix is in master now, you can download the last build within half an hour.

  17. reopened this on Jul 29, 2021
  18. jekkos commented on Jul 30, 2021

    @jekkos
    Member

    Fix in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions