Bug 14242 - Use ISBN-field to fill out purchase suggestions using Google Books API
Summary: Use ISBN-field to fill out purchase suggestions using Google Books API
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Chris Cormack
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 30758 30759 31274
  Show dependency treegraph
 
Reported: 2015-05-21 08:47 UTC by Viktor Sarge
Modified: 2022-08-01 13:21 UTC (History)
16 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch adds a system preference, OPACSuggestionAutoFill, which enables a feature within the OPAC Purchase Suggestions where a user can enter an ISBN and use a Google API to pull the relevant data and input it into the form.
Version(s) released in:
22.05.00


Attachments
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (16.54 KB, patch)
2015-08-26 20:34 UTC, Martin Stenberg
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (16.74 KB, patch)
2016-09-29 23:46 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 14242 Follow up, renaming syspref, there should be no changes (6.91 KB, patch)
2016-10-05 20:06 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 14242 Follow up (9.06 KB, patch)
2016-10-05 21:00 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 14242 Follow up - Change the icon to words (9.07 KB, patch)
2016-10-06 08:48 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 14242 - Strip - from ISBN for serach purposes (1.07 KB, patch)
2016-10-06 08:51 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (16.82 KB, patch)
2016-10-06 11:20 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 14242 Follow up, renaming syspref, there should be no changes (6.95 KB, patch)
2016-10-06 11:21 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 14242 Follow up - Change the icon to words (9.11 KB, patch)
2016-10-06 11:21 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 14242 - Strip - from ISBN for serach purposes (1.10 KB, patch)
2016-10-06 11:23 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (16.77 KB, patch)
2019-02-05 02:10 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242 Follow up, renaming syspref, there should be no changes (6.97 KB, patch)
2019-02-05 02:10 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242 Follow up - Change the icon to words (9.11 KB, patch)
2019-02-05 02:10 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242 - Strip - from ISBN for serach purposes (1.10 KB, patch)
2019-02-05 02:10 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Making js strings translateable (1.46 KB, patch)
2019-02-05 02:21 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (2.23 KB, patch)
2019-02-07 00:21 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (16.77 KB, patch)
2019-02-13 03:02 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (6.95 KB, patch)
2019-02-13 03:02 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.11 KB, patch)
2019-02-13 03:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.12 KB, patch)
2019-02-13 03:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (2.23 KB, patch)
2019-02-13 03:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (2.26 KB, patch)
2019-05-12 23:22 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.43 KB, patch)
2019-05-13 14:06 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (17.50 KB, patch)
2019-05-28 15:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (6.41 KB, patch)
2019-05-28 15:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.11 KB, patch)
2019-05-28 15:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.12 KB, patch)
2019-05-28 15:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (1.46 KB, patch)
2019-05-28 15:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.44 KB, patch)
2019-05-28 15:10 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (17.56 KB, patch)
2019-05-31 19:37 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (6.47 KB, patch)
2019-05-31 19:37 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.17 KB, patch)
2019-05-31 19:37 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.18 KB, patch)
2019-05-31 19:37 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (1.52 KB, patch)
2019-05-31 19:37 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.49 KB, patch)
2019-05-31 19:37 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (17.48 KB, patch)
2020-04-23 01:51 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (6.34 KB, patch)
2020-04-23 01:51 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.17 KB, patch)
2020-04-23 01:51 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.18 KB, patch)
2020-04-23 01:51 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (1.53 KB, patch)
2020-04-23 01:51 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.40 KB, patch)
2020-04-23 01:52 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment (11.03 KB, patch)
2020-04-23 01:52 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions (17.52 KB, patch)
2020-08-19 21:05 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (6.38 KB, patch)
2020-08-19 21:05 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.23 KB, patch)
2020-08-19 21:05 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.24 KB, patch)
2020-08-19 21:05 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (1.58 KB, patch)
2020-08-19 21:05 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.46 KB, patch)
2020-08-19 21:06 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment (11.07 KB, patch)
2020-08-19 21:06 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (16.91 KB, patch)
2020-09-16 03:00 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (5.60 KB, patch)
2020-09-16 03:00 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.23 KB, patch)
2020-09-16 03:01 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.24 KB, patch)
2020-09-16 03:01 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (1.58 KB, patch)
2020-09-16 03:01 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.46 KB, patch)
2020-09-16 03:01 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment (10.43 KB, patch)
2020-09-16 03:01 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Adding publication year hint and fix js translations (3.88 KB, patch)
2020-09-16 03:01 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (16.91 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (5.60 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.23 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.24 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (1.58 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.46 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment (10.43 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Adding publication year hint and fix js translations (3.88 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (QA follow-up) Fix buttons for new bootstrap version (1.45 KB, patch)
2020-09-21 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: Remove TT conditional from HTML tags (1.44 KB, patch)
2020-09-30 13:34 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (15.21 KB, patch)
2020-10-28 02:24 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow up) renaming syspref (5.67 KB, patch)
2020-10-28 02:24 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Change the icon to words (9.23 KB, patch)
2020-10-28 02:24 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes (1.24 KB, patch)
2020-10-28 02:24 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Translateable js strings, $raw filter (1.58 KB, patch)
2020-10-28 02:25 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.46 KB, patch)
2020-10-28 02:25 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment (10.62 KB, patch)
2020-10-28 02:25 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Adding publication year hint and fix js translations (3.90 KB, patch)
2020-10-28 02:25 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (QA follow-up) Fix buttons for new bootstrap version (1.45 KB, patch)
2020-10-28 02:25 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Remove TT conditional from HTML tags (1.44 KB, patch)
2020-10-28 02:25 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Remove well class, weird gap, fix clear form (3.98 KB, patch)
2020-10-28 02:25 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Move English strings out of JavaScript (2.41 KB, patch)
2020-11-05 20:05 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment (10.60 KB, patch)
2020-11-05 20:06 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Adding publication year hint and fix js translations (3.84 KB, patch)
2020-11-05 20:06 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (QA follow-up) Fix buttons for new bootstrap version (1.45 KB, patch)
2020-11-05 20:06 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Remove TT conditional from HTML tags (1.44 KB, patch)
2020-11-05 20:06 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Remove well class, weird gap, fix clear form (3.98 KB, patch)
2020-11-05 20:06 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (18.36 KB, patch)
2021-02-10 01:44 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (18.42 KB, patch)
2021-02-11 12:45 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Format copyright date before plugged into form (1.40 KB, patch)
2021-02-18 00:55 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Format copyright date before plugged into form (1.45 KB, patch)
2021-02-18 12:06 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (18.44 KB, patch)
2021-09-28 02:47 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Format copyright date before plugged into form (1.45 KB, patch)
2021-09-28 02:47 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN (1.46 KB, patch)
2021-09-28 02:47 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (18.48 KB, patch)
2022-03-02 02:21 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Format copyright date before plugged into form (1.45 KB, patch)
2022-03-02 02:22 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN (1.46 KB, patch)
2022-03-02 02:22 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: (follow-up) Clear all text input fields (907 bytes, patch)
2022-03-02 02:22 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (18.44 KB, patch)
2022-04-26 17:14 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Format copyright date before plugged into form (1.45 KB, patch)
2022-04-26 17:14 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN (1.51 KB, patch)
2022-04-26 17:14 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: (follow-up) Clear all text input fields (955 bytes, patch)
2022-04-26 17:14 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions (18.55 KB, patch)
2022-04-28 15:10 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Format copyright date before plugged into form (1.56 KB, patch)
2022-04-28 15:10 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN (1.62 KB, patch)
2022-04-28 15:10 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (follow-up) Clear all text input fields (1.05 KB, patch)
2022-04-28 15:10 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (QA follow-up) Fix alphatic order of sysprefs.sql (2.67 KB, patch)
2022-04-28 15:10 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14242: (QA follow-up) Update hint on suggestion form: 2016 > 2022 (2.50 KB, patch)
2022-04-28 15:10 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Viktor Sarge 2015-05-21 08:47:25 UTC
We suggest that the purchase suggestion in Opac could use the ISBN field to try and find the information for the other fileds. People will often not know how to fill out this form in a way that makes librarians smile :) Perhaps an Ajax request in the background and fronting this field a bit more as a starting point if we get this function on the road.
Comment 1 Martin Stenberg 2015-08-26 20:34:25 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2016-04-13 00:59:52 UTC
I think this is neat. I have a few issues:

- I think the submit button needs to be a text label. The icon doesn't really mean anything.
- I think the system preference should be more specific. Perhaps "OPACSuggestionAutoFill" ?
- The form sometimes tries to pull data based on an empty field:

  1. Fill in a valid ISBN (Book data is correctly loaded)
  2. Clear the ISBN from the field (Book data is correctly removed)
  3. Tab away from the empty ISBN field: Data is loaded for a title "ISBN 0-9690745-2-2"

And lastly, not a problem but a question: In my test copyright date is never populated. Is that a bug or a problem with Google Books' data?
Comment 3 Chris Cormack 2016-09-29 23:38:46 UTC
Going to work on this
Comment 4 Chris Cormack 2016-09-29 23:46:40 UTC Comment hidden (obsolete)
Comment 5 Chris Cormack 2016-09-29 23:48:27 UTC
Rebased to apply, now to work on the issues Owen noticed
Comment 6 Chris Cormack 2016-10-05 20:06:57 UTC Comment hidden (obsolete)
Comment 7 Chris Cormack 2016-10-05 20:44:16 UTC
> And lastly, not a problem but a question: In my test copyright date is never
> populated. Is that a bug or a problem with Google Books' data?

Yes, Google books API only hands back publication date, not copyright date.
Comment 8 Chris Cormack 2016-10-05 21:00:56 UTC Comment hidden (obsolete)
Comment 9 Marc Véron 2016-10-06 08:21:47 UTC
I like this feature very much, and it works nicely (with FF and IE).

However I have following problem: If I indicate an ISBN like it is printed in a book, like e.g. 978-1-78416-110-1, I get a "Sorry, not found"

I have to "normalize" the ISBEN to 9781784161101 in order get a result.

Is it possible to do such normalizing for the search - but leaving the content of the ISBN field "as is"?
Comment 10 Chris Cormack 2016-10-06 08:36:28 UTC
Yep, that is possible
Comment 11 Chris Cormack 2016-10-06 08:48:01 UTC Comment hidden (obsolete)
Comment 12 Chris Cormack 2016-10-06 08:51:19 UTC Comment hidden (obsolete)
Comment 13 Marc Véron 2016-10-06 08:58:38 UTC
Works great.
It is still "assigned".
I will have time to sign off in the afternoon.
Comment 14 Marc Véron 2016-10-06 11:20:09 UTC Comment hidden (obsolete)
Comment 15 Marc Véron 2016-10-06 11:21:01 UTC Comment hidden (obsolete)
Comment 16 Marc Véron 2016-10-06 11:21:59 UTC Comment hidden (obsolete)
Comment 17 Marc Véron 2016-10-06 11:23:15 UTC Comment hidden (obsolete)
Comment 18 Jonathan Druart 2016-11-01 11:28:15 UTC
Does it make sense to add the autofill.js to opac-bottom.js when it's only used once (in opac-suggestions.tt)?
Comment 19 Jonathan Druart 2017-01-02 11:22:52 UTC
(In reply to Jonathan Druart from comment #18)
> Does it make sense to add the autofill.js to opac-bottom.js when it's only
> used once (in opac-suggestions.tt)?

ping?
Comment 20 Chris Cormack 2017-01-03 04:23:55 UTC
It could be in its own include I guess, but in the opac-bottom.js is better than having it in the template itself.

One of things that are annoying about our template structure currently is the js is all over the place.
Comment 21 Jonathan Druart 2017-01-11 09:40:01 UTC
Chris,
Where does come from the autofill.js file (ie. do we need to add it to the license section of the about page)?

Moreover the 2 strings ("Undo" and "Search Google Books") are not translatable. They should be moved out from the js file.
Comment 22 Aleisha Amohia 2019-02-05 02:10:25 UTC Comment hidden (obsolete)
Comment 23 Aleisha Amohia 2019-02-05 02:10:31 UTC Comment hidden (obsolete)
Comment 24 Aleisha Amohia 2019-02-05 02:10:37 UTC Comment hidden (obsolete)
Comment 25 Aleisha Amohia 2019-02-05 02:10:45 UTC Comment hidden (obsolete)
Comment 26 Aleisha Amohia 2019-02-05 02:11:06 UTC
(In reply to Jonathan Druart from comment #21)
> Chris,
> Where does come from the autofill.js file (ie. do we need to add it to the
> license section of the about page)?
> 
> Moreover the 2 strings ("Undo" and "Search Google Books") are not
> translatable. They should be moved out from the js file.

Reabsed - working on these fixes now.
Comment 27 Aleisha Amohia 2019-02-05 02:21:52 UTC Comment hidden (obsolete)
Comment 28 Aleisha Amohia 2019-02-05 02:53:36 UTC
(In reply to Jonathan Druart from comment #21)
> Chris,
> Where does come from the autofill.js file (ie. do we need to add it to the
> license section of the about page)?
> 

Finding out about this.
Comment 29 Owen Leonard 2019-02-05 12:55:28 UTC
I think we want the $raw filter on this line:

     var FldsRequired = [[% mandatoryfields | $raw %]];

Otherwise it works well for me. A cursory search didn't return the origin of autofill.js but we do need to find out.
Comment 30 Aleisha Amohia 2019-02-07 00:21:55 UTC Comment hidden (obsolete)
Comment 31 Aleisha Amohia 2019-02-07 00:23:33 UTC
(In reply to Owen Leonard from comment #29)
> I think we want the $raw filter on this line:
> 
>      var FldsRequired = [[% mandatoryfields | $raw %]];

Fixed this in latest patch

> 
> Otherwise it works well for me. A cursory search didn't return the origin of
> autofill.js but we do need to find out.

I did a search too and couldn't find anything. Chris is away at the moment so may be a while before he can let us know.
Comment 32 Owen Leonard 2019-02-10 20:37:52 UTC
Could you please also look at the warnings the QA tool raises?
Comment 33 Aleisha Amohia 2019-02-13 03:02:37 UTC Comment hidden (obsolete)
Comment 34 Aleisha Amohia 2019-02-13 03:02:52 UTC Comment hidden (obsolete)
Comment 35 Aleisha Amohia 2019-02-13 03:03:02 UTC Comment hidden (obsolete)
Comment 36 Aleisha Amohia 2019-02-13 03:03:11 UTC Comment hidden (obsolete)
Comment 37 Aleisha Amohia 2019-02-13 03:03:18 UTC Comment hidden (obsolete)
Comment 38 Aleisha Amohia 2019-02-13 03:05:34 UTC
(In reply to Owen Leonard from comment #32)
> Could you please also look at the warnings the QA tool raises?

QA tool complained about naming of the patches so I have fixed that up. ready for testing
Comment 39 Katrin Fischer 2019-04-03 21:01:42 UTC
Hi Aleisha,

sorry, the patch no longer applies:

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions
Applying: Bug 14242: (follow up) renaming syspref
Applying: Bug 14242: (follow-up) Change the icon to words
Applying: Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes
Applying: Bug 14242: (follow-up) Translateable js strings, $raw filter
error: sha1 information is lacking or useless (koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt).
error: could not build fake ancestor
Patch failed at 0001 Bug 14242: (follow-up) Translateable js strings, $raw filter
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-14242-follow-up-Translateable-js-strings-raw-f-RD9rNt.patch
Comment 40 Aleisha Amohia 2019-05-06 02:15:33 UTC
It applies cleanly for me on master. Can you please retry?
Comment 41 Owen Leonard 2019-05-06 13:59:13 UTC
Sorry Aleisha but I get the same error when trying to apply the patches.
Comment 42 Aleisha Amohia 2019-05-12 23:22:04 UTC Comment hidden (obsolete)
Comment 43 Aleisha Amohia 2019-05-12 23:23:25 UTC
Rebased.

I emailed Martin (the original patch author) about that autofill.js license and haven't heard back. Did a few searches and wasn't able to find it existing elsewhere either.
Comment 44 Owen Leonard 2019-05-13 13:57:30 UTC
(In reply to Aleisha Amohia from comment #43)

> Did a few searches and wasn't able to find it
> existing elsewhere either.

I would be nice to get confirmation, but I think we could go forward on the assumption that Martin is the author of the plugin.
Comment 45 Owen Leonard 2019-05-13 14:06:11 UTC Comment hidden (obsolete)
Comment 46 Maryse Simard 2019-05-24 19:51:29 UTC
Patch doesn't apply

Applying: Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions
Using index info to reconstruct a base tree...
M	installer/data/mysql/sysprefs.sql
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
M	koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
M	koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
CONFLICT (content): Merge conflict in koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
Auto-merging installer/data/mysql/sysprefs.sql
error: Failed to merge in the changes.
Patch failed at 0001 Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions
Comment 47 Owen Leonard 2019-05-28 15:09:32 UTC Comment hidden (obsolete)
Comment 48 Owen Leonard 2019-05-28 15:09:39 UTC Comment hidden (obsolete)
Comment 49 Owen Leonard 2019-05-28 15:09:46 UTC Comment hidden (obsolete)
Comment 50 Owen Leonard 2019-05-28 15:09:54 UTC Comment hidden (obsolete)
Comment 51 Owen Leonard 2019-05-28 15:09:59 UTC Comment hidden (obsolete)
Comment 52 Owen Leonard 2019-05-28 15:10:07 UTC Comment hidden (obsolete)
Comment 53 Maryse Simard 2019-05-31 19:37:01 UTC Comment hidden (obsolete)
Comment 54 Maryse Simard 2019-05-31 19:37:07 UTC Comment hidden (obsolete)
Comment 55 Maryse Simard 2019-05-31 19:37:13 UTC Comment hidden (obsolete)
Comment 56 Maryse Simard 2019-05-31 19:37:19 UTC Comment hidden (obsolete)
Comment 57 Maryse Simard 2019-05-31 19:37:24 UTC Comment hidden (obsolete)
Comment 58 Maryse Simard 2019-05-31 19:37:29 UTC Comment hidden (obsolete)
Comment 59 Katrin Fischer 2019-06-02 15:12:35 UTC
First of all: I like this!

Some findings while testing:

1) Use the TT Asset plugin instead:

[% IF ( Koha.Preference('OPACSuggestionAutoFill') ) %]
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/autofill.js"></script>
[% END %]

2) Style question :) (non-blocker)

[% IF NOT Koha.Preference( 'OPACSuggestionAutoFill' ) %]

Why not UNLESS? Just hadn't seen this before!

3) The jQuery plugin 

Wondering about the Javascript file included here. I think right now it's the biggest issue for me.

It's labelled "jquery autofill plugin", but it appears to be unrelated to the existing one or has been changed so much I am not seeing the relationship anymore:

https://plugins.jquery.com/autofill/

Maybe this should be renamed as it's now a plugin dealing with the Google API specifically and no longer a generic one and the note be removed to avoid confusion?

I also think that Jonathan's comment 18 is still valid. If we only need it on one page, it would make sense to only include it there.

I think we also really need to figure out the license situation here. My guess right now is that Martin is the author. 

We don't usually add the authors/licenses for js files written for Koha that live in bootstrap/js, so maybe this is mostly about removing the confusing comment/making sure this was written for Koha and is not a general plugin.

Adding Owen.

4) Pref description should mention this is about the suggestion form :)

5) It would be nice if the error message didn't appear as another button (and if the Google Search button was more clearly formatted as a button) (non-blocker)(In reply to Chris Cormack from comment #7)

6) Copyright date / Publication year
> > And lastly, not a problem but a question: In my test copyright date is never
> > populated. Is that a bug or a problem with Google Books' data?
> 
> Yes, Google books API only hands back publication date, not copyright date.

