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

            Bug ID: 30677
           Summary: Unknown column 'biblioitem.title' in 'where clause'
                    500 error in API /api/v1/acquisitions/orders
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: REST API
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
        Depends on: 30165

The 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;

Making a fix.


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30165
[Bug 30165] Several q parameters break the filters
-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to