[BUG]: strange getListQuery code when using WHERE IN statement #1181

Closed
opened 2024-10-17 20:01:51 +00:00 by Daniel Duvald · 2 comments

What Happened?

I created a dynamic get of the type getListQuery where I pulled data from a database table. Under tweak, I added a WHERE statement: a.discount_type IN (1,2). See screenshot.

This produced a rather strange and invalid piece of code:

		if (isset((1,2)) && UtilitiesArrayHelper::check((1,2)))
		{
			// Get where a.discount_type is (1,2)
			$query->where('a.discount_type IN (1,2)');
		}
		else
		{
			return false;
		}

To me this looks like a bug, as I was only expecting to see $query->where('a.discount_type IN (1,2)'); in code, but Im unsure if I use JCB as intended in this case? It works fine if I just set a.discount_type equal to e.g. 1. or greater than 0. But IN and NOT IN are giving me issues.

Steps to reproduce the Bug

Create a WHERE IN tweak in a getListQuery dynamic get as described above.

Which Joomla version are you compiling in?

5.2 rc2

Which PHP version are you compiling in?

8.1

Which Joomla versions are you targeting?

v5

Which PHP version are you targeting?

8.1

Which Web server is JCB running on?

Apache 2.4

Which Relational Database is JCB running on?

MariaDB

Which OS is JCB running on?

Ubuntu 20.04

Which JCB version are you using?

5.0.4-alpha3

Where in JCB did this issue occur?

Dynamic Get(admin_view)

On which browsers did you encounter the issue?

Safari

Additional Comments

No response

### What Happened? I created a dynamic get of the type getListQuery where I pulled data from a database table. Under tweak, I added a WHERE statement: a.discount_type IN (1,2). See screenshot. This produced a rather strange and invalid piece of code: ``` if (isset((1,2)) && UtilitiesArrayHelper::check((1,2))) { // Get where a.discount_type is (1,2) $query->where('a.discount_type IN (1,2)'); } else { return false; } ``` To me this looks like a bug, as I was only expecting to see $query->where('a.discount_type IN (1,2)'); in code, but Im unsure if I use JCB as intended in this case? It works fine if I just set a.discount_type equal to e.g. 1. or greater than 0. But IN and NOT IN are giving me issues. ### Steps to reproduce the Bug Create a WHERE IN tweak in a getListQuery dynamic get as described above. ### Which Joomla version are you compiling in? 5.2 rc2 ### Which PHP version are you compiling in? 8.1 ### Which Joomla versions are you targeting? v5 ### Which PHP version are you targeting? 8.1 ### Which Web server is JCB running on? Apache 2.4 ### Which Relational Database is JCB running on? MariaDB ### Which OS is JCB running on? Ubuntu 20.04 ### Which JCB version are you using? 5.0.4-alpha3 ### Where in JCB did this issue occur? Dynamic Get(admin_view) ### On which browsers did you encounter the issue? Safari ### Additional Comments _No response_
Daniel Duvald added the
Bug
label 2024-10-17 20:01:51 +00:00
Owner

Note the note in the field:
image

User an array variable instead that you set in the before query (custom PHP area) or use a database a.field ref, you can not place text directly into that field for now...

The custom PHP area:
image

Note the *note* in the field: ![image](https://git.vdm.dev/attachments/ed91c6ad-1a23-4761-b2ba-a9b5716846b3) User an array variable instead that you set in the before query (custom PHP area) or use a database `a.field` ref, you can not place text directly into that field for now... The custom PHP area: ![image](https://git.vdm.dev/attachments/255d42a6-ce58-4ec1-8f4d-68f42f1d6dc9)
Author

Thank you Llewellyn, I got it working with your help.

Thank you Llewellyn, I got it working with your help.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1181
No description provided.