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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-23 / +29 lines)
Lines 457-462 Link Here
457
[% MACRO jsinclude BLOCK %]
457
[% MACRO jsinclude BLOCK %]
458
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
458
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
459
    [% INCLUDE 'datatables.inc' %]
459
    [% INCLUDE 'datatables.inc' %]
460
    <script>
461
        const interface = "[% interface | html %]";
462
        const theme = "[% theme | html %]";
463
        const import_batch_id = "[% import_batch_id | html %]";
464
        const record_type = "[% record_type | html %]";
465
        addPermissions({
466
            CAN_user_editcatalogue_edit_catalogue: [% CAN_user_editcatalogue_edit_catalogue ? 1 : 0 | html %],
467
        });
468
    </script>
469
460
    <script>
470
    <script>
461
        $(document).ready(function() {
471
        $(document).ready(function() {
462
            $("#staged-record-matching-rules select").change(function() {
472
            $("#staged-record-matching-rules select").change(function() {
Lines 470-476 Link Here
470
                $(this).parent().hide();
480
                $(this).parent().hide();
471
            });
481
            });
472
482
473
            [% IF import_batch_id %]
483
            if (import_batch_id){
474
                $("#records-table").kohaTable({
484
                $("#records-table").kohaTable({
475
                    autoWidth: false,
485
                    autoWidth: false,
476
                    searching: false,
486
                    searching: false,
Lines 479-485 Link Here
479
                    ajax: {
489
                    ajax: {
480
                        url: "batch_records_ajax.pl",
490
                        url: "batch_records_ajax.pl",
481
                        data: function ( d ) {
491
                        data: function ( d ) {
482
                            d.import_batch_id = [% import_batch_id | html %];
492
                            d.import_batch_id = import_batch_id;
483
                            return d;
493
                            return d;
484
                        },
494
                        },
485
                    },
495
                    },
Lines 496-511 Link Here
496
                        { data: "matched" }
506
                        { data: "matched" }
497
                    ],
507
                    ],
498
                    rowCallback: function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
508
                    rowCallback: function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
499
                        [% IF(record_type == 'auth') %]
509
                        var record_details_url = record_type == 'auth' ? "/cgi-bin/koha/authorities/detail.pl?authid=":"/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
500
                            var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
510
                        var record_edit_url = record_type == 'auth' ? "/cgi-bin/koha/authorities/authorities.pl?authid=":"/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
501
                        [% ELSE %]
502
                            var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
503
                        [% END %]
504
                        [% IF(record_type == 'auth') %]
505
                            var record_edit_url = "/cgi-bin/koha/authorities/authorities.pl?authid=";
506
                        [% ELSE %]
507
                            var record_edit_url = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
508
                        [% END %]
509
511
510
                        var additional_details = "";
512
                        var additional_details = "";
511
                        if( aData['author'] ){
513
                        if( aData['author'] ){
Lines 575-581 Link Here
575
                                        + item.candidate_match_id + '">' + match_citation + '</a></label></li>')
577
                                        + item.candidate_match_id + '">' + match_citation + '</a></label></li>')
576
                                );
578
                                );
577
                                $('td:eq(5) ul', nRow).append('<li><a href="'
579
                                $('td:eq(5) ul', nRow).append('<li><a href="'
578
                                        + diff_url.format( [% import_batch_id | html %], aData['import_record_id'], item.candidate_match_id, item.record_type) + '">' + _("View") + '</a></li>');
580
                                        + diff_url.format(import_batch_id, aData['import_record_id'], item.candidate_match_id, item.record_type) + '">' + _("View") + '</a></li>');
579
                                checked = "";
581
                                checked = "";
580
                            });
582
                            });
581
                            if( !any_checked ){ checked = 'checked="checked"'; }
583
                            if( !any_checked ){ checked = 'checked="checked"'; }
Lines 591-600 Link Here
591
                            $('td:eq(6)', nRow).html(
593
                            $('td:eq(6)', nRow).html(
592
                                '<a class="btn btn-default btn-xs" target="_blank" href="' + record_details_url
594
                                '<a class="btn btn-default btn-xs" target="_blank" href="' + record_details_url
593
                                + aData['matched'] + '"><i class="fa-solid fa-eye"></i> ' + _("View") + '</a> '
595
                                + aData['matched'] + '"><i class="fa-solid fa-eye"></i> ' + _("View") + '</a> '
594
                                [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
596
                                if (perms.CAN_user_editcatalogue_edit_catalogue){
595
                                    + '<a class="btn btn-default btn-xs" target="_blank" href="' + record_edit_url
597
                                    + '<a class="btn btn-default btn-xs" target="_blank" href="' + record_edit_url
596
                                    + aData['matched'] + '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>'
598
                                    + aData['matched'] + '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>'
597
                                [% END %]
599
                                }
598
                            );
600
                            );
599
                        }
601
                        }
