From 626c27baf993b8a19a7cdace902c03ae26f23da5 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 8 Mar 2013 12:56:24 -0500 Subject: [PATCH] Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 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 Plugin now works correctly for me, even when linked to 260$b in a MARC21 installation. All tests and QA script pass. Signed-off-by: Jared Camins-Esakov --- cataloguing/ysearch.pl | 10 +- .../value_builder/unimarc_field_210c_bis.tt | 91 ++++++++----------- 2 files changed, 46 insertions(+), 55 deletions(-) diff --git a/cataloguing/ysearch.pl b/cataloguing/ysearch.pl index 77144e1731..825501608b 100755 --- a/cataloguing/ysearch.pl +++ b/cataloguing/ysearch.pl @@ -31,7 +31,7 @@ use C4::Charset; use C4::Auth qw/check_cookie_auth/; my $input = new CGI; -my $query = $input->param('query'); +my $query = $input->param('term'); my $table = $input->param('table'); my $field = $input->param('field'); @@ -54,8 +54,14 @@ $sql .= qq( ORDER BY $field); my $sth = $dbh->prepare($sql); $sth->execute("$query%", "% $query%", "%-$query%"); +print "["; +my $i = 0; while ( my $rec = $sth->fetchrow_hashref ) { - print nsb_clean($rec->{$field}) . "\n"; + if($i > 0){ print ","; } + print "{\"fieldvalue\":\"" . nsb_clean($rec->{$field}) . "\"" . + "}"; + $i++; } +print "]"; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt index 1eedf4c79b..af5cdf6510 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt @@ -1,65 +1,51 @@ - - - - UNIMARC field 225a builder - - - - - - - - -