View | Details | Raw Unified | Return to bug 13918
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 (+25 lines)
Lines 105-110 sub is_in_transit { Link Here
105
    return $self->found() eq 'T';
105
    return $self->found() eq 'T';
106
}
106
}
107
107
108
=head3 is_cancelable
109
110
Returns true if hold is a cancelable hold
111
112
=cut
113
114
sub is_cancelable {
115
    my ($self) = @_;
116
117
    return ( $self->is_waiting() && !$self->is_found() )
118
      || ( !$self->is_waiting() && !$self->is_in_transit() );
119
}
120
121
=head3 is_at_destination
122
123
Returns true if hold is a in_transit hold
124
125
=cut
126
127
sub is_at_destination {
128
    my ($self) = @_;
129
130
    return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() );
131
}
132
108
=head3 biblio
133
=head3 biblio
109
134
110
Returns the related Koha::Biblio object for this hold
135
Returns the related Koha::Biblio object for this hold
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-22 / +32 lines)
Lines 520-528 Link Here
520
                                    </thead>
520
                                    </thead>
521
                                    <tbody>
521
                                    <tbody>
522
                                    [% FOREACH RESERVE IN RESERVES %]
522
                                    [% FOREACH RESERVE IN RESERVES %]
523
                                        [% IF ( RESERVE.wait ) %]
523
                                        [% IF ( RESERVE.is_waiting ) %]
524
                                            [% IF ( RESERVE.atdestination ) %]
524
                                            [% IF ( RESERVE.is_at_destination ) %]
525
                                                [% IF ( RESERVE.found ) %]
525
                                                [% IF ( RESERVE.is_found ) %]
526
                                                    <tr class="reserved">
526
                                                    <tr class="reserved">
527
                                                [% ELSE %]
527
                                                [% ELSE %]
528
                                                    <tr>
528
                                                    <tr>
Lines 535-547 Link Here
535
                                        [% END %]
535
                                        [% END %]
536
                                            <td class="title">
536
                                            <td class="title">
537
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
537
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
538
                                                    [% RESERVE.reserves_title %]
538
                                                    [% RESERVE.biblio.title %]
539
                                                    [% FOREACH subtitl IN RESERVE.subtitle %]
539
                                                    [% FOREACH subtitl IN RESERVE.biblio.subtitle %]
540
                                                        [% subtitl.subfield %]
540
                                                        [% subtitl.subfield %]
541
                                                    [% END %]
541
                                                    [% END %]
542
                                                    [% RESERVE.enumchron %]
542
                                                    [% RESERVE.item.enumchron %]
543
                                                </a>
543
                                                </a>
544
                                                [% RESERVE.author %]
544
                                                [% RESERVE.biblio.author %]
545
                                            </td>
545
                                            </td>
546
                                            <td class="reservedate">
546
                                            <td class="reservedate">
547
                                                <span title="[% RESERVE.reservedate %]">
547
                                                <span title="[% RESERVE.reservedate %]">
Lines 550-568 Link Here
550
                                                </span>
550
                                                </span>
551
                                            </td>
551
                                            </td>
552
                                            <td class="expirationdate">
552
                                            <td class="expirationdate">
553
                                                [% IF ( RESERVE.expirationdate ) %]
553
                                                [% IF ! RESERVE.found %]
554
                                                    <span>
554
                                                    [% IF ( RESERVE.expirationdate ) %]
555
                                                        <span>
556
                                                            <span class="tdlabel">Expiration:</span>
557
                                                                [% RESERVE.expirationdate | $KohaDates %]
558
                                                        </span>
559
                                                    [% ELSE %]
555
                                                        <span class="tdlabel">Expiration:</span>
560
                                                        <span class="tdlabel">Expiration:</span>
556
                                                        [% RESERVE.expirationdate | $KohaDates %]
561
                                                        Never expires
557
                                                    </span>
562
                                                    [% END %]
558
                                                [% ELSE %]
563
                                                [% ELSE %]
559
                                                    <span class="tdlabel">Expiration:</span>
564
                                                    -
560
                                                    Never expires
561
                                                [% END %]
565
                                                [% END %]
562
                                            </td>
566
                                            </td>
563
                                            <td class="branch">
567
                                            <td class="branch">
564
                                                <span class="tdlabel">Pick up location:</span>
568
                                                <span class="tdlabel">Pick up location:</span>
565
                                                [% RESERVE.branch %]
569
                                                [% RESERVE.branch.branchname %]
566
                                            </td>
570
                                            </td>
567
                                            [% IF ( showpriority ) %]
571
                                            [% IF ( showpriority ) %]
568
                                                 <td class="priority">
572
                                                 <td class="priority">
Lines 572-582 Link Here
572
                                            [% END %]
576
                                            [% END %]
573
                                            <td class="status">
577
                                            <td class="status">
574
                                                <span class="tdlabel">Status:</span>
578
                                                <span class="tdlabel">Status:</span>
575
                                                [% IF ( RESERVE.wait ) %]
579
                                                [% IF ( RESERVE.is_waiting ) %]
576
                                                    [% IF ( RESERVE.atdestination ) %]
580
                                                    [% IF ( RESERVE.is_at_destination ) %]
577
                                                        [% IF ( RESERVE.found ) %]
581
                                                        [% IF ( RESERVE.found ) %]
578
                                                            Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %]
582
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
579
                                                            <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
