[Koha-bugs] [Bug 30165] Several q parameters break the filters

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 4 10:58:56 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30165

Andrew Nugged <nugged at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nugged at gmail.com

--- Comment #28 from Andrew Nugged <nugged at gmail.com> ---
Seems this is the source of exception:

[ERROR] GET /api/v1/acquisitions/orders: unhandled exception
(DBIx::Class::Exception)<<DBIx::Class::Storage::DBI::_dbh_execute(): DBI
Exception: DBD::mysql::st execute failed: Unknown column 'biblioitem.title' in
'where clause' at /usr/share/perl5/Data/Page.pm line 49

Because here is the experimental dump of what sub table_name_fixer replaces:

in:

  'q' =>
'{"-and":[{"basket.vendor_id":2},[[{"basket.name":{"like":"%f%"}}],[{"basket.basket_group.name":{"like":"%f%"}}],[{"me.order_id":{"like":"%f%"}}],[{"biblio.title":{"like":"%f%"}},{"biblio.author":{"like":"%f%"}},{"biblio.isbn":{"like":"%f%"}},{"biblio.publisher":{"like":"%f%"}},{"me.internal_note":{"like":"%f%"}},{"me.vendor_note":{"like":"%f%"}}],[{"me.replacement_price":{"like":"%f%"}}],[{"me.quantity":{"like":"%f%"}}],[{"me.ecost":{"like":"%f%"}}],[{"fund.name":{"like":"%f%"}}]]]}'
};

out:

  'q' =>
'{"-and":[{"basket.vendor_id":2},[[{"basket.name":{"like":"%f%"}}],[{"basket.basket_group.name":{"like":"%f%"}}],[{"me.order_id":{"like":"%f%"}}],[{"biblio.biblioitem.title":{"like":"%f%"}},{"biblio.biblioitem.author":{"like":"%f%"}},{"biblio.biblioitem.isbn":{"like":"%f%"}},{"biblio.biblioitem.publisher":{"like":"%f%"}},{"me.internal_note":{"like":"%f%"}},{"me.vendor_note":{"like":"%f%"}}],[{"me.replacement_price":{"like":"%f%"}}],[{"me.quantity":{"like":"%f%"}}],[{"me.ecost":{"like":"%f%"}}],[{"fund.name":{"like":"%f%"}}]]]}'
};


That because this:

    $q =~ s|biblio\.|biblio\.biblioitem\.|g
      if $q =~ m/.*(isbn|ean|publisher).*/;

should be with lookahead to exclude false matches:

    $q =~ s{biblio\.(?=isbn|ean|publisher)}{biblio\.biblioitem\.}g
      if $q =~ m/.*(isbn|ean|publisher).*/;

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list