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 91-96 sub is_waiting { Link Here
91
    return $self->found() eq 'W';
91
    return $self->found() eq 'W';
92
}
92
}
93
93
94
=head3 is_cancelable
95
96
Returns true if hold is a cancelable hold
97
98
=cut
99
100
sub is_cancelable {
101
    my ($self) = @_;
102
103
    return ( $self->is_waiting() && !$self->is_found() )
104
      || ( !$self->is_waiting() && !$self->is_in_transit() );
105
}
106
94
=head3 is_in_transit
107
=head3 is_in_transit
95
108
96
Returns true if hold is a in_transit hold
109
Returns true if hold is a in_transit hold
Lines 104-109 sub is_in_transit { Link Here
104
    return $self->found() eq 'T';
117
    return $self->found() eq 'T';
105
}
118
}
106
119
120
=head3 is_at_destination
121
122
Returns true if hold is a in_transit hold
123
124
=cut
125
126
sub is_at_destination {
127
    my ($self) = @_;
128
129
    return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() );
130
}
131
107
=head3 biblio
132
=head3 biblio
108
133
109
Returns the related Koha::Biblio object for this hold
134
Returns the related Koha::Biblio object for this hold
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-20 / +30 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 525-532 Link Here
525
                                            <tr>
525
                                            <tr>
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 %]">[% RESERVE.reserves_title %] [% FOREACH subtitl IN RESERVE.subtitle %] [% subtitl.subfield %][% END %]</a>
528
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">[% RESERVE.biblio.title %] [% FOREACH subtitl IN RESERVE.biblio.subtitle %] [% subtitl.subfield %][% END %]</a>
529
                                                [% RESERVE.author %]
529
                                                [% RESERVE.biblio.author %]
530
                                            </td>
530
                                            </td>
531
                                            <td class="reservedate">
531
                                            <td class="reservedate">
532
                                                <span title="[% RESERVE.reservedate %]">
532
                                                <span title="[% RESERVE.reservedate %]">
Lines 535-553 Link Here
535
                                                </span>
535
                                                </span>
536
                                            </td>
536
                                            </td>
537
                                            <td class="expirationdate">
537
                                            <td class="expirationdate">
538
                                                [% IF ( RESERVE.expirationdate ) %]
538
                                                [% IF ! RESERVE.found %]
539
                                                    <span>
539
                                                    [% IF ( RESERVE.expirationdate ) %]
540
                                                        <span>
541
                                                            <span class="tdlabel">Expiration:</span>
542
                                                                [% RESERVE.expirationdate | $KohaDates %]
543
                                                        </span>
544
                                                    [% ELSE %]
540
                                                        <span class="tdlabel">Expiration:</span>
545
                                                        <span class="tdlabel">Expiration:</span>
541
                                                        [% RESERVE.expirationdate | $KohaDates %]
546
                                                        Never expires
542
                                                    </span>
547
                                                    [% END %]
543
                                                [% ELSE %]
548
                                                [% ELSE %]
544
                                                    <span class="tdlabel">Expiration:</span>
549
                                                    -
545
                                                    Never expires
546
                                                [% END %]
550
                                                [% END %]
547
                                            </td>
551
                                            </td>
548
                                            <td class="branch">
552
                                            <td class="branch">
549
                                                <span class="tdlabel">Pick up location:</span>
553
                                                <span class="tdlabel">Pick up location:</span>
550
                                                [% RESERVE.branch %]
554
                                                [% RESERVE.branch.branchname %]
551
                                            </td>
555
                                            </td>
552
                                            [% IF ( showpriority ) %]
556
                                            [% IF ( showpriority ) %]
553
                                                 <td class="priority">
557
                                                 <td class="priority">
Lines 557-567 Link Here
557
                                            [% END %]
561
                                            [% END %]
558
                                            <td class="status">
562
                                            <td class="status">
559
                                                <span class="tdlabel">Status:</span>
563
                                                <span class="tdlabel">Status:</span>
560
                                                [% IF ( RESERVE.wait ) %]
564
                                                [% IF ( RESERVE.is_waiting ) %]
561
                                                    [% IF ( RESERVE.atdestination ) %]
565
                                                    [% IF ( RESERVE.is_at_destination ) %]
562
                                                        [% IF ( RESERVE.found ) %]
566
                                                        [% IF ( RESERVE.found ) %]
563
                                                            Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %]
567
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
564
                                                            <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
