Bug 8278

Summary: Replace YUI autocomplete in UNIMARC 210c plugin
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: bgkriegel, chris, jonathan.druart, katrin.fischer
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 5481, 7747, 9779    
Attachments: Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin
[SIGNED-OFF] Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin
Bug 8278 : Follow up, fixing the permissions on cataloguing/ysearch.pl
[SIGNED-OFF] Bug 8278 : Follow up, fixing the permissions on cataloguing/ysearch.pl
Bug 8278 [Follow-up] Replace YUI autocomplete in UNIMARC 210c plugin
[SIGNED-OFF] Bug 8278 [Follow-up] Replace YUI autocomplete in UNIMARC 210c plugin
Bug 8278: build the structure with to_json instead of manually.
[Signed-Off] Bug 8278: build the structure with to_json instead of manually.
[PASSED QA] Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin
[PASSED QA] Bug 8278 : Follow up, fixing the permissions on cataloguing/ysearch.pl
[PASSED QA] Bug 8278 [Follow-up] Replace YUI autocomplete in UNIMARC 210c plugin
[PASSED QA] Bug 8278: build the structure with to_json instead of manually.

Description Owen Leonard 2012-06-20 19:53:24 UTC
There is a YUI autocomplete instance in a UNIMARC plugin (unimarc_field_210c_bis.tt) which I couldn't figure out how to test, even on a sandbox set up with UNIMARC. I could use help with a follow-up to Bug 7747.
Comment 1 Owen Leonard 2013-03-09 01:36:47 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2013-03-19 19:47:31 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2013-03-30 21:10:25 UTC
Owen, could you take another look at this? 

1) The Heading about 225a seems to be not right?

2) I can't get autocomplete to work. I looked up an existing publisher from 
   biblioitems.publishercode and tried typing the name "Gütersloher" and "Klett"
   After typing a few letters I can see that the processing symbol appear,
   but nothing is found. 
 
Tested in Firefox and Chromium in Ubuntu.
Also happens when I try to test bug 9282.
Comment 4 Owen Leonard 2013-04-01 20:16:27 UTC
What Katrin and I have discovered is that if you trigger the script directly or indirectly via the plugin you'll get different outcomes if you're logged in as a superlibrarian versus a regular librarian with cataloging privileges. To access the script directly:

/cgi-bin/koha/cataloguing/ysearch.pl?table=biblioitems&field=itemtype&query=press

If you're logged in as a superlibrarian that should produce valid output. If you're logged in as a regular user with cataloging permission you get no output and your session is terminated.

I also see errors in the log:

Use of uninitialized value in numeric eq (==) at /C4/Auth.pm line 1687
Use of uninitialized value $lasttime in numeric lt (<) at /C4/Auth.pm line 703.

I'm not sure why this script is problematic. It's virtually identical to circ/ysearch.pl which didn't show the same issues when I tested it.
Comment 5 Chris Cormack 2013-04-02 06:29:45 UTC
Looking into this now
Comment 6 Chris Cormack 2013-04-02 06:36:08 UTC
(In reply to comment #5)
> Looking into this now

And yes I can full recreate the issue Owen and Katrin describe, if the permissions don't match, it logs you out.
Comment 7 Chris Cormack 2013-04-02 06:49:24 UTC Comment hidden (obsolete)
Comment 8 Bernardo Gonzalez Kriegel 2013-04-04 11:26:07 UTC Comment hidden (obsolete)
Comment 9 Owen Leonard 2013-04-15 19:12:21 UTC Comment hidden (obsolete)
Comment 10 Bernardo Gonzalez Kriegel 2013-04-15 21:36:42 UTC Comment hidden (obsolete)
Comment 11 Jonathan Druart 2013-04-22 14:18:44 UTC
QA comment:

Works as before, no regression found.
Just one little remark: it would be great to use the JSON::to_json routine in order not to build manually the expected structure (in cataloguing/ysearch.pl).

Marked as Failed QA.
Comment 12 Jonathan Druart 2013-04-22 14:20:36 UTC Comment hidden (obsolete)
Comment 13 Kyle M Hall 2013-05-03 17:05:48 UTC Comment hidden (obsolete)
Comment 14 Jonathan Druart 2013-05-06 07:41:27 UTC
(In reply to comment #7)
> Created attachment 17110 [details] [review] [review]
> Bug 8278 : Follow up, fixing the permissions on cataloguing/ysearch.pl

Katrin, could you confirm this patch fixes your issue please?
Comment 15 Katrin Fischer 2013-05-08 05:35:25 UTC
Created attachment 18002 [details] [review]
[PASSED QA] Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin

This plugin, for pseudo-authority-control of publisher information,
used YUI autocomplete to pull existing publisher data from the
biblioitems table. Despite its name it is not UNIMARC-specific.
It assumes publisher name data is saved in biblioitems.

This patch converts the autocomplete to jQueryUI. The search
script has been amended to return valid JSON. The template has
been modified to enable the jQueryUI autocomplete and to add
structure more consistent with other popups.

To test, link the publisher name field in your MARC structure to
the unimarc_field_210c_bis.pl plugin. Open a MARC record for
editing and click the "tag editor" link to launch the plugin.
Type the first few letters of a publisher which exists in your
database. You should get an autocomplete menu of publishers
which match your search. Select one and click the "choose"
button to fill the field in the MARC editor.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: work as described. No errors.

Test: link 260b to plugin. Edit record and search first letters
of present editors. Menú appears and can select and fill value.

Why plugin 210c_bis talk about field 225a?

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Plugin now works correctly for me, even when linked
to 260$b in a MARC21 installation. All tests and QA script
pass.
Comment 16 Katrin Fischer 2013-05-08 05:35:35 UTC
Created attachment 18003 [details] [review]
[PASSED QA] Bug 8278 : Follow up, fixing the permissions on cataloguing/ysearch.pl

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Works. No errors.

Without patch and normal staff user, logged out
With patch, normal staff, valid output.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 17 Katrin Fischer 2013-05-08 05:35:42 UTC
Created attachment 18004 [details] [review]
[PASSED QA] Bug 8278 [Follow-up] Replace YUI autocomplete in UNIMARC 210c plugin

This follow-up corrects the heading of the plugin pop-up window to match
the UNIMARC field it targets.

To test, trigger the plugin and confirm that the pop-up window refers to
210c.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Smple patch, fixes label. No errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 18 Katrin Fischer 2013-05-08 05:35:49 UTC
Created attachment 18005 [details] [review]
[PASSED QA] Bug 8278: build the structure with to_json instead of manually.

Test plan:
Same as previously.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 19 Jared Camins-Esakov 2013-05-08 13:50:43 UTC
This patch has been pushed to master and 3.12.x.