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 521-529 Link Here
521
                                    </thead>
521
                                    </thead>
522
                                    <tbody>
522
                                    <tbody>
523
                                    [% FOREACH RESERVE IN RESERVES %]
523
                                    [% FOREACH RESERVE IN RESERVES %]
524
                                        [% IF ( RESERVE.wait ) %]
524
                                        [% IF ( RESERVE.is_waiting ) %]
525
                                            [% IF ( RESERVE.atdestination ) %]
525
                                            [% IF ( RESERVE.is_at_destination ) %]
526
                                                [% IF ( RESERVE.found ) %]
526
                                                [% IF ( RESERVE.is_found ) %]
527
                                                    <tr class="reserved">
527
                                                    <tr class="reserved">
528
                                                [% ELSE %]
528
                                                [% ELSE %]
529
                                                    <tr>
529
                                                    <tr>
Lines 536-548 Link Here
536
                                        [% END %]
536
                                        [% END %]
537
                                            <td class="title">
537
                                            <td class="title">
538
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
538
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
539
                                                    [% RESERVE.reserves_title %]
539
                                                    [% RESERVE.biblio.title %]
540
                                                    [% FOREACH subtitl IN RESERVE.subtitle %]
540
                                                    [% FOREACH subtitl IN RESERVE.biblio.subtitle %]
541
                                                        [% subtitl.subfield %]
541
                                                        [% subtitl.subfield %]
542
                                                    [% END %]
542
                                                    [% END %]
543
                                                    [% RESERVE.enumchron %]
543
                                                    [% RESERVE.item.enumchron %]
544
                                                </a>
544
                                                </a>
545
                                                [% RESERVE.author %]
545
                                                [% RESERVE.biblio.author %]
546
                                            </td>
546
                                            </td>
547
                                            <td class="reservedate">
547
                                            <td class="reservedate">
548
                                                <span title="[% RESERVE.reservedate %]">
548
                                                <span title="[% RESERVE.reservedate %]">
Lines 551-569 Link Here
551
                                                </span>
551
                                                </span>
552
                                            </td>
552
                                            </td>
553
                                            <td class="expirationdate">
553
                                            <td class="expirationdate">
554
                                                [% IF ( RESERVE.expirationdate ) %]
554
                                                [% IF ! RESERVE.found %]
555
                                                    <span>
555
                                                    [% IF ( RESERVE.expirationdate ) %]
556
                                                        <span>
557
                                                            <span class="tdlabel">Expiration:</span>
558
                                                                [% RESERVE.expirationdate | $KohaDates %]
559
                                                        </span>
560
                                                    [% ELSE %]
556
                                                        <span class="tdlabel">Expiration:</span>
561
                                                        <span class="tdlabel">Expiration:</span>
557
                                                        [% RESERVE.expirationdate | $KohaDates %]
562
                                                        Never expires
558
                                                    </span>
563
                                                    [% END %]
559
                                                [% ELSE %]
564
                                                [% ELSE %]
560
                                                    <span class="tdlabel">Expiration:</span>
565
                                                    -
561
                                                    Never expires
562
                                                [% END %]
566
                                                [% END %]
563
                                            </td>
567
                                            </td>
564
                                            <td class="branch">
568
                                            <td class="branch">
565
                                                <span class="tdlabel">Pick up location:</span>
569
                                                <span class="tdlabel">Pick up location:</span>
566
                                                [% RESERVE.branch %]
570
                                                [% RESERVE.branch.branchname %]
567
                                            </td>
571
                                            </td>
568
                                            [% IF ( showpriority ) %]
572
                                            [% IF ( showpriority ) %]
569
                                                 <td class="priority">
573
                                                 <td class="priority">
Lines 573-583 Link Here
573
                                            [% END %]
577
                                            [% END %]
574
                                            <td class="status">
578
                                            <td class="status">
575
                                                <span class="tdlabel">Status:</span>
579
                                                <span class="tdlabel">Status:</span>
576
                                                [% IF ( RESERVE.wait ) %]
580
                                                [% IF ( RESERVE.is_waiting ) %]
577
                                                    [% IF ( RESERVE.atdestination ) %]
581
                                                    [% IF ( RESERVE.is_at_destination ) %]
578
                                                        [% IF ( RESERVE.found ) %]
582
                                                        [% IF ( RESERVE.found ) %]
579
                                                            Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %]
583
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
580
                                                            <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
584
                                                            [% IF ( RESERVE.waitingdate ) %]
585
                                                                since [% RESERVE.waitingdate | $KohaDates %]
586
                                                                [% IF RESERVE.waiting_expires_on %]
587
                                                                    until [% RESERVE.waiting_expires_on | $KohaDates %]
588
                                                                [% END %]
589
                                                            [% END %]
590
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
581
                                                        [% ELSE %]
591
                                                        [% ELSE %]
582
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
592
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
583
                                                        [% END %]
593
                                                        [% END %]
Lines 585-591 Link Here
585
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
595
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
586
                                                    [% END %]
596
                                                    [% END %]
587
                                                [% ELSE %]
597
                                                [% ELSE %]
588
                                                    [% IF ( RESERVE.intransit ) %]
598
                                                    [% IF ( RESERVE.is_in_transit ) %]
589
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
599
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
590
                                                        [% RESERVE.datesent | $KohaDates %]
600
                                                        [% RESERVE.datesent | $KohaDates %]
591
                                                    [% ELSIF ( RESERVE.suspend ) %]
