Bug 30195 - Suggestion form in OPAC should use ISBN to FindDuplicate
Summary: Suggestion form in OPAC should use ISBN to FindDuplicate
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Thomas Klausner
QA Contact: Testopia
URL:
Keywords:
Depends on: 14973
Blocks:
  Show dependency treegraph
 
Reported: 2022-02-28 14:12 UTC by Thomas Klausner
Modified: 2023-12-28 20:42 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/679
Text to go in the release notes:
Version(s) released in:
22.11.00
Circulation function:


Attachments
Patch adding ISBN-search to purchase suggestions (5.58 KB, patch)
2022-03-15 15:30 UTC, Thomas Klausner
Details | Diff | Splinter Review
Bug 30195: Search by ISBN if it is provided in suggestion (5.57 KB, patch)
2022-05-12 11:44 UTC, Paul Derscheid
Details | Diff | Splinter Review
Added a missing semicolon to the added subtest and increased test count to 107 (1.03 KB, patch)
2022-05-12 11:51 UTC, Paul Derscheid
Details | Diff | Splinter Review
The patch passes the provided test cases under t/db_dependent/Suggestions.t as well as several manual tests using different existing ISBNs inside opac-suggestions.pl (1.17 KB, patch)
2022-05-12 12:01 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 30195: Search by ISBN if it is provided in suggestion (5.62 KB, patch)
2022-05-23 13:30 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 30195: Added a missing semicolon to the added subtest and increased test count to 107 (1.10 KB, patch)
2022-05-23 13:30 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 30195: Search by ISBN if it is provided in suggestion (5.70 KB, patch)
2022-05-31 07:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30195: Added a missing semicolon to the added subtest and increased test count to 107 (1.17 KB, patch)
2022-05-31 07:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30195: Remove second parameter for GetMarcFromKohaField (2.74 KB, patch)
2022-05-31 07:57 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Klausner 2022-02-28 14:12:32 UTC
MarcRecordFromNewSuggestion (in C4::::Suggestions, used eg in koha/opac-suggestions.pl) only converts title, author and itemtype from the $suggestion input into the marc record that is passed on to FindDuplicate. So if a patron enters an ISBN, this is not used for the duplicate search.

We will provide a patch implementing this feature in the next few days.
Comment 1 Thomas Klausner 2022-03-15 15:30:05 UTC
Created attachment 131731 [details] [review]
Patch adding ISBN-search to purchase suggestions

When a patron enters an ISBN/ISSN when suggesting a new purchase, the
ISBN is used to find duplicates. Title/Author are ignored (as patrons
might misspell them, and the ISBN provides a better way to find
duplicates)

Test Plan:
* in the OPAC, go to /cgi-bin/koha/opac-suggestions.pl
* Click "new purchase suggestion"
* Enter any title
* Enter an ISBN that exists in your library
* Click "Submit your suggestion"
-> A new purchase suggestion has been submitted

* Apply the patch!

* Again start a new purchase suggestion, enter any title and the
  duplicate ISBN, and Submit
* You should see the note "A similar document already exists: ..."

Please note that the title should not be required when entering an ISBN,
but as the list of required fields is managed via OPACSuggestionMandatoryFields
I fear that it's rather complicated to make title an optional required
field if isbn is provided.

I also added a simple non-DB test case to t/db_dependent/Suggestions.t
(in a subtest at the end), but could not actually run it as I haven't
gotten around to set up / try a testing Koha dev env...

Sponsored-by: Steiermärkische Landesbibliothek
Comment 2 Paul Derscheid 2022-05-12 11:44:29 UTC
Created attachment 134923 [details] [review]
Bug 30195: Search by ISBN if it is provided in suggestion

When a patron enters an ISBN/ISSN when suggesting a new purchase, the
ISBN is used to find duplicates. Title/Author are ignored (as patrons
might misspell them, and the ISBN provides a better way to find
duplicates)

Test Plan:
* in the OPAC, go to /cgi-bin/koha/opac-suggestions.pl
* Click "new purchase suggestion"
* Enter any title
* Enter an ISBN that exists in your library
* Click "Submit your suggestion"
-> A new purchase suggestion has been submitted

* Apply the patch!

* Again start a new purchase suggestion, enter any title and the
  duplicate ISBN, and Submit
* You should see the note "A similar document already exists: ..."

Please note that the title should not be required when entering an ISBN,
but as the list of required fields is managed via OPACSuggestionMandatoryFields
I fear that it's rather complicated to make title an optional required
field if isbn is provided.

