https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43880 Bug ID: 43880 Summary: REST API: like search on a boolean column matches every true row Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: tomascohen@gmail.com CC: tomascohen@gmail.com Target Milestone: --- The REST API turns a pattern on a boolean column into a plain true value, so a "like" search on such a column matches every row where the column is true. Koha::Object::_recursive_fixup coerces any value on an is_boolean column with ($value ? 1 : 0). It recurses into hashes, so { like => '%foo%' } becomes { like => 1 } and the query becomes active LIKE 1, which is true for every active row. This is visible in the vendors table (Acquisitions > Vendors): the global search ORs a LIKE across every searchable column, including the boolean active column, so searching for a vendor name also lists every active vendor. It also makes t/cypress/integration/Acquisitions/Vendors_spec.ts ("receive should open in the same tab") depend on the order of leftover vendors: it clicks tr:first, which is whichever active vendor sorts first rather than the one it created. It failed on the Debian 12 Jenkins runs for that reason. Test plan: 1. Apply the tests patch only (or run it before the fix) and run prove t/db_dependent/api/v1/acquisitions_vendors.t => the new subtest fails 2. Apply the fix and run it again => it passes 3. In the staff interface go to Acquisitions > Vendors with at least two active vendors and search for a name that only one has => only that vendor is listed 4. Run t/cypress/integration/Acquisitions/Vendors_spec.ts => passes -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.