601
                                                    [% ELSIF ( RESERVE.suspend ) %]
Lines 597-603 Link Here
597
                                            </td>
607
                                            </td>
598
                                            [% IF SuspendHoldsOpac %]
608
                                            [% IF SuspendHoldsOpac %]
599
                                                <td>
609
                                                <td>
600
                                                    [% IF ( RESERVE.cancelable ) %]
610
                                                    [% IF ( RESERVE.is_cancelable ) %]
601
                                                        [% IF RESERVE.suspend %]
611
                                                        [% IF RESERVE.suspend %]
602
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
612
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
603
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
613
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
Lines 638-648 Link Here
638
                                                                </form>
648
                                                                </form>
639
                                                            [% END # / IF AutoResumeSuspendedHolds %]
649
                                                            [% END # / IF AutoResumeSuspendedHolds %]
640
                                                        [% END # / IF RESERVE.suspend %]
650
                                                        [% END # / IF RESERVE.suspend %]
641
                                                    [% END # / IF ( RESERVE.cancelable )%]
651
                                                    [% END # / IF ( RESERVE.is_cancelable )%]
642
                                                </td>
652
                                                </td>
643
                                            [% END # / IF SuspendHoldsOpac %]
653
                                            [% END # / IF SuspendHoldsOpac %]
644
                                            <td class="modify">
654
                                            <td class="modify">
645
                                                [% IF ( RESERVE.cancelable ) %]
655
                                                [% IF ( RESERVE.is_cancelable ) %]
646
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
656
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
647
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
657
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
648
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
658
                                                    <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 275-353 for my $branch_hash ( sort keys %{$branches} ) { Link Here
275
$template->param( branchloop => \@branch_loop );
276
$template->param( branchloop => \@branch_loop );
276
277
277
# now the reserved items....
278
# now the reserved items....
278
my @reserves  = GetReservesFromBorrowernumber( $borrowernumber );
279
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
279
foreach my $res (@reserves) {
280
280
281
    if ( $res->{'expirationdate'} eq '0000-00-00' ) {
281
$template->param(
282
      $res->{'expirationdate'} = '';
282
    RESERVES       => $reserves,
283
    }
283
    reserves_count => $reserves->count(),
284
    $res->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($res->{'biblionumber'}), GetFrameworkCode($res->{'biblionumber'}));
284
    showpriority   => $show_priority,
285
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
285
    WAITING        => $reserves->waiting()
286
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
286
);
287
    my $biblioData = GetBiblioData($res->{'biblionumber'});
288
    $res->{'reserves_title'} = $biblioData->{'title'};
289
    $res->{'author'} = $biblioData->{'author'};
290
291
    if ($show_priority) {
292
        $res->{'priority'} ||= '';
293
    }
294
    if ( $res->{'suspend_until'} ) {
295
        $res->{'suspend_until'} = output_pref({ dt => dt_from_string( $res->{'suspend_until'} , 'iso' ), dateonly => 1 });
296
    }
297
}
298
299
# use Data::Dumper;
300
# warn Dumper(@reserves);
301
302
$template->param( RESERVES       => \@reserves );
303
$template->param( reserves_count => $#reserves+1 );
304
$template->param( showpriority=>$show_priority );
305
306
my @waiting;
307
my $wcount = 0;
308
foreach my $res (@reserves) {
309
    if ( $res->{'itemnumber'} ) {
310
        my $item = GetItem( $res->{'itemnumber'});
311
        $res->{'holdingbranch'} =
312
          $branches->{ $item->{'holdingbranch'} }->{'branchname'};
313
        $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
314
        $res->{'enumchron'} = $item->{'enumchron'} if $item->{'enumchron'};
315
        # get document reserve status
316
        my $biblioData = GetBiblioData($res->{'biblionumber'});
317
        $res->{'waiting_title'} = $biblioData->{'title'};
318
        if ( ( $res->{'found'} eq 'W' ) ) {
319
            my $item = $res->{'itemnumber'};
320
            $item = GetBiblioFromItemNumber($item,undef);
321
            $res->{'wait'}= 1;
322
            $res->{'holdingbranch'}=$item->{'holdingbranch'};
323
            $res->{'biblionumber'}=$item->{'biblionumber'};
324
            $res->{'barcode'} = $item->{'barcode'};
325
            $res->{'wbrcode'} = $res->{'branchcode'};
326
            $res->{'itemnumber'}    = $res->{'itemnumber'};
327
            $res->{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
328
            if($res->{'holdingbranch'} eq $res->{'wbrcode'}){
329
                $res->{'atdestination'} = 1;
330
            }
331
            # set found to 1 if reserve is waiting for patron pickup
332
            $res->{'found'} = 1 if $res->{'found'} eq 'W';
333
        } else {
334
            my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} );
335
            if ($transfertwhen) {
336
                $res->{intransit} = 1;
337
                $res->{datesent}   = $transfertwhen;
338
                $res->{frombranch} = GetBranchName($transfertfrom);
339
            }
340
        }
341
        push @waiting, $res;
342
        $wcount++;
343
    }
344
    # can be cancelled
345
    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
346
    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
347
348
}
349
350
$template->param( WAITING => \@waiting );
351
287
352
# current alert subscriptions
288
# current alert subscriptions
353
my $alerts = getalert($borrowernumber);
289
my $alerts = getalert($borrowernumber);
354
- 

Return to bug 13918