583
                                                            [% IF ( RESERVE.waitingdate ) %]
584
                                                                since [% RESERVE.waitingdate | $KohaDates %]
585
                                                                [% IF RESERVE.waiting_expires_on %]
586
                                                                    until [% RESERVE.waiting_expires_on | $KohaDates %]
587
                                                                [% END %]
588
                                                            [% END %]
589
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
580
                                                        [% ELSE %]
590
                                                        [% ELSE %]
581
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
591
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
582
                                                        [% END %]
592
                                                        [% END %]
Lines 584-590 Link Here
584
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
594
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
585
                                                    [% END %]
595
                                                    [% END %]
586
                                                [% ELSE %]
596
                                                [% ELSE %]
587
                                                    [% IF ( RESERVE.intransit ) %]
597
                                                    [% IF ( RESERVE.is_in_transit ) %]
588
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
598
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
589
                                                        [% RESERVE.datesent | $KohaDates %]
599
                                                        [% RESERVE.datesent | $KohaDates %]
590
                                                    [% ELSIF ( RESERVE.suspend ) %]
600
                                                    [% ELSIF ( RESERVE.suspend ) %]
Lines 596-602 Link Here
596
                                            </td>
606
                                            </td>
597
                                            [% IF SuspendHoldsOpac %]
607
                                            [% IF SuspendHoldsOpac %]
598
                                                <td>
608
                                                <td>
599
                                                    [% IF ( RESERVE.cancelable ) %]
609
                                                    [% IF ( RESERVE.is_cancelable ) %]
600
                                                        [% IF RESERVE.suspend %]
610
                                                        [% IF RESERVE.suspend %]
601
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
611
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
602
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
612
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
Lines 637-647 Link Here
637
                                                                </form>
647
                                                                </form>
638
                                                            [% END # / IF AutoResumeSuspendedHolds %]
648
                                                            [% END # / IF AutoResumeSuspendedHolds %]
639
                                                        [% END # / IF RESERVE.suspend %]
649
                                                        [% END # / IF RESERVE.suspend %]
640
                                                    [% END # / IF ( RESERVE.cancelable )%]
650
                                                    [% END # / IF ( RESERVE.is_cancelable )%]
641
                                                </td>
651
                                                </td>
642
                                            [% END # / IF SuspendHoldsOpac %]
652
                                            [% END # / IF SuspendHoldsOpac %]
643
                                            <td class="modify">
653
                                            <td class="modify">
644
                                                [% IF ( RESERVE.cancelable ) %]
654
                                                [% IF ( RESERVE.is_cancelable ) %]
645
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
655
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
646
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
656
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
647
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
657
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
(-)a/opac/opac-user.pl (-73 / +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-354 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
    if ( $res->{'suspend_until'} ) {
296
        $res->{'suspend_until'} = output_pref({ dt => dt_from_string( $res->{'suspend_until'} , 'iso' ), dateonly => 1 });
297
    }
298
}
299
300
# use Data::Dumper;
301
# warn Dumper(@reserves);
302
303
$template->param( RESERVES       => \@reserves );
304
$template->param( reserves_count => $#reserves+1 );
305
$template->param( showpriority=>$show_priority );
306
307
my @waiting;
308
my $wcount = 0;
309
foreach my $res (@reserves) {
310
    if ( $res->{'itemnumber'} ) {
311
        my $item = GetItem( $res->{'itemnumber'});
312
        $res->{'holdingbranch'} =
313
          $branches->{ $item->{'holdingbranch'} }->{'branchname'};
314
        $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
315
        $res->{'enumchron'} = $item->{'enumchron'} if $item->{'enumchron'};
316
        # get document reserve status
317
        my $biblioData = GetBiblioData($res->{'biblionumber'});
318
        $res->{'waiting_title'} = $biblioData->{'title'};
319
        if ( ( $res->{'found'} eq 'W' ) ) {
320
            my $item = $res->{'itemnumber'};
321
            $item = GetBiblioFromItemNumber($item,undef);
322
            $res->{'wait'}= 1;
323
            $res->{'holdingbranch'}=$item->{'holdingbranch'};
324
            $res->{'biblionumber'}=$item->{'biblionumber'};
325
            $res->{'barcode'} = $item->{'barcode'};
326
            $res->{'wbrcode'} = $res->{'branchcode'};
327
            $res->{'itemnumber'}    = $res->{'itemnumber'};
328
            $res->{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
329
            if($res->{'holdingbranch'} eq $res->{'wbrcode'}){
330
                $res->{'atdestination'} = 1;
331
            }
332
            # set found to 1 if reserve is waiting for patron pickup
333
            $res->{'found'} = 1 if $res->{'found'} eq 'W';
334
        } else {
335
            my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} );
336
            if ($transfertwhen) {
337
                $res->{intransit} = 1;
338
                $res->{datesent}   = $transfertwhen;
339
                $res->{frombranch} = GetBranchName($transfertfrom);
340
            }
341
        }
342
        push @waiting, $res;
343
        $wcount++;
344
    }
345
    # can be cancelled
346
    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
347
    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
348
349
}
350
351
$template->param( WAITING => \@waiting );
352
288
353
# current alert subscriptions
289
# current alert subscriptions
354
my $alerts = getalert($borrowernumber);
290
my $alerts = getalert($borrowernumber);
355
- 

Return to bug 13918