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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt (-126 / +51 lines)
Lines 103-109 Link Here
103
                [% ELSIF view == "report" %]
103
                [% ELSIF view == "report" %]
104
                    <div id="modified_holds_results-wrapper">
104
                    <div id="modified_holds_results-wrapper">
105
                        <div id="modified_holds_results" class="page-section">
105
                        <div id="modified_holds_results" class="page-section">
106
                            <table id="modified_holds"></table>
106
                            <table id="modified_holds">
107
                                <thead>
108
                                    <tr>
109
                                        <th>Title</th>
110
                                        <th>Patron</th>
111
                                        <th>Pickup Location</th>
112
                                        <th>Priority</th>
113
                                        <th>Expiration Date</th>
114
                                        <th>Status</th>
115
                                        <th>Suspended</th>
116
                                        <th>Suspended Until</th>
117
                                        <th>Notes</th>
118
                                        <!-- Add other columns as needed -->
119
                                    </tr>
120
                                </thead>
121
                                <tbody>
122
                                    [% FOREACH hold IN updated_holds_obj %]
123
                                        <tr>
124
                                            <td>[% hold.biblio.title | html %]</td>
125
                                            <td>[% hold.borrower.firstname | html %] [% hold.borrower.surname | html %]</td>
126
                                            <td>[% hold.branch.branchname | html %]</td>
127
                                            <td>[% hold.priority | html %]</td>
128
                                            <td>[% hold.expirationdate | $KohaDates %]</td>
129
                                            <td>
130
                                                [% IF hold.found == 'F' %]
131
                                                    <span>Fulfilled</span>
132
                                                [% ELSIF hold.cancellationdate %]
133
                                                    <span>Cancelled</span>
134
                                                [% ELSIF hold.found == 'W' %]
135
                                                    [% IF hold.cancellation_requests.count == 0 %]
136
                                                        <span>Waiting</span>
137
                                                    [% ELSE %]
138
                                                        <span>Cancelled</span>
139
                                                    [% END %]
140
                                                [% ELSIF hold.found == 'T' %]
141
                                                    <span>In transit</span>
142
                                                [% ELSE %]
143
                                                    <span>Pending</span>
144
                                                [% END %]
145
                                            </td>
146
                                            <td>[% IF hold.suspend %]Yes[% ELSE %]No[% END %]</td>
147
                                            <td>[% IF hold.suspend_until %][% hold.suspend_until | $KohaDates %][% ELSE %]-[% END %]</td>
148
                                            <td>[% hold.reservenotes | html %]</td>
149
                                        </tr>
150
                                    [% END %]
151
                                </tbody>
152
                            </table>
107
                        </div>
153
                        </div>
108
                        <!-- /#modified_holds_results -->
154
                        <!-- /#modified_holds_results -->
109
                        <fieldset class="action">
155
                        <fieldset class="action">
Lines 582-712 Link Here
582
628
583
                //Modified holds table
629
                //Modified holds table
584
                var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'modified_holds', 'json' ) | $raw %];
630
                var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'modified_holds', 'json' ) | $raw %];
585
                var filters = {
631
                $("#modified_holds").kohaTable({
586
                    "me.hold_id": function(){
632
                    pagingType: "full",
587
                        return {"-in": hold_ids};
633
                    autoWidth: false
588
                    }
634
                }, table_settings);
589
                }
