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 (+38 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_in_transit
122
123
Returns true if hold is a in_transit hold
124
125
=cut
126
127
sub is_in_transit {
128
    my ($self) = @_;
129
130
    return 0 unless $self->found();
131
    return $self->found() eq 'T';
132
}
133
134
=head3 is_at_destination
135
136
Returns true if hold is a in_transit hold
137
138
=cut
139
140
sub is_at_destination {
141
    my ($self) = @_;
142
143
    return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() );
144
}
145
108
=head3 biblio
146
=head3 biblio
109
147
110
Returns the related Koha::Biblio object for this hold
148
Returns the related Koha::Biblio object for this hold
(-)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 (-72 / +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,
391
- 

Return to bug 13918