tastyigniter / TastyIgniter

:fire: Powerful, yet easy to use, open-source online ordering, table reservation and management system for restaurants
https://tastyigniter.com
MIT License
2.98k stars 976 forks source link

[Bug]: Error when selecting multiple options of multi-select ('selectlist' component) on admin/orders #1023

Closed CupNoodles closed 1 year ago

CupNoodles commented 1 year ago

What happened?

Steps to repro:

On 3.6.0 (but based on how old the code is, presumably older versions as well), create more than one location and more than one payment option.

Go to /admin/orders and select more than one location to filter your orders list by. Page crashes for me, relevant logs below.

What makes it worse/more annoying is that the filter sets gets saved to your session, so I believe the only way to fix it is to navigate to another admin page, and then log out and back into admin.

What did you expect to happen?

Expect to not have an SQL error!

Version

Other (please detail)

What browser are you seeing the problem on?

Firefox

Relevant log output

Next Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ','cod''
 at line 1 (SQL: select count(*) as aggregate from `ti_orders` where location_id IN('1','2') and status_id IN('1') and order_type = 'collection' and payment = '','cod') in /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Conn
ection.php:712
CupNoodles commented 1 year ago

I've got one possible fix at https://github.com/tastyigniter/TastyIgniter/pull/1024 - while it works fine, I'm a little weirded out that this hasn't been a problem for anybody else? Confirmation would be appreciated!

iva-system commented 1 year ago

I have the same problem

sampoyigi commented 1 year ago

Fixed https://github.com/tastyigniter/TastyIgniter/commit/a85efb96706a6f2d4bf6b62ec2c90fa54d37b0b4