590
591
                var holds_modified_table = $("#modified_holds").kohaTable({
592
                    "ajax": {
593
                        "url": "/api/v1/holds"
594
                    },
595
                    "embed": [
596
                        "biblio",
597
                        "item",
598
                        "pickup_library",
599
                        "patron"
600
                    ],
601
                    "destroy": true,
602
                    "autoWidth": false,
603
                    "processing": true,
604
                    "columns": [
605
                        {
606
                            "data": "expiration_date",
607
                            "name": "expiration_date",
608
                            "type": "date",
609
                            "title": _("Expiration date"),
610
                            "orderable": true,
611
                            "render": function( data, type, row, meta ) {
612
                                return $date(data);
613
                            }
614
                        },
615
                        {
616
                            "data": "biblio.title",
617
                            "name": "title",
618
                            "title": _("Title"),
619
                            "orderable": true,
620
                            "render": function( data, type, row, meta ) {
621
                                return '<a href="/cgi-bin/koha/catalogue/detail.pl?' +
622
                                'biblionumber=' + encodeURIComponent( row.biblio_id ) + '">' + escape_str( data ) + '</a>';
623
                            }
624
                        },
625
                        {
626
                            "data": "item.external_id",
627
                            "name": "barcode",
628
                            "title": _("Barcode"),
629
                            "defaultContent": _(""),
630
                            "orderable": true,
631
                            "render": function( data, type, row, meta ) {
632
                                if( row.item ){
633
                                    let item_id = encodeURIComponent( row.item_id );
634
                                    let biblio_id = encodeURIComponent( row.biblio_id );
635
                                    return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' +
636
                                    'itemnumber='+ item_id +'&biblionumber='+ biblio_id +'&' +
637
                                    'bi='+ biblio_id +'#item'+ item_id +'">' + escape_str( data ) + '</a>'
638
                                }
639
                            }
640
                        },
641
                        {
642
                            "data": "patron_id",
643
                            "name": "patron",
644
                            "title": _("Patron"),
645
                            "orderable": true,
646
                            "render": function( data, type, row, meta ) {
647
                                let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name });
648
                                return patron_to_html;
649
                            }
650
                        },
651
                        {
652
                            "data": "status",
653
                            "name": "status",
654
                            "className": "found_status",
655
                            "title": _("Status"),
656
                            "orderable": true,
657
                            "render": function( data, type, row, meta ) {
658
                                let status = _("No status");
659
                                if ( data == "T" ) {
660
                                    status = _("In transit");
661
                                } else if( data == "P" ) {
662
                                    status = _("In processing");
663
                                } else if( data == "W" ) {
664
                                    status = _("Waiting");
665
                                }
666
                                return status;
667
                            }
668
                        },
669
                        {
670
                            "data": "pickup_library_id",
671
                            "name": "pickup_library",
672
                            "title": _("Hold pickup library"),
673
                            "orderable": true,
674
                            "render": function( data, type, row, meta ) {
675
                                return escape_str( row.pickup_library.name );
676
                            }
677
                        },
678
                        {
679
                            "data": "suspended",
680
                            "name": "suspended",
681
                            "title": _("Suspended"),
682
                            "orderable": true,
683
                            "render": function( data, type, row, meta ) {
684
                                return data == 0 ? _("No") : _("Yes");
685
                            }
686
                        },
687
                        {
688
                            "data": "suspended_until",
689
                            "name": "suspended_until",
690
                            "title": _("Suspended until"),
691
                            "orderable": true,
692
                            "render": function( data, type, row, meta ) {
693
                                return $date( data );
694
                            }
695
                        },
696
                        {
697
                            "data": "notes",
698
                            "name": "notes",
699
                            "title": _("Notes"),
700
                            "orderable": true,
701
                            "render": function( data, type, row, meta ) {
702
                                return escape_str( data );
703
                            }
704
                        }
705
                    ]
706
                }, table_settings, 0, filters);
707
708
                var modified_message = '<div class="alert alert-info">'+hold_ids.length+' hold(s) have been modified!</div>';
709
                $("#modified_holds_results-wrapper").prepend(modified_message);
710
635
711
            });
636
            });
712
        </script>
637
        </script>
(-)a/tools/batch_modify_holds.pl (-3 / +6 lines)
Lines 59-64 if ( $op eq 'cud-form' ) { Link Here
59
    my $clear_hold_notes    = $input->param('clear_hold_notes');
59
    my $clear_hold_notes    = $input->param('clear_hold_notes');
60
60
61
    @hold_ids = $input->multi_param('hold_id');
61
    @hold_ids = $input->multi_param('hold_id');
62
    my @holds_data = ();
62
63
63
    my $holds_to_update =
64
    my $holds_to_update =
64
        Koha::Holds->search( { reserve_id => { -in => \@hold_ids } }, { join => [ "item", "biblio" ] } );
65
        Koha::Holds->search( { reserve_id => { -in => \@hold_ids } }, { join => [ "item", "biblio" ] } );
Lines 95-105 if ( $op eq 'cud-form' ) { Link Here
95
        if ($clear_hold_notes) {
96
        if ($clear_hold_notes) {
96
            $hold->reservenotes(undef)->store;
97
            $hold->reservenotes(undef)->store;
97
        }
98
        }
99
        push @holds_data, $hold;
98
    }
100
    }
99
101
100
    $template->param(
102
    $template->param(
101
        updated_holds => to_json( \@hold_ids ),
103
        updated_holds     => to_json( \@hold_ids ),
102
        view          => 'report',
104
        updated_holds_obj => \@holds_data,
105
        total_updated     => scalar @holds_data,
106
        view              => 'report',
103
    );
107
    );
104
108
105
}
109
}
106
- 

Return to bug 36135