J3 Issue ?
avatar sdi68
sdi68
30 Oct 2018

Steps to reproduce the issue

I need to use field type sql with param sql_filter (see https://docs.joomla.org/SQL_form_field_type)

Expected result

I query added condition with values in this field.

Actual result

Condition not added.

System information (as much as possible)

Joomla 3.x

Additional comments

I fix this with edit the file: \libraries\joomla\form\fields\sql.php.
screen shot 2018-10-30 at 09 04 47My code add with comments //SDI.

avatar sdi68 sdi68 - open - 30 Oct 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Oct 2018
avatar brianteeman brianteeman - change - 30 Oct 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 30 Oct 2018
avatar brianteeman brianteeman - change - 30 Oct 2018
Labels Removed: J3 Issue
avatar brianteeman brianteeman - unlabeled - 30 Oct 2018
avatar brianteeman brianteeman - unlabeled - 30 Oct 2018
avatar brianteeman brianteeman - change - 30 Oct 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 30 Oct 2018
avatar brianteeman brianteeman - change - 30 Oct 2018
Title
Bug witch xml field type SQL
Bug with xml field type SQL
avatar brianteeman brianteeman - edited - 30 Oct 2018
avatar Quy
Quy - comment - 1 Nov 2018

Is this related #22241? Please provide an XML example in your case.

avatar sdi68
sdi68 - comment - 1 Nov 2018

This is code example from my case

			<field
				name="catid"
				type="category"
				extension="com_content"
				multiple="false"
				default=""
				size="10"
				label="JCATEGORY"
				description="MOD_SDI_SELART_CATEGORY_DESC"
			>
				<option value="">JOPTION_ALL_CATEGORIES</option>
			</field>

			<field
					name="artids"
					type="sql"
					multiple="true"
					default=""
					size="10"
					label="JGLOBAL_ARTICLES"
					description="MOD_SDI_SELART_ARTICLES_DESC"
					sql_select="id, title"
					sql_from="#__content"
					sql_filter= "catid"
					sql_where="state=1"
					key_field="id"
					value_field="title"
					sql_default_catid=""
			>
			</field>

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22859.
avatar sdi68
sdi68 - comment - 1 Nov 2018

I try this from module.


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

avatar jbrailas
jbrailas - comment - 15 Jan 2019

I can reproduce this problem but your code doesn't work in order to solve this bug.

avatar sdi68
sdi68 - comment - 15 Jan 2019

I can reproduce this problem but your code doesn't work in order to solve this bug.

Sorry! I forgot add second part of fix. In the same file (see comment SDI)
2019-01-15_18-18-02

avatar jbrailas
jbrailas - comment - 16 Jan 2019

It is ok now. But the first part of your code should be:

$curfrm = $this->form;
if (is_array($filters)) :
	foreach ($filters as $i => $v)
	{
		$filterval = $curfrm->getValue ($v, $group);
		if (!is_null($filterval)) 
			$filters[$i]= $v . '=' . $filterval;
	}
endif;

If you don't add "if (is_array($filters)) " then you will have a warning: Invalid argument supplied for foreach() in other sql fields, which don't use the "sql-filter".

Someone should include this fix in the next version of joomla.
However, it doesn't work dynamically, meaning it doesn't change the values after the page is loaded, so it is not very useful.

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Removed: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - unlabeled - 4 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar fastslack
fastslack - comment - 30 Apr 2019

@sdi68 Try with this PR #24755

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 30 Apr 2019

Closed as having Pull Request #24755. Please reopen if PR didn't fix the Issue.

avatar franz-wohlkoenig franz-wohlkoenig - close - 30 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Apr 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-04-30 07:16:31
Closed_By franz-wohlkoenig
avatar jbrailas
jbrailas - comment - 11 Mar 2021

Why the solution is not implemented in Joomla core file sql.php yet?

Add a Comment

Login with GitHub to post a comment