Bugzilla – Attachment 40831 Details for
Bug 11299
Add a button to automatically link authority records in cataloguing (AJAX)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11299 - Follow-up to QA failure
Bug-11299---Follow-up-to-QA-failure.patch (text/plain), 8.62 KB, created by
Maxime Beaulieu
on 2015-07-08 12:28:51 UTC
(
hide
)
Description:
Bug 11299 - Follow-up to QA failure
Filename:
MIME Type:
Creator:
Maxime Beaulieu
Created:
2015-07-08 12:28:51 UTC
Size:
8.62 KB
patch
obsolete
>From 5a948abe7a97e577073c330321e919de9e528e57 Mon Sep 17 00:00:00 2001 >From: mxbeaulieu <maxime.beaulieu@inlibro.com> >Date: Tue, 7 Jul 2015 16:26:53 -0400 >Subject: [PATCH] Bug 11299 - Follow-up to QA failure > >Fixes problems reported by koha-qa > >use Modern::Perl >Changed required permission to editauthorities >pertidy cataloguing/automatic_linker.pl > >Testing scenario (Creating an authority record for a failed automatic link) : > >* In you system preferences, deactivate the "AutoCreateAuthorities" preference. >* Go to the biblio record creation form to create a new biblio record. (koha/cataloguing/addbiblio.pl) >* Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed." >* Add random informations in field 600$a of the biblio record. >* Click the "Link authorities automatically" button. The message box should now show "600 - No matching authority found." if no matching authority was found. For this scenario, we want the authority match to have failed. >* The 600$9 field should now be red and icons should have appeared next to it. Click on the "create authority" icon. >* A popup should appear, containing a "Modify authority" form. The form should be pre-filled, a the informations in the 600$a field of the biblio should be in the 100$a field of this new authority record. >* Click the "Save" button >* The 600$9 field in the biblio record should now be back to normal and have the authid of the authority record that was just created. >* Click the "Link authorities automatically" button again. The message box should now show "No authority link was changed.". > >I tried it and got the expected results. > >(In reply to Jonathan Druart from comment #18) >> 5/ * Click the "Link authorities automatically" button. A message should appear, telling the user "No authority link was changed." >> >> No, I got >> Automatic authority link results: >> 700 - No matching authority found. >> ... > >Jonathan, did you create the biblio from scratch? >The record you tested probably had data in the 700 field. > >Tests will be included in a future patch. >--- > cataloguing/automatic_linker.pl | 29 +++++--- > .../prog/en/modules/cataloguing/addbiblio.tt | 78 ++++++++++---------- > 2 files changed, 56 insertions(+), 51 deletions(-) > >diff --git a/cataloguing/automatic_linker.pl b/cataloguing/automatic_linker.pl >index a853398..a17e7ea 100755 >--- a/cataloguing/automatic_linker.pl >+++ b/cataloguing/automatic_linker.pl >@@ -6,7 +6,7 @@ > # > # Koha is free software; you can redistribute it and/or modify it under the > # terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 2 of the License, or (at your option) any later >+# Foundation; either version 3 of the License, or (at your option) any later > # version. > # > # Koha is distributed in the hope that it will be useful, but WITHOUT ANY >@@ -17,8 +17,7 @@ > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use strict; >-use warnings; >+use Modern::Perl; > use CGI; > use CGI::Cookie; > use JSON; >@@ -26,15 +25,16 @@ use C4::Auth; > use C4::Biblio; > use C4::Context; > >-my $input = new CGI; >+my $input = new CGI; > print $input->header('application/json'); > > # Check the user's permissions > my %cookies = fetch CGI::Cookie; > my $sessid = $cookies{'CGISESSID'}->value || $input->param('CGISESSID'); >-my ($auth_status, $auth_sessid) = C4::Auth::check_cookie_auth($sessid, {catalogue => 1}); >-if ($auth_status ne "ok") { >- print to_json({status => 'UNAUTHORIZED'}); >+my ( $auth_status, $auth_sessid ) = >+ C4::Auth::check_cookie_auth( $sessid, { editauthorities => 1 } ); >+if ( $auth_status ne "ok" ) { >+ print to_json( { status => 'UNAUTHORIZED' } ); > exit 0; > } > >@@ -47,10 +47,10 @@ if ($auth_status ne "ok") { > > my $json; > >-my $record = TransformHtmlToMarc( $input ); >+my $record = TransformHtmlToMarc($input); > >- >-my $linker_module = "C4::Linker::" . ( C4::Context->preference("LinkerModule") || 'Default' ); >+my $linker_module = >+ "C4::Linker::" . ( C4::Context->preference("LinkerModule") || 'Default' ); > eval { eval "require $linker_module"; }; > if ($@) { > $linker_module = 'C4::Linker::Default'; >@@ -59,9 +59,14 @@ if ($@) { > if ($@) { > return 0, 0; > } >-my $linker = $linker_module->new( { 'options' => C4::Context->preference("LinkerOptions") } ); >+my $linker = $linker_module->new( >+ { 'options' => C4::Context->preference("LinkerOptions") } ); > >-my ( $headings_changed, $results ) = LinkBibHeadingsToAuthorities( $linker, $record, $input->param('frameworkcode'), C4::Context->preference("CatalogModuleRelink") || '', 1 ); >+my ( $headings_changed, $results ) = LinkBibHeadingsToAuthorities( >+ $linker, $record, >+ $input->param('frameworkcode'), >+ C4::Context->preference("CatalogModuleRelink") || '', 1 >+); > > $json->{status} = 'OK'; > $json->{links} = $results->{details} || ''; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index 659532f..ae6936d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -144,46 +144,46 @@ function PopupZ3950() { > } > > function addCreateAuthorityButton(tag_subfield_line, tag, index) { >- var title = _("Create authority"); >- var elem = $('<a class="subfield_status" href="#"><img src="/intranet-tmpl/[% theme %]/img/edit-tag.png" title="' + title + '" /></a>'); >- tag_subfield_line.append(elem); >+ var title = _("Create authority"); >+ var elem = $('<a class="subfield_status" href="#"><img src="[% interface %]/[% theme %]/img/edit-tag.png" title="' + title + '" /></a>'); >+ tag_subfield_line.append(elem); > >- elem.click(function() { >+ elem.click(function() { > var biblioindex = $(this).parents('.subfield_line').find('input').eq(1).attr('id'); >- var popup = window.open("", "new_auth_popup",'width=700,height=550,toolbar=false,scrollbars=yes'); >- >- if(popup !== null) { >- // Create a new form that will be POSTed in the new window >- var form = $('<form>').attr({ >- method: 'post', >- action: "../authorities/authorities.pl", >- target: "new_auth_popup" >- }); >- >- // Add the biblioindex >- form.append($('<input>').attr({ >- type: 'hidden', >- name: 'biblioindex', >- value: biblioindex >- })); >- >- // Get all form datas for the current heading field >- $('.tag[id^=tag_' + tag + '_]').eq(index).find(':input').each(function(){ >- form.append($('<input>').attr({ >- type: 'hidden', >- name: this.name, >- value: $(this).val() >- })); >- }); >- >- // We need to add the temporary form to the body so we can submit it >- $('body').append(form); >- form.submit(); >- form.remove(); >- } >+ var popup = window.open("", "new_auth_popup",'width=700,height=550,toolbar=false,scrollbars=yes'); >+ >+ if(popup !== null) { >+ // Create a new form that will be POSTed in the new window >+ var form = $('<form>').attr({ >+ method: 'post', >+ action: "../authorities/authorities.pl", >+ target: "new_auth_popup" >+ }); >+ >+ // Add the biblioindex >+ form.append($('<input>').attr({ >+ type: 'hidden', >+ name: 'biblioindex', >+ value: biblioindex >+ })); >+ >+ // Get all form datas for the current heading field >+ $('.tag[id^=tag_' + tag + '_]').eq(index).find(':input').each(function(){ >+ form.append($('<input>').attr({ >+ type: 'hidden', >+ name: this.name, >+ value: $(this).val() >+ })); >+ }); > >- return false; >- }); >+ // We need to add the temporary form to the body so we can submit it >+ $('body').append(form); >+ form.submit(); >+ form.remove(); >+ } >+ >+ return false; >+ }); > } > > /** >@@ -253,14 +253,14 @@ function updateHeadingLinks(links) { > } > > subfield.css({backgroundColor:field_color}); >- tag_subfield_line.append('<img class="subfield_status" src="/intranet-tmpl/[% theme %]/img/' + image + '" title="' + message + '" />'); >+ tag_subfield_line.append('<img class="subfield_status" src="[% interface %]/[% theme %]/img/' + image + '" title="' + message + '" />'); > > // Add the message to the dialog > message_dialog_ul.append('<li><strong>' + heading.tag + '</strong> - ' + message + '</li>'); > > // Add a link to create a new authority if none was found > if(heading.status == 'NONE_FOUND') { >- addCreateAuthorityButton(tag_subfield_line, heading.tag, tag_index); >+ addCreateAuthorityButton(tag_subfield_line, heading.tag, tag_index); > } > }); > >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11299
:
23146
|
26715
|
33074
|
37912
|
37913
|
37972
|
38737
|
39477
|
39478
|
39479
|
40831
|
41229
|
45218
|
56440
|
56508
|
56509
|
58307
|
60998
|
63311
|
63312
|
63313
|
64075
|
67162
|
67708
|
67709
|
67710
|
67712
|
67713
|
67714
|
67824
|
67825
|
67826
|
67827
|
67828
|
67829
|
79385
|
79386
|
79387
|
79388
|
79389
|
79390
|
79391
|
79392
|
79393
|
79394
|
79395
|
79396
|
79397
|
79398
|
79399
|
79447
|
79448
|
79449
|
79450
|
79451
|
79452
|
79545
|
94818
|
95126
|
95152
|
98571
|
98572
|
99249
|
108091
|
108309
|
108310
|
108396
|
108552
|
108834
|
108835
|
109062
|
109063
|
109069
|
109181
|
110553
|
110554
|
110555
|
110556
|
110557
|
110568
|
110569
|
110570
|
110571
|
110572
|
111706
|
111707
|
111708
|
111709
|
111710
|
112125
|
112126
|
112127
|
112128
|
112129
|
112130
|
112131
|
112132
|
112133
|
112134
|
112135
|
113562
|
113563
|
113564
|
113565
|
113566
|
113567
|
113568
|
114803
|
114924
|
114925
|
114926
|
114927
|
114928
|
114929
|
114930
|
114931
|
114932