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]: Filtering issues on the staff management screen #1026

Closed digi-shirakawa-y closed 1 year ago

digi-shirakawa-y commented 1 year ago

What happened?

In the System > Staff section of the admin page, I set up a Filter and specified two or more roles, which resulted in an error.

v3.6.0

スクリーンショット 2023-02-02 11 17 51

What did you expect to happen?

To allow more than one role to be specified, I think the following actions need to be taken.

app/admin/models/config/staffs_model.php

'scopes' => [
     'role' => [
         'label' => 'lang:admin::lang.staff.text_filter_role',
         'type' => 'selectlist',
         'conditions' => 'staff_role_id = :filtered',
         'modelClass' => 'Admin\Models\Staff_roles_model',
     ],

->

'scopes' => [
       'role' => [
           'label' => 'lang:admin::lang.staff.text_filter_role',
           'type' => 'selectlist',
           'conditions' => 'staff_role_id in (:filtered)',
           'modelClass' => 'Admin\Models\Staff_roles_model',
       ],

Version

Other (please detail)

What browser are you seeing the problem on?

Chrome

Relevant log output

> 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 ','2'' at line 1 (SQL: select count(*) as aggregate from `ti_staffs` where staff_role_id = '1','2')