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

(-)a/admin/columns_settings.yml (+31 lines)
Lines 1403-1408 modules: Link Here
1403
            -
1403
            -
1404
              columnname: action
1404
              columnname: action
1405
1405
1406
      holdscr:
1407
        columns:
1408
            -
1409
                columnname: checkbox
1410
                cannot_be_toggled: 1
1411
                cannot_be_modified: 1
1412
            -
1413
                columnname: waiting_since
1414
            -
1415
                columnname: date_hold_placed
1416
            -
1417
                columnname: expiration_date
1418
            -
1419
                columnname: title
1420
            -
1421
                columnname: patron
1422
            -
1423
                columnname: home_library
1424
            -
1425
                columnname: current_location
1426
            -
1427
                columnname: shelving_location
1428
            -
1429
                columnname: call_number
1430
            -
1431
                columnname: copy_number
1432
            -
1433
                columnname: enumeration
1434
            -
1435
                columnname: action
1436
1406
    overdues:
1437
    overdues:
1407
      circ-overdues:
1438
      circ-overdues:
1408
        default_display_length: 20
1439
        default_display_length: 20
(-)a/circ/waitingreserves.pl (+29 lines)
Lines 19-24 Link Here
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
23
use Try::Tiny;
22
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
23
use C4::Context;
25
use C4::Context;
24
use C4::Output qw( output_html_with_http_headers );
26
use C4::Output qw( output_html_with_http_headers );
Lines 28-33 use Date::Calc qw( Date_to_Days Today ); Link Here
28
use C4::Reserves qw( ModReserve ModReserveCancelAll );
30
use C4::Reserves qw( ModReserve ModReserveCancelAll );
29
use Koha::DateUtils qw( dt_from_string output_pref );
31
use Koha::DateUtils qw( dt_from_string output_pref );
30
use Koha::BiblioFrameworks;
32
use Koha::BiblioFrameworks;
33
use Koha::Hold::CancellationRequests;
31
use Koha::Items;
34
use Koha::Items;
32
use Koha::ItemTypes;
35
use Koha::ItemTypes;
33
use Koha::Patrons;
36
use Koha::Patrons;
Lines 44-49 my $cancelall = $input->param('cancelall'); Link Here
44
my $tab            = $input->param('tab');
47
my $tab            = $input->param('tab');
45
my $cancelBulk     = $input->param('cancelBulk');
48
my $cancelBulk     = $input->param('cancelBulk');
46
49
50
my $reject_hold_cancellation_id = $input->param('reject_hold_cancellation_id');
51
47
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
52
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
48
    {
53
    {
49
        template_name   => "circ/waitingreserves.tt",
54
        template_name   => "circ/waitingreserves.tt",
Lines 73-78 if ( C4::Context->preference('IndependentBranches') ) { Link Here
73
}
78
}
74
$template->param( all_branches => 1 ) if $all_branches;
79
$template->param( all_branches => 1 ) if $all_branches;
75
80
81
# handle cancellation requests rejection
82
if ($reject_hold_cancellation_id) {
83
    try {
84
        Koha::Holds
85
            ->find( $reject_hold_cancellation_id )
86
            ->cancellation_requests
87
            ->filter_by_current
88
            ->reject( $loggedinuser );
89
    }
90
    catch {
91
        if ( $_->isa('Koha::Exceptions::InvalidStatus') ) {
92
            $template->param( reject_result_error => { invalid_status => $_->invalid_status } );
93
        }
94
        else {
95
            $template->param( reject_result_error => { unkown_error => "$_" } );
96
            warn "Unhandled exception when trying to reject a hold cancellation request: $_";
97
        }
98
    };
99
}
100
76
if ($cancelBulk) {
101
if ($cancelBulk) {
77
    my $reason   = $input->param("cancellation-reason");
102
    my $reason   = $input->param("cancellation-reason");
78
    my @hold_ids = split( ',', scalar $input->param("ids") );
103
    my @hold_ids = split( ',', scalar $input->param("ids") );
Lines 116-121 while ( my $hold = $holds->next ) { Link Here
116
    
141
    
117
}
142
}
118
143
144
my $holds_with_cancellation_requests = Koha::Holds->waiting->filter_by_has_pending_cancellation_requests;
145
119
$template->param(cancel_result => \@cancel_result) if @cancel_result;
146
$template->param(cancel_result => \@cancel_result) if @cancel_result;
120
147
121
$template->param(
148
$template->param(
Lines 123-128 $template->param( Link Here
123
    reservecount => scalar @reserve_loop,
150
    reservecount => scalar @reserve_loop,
124
    overloop    => \@over_loop,
151
    overloop    => \@over_loop,
125
    overcount   => scalar @over_loop,
152
    overcount   => scalar @over_loop,
153
    cancel_reqs_count => $holds_with_cancellation_requests->count,
154
    cancel_reqs => $holds_with_cancellation_requests,
126
    show_date   => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
155
    show_date   => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
127
    tab => $tab,
156
    tab => $tab,
128
);
157
);
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc (+17 lines)
Lines 1-3 Link Here
1
[% USE KohaDates %]
1
[% USE ItemTypes %]
2
[% USE ItemTypes %]
2
[% USE AuthorisedValues %]
3
[% USE AuthorisedValues %]
3
<table class="holds_table" id="[% table_name | html %]">
4
<table class="holds_table" id="[% table_name | html %]">
Lines 8-13 Link Here
8
            [% END %]
9
            [% END %]
9
            <th>Waiting since</th>
10
            <th>Waiting since</th>
10
            <th>Date hold placed</th>
11
            <th>Date hold placed</th>
12
          [% IF table_name == 'holdscr' %]
13
            <th>Date cancellation requested</th>
14
          [% END %]
11
            <th>Expiration date</th>
15
            <th>Expiration date</th>
12
            <th class="anti-the">Title</th>
16
            <th class="anti-the">Title</th>
13
            <th>Patron</th>
17
            <th>Patron</th>
Lines 28-33 Link Here
28
                [% END %]
32
                [% END %]
29
                <td><span data-order="[% reserveloo.waitingdate | html %]">[% reserveloo.waitingdate | $KohaDates %]</span></td>
33
                <td><span data-order="[% reserveloo.waitingdate | html %]">[% reserveloo.waitingdate | $KohaDates %]</span></td>
30
                <td><span data-order="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %]</span></td>
34
                <td><span data-order="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %]</span></td>
35
              [% IF table_name == 'holdscr' %]
36
                <td>
37
                [% FOREACH cancellation_request IN reserveloo.cancellation_requests.filter_by_current %]
38
                    <span>[% cancellation_request.creation_date | $KohaDates %]</span>
39
                [% END %]
40
                </td>
41
              [% END %]
31
                <td><span data-order="[% reserveloo.expirationdate | html %]">[% reserveloo.expirationdate | $KohaDates %]</span></td>
42
                <td><span data-order="[% reserveloo.expirationdate | html %]">[% reserveloo.expirationdate | $KohaDates %]</span></td>
32
                <td>
43
                <td>
33
                    [% INCLUDE 'biblio-title.inc' biblio=reserveloo.biblio link = 1 %]
44
                    [% INCLUDE 'biblio-title.inc' biblio=reserveloo.biblio link = 1 %]
Lines 63-68 Link Here
63
                            <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-remove"></i> Cancel hold</button>
74
                            <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-remove"></i> Cancel hold</button>
64
                        [% END %]
75
                        [% END %]
65
                   </form>
76
                   </form>
77
                    [% IF table_name == 'holdscr' %]
78
                    <form name="rejectCancellationRequest" action="waitingreserves.pl" method="post">
79
                        <input type="hidden" name="reject_hold_cancellation_id" value="[% reserveloo.reserve_id | html %]" />
80
                        <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-remove"></i> Reject cancellation</button>
81
                   </form>
82
                   [% END %]
66
                </td>
83
                </td>
67
            </tr>
84
            </tr>
68
        [% END %]
85
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-3 / +29 lines)
Lines 48-53 Link Here
48
            View all libraries</a></span>
48
            View all libraries</a></span>
49
            [% END %]
49
            [% END %]
50
        </h2>
50
        </h2>
51
    [% IF reject_result_error %]
52
        <div class="error message">
53
        [% IF reject_result_error.invalid_status %]
54
            <p>There was a problem rejecting the cancellation request. Cannot reject an already completed cancellation request.</p>
55
        [% ELSE %]
56
            <p>Some error occurred while rejecting the cancellation request. Please check the logs</p>
57
        [% END %]
58
        </div>
59
    [% END %]
51
    [% IF ( cancel_result ) %]
60
    [% IF ( cancel_result ) %]
52
        [% FOREACH cancel_result %]
61
        [% FOREACH cancel_result %]
53
            [% IF ( messagetransfert ) %]
62
            [% IF ( messagetransfert ) %]
Lines 88-93 Link Here
88
                        Holds waiting over [% Koha.Preference('ReservesMaxPickUpDelay') | html %] days: [% overcount | html %]
97
                        Holds waiting over [% Koha.Preference('ReservesMaxPickUpDelay') | html %] days: [% overcount | html %]
89
                    </a>
98
                    </a>
90
                </li>
99
                </li>
100
                <li role="presentation">
101
                    <a href="#holdscr" aria-controls="holdscr" role="tab" data-toggle="tab">
102
                        Holds with cancellation requests: [% cancel_reqs_count | html %]
103
                    </a>
104
                </li>
91
            </ul>
105
            </ul>
92
            <div class="tab-content">
106
            <div class="tab-content">
93
            <div role="tabpanel" class="tab-pane active" id="holdswaiting">
107
            <div role="tabpanel" class="tab-pane active" id="holdswaiting">
Lines 125-130 Link Here
125
                <div class="dialog message">No holds found.</div>
139
                <div class="dialog message">No holds found.</div>
126
            [% END %]
140
            [% END %]
127
        </div>
141
        </div>
142
        <div role="tabpanel" class="tab-pane" id="holdscr">
143
            [% IF cancel_reqs_count %]
144
                [% INCLUDE waiting_holds.inc select_column='1' table_name='holdscr' reserveloop=cancel_reqs tab='holdscr' %]
145
            [% ELSE %]
146
                <div class="dialog message">No holds found.</div>
147
            [% END %]
148
        </div>
128
        </div>
149
        </div>
129
    [% END %]
150
    [% END %]
130
151
Lines 180-187 Link Here
180
    [% INCLUDE 'columns_settings.inc' %]
201
    [% INCLUDE 'columns_settings.inc' %]
181
    <script>
202
    <script>
182
        var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
203
        var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
183
        var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
204
        var holdst_table_settings  = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst',  'json' ) | $raw %];
184
        var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
205
        var holdso_table_settings  = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso',  'json' ) | $raw %];
206
        var holdscr_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdscr', 'json' ) | $raw %];
185
207
186
        $(document).ready(function() {
208
        $(document).ready(function() {
187
209
Lines 195-200 Link Here
195
                "order": [[1, 'asc']]
217
                "order": [[1, 'asc']]
196
            }, holdso_table_settings);
218
            }, holdso_table_settings);
197
219
220
            KohaTable("holdscr", {
221
                "sPaginationType": "full",
222
                "order": [[1, 'asc']]
223
            }, holdscr_table_settings);
224
198
            let cancel_link;
225
            let cancel_link;
199
226
200
            $("#cancelModalConfirmBtn").on("click",function(e) {
227
            $("#cancelModalConfirmBtn").on("click",function(e) {
201
- 

Return to bug 22456