@@ -, +, @@ styling, fix population of new record --- .../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(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -192,7 +192,7 @@ function addCreateAuthorityButton(tag_subfield_line, heading, tag_index) { var elem = $(''); 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 = ' '; + var image = ' '; var message = ''; var field_class = 'no_matching_authority_field'; switch(heading.status) { case 'LOCAL_FOUND': - image = ' '; + image = ' '; message = _("A matching authority was found in the local database."); field_class = 'matching_authority_field'; break; case 'CREATED': - image = ' '; + image = ' '; message = _("No matching authority found. A new authority was created automatically."); field_class = 'matching_authority_field'; break; --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ a/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'); --- a/t/db_dependent/Biblio.t +++ a/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"); --