Bugzilla – Attachment 114932 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) adjust tests for bug 26641, fix styling, fix population of new record
Bug-11299-follow-up-adjust-tests-for-bug-26641-fix.patch (text/plain), 7.02 KB, created by
Nick Clemens (kidclamp)
on 2021-01-07 16:06:14 UTC
(
hide
)
Description:
Bug 11299: (follow-up) adjust tests for bug 26641, fix styling, fix population of new record
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-01-07 16:06:14 UTC
Size:
7.02 KB
patch
obsolete
>From 10484ac4df0ca04e7b12d0f69b5485b4422eef23 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 7 Jan 2021 14:27:09 +0000 >Subject: [PATCH] Bug 11299: (follow-up) adjust tests for bug 26641, fix > styling, fix population of new record > >This corrects parameters in tests to adjust for new parameter in LinkBibHeadings > >We also add lines to remove classes before adding the correct class while linking and restore >a missing class to the icons > >Lastly we correct fetching the paramters to pass to authority creation popup to ensure >values are populated on save >--- > .../prog/en/modules/cataloguing/addbiblio.tt | 9 +++++---- > koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 2 +- > t/db_dependent/Biblio.t | 15 ++++++++------- > 3 files changed, 14 insertions(+), 12 deletions(-) > >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 2b5b8ee2fd..ea86100d2c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -192,7 +192,7 @@ function addCreateAuthorityButton(tag_subfield_line, heading, tag_index) { > var elem = $('<a href="#" title="' + title + '"><i class="fa fa-plus-circle"></i></a>'); > tag_subfield_line.append(elem); > var tag_subfield_line_a = $('.subfield_line[id^=subfield' + heading.tag + 'a]').eq(tag_index); >- var subfield_a = tag_subfield_line_a.children('.input_marceditor').eq(0); >+ var subfield_a = tag_subfield_line_a.find('.input_marceditor').eq(0); > var index = subfield_a.attr('id'); > elem.click(function() { > var popup = window.open("", "new_auth_popup",'fullscreen,toolbar=false,scrollbars=yes'); >@@ -267,6 +267,7 @@ function updateHeadingLinks(links) { > if( tag_subfield_line.length < 1 ){ return; } > > var subfield = tag_subfield_line.find('.input_marceditor').eq(0); >+ subfield.removeClass("matching_authority_field no_matching_authority_field"); > > // Delete the old status if one exists > tag_subfield_line.children('.subfield_status').remove(); >@@ -282,17 +283,17 @@ function updateHeadingLinks(links) { > subfield.val(heading.authid); > > // Add the new status >- var image = '<i class="fa fa-close no_matching_authority" </i> '; >+ var image = '<i class="fa fa-close subfield_status no_matching_authority" </i> '; > var message = ''; > var field_class = 'no_matching_authority_field'; > switch(heading.status) { > case 'LOCAL_FOUND': >- image = '<i class="fa fa-check matching_authority"</i> '; >+ image = '<i class="fa fa-check subfield_status matching_authority"</i> '; > message = _("A matching authority was found in the local database."); > field_class = 'matching_authority_field'; > break; > case 'CREATED': >- image = '<i class="fa fa-check matching_authority"></i> '; >+ image = '<i class="fa fa-check subfield_status matching_authority"></i> '; > message = _("No matching authority found. A new authority was created automatically."); > field_class = 'matching_authority_field'; > break; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >index b7b9ab3d5c..64a9ebdce5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >@@ -189,7 +189,7 @@ function CloneField(index, hideMarc, advancedMARCEditor) { > inputs[j].value = ""; > > //Remove the color added by the automatic linker >- $(inputs[j]).css({backgroundColor:""}); >+ $(inputs[j]).removeClass("matching_authority_field no_matching_authority_field"); > } > } > var textareas = divs[i].getElementsByTagName('textarea'); >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 21c39ae91c..3f970acdeb 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -745,13 +745,14 @@ subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { > t::lib::Mocks::mock_preference('AutoCreateAuthorities', '1'); > > my $linker = C4::Linker::Default->new(); >- my $record = MARC::Record->new(); >+ my $biblio = $builder->build_sample_biblio(); >+ my $record = $biblio->metadata->record; > > # Generate a record including all valid subfields and an invalid one 'e' > my $field = MARC::Field->new('650','','','a' => 'Beach city', 'b' => 'Weirdness', 'v' => 'Fiction', 'x' => 'Books', 'y' => '21st Century', 'z' => 'Fish Stew Pizza', 'e' => 'Depicted'); > > $record->append_fields($field); >- my ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef); >+ my ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef,650); > > is( $num_headings_changed, 1, 'We changed the one we passed' ); > is_deeply( $results->{added}, >@@ -767,8 +768,8 @@ subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { > ); > > #Add test for this case using verbose >- ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 1); >- my $details = $results->{details}; >+ $record->field('650')->delete_subfield('9'); >+ ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 650, 1); > is( $num_headings_changed, 1, 'We changed the one we passed' ); > is( $results->{details}->[0]->{status}, 'CREATED', "We added an authority record for the heading using verbose"); > >@@ -781,11 +782,10 @@ subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { > ); > > # Example series link with volume and punctuation >- $record = MARC::Record->new(); > $field = MARC::Field->new('800','','','a' => 'Tolkien, J. R. R.', 'q' => '(John Ronald Reuel),', 'd' => '1892-1973.', 't' => 'Lord of the rings ;', 'v' => '1'); > $record->append_fields($field); > >- ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef); >+ ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 800); > > is( $num_headings_changed, 1, 'We changed the one we passed' ); > is_deeply( $results->{added}, >@@ -801,7 +801,8 @@ subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { > ); > > # The same example With verbose >- ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 1); >+ $record->field('800')->delete_subfield('9'); >+ ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 800, 1); > is( $num_headings_changed, 1, 'We changed the one we passed' ); > is( $results->{details}->[0]->{status}, 'CREATED', "We added an authority record for the heading using verbose"); > >-- >2.11.0
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