I think it might make sense to use this in the field. While technically not the same, we use both in Koha often for the same thing. This is one of the forms using copyright date, but in other places it will be publication year. And it all goes into the same fields when creating a record from it. The year would be helpful I think. (I'd even go as far to say we should relabel the form, because I doubt copyright date has meaning to users)
Comment 60 Katrin Fischer 2019-06-02 15:14:02 UTC
> ..., because I doubt copyright date has meaning to users)

I meant: people! :)
Comment 61 Aleisha Amohia 2020-04-23 01:51:41 UTC Comment hidden (obsolete)
Comment 62 Aleisha Amohia 2020-04-23 01:51:45 UTC Comment hidden (obsolete)
Comment 63 Aleisha Amohia 2020-04-23 01:51:50 UTC Comment hidden (obsolete)
Comment 64 Aleisha Amohia 2020-04-23 01:51:55 UTC Comment hidden (obsolete)
Comment 65 Aleisha Amohia 2020-04-23 01:51:59 UTC Comment hidden (obsolete)
Comment 66 Aleisha Amohia 2020-04-23 01:52:04 UTC Comment hidden (obsolete)
Comment 67 Aleisha Amohia 2020-04-23 01:52:08 UTC Comment hidden (obsolete)
Comment 68 ByWater Sandboxes 2020-08-19 21:05:44 UTC Comment hidden (obsolete)
Comment 69 ByWater Sandboxes 2020-08-19 21:05:47 UTC Comment hidden (obsolete)
Comment 70 ByWater Sandboxes 2020-08-19 21:05:50 UTC Comment hidden (obsolete)
Comment 71 ByWater Sandboxes 2020-08-19 21:05:53 UTC Comment hidden (obsolete)
Comment 72 ByWater Sandboxes 2020-08-19 21:05:57 UTC Comment hidden (obsolete)
Comment 73 ByWater Sandboxes 2020-08-19 21:06:00 UTC Comment hidden (obsolete)
Comment 74 ByWater Sandboxes 2020-08-19 21:06:03 UTC Comment hidden (obsolete)
Comment 75 Lisette Scheer 2020-08-19 21:09:24 UTC
Worked as intended. 