I also added a simple non-DB test case to t/db_dependent/Suggestions.t
(in a subtest at the end), but could not actually run it as I haven't
gotten around to set up / try a testing Koha dev env...

Sponsored-by: Steiermärkische Landesbibliothek
Comment 3 Paul Derscheid 2022-05-12 11:51:10 UTC
Created attachment 134924 [details] [review]
Added a missing semicolon to the added subtest and increased test count to 107
Comment 4 Paul Derscheid 2022-05-12 12:01:44 UTC
Created attachment 134925 [details] [review]
The patch passes the provided test cases under t/db_dependent/Suggestions.t as well as several manual tests using different existing ISBNs inside opac-suggestions.pl

https://bugs.koha-community.org/show_bug.cgi?id=30195
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>


Current status: Signed Off
Comment 5 Victor Grousset/tuxayo 2022-05-15 19:37:53 UTC
There are some issues with the signoff.

- Each commit must be signed off. I don't know the simplest way, I used to do an interactive rebase with git but now I just signoff when applying the patches: `git git bz apply 30195 --signoff`
- It's clearer if comments are written in separate messages than the patches.
- The 2nd and 3rd attachment are actually a duplicate of the 2nd patch.
Comment 6 Paul Derscheid 2022-05-23 13:30:03 UTC
Created attachment 135264 [details] [review]
Bug 30195: Search by ISBN if it is provided in suggestion

When a patron enters an ISBN/ISSN when suggesting a new purchase, the
ISBN is used to find duplicates. Title/Author are ignored (as patrons
might misspell them, and the ISBN provides a better way to find
duplicates)

Test Plan:
* in the OPAC, go to /cgi-bin/koha/opac-suggestions.pl
* Click "new purchase suggestion"
* Enter any title
* Enter an ISBN that exists in your library
* Click "Submit your suggestion"
-> A new purchase suggestion has been submitted

* Apply the patch!

* Again start a new purchase suggestion, enter any title and the
  duplicate ISBN, and Submit
* You should see the note "A similar document already exists: ..."

Please note that the title should not be required when entering an ISBN,
but as the list of required fields is managed via OPACSuggestionMandatoryFields
I fear that it's rather complicated to make title an optional required
field if isbn is provided.

I also added a simple non-DB test case to t/db_dependent/Suggestions.t
(in a subtest at the end), but could not actually run it as I haven't
gotten around to set up / try a testing Koha dev env...

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

xbsoletes: 131731 - Patch adding ISBN-search to purchase suggestions

Current status: Signed Off
Comment 7 Paul Derscheid 2022-05-23 13:30:07 UTC
Created attachment 135265 [details] [review]
Bug 30195: Added a missing semicolon to the added subtest and increased test count to 107

https://bugs.koha-community.org/show_bug.cgi?id=30195
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 8 Jonathan Druart 2022-05-31 07:57:35 UTC
Created attachment 135474 [details] [review]
Bug 30195: Search by ISBN if it is provided in suggestion

When a patron enters an ISBN/ISSN when suggesting a new purchase, the
ISBN is used to find duplicates. Title/Author are ignored (as patrons
might misspell them, and the ISBN provides a better way to find
duplicates)

Test Plan:
* in the OPAC, go to /cgi-bin/koha/opac-suggestions.pl
* Click "new purchase suggestion"
* Enter any title
* Enter an ISBN that exists in your library
* Click "Submit your suggestion"
-> A new purchase suggestion has been submitted

* Apply the patch!

* Again start a new purchase suggestion, enter any title and the
  duplicate ISBN, and Submit
* You should see the note "A similar document already exists: ..."

Please note that the title should not be required when entering an ISBN,
but as the list of required fields is managed via OPACSuggestionMandatoryFields
I fear that it's rather complicated to make title an optional required
field if isbn is provided.

I also added a simple non-DB test case to t/db_dependent/Suggestions.t
(in a subtest at the end), but could not actually run it as I haven't
gotten around to set up / try a testing Koha dev env...

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2022-05-31 07:57:40 UTC
Created attachment 135475 [details] [review]
Bug 30195: Added a missing semicolon to the added subtest and increased test count to 107

https://bugs.koha-community.org/show_bug.cgi?id=30195
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Jonathan Druart 2022-05-31 07:57:44 UTC
Created attachment 135476 [details] [review]
Bug 30195: Remove second parameter for GetMarcFromKohaField

It does not longer exist.

Also fix a spelling (emtpy ==> empty)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Tomás Cohen Arazi (tcohen) 2022-06-25 14:26:58 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 12 Lucas Gass (lukeg) 2022-07-29 16:18:25 UTC
Enhancement will not be backported to the 22.05.x series unless requested.