? ? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
3 Nov 2019

Pull Request for Issue #26964 (comment).

Summary of Changes

Change names of bind variables in users model so they still are unambiguous when range filters are used for both columns register date and last visit date.

Testing Instructions

In the users list view having more than 1 user, set any datetime filter like e.g. "today" on each of the columns "Registration Date" and "Last Visit Date", so that for both columns a filter is applied.

Expected result

No error, filter is applied.

Actual result

HTTP code 500, no further error message in UI. In PHP log with error log into file on and error reporting = maximum following message 2 times:

PHP Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in /home/richard/lamp/public_html/joomla-cms-4.0-dev/libraries/vendor/joomla/database/src/Mysqli/MysqliStatement.php on line 430

Documentation Changes Required

None.

avatar richard67 richard67 - open - 3 Nov 2019
avatar richard67 richard67 - change - 3 Nov 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Nov 2019
Category Administration com_users
avatar richard67 richard67 - change - 3 Nov 2019
The description was changed
avatar richard67 richard67 - edited - 3 Nov 2019
avatar richard67
richard67 - comment - 3 Nov 2019

@Quy @alikon Please test.

avatar Quy Quy - test_item - 3 Nov 2019 - Tested successfully
avatar Quy
Quy - comment - 3 Nov 2019

I have tested this item successfully on 445d995


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26970.

avatar SharkyKZ SharkyKZ - test_item - 4 Nov 2019 - Tested successfully
avatar SharkyKZ
SharkyKZ - comment - 4 Nov 2019

I have tested this item successfully on 445d995


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26970.

avatar SharkyKZ SharkyKZ - change - 4 Nov 2019
Status Pending Ready to Commit
Labels Added: ?
avatar SharkyKZ
SharkyKZ - comment - 4 Nov 2019

RTC.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26970.

avatar laoneo laoneo - change - 4 Nov 2019
Labels Added: ?
avatar laoneo laoneo - change - 4 Nov 2019
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-11-04 09:44:44
Closed_By laoneo
avatar laoneo laoneo - close - 4 Nov 2019
avatar laoneo laoneo - merge - 4 Nov 2019
avatar laoneo
laoneo - comment - 4 Nov 2019

Thanks!

avatar infograf768
infograf768 - comment - 4 Nov 2019

@richard67
PHP Warning is gone but I have an error here when using last visit date of today or in the last week
My superadmin has visited today
When no filter I get
Screen-Shot-2019-11-04-at-10 50 04with-indications

After filtering the list is empty
Screen Shot 2019-11-04 at 11 00 34

avatar infograf768
infograf768 - comment - 4 Nov 2019

After waiting for a while and reloading the page, it is the Select Registration date filter which gives false results. I.e. it works without any filter or with more than a year ago....
Confused...

avatar richard67
richard67 - comment - 4 Nov 2019

@infograf768 I‘ll check tonight after work (German time).

avatar richard67
richard67 - comment - 4 Nov 2019

I always asked myself when working in that file why for the last visit date there is this check is_string here https://github.com/richard67/joomla-cms/blob/7d1a1964d0780b61bbe5a077f593b6cba7a229fc/administrator/components/com_users/Model/UsersModel.php#L422 but for the registration date there is no such condition. Does anyone have any idea what this is (or was) good for?

avatar richard67
richard67 - comment - 4 Nov 2019

Ah, I think I know why. It was for the null date check. So I have to fix the last visit date too, not only the registration date. Am working on a PR.

avatar richard67
richard67 - comment - 4 Nov 2019

@infograf768 I've found an issue when filtering for last visit date = "never". But your issue with registration date I can't reproduce. Could it be a timezone issue? What timezone have you set for the server and the user who is logged in to backend? I have set server time zone to Europe/Berlin in Global Configuration, and user time zone I haven't set, so the one of the server is used.

avatar infograf768
infograf768 - comment - 4 Nov 2019

not on desktop right now but issue is both server set to utc or paris

avatar richard67
richard67 - comment - 4 Nov 2019

I see another issue in the queries but this error must have been there before my nulldate changes.

When I enter a text in the search box and in addition select one of the time range filters for registered date or last visit date, I would expect that all conditions have to be fulfilled, i.e. search text has to be found AND time range fits.

But for the search sting "orWhere" is used here: https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_users/Model/UsersModel.php#L372.

If there is a date range filter, it is appended then to the query with "OR" where it should be "AND", see the query from the debug module:

SELECT a.*
FROM `j4ux0_users` AS a
WHERE 
(
(`a`.`name` LIKE :name) OR 
(`a`.`username` LIKE :username)) OR 
(`a`.`email` LIKE :email) OR `a`.`lastvisitDate` IS NULL
ORDER BY `a`.`name` ASC LIMIT 20

That's why a combination of search text and any of the date range filters does not work.

Beside the fact that I've never seen that orWhere before: Does anybody know how to get out of this mess so the last "OR" before the a.lastvisitDate becomes and "AND"? @Quy @SharkyKZ @wilsonge Any idea?

avatar alikon
alikon - comment - 4 Nov 2019

extendWhere can help sorry for brevity but i'm running out of time now

avatar richard67
richard67 - comment - 4 Nov 2019

@infograf768 Sure it is the registration date and not the last visit date which makes you the problems? I ask because I found errors for the last visit date but not for the registration date.

@alikon Do you think you can help later? I think it needs also to fix these "orWhere" things with "extendWhere", because as you can see the brackets set by the "orWhere" are not right.

avatar alikon
alikon - comment - 4 Nov 2019

sure...

avatar richard67
richard67 - comment - 4 Nov 2019

@alikon Ok, ping me in glip whenever you have some time. or post a proposal here.

avatar SharkyKZ
SharkyKZ - comment - 4 Nov 2019

extendWhere() won't work here because it requires at least one WHERE condition.

avatar richard67
richard67 - comment - 4 Nov 2019

@SharkyKZ Any other idea? We can't be sure if there is a where before or after because any of the filters or the text search might be used or might not be used. But like it is now, the query is wrong, or I understand the functionality of the text search together with other filters wrong.

avatar SharkyKZ
SharkyKZ - comment - 4 Nov 2019

Just need to revert that part to how it was. I'll make a PR.

avatar SharkyKZ
SharkyKZ - comment - 4 Nov 2019

See PR #26981.

avatar richard67
richard67 - comment - 4 Nov 2019

@SharkyKZ We have this problem at other places in getListQuery functions of diverse models, too, with this orWhere. We only might be lucky that it comes as last, so no other where would be appended after that.

Add a Comment

Login with GitHub to post a comment