ISBN 978-1-78416-110-1 did import the date as 2016-09-22 and the box only allows you to type in 4 characters. It would not let me submit the form with the date that it autofilled, which might cause some patron confusion. 

It only said "Please match the requested format" but doesn't tell you what the requested format is. Functionally it worked great, that was the only odd thing I noticed.
Comment 76 Katrin Fischer 2020-08-22 12:51:15 UTC
1) Copyright date changed

The patch set changes the size on coyprightdate and add a pattern check:

-                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" max
length="4" value="[% copyrightdate | html %]" required="required" />
+                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="10" ma
xlength="4" value="[% copyrightdate | html %]" required="required" />

I am not sure about this one, especially since it causes issues as Lisette noted on comment#75. The message is just: Please match the requested format. The label and the check also don't match and add a bit to the confusion - we ask for "date" but expect "year". 

I think adding a hint on the field with the expected format or improving the validation feedback, would be a worthwhile addition here to complement the new check.

I am not sure if we can agree on this, but maybe we can discuss renaming Copyright date to publication year? I think this is the only context we use this specific term. (not blocker, asking for opinion and can file separately)

2) Translations in .js files

This trick is no longer necessary, you can now wrap translations in js files in __( ) to make them translatable. As Owen is just working hard on switching all the old constructs to the new one, we should avoid adding more work for him. Can you please change that?

+    var MSG_UNDO_AUTOFILL_SUGGESTION =  _("Undo");
+    var MSG_SEARCH_GOOGLE_BOOKS = _("Search Google Books");

3) Undo

Not blocker, but wondering if "Clear form" or similar would work a bit better in this case and be more specific for translations.

Failing for 2) and a missing hint on 1). Really close and works nicely already, hope to see this come back soon!
Comment 77 Katrin Fischer 2020-08-22 12:53:27 UTC
Spotted something else:

self.$error.html(_('Sorry, nothing found.'));

Is not translatable (in .js). Just needs another _
Comment 78 Aleisha Amohia 2020-09-16 03:00:48 UTC Comment hidden (obsolete)
Comment 79 Aleisha Amohia 2020-09-16 03:00:54 UTC Comment hidden (obsolete)
Comment 80 Aleisha Amohia 2020-09-16 03:01:01 UTC Comment hidden (obsolete)
Comment 81 Aleisha Amohia 2020-09-16 03:01:06 UTC Comment hidden (obsolete)
Comment 82 Aleisha Amohia 2020-09-16 03:01:12 UTC Comment hidden (obsolete)
Comment 83 Aleisha Amohia 2020-09-16 03:01:17 UTC Comment hidden (obsolete)
Comment 84 Aleisha Amohia 2020-09-16 03:01:22 UTC Comment hidden (obsolete)
Comment 85 Aleisha Amohia 2020-09-16 03:01:29 UTC Comment hidden (obsolete)
Comment 86 Katrin Fischer 2020-09-20 22:46:44 UTC
The follow-up is not dramatic, keeping signed off status here.
Comment 87 Katrin Fischer 2020-09-21 20:44:00 UTC Comment hidden (obsolete)
Comment 88 Katrin Fischer 2020-09-21 20:44:07 UTC Comment hidden (obsolete)
Comment 89 Katrin Fischer 2020-09-21 20:44:13 UTC Comment hidden (obsolete)
Comment 90 Katrin Fischer 2020-09-21 20:44:19 UTC Comment hidden (obsolete)
Comment 91 Katrin Fischer 2020-09-21 20:44:25 UTC Comment hidden (obsolete)
Comment 92 Katrin Fischer 2020-09-21 20:44:33 UTC Comment hidden (obsolete)
Comment 93 Katrin Fischer 2020-09-21 20:44:41 UTC Comment hidden (obsolete)
Comment 94 Katrin Fischer 2020-09-21 20:44:47 UTC Comment hidden (obsolete)
Comment 95 Katrin Fischer 2020-09-21 20:44:57 UTC Comment hidden (obsolete)
Comment 96 Jonathan Druart 2020-09-30 13:34:29 UTC Comment hidden (obsolete)
Comment 97 Jonathan Druart 2020-09-30 13:35:34 UTC
2 minor ergonomic questions:
1. What is the purpose of the "well" class?