600
                    },
602
                    },
Lines 602-608 Link Here
602
                $("#revert_batch_form").on("submit", function() {
604
                $("#revert_batch_form").on("submit", function() {
603
                    return confirm(_("Are you sure you want to undo the import of this batch into the catalog?"));
605
                    return confirm(_("Are you sure you want to undo the import of this batch into the catalog?"));
604
                });
606
                });
605
            [% END %]
607
            }
606
608
607
            $("body").on("change", ".chosen", function(e) {
609
            $("body").on("change", ".chosen", function(e) {
608
                let apimethod = "DELETE";
610
                let apimethod = "DELETE";
Lines 612-618 Link Here
612
                    apidata = JSON.stringify({ candidate_match_id: $(this).val() });
614
                    apidata = JSON.stringify({ candidate_match_id: $(this).val() });
613
                }
615
                }
614
                $.ajax({
616
                $.ajax({
615
                    url: '/api/v1/import_batches/[% import_batch_id | html %]/records/'+$(this).data('import_record_id')+'/matches/chosen',
617
                    url: '/api/v1/import_batches/' + import_batch_id + '/records/'+$(this).data('import_record_id')+'/matches/chosen',
616
                    method: apimethod,
618
                    method: apimethod,
617
                    data: apidata,
619
                    data: apidata,
618
                    contentType: 'application/json'
620
                    contentType: 'application/json'
Lines 629-635 Link Here
629
            });
631
            });
630
            $("#marcPreview").on("hidden.bs.modal", function() {
632
            $("#marcPreview").on("hidden.bs.modal", function() {
631
                $("#marcPreviewLabel").html("");
633
                $("#marcPreviewLabel").html("");
632
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
634
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
633
            });
635
            });
634
            $(".batch_form").on("submit", function() {
636
            $(".batch_form").on("submit", function() {
635
                if ($(this).hasClass("batch_delete")) {
637
                if ($(this).hasClass("batch_delete")) {
Lines 642-655 Link Here
642
                    }
644
                    }
643
                }
645
                }
644
            });
646
            });
645
            [% IF job_enqueued %]
647
        });
648
    </script>
649
650
    [% IF job_enqueued %]
651
        <script>
652
            $(document).ready(function() {
646
                setTimeout(
653
                setTimeout(
647
                    function() { window.location.href=$('a.job_details').attr('href'); },
654
                    function() { window.location.href=$('a.job_details').attr('href'); },
648
                    5000, // 5 secs to read
655
                    5000, // 5 secs to read
649
                );
656
                );
650
            [% END %]
657
            });
651
        });
658
        </script>
652
    </script>
659
    [% END %]
653
[% END %]
660
[% END %]
654
[% INCLUDE 'intranet-bottom.inc' %]
661
[% INCLUDE 'intranet-bottom.inc' %]
655
[% BLOCK pagination %]
662
[% BLOCK pagination %]
656
- 

Return to bug 41580