Description
Viktor Sarge
2015-05-21 08:47:25 UTC
Created attachment 42002 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values 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? Going to work on this Created attachment 55949 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Rebased to apply, now to work on the issues Owen noticed Created attachment 56061 [details] [review] Bug 14242 Follow up, renaming syspref, there should be no changes OPACAutoFill -> OPACSuggestionAutoFill
> 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.
Created attachment 56062 [details] [review] Bug 14242 Follow up Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done 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"? Yep, that is possible Created attachment 56070 [details] [review] Bug 14242 Follow up - Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Created attachment 56071 [details] [review] Bug 14242 - Strip - from ISBN for serach purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Works great. It is still "assigned". I will have time to sign off in the afternoon. Created attachment 56072 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Created attachment 56073 [details] [review] Bug 14242 Follow up, renaming syspref, there should be no changes OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Created attachment 56074 [details] [review] Bug 14242 Follow up - Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Created attachment 56075 [details] [review] Bug 14242 - Strip - from ISBN for serach purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Does it make sense to add the autofill.js to opac-bottom.js when it's only used once (in opac-suggestions.tt)? (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? 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. 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. Created attachment 84760 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Created attachment 84761 [details] [review] Bug 14242 Follow up, renaming syspref, there should be no changes OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Created attachment 84762 [details] [review] Bug 14242 Follow up - Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Created attachment 84763 [details] [review] Bug 14242 - Strip - from ISBN for serach purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> (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. Created attachment 84764 [details] [review] Bug 14242: (follow-up) Making js strings translateable Sponsored-by: Region Halland (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. 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. Created attachment 84840 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland (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. Could you please also look at the warnings the QA tool raises? Created attachment 85031 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Created attachment 85032 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Created attachment 85033 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Created attachment 85034 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Created attachment 85035 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland (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 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 It applies cleanly for me on master. Can you please retry? Sorry Aleisha but I get the same error when trying to apply the patches. Created attachment 89643 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland 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. (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. Created attachment 89662 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. 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 Created attachment 90157 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Created attachment 90158 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Created attachment 90159 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Created attachment 90160 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Created attachment 90161 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland Created attachment 90162 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Created attachment 90250 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 90251 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 90252 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 90253 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 90254 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 90255 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> 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) > ..., because I doubt copyright date has meaning to users)
I meant: people! :)
Created attachment 103527 [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 automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 103528 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 103529 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 103530 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 103531 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 103532 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Created attachment 103533 [details] [review] Bug 14242: Styling of buttons, get copyright date, fixing plugin comment And other code-y bits. Addressing comments in Comment 59. Sponsored-by: Catalyst IT Created attachment 108695 [details] [review] Bug 14242: Use ISBN-field to automaticly fill out purchase suggestions Add new jQuery plugin "autofill" which transforms selected element(s) into search fields for Google Books API and automaticly fills requested fields with search result. Use in OPAC purchase suggestions to automaticly fill out fields when entering ISBN-number. Test plan: 1. Run updatedatabase.pl 2. Enable system precference "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 108696 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 108697 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 108698 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 108699 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 108700 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 108701 [details] [review] Bug 14242: Styling of buttons, get copyright date, fixing plugin comment And other code-y bits. Addressing comments in Comment 59. Sponsored-by: Catalyst IT Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> 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. 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! Spotted something else: self.$error.html(_('Sorry, nothing found.')); Is not translatable (in .js). Just needs another _ Created attachment 110141 [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 "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110142 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110143 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110144 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110145 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110146 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110147 [details] [review] Bug 14242: Styling of buttons, get copyright date, fixing plugin comment And other code-y bits. Addressing comments in Comment 59. Sponsored-by: Catalyst IT Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110148 [details] [review] Bug 14242: (follow-up) Adding publication year hint and fix js translations The follow-up is not dramatic, keeping signed off status here. Created attachment 110493 [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 "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110494 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110495 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110496 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110497 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110498 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110499 [details] [review] Bug 14242: Styling of buttons, get copyright date, fixing plugin comment And other code-y bits. Addressing comments in Comment 59. Sponsored-by: Catalyst IT Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 110500 [details] [review] Bug 14242: (follow-up) Adding publication year hint and fix js translations Created attachment 110501 [details] [review] Bug 14242: (QA follow-up) Fix buttons for new bootstrap version Stole the mark-up from bug 26478. Created attachment 110990 [details] [review] Bug 14242: Remove TT conditional from HTML tags It brakes the translation script 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 3. Search for "foo", then search for "bar" Clear form => It restores values from "foo" Created attachment 112597 [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 "OPACAutoFill" 3. Log into OPAC and go to purchase suggetions page 4. Write a valid ISBN 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 automaticly. 6. Press "undo" to undo - should restore all changed fields to original values Tested all patches together, works as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 112598 [details] [review] Bug 14242: (follow up) renaming syspref OPACAutoFill -> OPACSuggestionAutoFill Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 112599 [details] [review] Bug 14242: (follow-up) Change the icon to words Fix a bug that meant it would search on empty ISBN To test 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" 4. Apply patch 5. Repeat 1,2 and 3 notice a search is no longer done Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 112600 [details] [review] Bug 14242: (follow-up) Strip hyphen from ISBN for search purposes To test, enter a valid ISBN complete with - eg 978-1-78416-110-1 The search should still work Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 112601 [details] [review] Bug 14242: (follow-up) Translateable js strings, $raw filter Sponsored-by: Region Halland Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 112602 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 112603 [details] [review] Bug 14242: Styling of buttons, get copyright date, fixing plugin comment And other code-y bits. Addressing comments in Comment 59. Sponsored-by: Catalyst IT Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 112604 [details] [review] Bug 14242: (follow-up) Adding publication year hint and fix js translations Created attachment 112605 [details] [review] Bug 14242: (QA follow-up) Fix buttons for new bootstrap version Stole the mark-up from bug 26478. Created attachment 112606 [details] [review] Bug 14242: Remove TT conditional from HTML tags It brakes the translation script Created attachment 112607 [details] [review] Bug 14242: (follow-up) Remove well class, weird gap, fix clear form 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 Created attachment 113162 [details] [review] Bug 14242: (follow-up) Move English strings out of JavaScript In order for English strings to be translatable they must be defined in the template, not in the JS file. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 113163 [details] [review] Bug 14242: Styling of buttons, get copyright date, fixing plugin comment And other code-y bits. Addressing comments in Comment 59. Sponsored-by: Catalyst IT Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Created attachment 113164 [details] [review] Bug 14242: (follow-up) Adding publication year hint and fix js translations Created attachment 113165 [details] [review] Bug 14242: (QA follow-up) Fix buttons for new bootstrap version Stole the mark-up from bug 26478. Created attachment 113166 [details] [review] Bug 14242: Remove TT conditional from HTML tags It brakes the translation script Created attachment 113167 [details] [review] Bug 14242: (follow-up) Remove well class, weird gap, fix clear form 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 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. > 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.
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 (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. 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> 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? (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! 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. 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> 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. 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 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> 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> Created attachment 125382 [details] [review] Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN (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? 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. and issue a. is fixed :D thanks for the other fixes 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> 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> Created attachment 131221 [details] [review] Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN Created attachment 131222 [details] [review] Bug 14242: (follow-up) Clear all text input fields (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! 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> 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> Created attachment 133987 [details] [review] Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN Signed-off-by: Owen Leonard <oleonard@myacpl.org> Created attachment 133988 [details] [review] Bug 14242: (follow-up) Clear all text input fields Signed-off-by: Owen Leonard <oleonard@myacpl.org> 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> 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> 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> 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> 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> 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> Pushed to master for 22.05, thanks to everybody involved [U+1F984] 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. 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 Please fix bug 31274 ASAP. |