Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem making checkbox selections then pressing 'selected' in navbar #16

Open
BRFud opened this issue Jan 28, 2023 · 8 comments
Open

Comments

@BRFud
Copy link

BRFud commented Jan 28, 2023

Hello. I am evaluating this software for use in a small business and encountering an error.

I have entered some items into the local database and selected their checkbox in search, but I get the following error in the apache error log when then pressing "selected" in the navbar:

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/html/lib_db_filter.php:197 Stack trace: #0 /var/www/html/lib_db_query.php(1026): getFilterObject() #1 /var/www/html/list.php(53): handleQueryRequest() #2 {main} thrown in /var/www/html/lib_db_filter.php on line 197

Any idea what the problem could be?

System is running on Ubuntu 22.04, php 8.1, apache2. Installation was from open_enventory_2022-11-29_php8.zip on Sourceforge. Thank you!

@BRFud
Copy link
Author

BRFud commented Jan 29, 2023

Trying to solve this issue I am additionally encountering another fatal error when attempting to create a new user:

PHP Fatal error: Uncaught TypeError: array_sum(): Argument #1 ($array) must be of type array, null given in /var/www/html/lib_db_manip_edit.php:1898\nStack trace:\n#0 /var/www/html/lib_db_manip_edit.php(1898): array_sum()\n#1 /var/www/html/lib_db_manip.php(1066): performEdit()\n#2 /var/www/html/editAsync.php(78): handleDesiredAction()\n#3 {main}\n thrown in /var/www/html/lib_db_manip_edit.php on line 1898

I'll continue to try and work out if I have configured php or the database incorrectly...

@rudolphi
Copy link
Owner

Hi BRFud,

the 2nd problem looks like I have fixed it already, but not yet published the update (always try to collect a bit). The 1st I have just fixed, please find the files I meanwhile updated attached. I will push this also to the git during the day and create a fresh release, hoping that the number of problems resulting from transition to PHP8 will approach 0 soon. Thanks for your error reports. If you like, email any Apache error.log files to [email protected] so that I can fix anything I find within.

Best regards,
unpublished_updates_23-01-29.zip

Felix

@BRFud
Copy link
Author

BRFud commented Jan 30, 2023

Thank you for the reply, and for all your efforts (adapting code to maintain php compatability is a frustrating task, from my experience). I am no longer getting the fatal error, but neither are the selections appearing when I click 'selected' in the navbar. Here are the warnings from apache log:

PHP Warning:  Undefined array key "selection" in /var/www/html/lib_db_filter.php on line 197, referer: /topnav.php?db_name=storage&user=root&sess_proof=63d70fbe3a6a1
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/lib_db_filter.php on line 197, referer: /topnav.php?db_name=storage&user=root&sess_proof=63d70fbe3a6a1
PHP Warning:  Undefined array key 10002 in /var/www/html/lib_db_filter.php on line 254, referer: /topnav.php?db_name=storage&user=root&sess_proof=63d70fbe3a6a1
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/lib_db_filter.php on line 836, referer: /topnav.php?db_name=storage&user=root&sess_proof=63d70fbe3a6a1
PHP Warning:  Undefined variable $per_page_text in /var/www/html/list.php on line 205, referer: /topnav.php?db_name=storage&user=root&sess_proof=63d70fbe3a6a1

Perhaps it is best I wait for you to push the fresh release?

@rudolphi
Copy link
Owner

Hi BRFud, thanks for the list of warnings, I will fix them (but they are not the cause of the remaining problem).

Have you tried to use the "Select" checkboxes with a normal user (i.e. not root)? root is special, it does not have and entry in 'person' table - and that is also where we store settings and info on users' selection of datasets... With a regular account, I just tried it successfully (and yes, we should explain this a bit somewhere...).

@BRFud
Copy link
Author

BRFud commented Jan 30, 2023

Thanks for your reply. Unfortunately I seem unable to create a new user. On creating a brand new database I immediately go to settings > users, and click the + to add a new user. Nothing happens in the browser when I click the green tick after entering a username/password and first/last name and leave all else defaults. The apache log gives:

PHP Fatal error:  Uncaught mysqli_sql_exception: Can't find any matching row in the user table in /var/www/html/lib_db_manip_edit.php:1948\nStack trace:\n#0 /var/www/html/lib_db_manip_edit.php(1948): mysqli_query()\n#1 /var/www/html/lib_db_manip.php(1066): performEdit()\n#2 /var/www/html/editAsync.php(78): handleDesiredAction()\n#3 {main}\n  thrown in /var/www/html/lib_db_manip_edit.php on line 1948, referer: /edit.php?db_name=storage2&user=root&dbs=-1&per_page=100&sess_proof=63d78022af7cf&desired_action=new&table=person&

@rudolphi
Copy link
Owner

Creating (and deleting) users is fixed. The SQL command was a safeguard needed in certain MySQL versions. From PHP8 onwards, it throws an exception (that we can just ignore). Fix is within
https://sourceforge.net/projects/enventory/files/update_2022-11-29_to_2023-01-29_php8.zip/download
(only files lib_db_manip_edit.php and lib_db_manip_del.php changed, I updated yesterday's update, instead of issuing an additional one)

@BRFud
Copy link
Author

BRFud commented Jan 31, 2023

Thank you! It's working well enough now to explore more of the software. Regarding explaining the special nature of the root user, perhaps whenever anyone is logged in as root, the "you are logged in as root" in the navbar could be higghlighted as a reminder not to start doing things they should be doing with the normal user.

I have bumped into another issue (I hope you don't mind being notified here): when I select Settings>Global>Internet data retrieval, I am unable to deactivate or re-order the individual data sources.

@rudolphi
Copy link
Owner

rudolphi commented Feb 2, 2023

Thanks for reporting, I pushed the fixed files, or you can just use the one in the zip
23-01-02_oe_bugfix_settings_dlg.zip
Regards, Felix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants