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

(-)a/Koha/Biblio.pm (+13 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use Carp;
22
use Carp;
23
23
24
use C4::Biblio qw( GetRecordValue GetMarcBiblio GetFrameworkCode );
25
24
use Koha::Database;
26
use Koha::Database;
25
27
26
use base qw(Koha::Object);
28
use base qw(Koha::Object);
Lines 35-40 Koha::Biblio - Koha Biblio Object class Link Here
35
37
36
=cut
38
=cut
37
39
40
=head3 subtitle
41
42
=cut
43
44
sub subtitle {
45
    my ( $self ) = @_;
46
47
    return GetRecordValue( 'subtitle', GetMarcBiblio( $self->id() ), GetFrameworkCode( $self->id() ) );
48
}
49
50
38
=head3 type
51
=head3 type
39
52
40
=cut
53
=cut
(-)a/Koha/Hold.pm (-1 / +67 lines)
Lines 41-46 Koha::Hold - Koha Hold object class Link Here
41
41
42
=cut
42
=cut
43
43
44
=head3 suspend_hold
45
46
my $hold = $hold->suspend_hold( $suspend_until_dt );
47
48
=cut
49
50
sub suspend_hold {
51
    my ( $self, $dt ) = @_;
52
53
    if ( $self->is_waiting ) {    # We can't suspend waiting holds
54
        carp "Unable to suspend waiting hold!";
55
        return $self;
56
    }
57
58
    $dt ||= undef;
59
60
    $self->suspend(1);
61
    $self->suspend_until( $dt );
62
63
    $self->store();
64
65
    return $self;
66
}
67
68
=head3 resume
69
70
my $hold = $hold->resume();
71
72
=cut
73
74
sub resume {
75
    my ( $self ) = @_;
76
77
    $self->suspend(0);
78
    $self->suspend_until( undef );
79
80
    $self->store();
81
82
    return $self;
83
}
84
44
=head3 waiting_expires_on
85
=head3 waiting_expires_on
45
86
46
Returns a DateTime for the date a waiting holds expires on.
87
Returns a DateTime for the date a waiting holds expires on.
Lines 52-58 Returns undef if the hold is not waiting ( found = 'W' ). Link Here
52
sub waiting_expires_on {
93
sub waiting_expires_on {
53
    my ($self) = @_;
94
    my ($self) = @_;
54
95
55
    return unless $self->found() eq 'W';
96
    return unless $self->found() && $self->found() eq 'W';
56
97
57
    my $ReservesMaxPickUpDelay = C4::Context->preference('ReservesMaxPickUpDelay');
98
    my $ReservesMaxPickUpDelay = C4::Context->preference('ReservesMaxPickUpDelay');
58
    return unless $ReservesMaxPickUpDelay;
99
    return unless $ReservesMaxPickUpDelay;
Lines 91-96 sub is_waiting { Link Here
91
    return $self->found() eq 'W';
132
    return $self->found() eq 'W';
92
}
133
}
93
134
135
=head3 is_cancelable
136
137
Returns true if hold is a cancelable hold
138
139
=cut
140
141
sub is_cancelable {
142
    my ($self) = @_;
143
144
    return ( $self->is_waiting() && !$self->is_found() )
145
      || ( !$self->is_waiting() && !$self->is_in_transit() );
146
}
147
94
=head3 is_in_transit
148
=head3 is_in_transit
95
149
96
Returns true if hold is a in_transit hold
150
Returns true if hold is a in_transit hold
Lines 104-109 sub is_in_transit { Link Here
104
    return $self->found() eq 'T';
158
    return $self->found() eq 'T';
105
}
159
}
106
160
161
=head3 is_at_destination
162
163
Returns true if hold is a in_transit hold
164
165
=cut
166
167
sub is_at_destination {
168
    my ($self) = @_;
169
170
    return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() );
171
}
172
107
=head3 biblio
173
=head3 biblio
108
174
109
Returns the related Koha::Biblio object for this hold
175
Returns the related Koha::Biblio object for this hold
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js (-8 / +79 lines)
Lines 8-18 $(document).ready(function() { Link Here
8
    if ( $("#holds-tab").parent().hasClass('ui-state-active') ) { load_holds_table() }
8
    if ( $("#holds-tab").parent().hasClass('ui-state-active') ) { load_holds_table() }
9
9
10
    function load_holds_table() {
10
    function load_holds_table() {
11
        var holds = new Array();
11
        if ( ! holdsTable ) {
12
        if ( ! holdsTable ) {
12
            holdsTable = $("#holds-table").dataTable({
13
            holdsTable = $("#holds-table").dataTable({
13
                "bAutoWidth": false,
14
                "bAutoWidth": false,
14
                "sDom": "rt",
15
                "sDom": "rt",
15
                "aoColumns": [
16
                "columns": [
16
                    {
17
                    {
17
                        "mDataProp": "reservedate_formatted"
18
                        "mDataProp": "reservedate_formatted"
18
                    },
19
                    },
Lines 119-139 $(document).ready(function() { Link Here
119
                                 + "<input type='hidden' name='borrowernumber' value='" + borrowernumber + "'>"
120
                                 + "<input type='hidden' name='borrowernumber' value='" + borrowernumber + "'>"
120
                                 + "<input type='hidden' name='reserve_id' value='" + oObj.reserve_id + "'>";
121
                                 + "<input type='hidden' name='reserve_id' value='" + oObj.reserve_id + "'>";
121
                        }
122
                        }
123
                    },
124
                    {
125
                        "bSortable": false,
126
                        "mDataProp": function( oObj ) {
127
                            holds[oObj.reserve_id] = oObj; //Store holds for later use
128
129
                            if ( oObj.found ) {
130
                                return "";
131
                            } else if ( oObj.suspend == 1 ) {
132
                                return "<a class='hold-resume btn btn-link' id='resume" + oObj.reserve_id + "' style='display: inline; white-space: nowrap;'>"
133
                                     + "<i class='icon-play'></i> " + _("Resume") + "</a>";
134
                            } else {
135
                                return "<a class='hold-suspend btn btn-link' id='suspend" + oObj.reserve_id + "' style='display: inline; white-space: nowrap;'>"
136
                                     + "<i class='icon-pause'></i> " + _("Suspend") + "</a>";
137
                            }
138
                        }
122
                    }
139
                    }
123
                ],
140
                ],
124
                "bPaginate": false,
141
                "bPaginate": false,
125
                "bProcessing": true,
142
                "bProcessing": true,
126
                "bServerSide": false,
143
                "bServerSide": false,
127
                "sAjaxSource": '/cgi-bin/koha/svc/holds',
144
                "ajax": {
128
                "fnServerData": function ( sSource, aoData, fnCallback ) {
145
                    "url": '/cgi-bin/koha/svc/holds',
129
                    aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
146
                    "data": function ( d ) {
130
147
                        d.borrowernumber = borrowernumber;
131
                    $.getJSON( sSource, aoData, function (json) {
148
                    }
132
                        fnCallback(json)
133
                    } );
134
                },
149
                },
135
            });
150
            });
136
151
152
            $('#holds-table').on( 'draw.dt', function () {
153
                $(".hold-suspend").on( "click", function() {
154
                    var id = $(this).attr("id").replace("suspend", "");
155
                    var hold = holds[id];
156
                    $("#suspend-modal-title").html( hold.title );
157
                    $("#suspend-modal-reserve_id").val( hold.reserve_id );
158
                    $('#suspend-modal').modal('show');
159
                });
160
161
                $(".hold-resume").on( "click", function() {
162
                    var id = $(this).attr("id").replace("resume", "");
163
                    var hold = holds[id];
164
                    $.post('/cgi-bin/koha/svc/hold/resume', { "reserve_id": hold.reserve_id }, function( data ){
165
                      holdsTable.api().ajax.reload();
166
                    });
167
                });
168
            });
169
137
            if ( $("#holds-table").length ) {
170
            if ( $("#holds-table").length ) {
138
                $("#holds-table_processing").position({
171
                $("#holds-table_processing").position({
139
                    of: $( "#holds-table" ),
172
                    of: $( "#holds-table" ),
Lines 142-145 $(document).ready(function() { Link Here
142
            }
175
            }
143
        }
176
        }
144
    }
177
    }
178
179
    $("body").append("\
180
        <div id='suspend-modal' class='modal hide fade' tabindex='-1' role='dialog' aria-hidden='true'>\
181
            <form id='suspend-modal-form' class='form-inline'>\
182
                <div class='modal-header'>\
183
                    <button type='button' class='closebtn' data-dismiss='modal' aria-hidden='true'>×</button>\
184
                    <h3 id='suspend-modal-label'>" + _("Suspend hold on") + " <i><span id='suspend-modal-title'></span></i></h3>\
185
                </div>\
186
\
187
                <div class='modal-body'>\
188
                    <input type='hidden' id='suspend-modal-reserve_id' name='reserve_id' />\
189
\
190
                    <label for='suspend-modal-until'>Suspend until:</label>\
191
                    <input name='suspend_until' id='suspend-modal-until' class='suspend-until' size='10' />\
192
\
193
                    <p/><a class='btn btn-link' id='suspend-modal-clear-date' >" + _("Clear date to suspend indefinitely") + "</a></p>\
194
\
195
                </div>\
196
\
197
                <div class='modal-footer'>\
198
                    <button id='suspend-modal-submit' class='btn btn-primary' type='submit' name='submit'>" + _("Suspend") + "</button>\
199
                    <a href='#' data-dismiss='modal' aria-hidden='true' class='cancel'>" + _("Cancel") + "</a>\
200
                </div>\
201
            </form>\
202
        </div>\
203
    ");
204
205
    $("#suspend-modal-until").datepicker({ minDate: 1 }); // Require that "until date" be in the future
206
    $("#suspend-modal-clear-date").on( "click", function() { $("#suspend-modal-until").val(""); } );
207
208
    $("#suspend-modal-submit").on( "click", function( e ) {
209
        e.preventDefault();
210
        $.post('/cgi-bin/koha/svc/hold/suspend', $('#suspend-modal-form').serialize(), function( data ){
211
          $('#suspend-modal').modal('hide');
212
          holdsTable.api().ajax.reload();
213
        });
214
    });
215
145
});
216
});
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 895-900 No patron matched <span class="ex">[% message %]</span> Link Here
895
                    <th>Expiration</th>
895
                    <th>Expiration</th>
896
                    <th>Priority</th>
896
                    <th>Priority</th>
897
                    <th>Delete?</th>
897
                    <th>Delete?</th>
898
                    <th>Suspend?</th>
898
                </tr>
899
                </tr>
899
            </thead>
900
            </thead>
900
        </table>
901
        </table>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 484-489 function validate1(date) { Link Here
484
                    <th>Expiration</th>
484
                    <th>Expiration</th>
485
                    <th>Priority</th>
485
                    <th>Priority</th>
486
                    <th>Delete?</th>
486
                    <th>Delete?</th>
487
                    <th>Suspend?</th>
487
                </tr>
488
                </tr>
488
            </thead>
489
            </thead>
489
        </table>
490
        </table>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-22 / +32 lines)
Lines 511-519 Link Here
511
                                    </thead>
511
                                    </thead>
512
                                    <tbody>
512
                                    <tbody>
513
                                    [% FOREACH RESERVE IN RESERVES %]
513
                                    [% FOREACH RESERVE IN RESERVES %]
514
                                        [% IF ( RESERVE.wait ) %]
514
                                        [% IF ( RESERVE.is_waiting ) %]
515
                                            [% IF ( RESERVE.atdestination ) %]
515
                                            [% IF ( RESERVE.is_at_destination ) %]
516
                                                [% IF ( RESERVE.found ) %]
516
                                                [% IF ( RESERVE.is_found ) %]
517
                                                    <tr class="reserved">
517
                                                    <tr class="reserved">
518
                                                [% ELSE %]
518
                                                [% ELSE %]
519
                                                    <tr>
519
                                                    <tr>
Lines 526-538 Link Here
526
                                        [% END %]
526
                                        [% END %]
527
                                            <td class="title">
527
                                            <td class="title">
528
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
528
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
529
                                                    [% RESERVE.reserves_title %]
529
                                                    [% RESERVE.biblio.title %]
530
                                                    [% FOREACH subtitl IN RESERVE.subtitle %]
530
                                                    [% FOREACH subtitl IN RESERVE.biblio.subtitle %]
531
                                                        [% subtitl.subfield %]
531
                                                        [% subtitl.subfield %]
532
                                                    [% END %]
532
                                                    [% END %]
533
                                                    [% RESERVE.enumchron %]
533
                                                    [% RESERVE.item.enumchron %]
534
                                                </a>
534
                                                </a>
535
                                                [% RESERVE.author %]
535
                                                [% RESERVE.biblio.author %]
536
                                            </td>
536
                                            </td>
537
                                            <td class="reservedate">
537
                                            <td class="reservedate">
538
                                                <span title="[% RESERVE.reservedate %]">
538
                                                <span title="[% RESERVE.reservedate %]">
Lines 541-559 Link Here
541
                                                </span>
541
                                                </span>
542
                                            </td>
542
                                            </td>
543
                                            <td class="expirationdate">
543
                                            <td class="expirationdate">
544
                                                [% IF ( RESERVE.expirationdate ) %]
544
                                                [% IF ! RESERVE.found %]
545
                                                    <span>
545
                                                    [% IF ( RESERVE.expirationdate ) %]
546
                                                        <span>
547
                                                            <span class="tdlabel">Expiration:</span>
548
                                                                [% RESERVE.expirationdate | $KohaDates %]
549
                                                        </span>
550
                                                    [% ELSE %]
546
                                                        <span class="tdlabel">Expiration:</span>
551
                                                        <span class="tdlabel">Expiration:</span>
547
                                                        [% RESERVE.expirationdate | $KohaDates %]
552
                                                        Never expires
548
                                                    </span>
553
                                                    [% END %]
549
                                                [% ELSE %]
554
                                                [% ELSE %]
550
                                                    <span class="tdlabel">Expiration:</span>
555
                                                    -
551
                                                    Never expires
552
                                                [% END %]
556
                                                [% END %]
553
                                            </td>
557
                                            </td>
554
                                            <td class="branch">
558
                                            <td class="branch">
555
                                                <span class="tdlabel">Pick up location:</span>
559
                                                <span class="tdlabel">Pick up location:</span>
556
                                                [% RESERVE.branch %]
560
                                                [% RESERVE.branch.branchname %]
557
                                            </td>
561
                                            </td>
558
                                            [% IF ( showpriority ) %]
562
                                            [% IF ( showpriority ) %]
559
                                                 <td class="priority">
563
                                                 <td class="priority">
Lines 563-573 Link Here
563
                                            [% END %]
567
                                            [% END %]
564
                                            <td class="status">
568
                                            <td class="status">
565
                                                <span class="tdlabel">Status:</span>
569
                                                <span class="tdlabel">Status:</span>
566
                                                [% IF ( RESERVE.wait ) %]
570
                                                [% IF ( RESERVE.is_waiting ) %]
567
                                                    [% IF ( RESERVE.atdestination ) %]
571
                                                    [% IF ( RESERVE.is_at_destination ) %]
568
                                                        [% IF ( RESERVE.found ) %]
572
                                                        [% IF ( RESERVE.found ) %]
569
                                                            Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %]
573
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
570
                                                            <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
574
                                                            [% IF ( RESERVE.waitingdate ) %]
575
                                                                since [% RESERVE.waitingdate | $KohaDates %]
576
                                                                [% IF RESERVE.waiting_expires_on %]
577
                                                                    until [% RESERVE.waiting_expires_on | $KohaDates %]
578
                                                                [% END %]
579
                                                            [% END %]
580
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
571
                                                        [% ELSE %]
581
                                                        [% ELSE %]
572
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
582
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
573
                                                        [% END %]
583
                                                        [% END %]
Lines 575-581 Link Here
575
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
585
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
576
                                                    [% END %]
586
                                                    [% END %]
577
                                                [% ELSE %]
587
                                                [% ELSE %]
578
                                                    [% IF ( RESERVE.intransit ) %]
588
                                                    [% IF ( RESERVE.is_in_transit ) %]
579
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
589
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
580
                                                        [% RESERVE.datesent | $KohaDates %]
590
                                                        [% RESERVE.datesent | $KohaDates %]
581
                                                    [% ELSIF ( RESERVE.suspend ) %]
591
                                                    [% ELSIF ( RESERVE.suspend ) %]
Lines 587-593 Link Here
587
                                            </td>
597
                                            </td>
588
                                            [% IF SuspendHoldsOpac %]
598
                                            [% IF SuspendHoldsOpac %]
589
                                                <td>
599
                                                <td>
590
                                                    [% IF ( RESERVE.cancelable ) %]
600
                                                    [% IF ( RESERVE.is_cancelable ) %]
591
                                                        [% IF RESERVE.suspend %]
601
                                                        [% IF RESERVE.suspend %]
592
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
602
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
593
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
603
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
Lines 628-638 Link Here
628
                                                                </form>
638
                                                                </form>
629
                                                            [% END # / IF AutoResumeSuspendedHolds %]
639
                                                            [% END # / IF AutoResumeSuspendedHolds %]
630
                                                        [% END # / IF RESERVE.suspend %]
640
                                                        [% END # / IF RESERVE.suspend %]
631
                                                    [% END # / IF ( RESERVE.cancelable )%]
641
                                                    [% END # / IF ( RESERVE.is_cancelable )%]
632
                                                </td>
642
                                                </td>
633
                                            [% END # / IF SuspendHoldsOpac %]
643
                                            [% END # / IF SuspendHoldsOpac %]
634
                                            <td class="modify">
644
                                            <td class="modify">
635
                                                [% IF ( RESERVE.cancelable ) %]
645
                                                [% IF ( RESERVE.is_cancelable ) %]
636
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
646
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
637
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
647
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
638
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
648
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
(-)a/opac/opac-user.pl (-71 / +8 lines)
Lines 36-41 use C4::Letters; Link Here
36
use C4::Branch; # GetBranches
36
use C4::Branch; # GetBranches
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Koha::Borrower::Debarments qw(IsDebarred);
38
use Koha::Borrower::Debarments qw(IsDebarred);
39
use Koha::Holds;
39
40
40
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
41
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
41
42
Lines 276-352 for my $branch_hash ( sort keys %{$branches} ) { Link Here
276
$template->param( branchloop => \@branch_loop );
277
$template->param( branchloop => \@branch_loop );
277
278
278
# now the reserved items....
279
# now the reserved items....
279
my @reserves  = GetReservesFromBorrowernumber( $borrowernumber );
280
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
280
foreach my $res (@reserves) {
281
281
282
    if ( $res->{'expirationdate'} eq '0000-00-00' ) {
282
$template->param(
283
      $res->{'expirationdate'} = '';
283
    RESERVES       => $reserves,
284
    }
284
    reserves_count => $reserves->count(),
285
    $res->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($res->{'biblionumber'}), GetFrameworkCode($res->{'biblionumber'}));
285
    showpriority   => $show_priority,
286
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
286
    WAITING        => $reserves->waiting()
287
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
287
);
288
    my $biblioData = GetBiblioData($res->{'biblionumber'});
289
    $res->{'reserves_title'} = $biblioData->{'title'};
290
    $res->{'author'} = $biblioData->{'author'};
291
292
    if ($show_priority) {
293
        $res->{'priority'} ||= '';
294
    }
295
    $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
296
}
297
298
# use Data::Dumper;
299
# warn Dumper(@reserves);
300
301
$template->param( RESERVES       => \@reserves );
302
$template->param( reserves_count => $#reserves+1 );
303
$template->param( showpriority=>$show_priority );
304
305
my @waiting;
306
my $wcount = 0;
307
foreach my $res (@reserves) {
308
    if ( $res->{'itemnumber'} ) {
309
        my $item = GetItem( $res->{'itemnumber'});
310
        $res->{'holdingbranch'} =
311
          $branches->{ $item->{'holdingbranch'} }->{'branchname'};
312
        $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
313
        $res->{'enumchron'} = $item->{'enumchron'} if $item->{'enumchron'};
314
        # get document reserve status
315
        my $biblioData = GetBiblioData($res->{'biblionumber'});
316
        $res->{'waiting_title'} = $biblioData->{'title'};
317
        if ( ( $res->{'found'} eq 'W' ) ) {
318
            my $item = $res->{'itemnumber'};
319
            $item = GetBiblioFromItemNumber($item,undef);
320
            $res->{'wait'}= 1;
321
            $res->{'holdingbranch'}=$item->{'holdingbranch'};
322
            $res->{'biblionumber'}=$item->{'biblionumber'};
323
            $res->{'barcode'} = $item->{'barcode'};
324
            $res->{'wbrcode'} = $res->{'branchcode'};
325
            $res->{'itemnumber'}    = $res->{'itemnumber'};
326
            $res->{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
327
            if($res->{'holdingbranch'} eq $res->{'wbrcode'}){
328
                $res->{'atdestination'} = 1;
329
            }
330
            # set found to 1 if reserve is waiting for patron pickup
331
            $res->{'found'} = 1 if $res->{'found'} eq 'W';
332
        } else {
333
            my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} );
334
            if ($transfertwhen) {
335
                $res->{intransit} = 1;
336
                $res->{datesent}   = $transfertwhen;
337
                $res->{frombranch} = GetBranchName($transfertfrom);
338
            }
339
        }
340
        push @waiting, $res;
341
        $wcount++;
342
    }
343
    # can be cancelled
344
    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
345
    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
346
347
}
348
349
$template->param( WAITING => \@waiting );
350
288
351
# current alert subscriptions
289
# current alert subscriptions
352
my $alerts = getalert($borrowernumber);
290
my $alerts = getalert($borrowernumber);
Lines 384-390 if ( $borr->{'opacnote'} ) { Link Here
384
322
385
$template->param(
323
$template->param(
386
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
324
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
387
    waiting_count      => $wcount,
388
    patronupdate => $patronupdate,
325
    patronupdate => $patronupdate,
389
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
326
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
390
    userview => 1,
327
    userview => 1,
(-)a/svc/hold/resume (+48 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2015 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
use JSON qw(to_json);
24
25
use C4::Context;
26
use C4::Auth qw(check_cookie_auth);
27
use Koha::DateUtils qw(dt_from_string);
28
use Koha::Holds;
29
30
my $input = new CGI;
31
32
my ( $auth_status, $sessionID ) =
33
  check_cookie_auth( $input->cookie('CGISESSID'),
34
    { circulate => 'circulate_remaining_permissions' } );
35
36
if ( $auth_status ne "ok" ) {
37
    exit 0;
38
}
39
40
binmode STDOUT, ":encoding(UTF-8)";
41
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
42
43
my $reserve_id = $input->param('reserve_id');
44
45
my $hold = Koha::Holds->find( $reserve_id );
46
$hold->resume();
47
48
print to_json( { success => !$hold->suspend() } );
(-)a/svc/hold/suspend (-1 / +51 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2015 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
use JSON qw(to_json);
24
25
use C4::Context;
26
use C4::Auth qw(check_cookie_auth);
27
use Koha::DateUtils qw(dt_from_string);
28
use Koha::Holds;
29
30
my $input = new CGI;
31
32
my ( $auth_status, $sessionID ) =
33
  check_cookie_auth( $input->cookie('CGISESSID'),
34
    { circulate => 'circulate_remaining_permissions' } );
35
36
if ( $auth_status ne "ok" ) {
37
    exit 0;
38
}
39
40
binmode STDOUT, ":encoding(UTF-8)";
41
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
42
43
my $reserve_id = $input->param('reserve_id');
44
45
my $suspend_until = $input->param('suspend_until') || undef;
46
$suspend_until = dt_from_string( $suspend_until ) if $suspend_until;
47
48
my $hold = Koha::Holds->find( $reserve_id );
49
$hold->suspend_hold( $suspend_until );
50
51
print to_json( { success => $hold->suspend() } );

Return to bug 14310