View | Details | Raw Unified | Return to bug 11299
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-4 / +5 lines)
Lines 192-198 function addCreateAuthorityButton(tag_subfield_line, heading, tag_index) { Link Here
192
    var elem = $('<a href="#" title="' + title + '"><i class="fa fa-plus-circle"></i></a>');
192
    var elem = $('<a href="#" title="' + title + '"><i class="fa fa-plus-circle"></i></a>');
193
    tag_subfield_line.append(elem);
193
    tag_subfield_line.append(elem);
194
    var tag_subfield_line_a = $('.subfield_line[id^=subfield' + heading.tag + 'a]').eq(tag_index);
194
    var tag_subfield_line_a = $('.subfield_line[id^=subfield' + heading.tag + 'a]').eq(tag_index);
195
    var subfield_a = tag_subfield_line_a.children('.input_marceditor').eq(0);
195
    var subfield_a = tag_subfield_line_a.find('.input_marceditor').eq(0);
196
    var index = subfield_a.attr('id');
196
    var index = subfield_a.attr('id');
197
    elem.click(function() {
197
    elem.click(function() {
198
        var popup = window.open("", "new_auth_popup",'fullscreen,toolbar=false,scrollbars=yes');
198
        var popup = window.open("", "new_auth_popup",'fullscreen,toolbar=false,scrollbars=yes');
Lines 267-272 function updateHeadingLinks(links) { Link Here
267
        if( tag_subfield_line.length < 1 ){ return; }
267
        if( tag_subfield_line.length < 1 ){ return; }
268
268
269
        var subfield = tag_subfield_line.find('.input_marceditor').eq(0);
269
        var subfield = tag_subfield_line.find('.input_marceditor').eq(0);
270
        subfield.removeClass("matching_authority_field no_matching_authority_field");
270
271
271
        // Delete the old status if one exists
272
        // Delete the old status if one exists
272
        tag_subfield_line.children('.subfield_status').remove();
273
        tag_subfield_line.children('.subfield_status').remove();
Lines 282-298 function updateHeadingLinks(links) { Link Here
282
        subfield.val(heading.authid);
283
        subfield.val(heading.authid);
283
284
284
        // Add the new status
285
        // Add the new status
285
        var image = '<i class="fa fa-close no_matching_authority" </i> ';
286
        var image = '<i class="fa fa-close subfield_status no_matching_authority" </i> ';
286
        var message = '';
287
        var message = '';
287
        var field_class = 'no_matching_authority_field';
288
        var field_class = 'no_matching_authority_field';
288
        switch(heading.status) {
289
        switch(heading.status) {
289
            case 'LOCAL_FOUND':
290
            case 'LOCAL_FOUND':
290
                image = '<i class="fa fa-check matching_authority"</i> ';
291
                image = '<i class="fa fa-check subfield_status matching_authority"</i> ';
291
                message = _("A matching authority was found in the local database.");
292
                message = _("A matching authority was found in the local database.");
292
                field_class = 'matching_authority_field';
293
                field_class = 'matching_authority_field';
293
                break;
294
                break;
294
            case 'CREATED':
295
            case 'CREATED':
295
                image = '<i class="fa fa-check matching_authority"></i> ';
296
                image = '<i class="fa fa-check subfield_status matching_authority"></i> ';
296
                message = _("No matching authority found. A new authority was created automatically.");
297
                message = _("No matching authority found. A new authority was created automatically.");
297
                field_class = 'matching_authority_field';
298
                field_class = 'matching_authority_field';
298
                break;
299
                break;
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js (-1 / +1 lines)
Lines 189-195 function CloneField(index, hideMarc, advancedMARCEditor) { Link Here
189
                    inputs[j].value = "";
189
                    inputs[j].value = "";
190
190
191
                    //Remove the color added by the automatic linker
191
                    //Remove the color added by the automatic linker
192
                    $(inputs[j]).css({backgroundColor:""});
192
                    $(inputs[j]).removeClass("matching_authority_field no_matching_authority_field");
193
                }
193
                }
194
            }
194
            }
195
            var textareas = divs[i].getElementsByTagName('textarea');
195
            var textareas = divs[i].getElementsByTagName('textarea');
(-)a/t/db_dependent/Biblio.t (-8 / +8 lines)
Lines 745-757 subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { Link Here
745
    t::lib::Mocks::mock_preference('AutoCreateAuthorities', '1');
745
    t::lib::Mocks::mock_preference('AutoCreateAuthorities', '1');
746
746
747
    my $linker = C4::Linker::Default->new();
747
    my $linker = C4::Linker::Default->new();
748
    my $record = MARC::Record->new();
748
    my $biblio = $builder->build_sample_biblio();
749
    my $record = $biblio->metadata->record;
749
750
750
    # Generate a record including all valid subfields and an invalid one 'e'
751
    # Generate a record including all valid subfields and an invalid one 'e'
751
    my $field = MARC::Field->new('650','','','a' => 'Beach city', 'b' => 'Weirdness', 'v' => 'Fiction', 'x' => 'Books', 'y' => '21st Century', 'z' => 'Fish Stew Pizza', 'e' => 'Depicted');
752
    my $field = MARC::Field->new('650','','','a' => 'Beach city', 'b' => 'Weirdness', 'v' => 'Fiction', 'x' => 'Books', 'y' => '21st Century', 'z' => 'Fish Stew Pizza', 'e' => 'Depicted');
752
753
753
    $record->append_fields($field);
754
    $record->append_fields($field);
754
    my ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef);
755
    my ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef,650);
755
756
756
    is( $num_headings_changed, 1, 'We changed the one we passed' );
757
    is( $num_headings_changed, 1, 'We changed the one we passed' );
757
    is_deeply( $results->{added},
758
    is_deeply( $results->{added},
Lines 767-774 subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { Link Here
767
    );
768
    );
768
769
769
    #Add test for this case using verbose
770
    #Add test for this case using verbose
770
    ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 1);
771
    $record->field('650')->delete_subfield('9');
771
    my $details = $results->{details};
772
    ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 650, 1);
772
    is( $num_headings_changed, 1, 'We changed the one we passed' );
773
    is( $num_headings_changed, 1, 'We changed the one we passed' );
773
    is( $results->{details}->[0]->{status}, 'CREATED', "We added an authority record for the heading using verbose");
774
    is( $results->{details}->[0]->{status}, 'CREATED', "We added an authority record for the heading using verbose");
774
775
Lines 781-791 subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { Link Here
781
    );
782
    );
782
783
783
    # Example series link with volume and punctuation
784
    # Example series link with volume and punctuation
784
    $record = MARC::Record->new();
785
    $field = MARC::Field->new('800','','','a' => 'Tolkien, J. R. R.', 'q' => '(John Ronald Reuel),', 'd' => '1892-1973.', 't' => 'Lord of the rings ;', 'v' => '1');
785
    $field = MARC::Field->new('800','','','a' => 'Tolkien, J. R. R.', 'q' => '(John Ronald Reuel),', 'd' => '1892-1973.', 't' => 'Lord of the rings ;', 'v' => '1');
786
    $record->append_fields($field);
786
    $record->append_fields($field);
787
787
788
    ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef);
788
    ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 800);
789
789
790
    is( $num_headings_changed, 1, 'We changed the one we passed' );
790
    is( $num_headings_changed, 1, 'We changed the one we passed' );
791
    is_deeply( $results->{added},
791
    is_deeply( $results->{added},
Lines 801-807 subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { Link Here
801
    );
801
    );
802
802
803
    # The same example With verbose
803
    # The same example With verbose
804
    ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 1);
804
    $record->field('800')->delete_subfield('9');
805
    ( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef, 800, 1);
805
    is( $num_headings_changed, 1, 'We changed the one we passed' );
806
    is( $num_headings_changed, 1, 'We changed the one we passed' );
806
    is( $results->{details}->[0]->{status}, 'CREATED', "We added an authority record for the heading using verbose");
807
    is( $results->{details}->[0]->{status}, 'CREATED', "We added an authority record for the heading using verbose");
807
808
808
- 

Return to bug 11299