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
Articles count in "List all categories" #5416
Conversation
Fixes articles count in "List all categories": articles for non active language were erroneously accounted for (see: 5412)
I also took the occasion for cleaning up the code in |
Travis not very clear on this...
I think it is the double spaces after the |
There is conceptual error: the active language must be taken into account when computing the instance hash... |
I have a fix ready but I cannot sync my local repo with upstream... I hope it is GitHub momentary issue... |
Fixed! |
Don't panic: "smz" is my new GitHub account |
Confirmed! |
Successfull test. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5416. |
@AlexRed Thank-you for testing, Alessandro! What I forgot to underline in the presentation of this PR is that this issue is particularly nasty when the returned count should be zero and instead it is non-zero: there you have an empty category displayed while it should not. I know that mixing articles tagged for different languages inside a common category is not considered a best practice and common wisdom is against this, but I think instead that this gives you a further degree of freedom that may be leveraged in different scenarios. Sometimes best practices and common wisdom derive from the necessity to work around existing issues... |
@test: This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5416. |
@stellainformatica Thanks for testing, ste, appreciated! C'mon guys/girls, some more tests and comments, so we have the opportunity of this bug being fixed! |
@smz I had already found that issue while testing your patch when I saw that report. Looks also that the issue exists for other core components. |
@infograf768 JM, I may be, as they say, "thick as brick", but I fail to understand if you're telling me that what I'm trying to solve here is a consequence of #4937 (and hence once fixed that, this issue will be automatically fixed as well) or if you are asking me to try to fix #4937 too while I'm trying to fix this... Sorry, sometimes is not so easy to understand between each other, especially when both are not using their native language! |
Just asking if you have time to also fix #4937 as you have been working on categories. :) |
Ah, OK! Will look into it and let you know if I'm able to... Right now I'm preparing a new commit to #5463 as I discovered that the dates conditions ("before", "after" and "exact") are not translated in the query description and so I'm adding 3 new strings for i18n... |
@infograf768 JM, if we are convinced this is the correct behavior for all components, I think we can just get rid of the new option and modify the library with the following:
doing that we will have it automatically applied to all current and future components. What do you think? |
P.S.: I already checked that it does not have any detrimental effect in backend... |
or better:
|
Have you tested? This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5416. |
Not yet, TBH... If all is well I'll push a commit, OK? |
I mean: I already tested in com_content, but not with other components. |
All fixed with smz#2 |
Add test dependencies
@wilsonge Thanks, George, merged! |
com_contact items count issue is fixed in #5515 (I think this is so trivial it may jump to merge...) |
Small typo: double semicolon
OK here. Need one more tester? |
@infograf768 JM, we also have @AlexRed and @stellainformatica tests (if you still consider those as valid), but what do you think about my concern about the need to use |
We do not use db->quote in If test OK, I guess it would be better. |
Seems to be OK here... |
@infograf768 JM, what do we do with this? In the meanwhile I discovered that it solves the same issue (wrong articles count) also for mod_articles_categories... |
Sorry, guys, may I ask why this PR which fixes a bug and has been extensively discussed/tested isn't apparently considered for merging? |
|
That looks more as a question than a statement and http://issues.joomla.org/tracker/joomla-cms/5416 says we already have 2 successfull test, but, please, feel free to test yourself. |
@test OK |
@dgt41 |
Merged - thanks for bringing to my attention. For some reason I thought I'd merged this earlier in the week. Totally my bad! Sorry! |
It's OK, George! Thanks! |
@@ -259,20 +261,21 @@ protected function _load($id) | |||
->where('badcats.id is null'); | |||
|
|||
// Note: i for item | |||
if (isset($this->_options['countItems']) && $this->_options['countItems'] == 1) | |||
if ($this->_options['currentlang'] !== 0 || $this->_options['countItems'] == 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one makes third party extensions fail on multilang sites, which don't want this part activated. The whole option of "currentlang" has no business here. It counters "countItems". The first part of this if needs to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please make an example?
That condition is essential for returning the correct items in multilingual environments: you want to get items that are flagged for either the current language or *
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before your change, you were able to disable the whole counting stuff. Your change forces this to be enabled when you are in a multi-language site, regardless of the component even using any language stuff at all. With your change, I can't switch this off.
I have a component that uses the category system, but does not have a catid field in the data table. So, since I don't need the whole counting thing and it is also not applicable to my situation, I disabled it for my JCategories implementation. This change forces this option to ON and since I don't have a DB table field for the category ID, I get a nice big error page with a broken query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you solve the original issue this PR has solved without breaking your component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a PR #7303 by Hannes. I think it should fix both the original issue from here and the regression introduced.
Fixes articles count in "List all categories": articles for non active language were erroneously accounted for (see: #5412)