2. Is the extra space between the 2 first inputs expected?
https://snipboard.io/7kYfJW.jpg
Comment 98 Jonathan Druart 2020-09-30 13:48:36 UTC
3. Search for "foo", then search for "bar"
Clear form
=> It restores values from "foo"
Comment 99 Aleisha Amohia 2020-10-28 02:24:39 UTC Comment hidden (obsolete)
Comment 100 Aleisha Amohia 2020-10-28 02:24:45 UTC Comment hidden (obsolete)
Comment 101 Aleisha Amohia 2020-10-28 02:24:50 UTC Comment hidden (obsolete)
Comment 102 Aleisha Amohia 2020-10-28 02:24:56 UTC Comment hidden (obsolete)
Comment 103 Aleisha Amohia 2020-10-28 02:25:02 UTC Comment hidden (obsolete)
Comment 104 Aleisha Amohia 2020-10-28 02:25:13 UTC Comment hidden (obsolete)
Comment 105 Aleisha Amohia 2020-10-28 02:25:22 UTC Comment hidden (obsolete)
Comment 106 Aleisha Amohia 2020-10-28 02:25:28 UTC Comment hidden (obsolete)
Comment 107 Aleisha Amohia 2020-10-28 02:25:34 UTC Comment hidden (obsolete)
Comment 108 Aleisha Amohia 2020-10-28 02:25:39 UTC Comment hidden (obsolete)
Comment 109 Aleisha Amohia 2020-10-28 02:25:45 UTC Comment hidden (obsolete)
Comment 110 Séverine Queune 2020-11-03 14:53:55 UTC
Applying: Bug 14242: (follow-up) Move English strings out of JavaScript
fatal: sha1 information is lacking or useless (koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 14242: (follow-up) Move English strings out of JavaScript
Comment 111 Aleisha Amohia 2020-11-05 20:05:55 UTC Comment hidden (obsolete)
Comment 112 Aleisha Amohia 2020-11-05 20:06:00 UTC Comment hidden (obsolete)
Comment 113 Aleisha Amohia 2020-11-05 20:06:05 UTC Comment hidden (obsolete)
Comment 114 Aleisha Amohia 2020-11-05 20:06:10 UTC Comment hidden (obsolete)
Comment 115 Aleisha Amohia 2020-11-05 20:06:15 UTC Comment hidden (obsolete)
Comment 116 Aleisha Amohia 2020-11-05 20:06:20 UTC Comment hidden (obsolete)
Comment 117 Victor Grousset/tuxayo 2020-11-09 19:38:55 UTC
First test plan needs to update the syspref name:
OPACAutoFill => OPACSuggestionAutoFill


978-1-250-23723-1 works and 978-2-89596-254-0 doesn't when they seems to both be found in books.google.com
Is there something wrong about the ISBN or is it a bug?

I finally managed to reproduce the bug that I found yesterday.
1. Paste an ISBN, e.g. 978-1451697384
2. Hit tab
3. Paste another ISBN, e.g. 978-1-250-23723-1
4. Hit tab
5. Clear field
6. The data from the find ISBN came back
Comment 118 Victor Grousset/tuxayo 2020-11-09 19:54:49 UTC
Some findings that will be useful for QA
The request to googleapis.com is done from the browser directly. IIUC the fact that it's due to Koha means that Koha (and thus the library) processes personal data by sending it to Google. Which means the library should (someplaces legally or just by best practices) inform the patrons in the list of all personal data processings.

Which personal data?
- IP address
- user agent
- Accept-Language
- ISBN search

Which is enough to identify someone/a device and for example know some of their reading preferences and use that in advertising.

That likely means that it should be avoided unless it's absolutely necessary. One solution could be for Koha to be a proxy for the requests.
Is there an example of Koha acting as a proxy to an external service?

Since it's an old bug, would me creating a followup bug about proxying the query be enough?

And meanwhile, should a small warning in the syspref description be added? So the library can update their documents about their personal data processing.

Something like «Personal data processing: Google will receive the following data: IP address, OS name, web browser version, prefered languages, and the ISBNs of the books suggested.»

A more experienced English speaker might find a better phrasing.
Comment 119 Victor Grousset/tuxayo 2020-11-09 20:57:44 UTC
> 2. Clear the ISBN from the field (Book data is correctly removed)

I can't get the data to be removed after just clearing the ISBN and tabbing. I feel that I might be misunderstanding this.

BTW, the Standard number field can search also for titles, that's a neat hidden feature.
Comment 120 Aleisha Amohia 2021-02-10 01:44:27 UTC
Created attachment 116620 [details] [review]
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions

Add new jQuery plugin "autofill" which transforms selected element(s) into
search fields for Google Books API and automatically fills requested fields with
search result.

Use in OPAC purchase suggestions to automatically fill out fields when entering
ISBN-number.

Test plan:
1. Run updatedatabase.pl
2. Enable system precference "OPACSuggestionAutoFill"
3. Log into OPAC and go to purchase suggestions page
4. Write a valid ISBN (such as 0-9690745-2-2 or 978-1-78416-110-1) into the ISBN
   field and press the edit icon next to the field, or unfocus the field.
5. Title, Author, Publisher and Item Type fields should now be filled
   automatically.
6. Press "undo" to undo - should restore all fields that the API pull filled to empty
Comment 121 Aleisha Amohia 2021-02-10 01:45:37 UTC
(In reply to Victor Grousset/tuxayo from comment #119)
> > 2. Clear the ISBN from the field (Book data is correctly removed)
> 
> I can't get the data to be removed after just clearing the ISBN and tabbing.
> I feel that I might be misunderstanding this.
> 
Okay, hoping I fixed this in the latest patch! I've also squashed all of the follow-ups so this will need another signoff.
Comment 122 Owen Leonard 2021-02-11 12:45:22 UTC
Created attachment 116712 [details] [review]
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions

Add new jQuery plugin "autofill" which transforms selected element(s)
into search fields for Google Books API and automatically fills
requested fields with search result.

Use in OPAC purchase suggestions to automatically fill out fields when
entering ISBN-number.

Test plan:
1. Run updatedatabase.pl
2. Enable system precference "OPACSuggestionAutoFill"
3. Log into OPAC and go to purchase suggestions page
4. Write a valid ISBN (such as 0-9690745-2-2 or 978-1-78416-110-1) into
   the ISBN field and press the edit icon next to the field, or unfocus
   the field.
5. Title, Author, Publisher and Item Type fields should now be filled
   automatically.
6. Press "undo" to undo - should restore all fields that the API pull
   filled to empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 123 Katrin Fischer 2021-02-17 20:26:50 UTC
Hi Aleisha,
I tested with "lerening perl" and the year got filled with "2011-06-16", but this won't store. Can we edit it to be 2011 so the form can be saved without further editing?
Comment 124 Katrin Fischer 2021-02-17 20:27:09 UTC
(In reply to Katrin Fischer from comment #123)
> Hi Aleisha,
> I tested with "lerening perl" and the year got filled with "2011-06-16", but
> this won't store. Can we edit it to be 2011 so the form can be saved without
> further editing?

Learning Perl actually... without all the typos!
Comment 125 Aleisha Amohia 2021-02-18 00:55:16 UTC
Created attachment 116968 [details] [review]
Bug 14242: (follow-up) Format copyright date before plugged into form

This patch formats the copyright date so that only the year shows before
plugging the formatted version into the form.
Comment 126 Owen Leonard 2021-02-18 12:06:34 UTC
Created attachment 116989 [details] [review]
Bug 14242: (follow-up) Format copyright date before plugged into form

This patch formats the copyright date so that only the year shows before
plugging the formatted version into the form.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 127 Victor Grousset/tuxayo 2021-03-28 21:53:35 UTC
Tried to QA, not at ease enough with the code, have to pass.

QA person: comment 118 have some feedback about the personal processing involved here.
Comment 128 Victor Grousset/tuxayo 2021-03-31 10:47:04 UTC
a.
That's odd, I'm getting the autofill even with OPACSuggestionAutoFill off.


b.
> press the edit icon next to the field

Where is the icon actually? Is that the Search Google Books button?

c.
Maybe an issue
1. fill "foo"
2. click on search
3. quickly before it loads, fill "bar" and click search
4. wait for the result to load
5. click on clear
6. the result for foo is restored
7. it's now the default value when restoring even after doing other searches


d.
Found something else that should be related and easy to reproduce
1. Fill a valid ISBN
2. Spam the search button during a few seconds
3. Wait for data to load multiple time
4. clear
5. data still there

e.
When clearing the form, should the ISBN also be cleared?


f.
I can still reproduce the issue from comment 117
1. Paste an ISBN, e.g. 978-1451697384
2. Hit tab
3. Paste another ISBN, e.g. 978-1-250-23723-1
4. Hit tab
5. Clear field
6. The data from the first ISBN came back
Comment 129 Aleisha Amohia 2021-09-28 02:47:03 UTC
Created attachment 125380 [details] [review]
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions

Add new jQuery plugin "autofill" which transforms selected element(s)
into search fields for Google Books API and automatically fills
requested fields with search result.

Use in OPAC purchase suggestions to automatically fill out fields when
entering ISBN-number.

Test plan:
1. Run updatedatabase.pl
2. Enable system precference "OPACSuggestionAutoFill"
3. Log into OPAC and go to purchase suggestions page
4. Write a valid ISBN (such as 0-9690745-2-2 or 978-1-78416-110-1) into
   the ISBN field and click the 'search google books' button, or unfocus
   the field.
5. Title, Author, Publisher, publication year and Item Type fields should now be filled
   automatically.
6. Press "clear form" to undo - should restore all fields that the API pull
   filled to empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 130 Aleisha Amohia 2021-09-28 02:47:10 UTC
Created attachment 125381 [details] [review]
Bug 14242: (follow-up) Format copyright date before plugged into form

This patch formats the copyright date so that only the year shows before
plugging the formatted version into the form.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 131 Aleisha Amohia 2021-09-28 02:47:16 UTC
Created attachment 125382 [details] [review]
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN
Comment 132 Aleisha Amohia 2021-09-28 02:49:11 UTC
(In reply to Victor Grousset/tuxayo from comment #128)
> a.
> That's odd, I'm getting the autofill even with OPACSuggestionAutoFill off.
> 


Fixed in latest follow-up
> 
> b.
> > press the edit icon next to the field
> 
> Where is the icon actually? Is that the Search Google Books button?

A step from an old test plan - yes it is the search button, I've reworded the test plan.

> 
> c.
> Maybe an issue
> 
> 
> d.
> Found something else that should be related and easy to reproduce
> 
> e.
> When clearing the form, should the ISBN also be cleared?

I've added a follow-up to clear the ISBN.

> 
> 
> f.
> I can still reproduce the issue from comment 117

I was not able to reproduce c, d or f. 

Can you please re-test?
Comment 133 Victor Grousset/tuxayo 2021-11-04 23:45:26 UTC
I can still reproduce easily comment 128 's *f* test on Firefox and Chromium.

I can reproduce c. using Chromium, going in the network dev tab, network conditions (wireless icon), network throttling, adding a custom profile with 2 seconds of latency.

That 2 second latency allows me to reproduce d. also.
Comment 134 Victor Grousset/tuxayo 2021-11-05 03:13:40 UTC
and issue a. is fixed :D

thanks for the other fixes
Comment 135 Aleisha Amohia 2022-03-02 02:21:57 UTC
Created attachment 131219 [details] [review]
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions

Add new jQuery plugin "autofill" which transforms selected element(s)
into search fields for Google Books API and automatically fills
requested fields with search result.

Use in OPAC purchase suggestions to automatically fill out fields when
entering ISBN-number.

Test plan:
1. Run updatedatabase.pl
2. Enable system precference "OPACSuggestionAutoFill"
3. Log into OPAC and go to purchase suggestions page
4. Write a valid ISBN (such as 0-9690745-2-2 or 978-1-78416-110-1) into
   the ISBN field and click the 'search google books' button, or unfocus
   the field.
5. Title, Author, Publisher, publication year and Item Type fields should now be filled
   automatically.
6. Press "clear form" to undo - should restore all fields that the API pull
   filled to empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 136 Aleisha Amohia 2022-03-02 02:22:04 UTC
Created attachment 131220 [details] [review]
Bug 14242: (follow-up) Format copyright date before plugged into form

This patch formats the copyright date so that only the year shows before
plugging the formatted version into the form.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 137 Aleisha Amohia 2022-03-02 02:22:10 UTC
Created attachment 131221 [details] [review]
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN
Comment 138 Aleisha Amohia 2022-03-02 02:22:17 UTC
Created attachment 131222 [details] [review]
Bug 14242: (follow-up) Clear all text input fields
Comment 139 Aleisha Amohia 2022-03-02 02:22:57 UTC
(In reply to Victor Grousset/tuxayo from comment #133)
> I can still reproduce easily comment 128 's *f* test on Firefox and Chromium.
> 
> I can reproduce c. using Chromium, going in the network dev tab, network
> conditions (wireless icon), network throttling, adding a custom profile with
> 2 seconds of latency.
> 
> That 2 second latency allows me to reproduce d. also.

Hopefully latest follow-up addresses the remaining issues!
Comment 140 Owen Leonard 2022-04-26 17:14:39 UTC
Created attachment 133985 [details] [review]
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions

Add new jQuery plugin "autofill" which transforms selected element(s)
into search fields for Google Books API and automatically fills
requested fields with search result.

Use in OPAC purchase suggestions to automatically fill out fields when
entering ISBN-number.

Test plan:
1. Run updatedatabase.pl
2. Enable system precference "OPACSuggestionAutoFill"
3. Log into OPAC and go to purchase suggestions page
4. Write a valid ISBN (such as 0-9690745-2-2 or 978-1-78416-110-1) into
   the ISBN field and click the 'search google books' button, or unfocus
   the field.
5. Title, Author, Publisher, publication year and Item Type fields should now be filled
   automatically.
6. Press "clear form" to undo - should restore all fields that the API pull
   filled to empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 141 Owen Leonard 2022-04-26 17:14:46 UTC
Created attachment 133986 [details] [review]
Bug 14242: (follow-up) Format copyright date before plugged into form

This patch formats the copyright date so that only the year shows before
plugging the formatted version into the form.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 142 Owen Leonard 2022-04-26 17:14:52 UTC
Created attachment 133987 [details] [review]
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 143 Owen Leonard 2022-04-26 17:14:59 UTC
Created attachment 133988 [details] [review]
Bug 14242: (follow-up) Clear all text input fields

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 144 Katrin Fischer 2022-04-28 15:10:12 UTC
Created attachment 134273 [details] [review]
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions

Add new jQuery plugin "autofill" which transforms selected element(s)
into search fields for Google Books API and automatically fills
requested fields with search result.

Use in OPAC purchase suggestions to automatically fill out fields when
entering ISBN-number.

Test plan:
1. Run updatedatabase.pl
2. Enable system precference "OPACSuggestionAutoFill"
3. Log into OPAC and go to purchase suggestions page
4. Write a valid ISBN (such as 0-9690745-2-2 or 978-1-78416-110-1) into
   the ISBN field and click the 'search google books' button, or unfocus
   the field.
5. Title, Author, Publisher, publication year and Item Type fields should now be filled
   automatically.
6. Press "clear form" to undo - should restore all fields that the API pull
   filled to empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 145 Katrin Fischer 2022-04-28 15:10:21 UTC
Created attachment 134274 [details] [review]
Bug 14242: (follow-up) Format copyright date before plugged into form

This patch formats the copyright date so that only the year shows before
plugging the formatted version into the form.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 146 Katrin Fischer 2022-04-28 15:10:29 UTC
Created attachment 134275 [details] [review]
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 147 Katrin Fischer 2022-04-28 15:10:37 UTC
Created attachment 134276 [details] [review]
Bug 14242: (follow-up) Clear all text input fields

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 148 Katrin Fischer 2022-04-28 15:10:45 UTC
Created attachment 134277 [details] [review]
Bug 14242: (QA follow-up) Fix alphatic order of sysprefs.sql

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 149 Katrin Fischer 2022-04-28 15:10:53 UTC
Created attachment 134278 [details] [review]
Bug 14242: (QA follow-up) Update hint on suggestion form: 2016 > 2022

First patches were written in 2015 - so I think we can safely
move the hint closer to the present.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 150 Fridolin Somers 2022-05-03 21:27:15 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 151 Victor Grousset/tuxayo 2022-05-12 20:08:00 UTC
We still have to do something about this new personal data processing sent to one of the worst surveillance capitalism company. 

See comment 118 for the analysis and possible actions.
At minimal to be compliant with GDPR and other regulations and good practices.

I don't know if there was a way to ensure that the QA person would have found this comment that ended up buried.
Comment 152 Katrin Fischer 2022-05-14 15:04:00 UTC
I indeed missed your comment Victor. When testing this I made sure that nothing would happen/be sent to Google, while the feature is not active.

A note on the system preference including information about what is sent to Google would make sense. Even better if we could make it so the request is not from the browser, but handled server side. 

I've filed 2 bugs:
* Bug 30758 - Handle Google Books API requests for OPACSuggestionAutoFill on server side
* Bug 30759 - Add hint about the data that is sent via the Google Books API to OPACSuggestionAutoFill
Comment 153 Jonathan Druart 2022-08-01 13:21:18 UTC
Please fix bug 31274 ASAP.