[Bug 33974] New: Add ability to search biblios endpoint using ISBN
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Bug ID: 33974 Summary: Add ability to search biblios endpoint using ISBN Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com CC: tomascohen@gmail.com Currently the biblios endpoint will list biblios, including the fields from the biblioitems table. For outside vendors, there is a need to search by the ISBN to retrieve biblios via an ISBN search -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Preliminary implementation here: https://gitlab.com/thekesolutions/Koha/-/tree/bug_33974_biblios_endpoint_ext... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 152433 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152433&action=edit Bug 33974: Add Koha::Biblios->api_query_fixer This patch adds the `api_query_fixer` method to the class, and adds tests to validate its behavior. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 152434 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152434&action=edit Bug 33974: Make biblioitem columns searchable in a generic way This patch makes biblioitem attributes be searchable on the biblios endpoint. It does so by using the new method in Koha::Biblios, and by adjusting objects.search(_rs) to accept a $query_fixer arrayref of functions to be applied to each query or order_by parameters. The result is cleaner code to write, but complex internals. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Searching for biblioitem attributes works on the API! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 152435 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152435&action=edit Bug 33974: (follow-up) Adapt the orders endpoint In order to reduce the technical debt carried on the orders controller, and to highlight the decisions made on the prior patch, I adapted the list() orders controller using the new tools in town. The result is this endpoint can now embed bibio, without needing to have a custom piece of code. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/*.t => SUCCESS: Tests pass :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Marking NSO to get some eyes here. The Objects.t tests haven't been reviewed yet and are expected to fail. Any help is of course welcome. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com, | |kyle@bywatersolutions.com, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com Summary|Add ability to search |Add ability to search |biblios endpoint using ISBN |biblios endpoint any | |biblioitem attribute -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152433|0 |1 is obsolete| | --- Comment #6 from Sam Lau <samalau@gmail.com> --- Created attachment 152487 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152487&action=edit Bug 33974: Add Koha::Biblios->api_query_fixer This patch adds the `api_query_fixer` method to the class, and adds tests to validate its behavior. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Sam Lau <samalau@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152434|0 |1 is obsolete| | --- Comment #7 from Sam Lau <samalau@gmail.com> --- Created attachment 152488 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152488&action=edit Bug 33974: Make biblioitem columns searchable in a generic way This patch makes biblioitem attributes be searchable on the biblios endpoint. It does so by using the new method in Koha::Biblios, and by adjusting objects.search(_rs) to accept a $query_fixer arrayref of functions to be applied to each query or order_by parameters. The result is cleaner code to write, but complex internals. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Searching for biblioitem attributes works on the API! 3. Sign off :-D Signed-off-by: Sam Lau <samalau@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152435|0 |1 is obsolete| | --- Comment #8 from Sam Lau <samalau@gmail.com> --- Created attachment 152489 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152489&action=edit Bug 33974: (follow-up) Adapt the orders endpoint In order to reduce the technical debt carried on the orders controller, and to highlight the decisions made on the prior patch, I adapted the list() orders controller using the new tools in town. The result is this endpoint can now embed bibio, without needing to have a custom piece of code. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/*.t => SUCCESS: Tests pass :-D Signed-off-by: Sam Lau <samalau@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152487|0 |1 is obsolete| | Attachment #152488|0 |1 is obsolete| | Attachment #152489|0 |1 is obsolete| | --- Comment #9 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 152765 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152765&action=edit Bug 33974: Add Koha::Biblios->api_query_fixer This patch adds the `api_query_fixer` method to the class, and adds tests to validate its behavior. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #10 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 152766 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152766&action=edit Bug 33974: Make biblioitem columns searchable in a generic way This patch makes biblioitem attributes be searchable on the biblios endpoint. It does so by using the new method in Koha::Biblios, and by adjusting objects.search(_rs) to accept a $query_fixer arrayref of functions to be applied to each query or order_by parameters. The result is cleaner code to write, but complex internals. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Searching for biblioitem attributes works on the API! 3. Sign off :-D Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #11 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 152767 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152767&action=edit Bug 33974: (follow-up) Adapt the orders endpoint In order to reduce the technical debt carried on the orders controller, and to highlight the decisions made on the prior patch, I adapted the list() orders controller using the new tools in town. The result is this endpoint can now embed bibio, without needing to have a custom piece of code. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/*.t => SUCCESS: Tests pass :-D Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152765|0 |1 is obsolete| | --- Comment #12 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 152983 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152983&action=edit Bug 33974: Add Koha::Biblios->api_query_fixer This patch adds the `api_query_fixer` method to the class, and adds tests to validate its behavior. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152766|0 |1 is obsolete| | --- Comment #13 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 152984 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152984&action=edit Bug 33974: Make biblioitem columns searchable in a generic way This patch makes biblioitem attributes be searchable on the biblios endpoint. It does so by using the new method in Koha::Biblios, and by adjusting objects.search(_rs) to accept a $query_fixer arrayref of functions to be applied to each query or order_by parameters. The result is cleaner code to write, but complex internals. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Searching for biblioitem attributes works on the API! 3. Sign off :-D Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #152767|0 |1 is obsolete| | --- Comment #14 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 152985 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152985&action=edit Bug 33974: (follow-up) Adapt the orders endpoint In order to reduce the technical debt carried on the orders controller, and to highlight the decisions made on the prior patch, I adapted the list() orders controller using the new tools in town. The result is this endpoint can now embed bibio, without needing to have a custom piece of code. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/*.t => SUCCESS: Tests pass :-D Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #15 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 152986 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152986&action=edit Bug 33974: (QA follow-up) Remove superflous import We don't actually need the Clone import.. it's not used in Biblios.pmt Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 152988 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152988&action=edit Bug 33974: (follow-up) biblionumber column needs special handling This patch makes a particular use case be handled correctly: i.e. no context is passed (e.g. 'biblio' explicitly) and the query is done against the `biblio_id` attribute. This results in the following DBIC error: [ERROR] GET /api/v1/biblios: unhandled exception (DBIx::Class::Exception)<<DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'biblionumber' in where clause is ambiguous at /kohadevbox/koha/Koha/Objects.pm line 394>> With this patch, this is no longuer the case :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #17 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #18 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- You broke t/db_dependent/Koha/REST/Plugin/Objects.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #19 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Jonathan Druart from comment #18)
You broke t/db_dependent/Koha/REST/Plugin/Objects.t
Can't use string ("+name,-country") as an ARRAY ref while "strict refs" in use at /kohadevbox/koha/Koha/R EST/Plugin/Objects.pm line 165. And lot of others. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #20 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 153104 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=153104&action=edit Bug 33974: (follow-up) _order_by is not always an arrayref The loop through the `_order_by` query parameter occurences introduced by this patchset was naive regarding the possible scenarios. When there's only one parameter passed, it shouldn't be expecting an arrayref, but a scalar. This patch deals with that in the simplest way. To test: 1. Run: $ ktd --shell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Tests are failing 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #21 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- API only addition.. choosing to backport to 23.05.x series. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.11.00 |23.11.00,23.05.02 released in| | Status|Pushed to master |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #22 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Thanks for all the hard work! Pushed to 23.05.x for the next release -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable Version(s)|23.11.00,23.05.02 |23.11.00,23.05.02,22.11.08 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 --- Comment #23 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Nice work everyone! Pushed to oldstable for 22.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |33556 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33556 [Bug 33556] $c->validation should be avoided -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33974 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Add ability to search |Add ability to search |biblios endpoint any |biblios endpoint using any |biblioitem attribute |biblioitem attribute -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org