568
                                                            [% IF ( RESERVE.waitingdate ) %]
569
                                                                since [% RESERVE.waitingdate | $KohaDates %]
570
                                                                [% IF RESERVE.waiting_expires_on %]
571
                                                                    until [% RESERVE.waiting_expires_on | $KohaDates %]
572
                                                                [% END %]
573
                                                            [% END %]
574
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
565
                                                        [% ELSE %]
575
                                                        [% ELSE %]
566
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
576
                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
567
                                                        [% END %]
577
                                                        [% END %]
Lines 569-575 Link Here
569
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
579
                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
570
                                                    [% END %]
580
                                                    [% END %]
571
                                                [% ELSE %]
581
                                                [% ELSE %]
572
                                                    [% IF ( RESERVE.intransit ) %]
582
                                                    [% IF ( RESERVE.is_in_transit ) %]
573
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
583
                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
574
                                                        [% RESERVE.datesent | $KohaDates %]
584
                                                        [% RESERVE.datesent | $KohaDates %]
575
                                                    [% ELSIF ( RESERVE.suspend ) %]
585
                                                    [% ELSIF ( RESERVE.suspend ) %]
Lines 581-587 Link Here
581
                                            </td>
591
                                            </td>
582
                                            [% IF SuspendHoldsOpac %]
592
                                            [% IF SuspendHoldsOpac %]
583
                                                <td>
593
                                                <td>
584
                                                    [% IF ( RESERVE.cancelable ) %]
594
                                                    [% IF ( RESERVE.is_cancelable ) %]
585
                                                        [% IF RESERVE.suspend %]
595
                                                        [% IF RESERVE.suspend %]
586
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
596
                                                            <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
587
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
597
                                                                <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
Lines 622-632 Link Here
622
                                                                </form>
632
                                                                </form>
623
                                                            [% END # / IF AutoResumeSuspendedHolds %]
633
                                                            [% END # / IF AutoResumeSuspendedHolds %]
624
                                                        [% END # / IF RESERVE.suspend %]
634
                                                        [% END # / IF RESERVE.suspend %]
625
                                                    [% END # / IF ( RESERVE.cancelable )%]
635
                                                    [% END # / IF ( RESERVE.is_cancelable )%]
626
                                                </td>
636
                                                </td>
627
                                            [% END # / IF SuspendHoldsOpac %]
637
                                            [% END # / IF SuspendHoldsOpac %]
628
                                            <td class="modify">
638
                                            <td class="modify">
629
                                                [% IF ( RESERVE.cancelable ) %]
639
                                                [% IF ( RESERVE.is_cancelable ) %]
630
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
640
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
631
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
641
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
632
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
642
                                                    <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 277-352 for my $branch_hash ( sort keys %{$branches} ) { Link Here
277
$template->param( branchloop => \@branch_loop );
278
$template->param( branchloop => \@branch_loop );
278
279
279
# now the reserved items....
280
# now the reserved items....
280
my @reserves  = GetReservesFromBorrowernumber( $borrowernumber );
281
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
281
foreach my $res (@reserves) {
282
282
283
    if ( $res->{'expirationdate'} eq '0000-00-00' ) {
283
$template->param(
284
      $res->{'expirationdate'} = '';
284
    RESERVES       => $reserves,
285
    }
285
    reserves_count => $reserves->count(),
286
    $res->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($res->{'biblionumber'}), GetFrameworkCode($res->{'biblionumber'}));
286
    showpriority   => $show_priority,
287
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
287
    WAITING        => $reserves->waiting()
288
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
288
);
289
    my $biblioData = GetBiblioData($res->{'biblionumber'});
290
    $res->{'reserves_title'} = $biblioData->{'title'};
291
    $res->{'author'} = $biblioData->{'author'};
292
293
    if ($show_priority) {
294
        $res->{'priority'} ||= '';
295
    }
296
    $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
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
        # 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
289
351
# current alert subscriptions
290
# current alert subscriptions
352
my $alerts = getalert($borrowernumber);
291
my $alerts = getalert($borrowernumber);
Lines 384-390 if ( $borr->{'opacnote'} ) { Link Here
384
323
385
$template->param(
324
$template->param(
386
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
325
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
387
    waiting_count      => $wcount,
388
    patronupdate => $patronupdate,
326
    patronupdate => $patronupdate,
389
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
327
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
390
    userview => 1,
328
    userview => 1,
391
- 

Return to bug 13918