? ? Pending

User tests: Successful: Unsuccessful:

avatar SharkyKZ
SharkyKZ
27 Apr 2018

Pull Request for Issue # .

Summary of Changes

This sets up site Articles model to allow filtering articles by no author, like in administrator.

Testing Instructions

Create an article without author.
Modify 'Articles - Category' module form (/modules/mod_articles_category/mod_articles_category.xml) by adding option with value 0 to created_by field. So the field looks like this:

<field
	name="created_by"
	type="sql"
	label="MOD_ARTICLES_CATEGORY_FIELD_AUTHOR_LABEL"
	description="MOD_ARTICLES_CATEGORY_FIELD_AUTHOR_DESC"
	multiple="true"
	size="5"
	query="select id, name, username from #__users where id IN (select distinct(created_by) from #__content) order by name ASC"
	key_field="id"
	value_field="name"
	>
	<option value="">JOPTION_SELECT_AUTHORS</option>
	<option value="0">JNONE</option>
</field>

Publish the module. In author field try these combinations:
a) No option
b) Option with empty value
c) Option with 0 value
d) Option with empty value and option with 0 value
e) Option with empty value and option with >= 1 value (e.g. author with ID 50)
f) Option with 0 value and option with >= 1 value (e.g. author with ID 50)

Expected result

a) All articles are shown
b) All articles are shown
c) Only articles without author are shown
d) Only articles without author are shown
e) Only articles from selected author (e.g. author with ID 50) are shown
f) Articles from selected author (e.g. author with ID 50) and without author are shown

Actual result

a) All articles are shown (correct)
b) All articles are shown (correct)
c) All articles are shown (incorrect)
d) Only articles without author are shown (correct)
e) Articles from selected author (e.g. author with ID 50) and without author are shown (incorrect)
f) Articles from selected author (e.g. author with ID 50) and without author are shown (correct)

Documentation Changes Required

No.

avatar SharkyKZ SharkyKZ - open - 27 Apr 2018
avatar SharkyKZ SharkyKZ - change - 27 Apr 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Apr 2018
Category Front End com_content
avatar Septdir
Septdir - comment - 27 Apr 2018

@SharkyKZ were change in xml files ? And why is it needed in fornt?

In adminstrator/com_content/views/articles this would be a very useful filter

avatar SharkyKZ
SharkyKZ - comment - 27 Apr 2018

This PR doesn't include any changes in XML.

Editing XML is needed to test the code, in which case the file is /modules/mod_articles_category/mod_articles_category.xml.

avatar SharkyKZ SharkyKZ - change - 27 Apr 2018
The description was changed
avatar SharkyKZ SharkyKZ - edited - 27 Apr 2018
avatar Septdir
Septdir - comment - 27 Apr 2018

@SharkyKZ then what is needed for this pr, and in the font model?

avatar Quy
Quy - comment - 27 Apr 2018

I have tested this item successfully on d543beb


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

avatar Quy Quy - test_item - 27 Apr 2018 - Tested successfully
avatar SharkyKZ
SharkyKZ - comment - 27 Apr 2018

@Septdir this is a fix to allow the same functionality in frontend as in backend. It's not used in the core yet.

avatar infograf768
infograf768 - comment - 28 Apr 2018

@SharkyKZ
I guess you can modify the xml by also adding to
<option value="0">JNONE</option>
a default value.
default=""
as that would be totally B/C.

avatar SharkyKZ
SharkyKZ - comment - 28 Apr 2018

@infograf768 You could do that, yes. But this PR doesn't touch XML. Editing XML is only needed to test the code. And note that option with empty value is for cosmetic reasons only. The existence of this option caused another issue, which is solved in this PR:

If you select an author (e.g. ID 50) and leave the default option selected, the value passed to model is array('', '50'). Using ArrayHelper::toInteger() results in array(0, 50) which means articles without author (where author ID is 0) will be included alongside articles from author with ID 50.

I'll update testing instructions with option combinations.

EDIT: Whoops, wrong button.

avatar SharkyKZ SharkyKZ - change - 28 Apr 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-04-28 08:45:04
Closed_By SharkyKZ
Labels Added: ?
avatar SharkyKZ SharkyKZ - close - 28 Apr 2018
avatar SharkyKZ SharkyKZ - change - 28 Apr 2018
Status Closed New
Closed_Date 2018-04-28 08:45:04
Closed_By SharkyKZ
avatar SharkyKZ SharkyKZ - change - 28 Apr 2018
Status New Pending
avatar SharkyKZ SharkyKZ - reopen - 28 Apr 2018
avatar infograf768
infograf768 - comment - 28 Apr 2018

OK. I guess using the author field instead would be a better solution.
But that is already in your other PR.

avatar SharkyKZ SharkyKZ - change - 28 Apr 2018
The description was changed
avatar SharkyKZ SharkyKZ - edited - 28 Apr 2018
avatar csthomas
csthomas - comment - 29 Apr 2018

I have tested this item successfully on d543beb


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

avatar csthomas csthomas - test_item - 29 Apr 2018 - Tested successfully
avatar Quy Quy - change - 29 Apr 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 29 Apr 2018

RTC


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

avatar mbabker mbabker - change - 30 Apr 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-04-30 22:33:04
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 30 Apr 2018
avatar mbabker mbabker - merge - 30 Apr 2018

Add a Comment

Login with GitHub to post a comment