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

(-)a/Koha/Hold.pm (-24 lines)
Lines 82-111 sub resume { Link Here
82
    return $self;
82
    return $self;
83
}
83
}
84
84
85
=head3 waiting_expires_on
86
87
Returns a DateTime for the date a waiting holds expires on.
88
Returns undef if the system peference ReservesMaxPickUpDelay is not set.
89
Returns undef if the hold is not waiting ( found = 'W' ).
90
91
=cut
92
93
sub waiting_expires_on {
94
    my ($self) = @_;
95
96
    my $found = $self->found;
97
    return unless $found && $found eq 'W';
98
99
    my $ReservesMaxPickUpDelay = C4::Context->preference('ReservesMaxPickUpDelay');
100
    return unless $ReservesMaxPickUpDelay;
101
102
    my $dt = dt_from_string( $self->waitingdate() );
103
104
    $dt->add( days => $ReservesMaxPickUpDelay );
105
106
    return $dt;
107
}
108
109
=head3 set_waiting
85
=head3 set_waiting
110
86
111
=cut
87
=cut
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 / +2 lines)
Lines 836-843 No patron matched <span class="ex">[% message %]</span> Link Here
836
836
837
                                <br/>
837
                                <br/>
838
                                [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
838
                                [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
839
                                    [% SET waiting_expires_on = w.waiting_expires_on %]
839
                                    [% SET expires_on = w.expirationdate %]
840
                                    Waiting at [% w.branch.branchname | html %] [% IF waiting_expires_on %] until [% waiting_expires_on | $KohaDates %] [% END %]
840
                                    Waiting at [% w.branch.branchname | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
841
                                </strong>
841
                                </strong>
842
                            </li>
842
                            </li>
843
                        </ul>
843
                        </ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-7 / +1 lines)
Lines 720-732 function checkMultiHold() { Link Here
720
        </td>
720
        </td>
721
        <td>[% reserveloo.notes %]</td>
721
        <td>[% reserveloo.notes %]</td>
722
        <td>[% reserveloo.date %]</td>
722
        <td>[% reserveloo.date %]</td>
723
        <td>
723
        <td>[% reserveloo.expirationdate %]</td>
724
            [% IF reserveloo.waiting_until %]
725
                [% reserveloo.waiting_until | $KohaDates %]
726
            [% ELSE %]
727
                [% reserveloo.expirationdate %]
728
            [% END %]
729
        </td>
730
        <td>
724
        <td>
731
    [% IF ( reserveloo.found ) %]
725
    [% IF ( reserveloo.found ) %]
732
    	[% IF ( reserveloo.atdestination ) %]
726
    	[% IF ( reserveloo.atdestination ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-2 / +2 lines)
Lines 591-598 Link Here
591
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
591
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
592
                                                            [% IF ( RESERVE.waitingdate ) %]
592
                                                            [% IF ( RESERVE.waitingdate ) %]
593
                                                                since [% RESERVE.waitingdate | $KohaDates %]
593
                                                                since [% RESERVE.waitingdate | $KohaDates %]
594
                                                                [% IF RESERVE.waiting_expires_on %]
594
                                                                [% IF RESERVE.expirationdate %]
595
                                                                    until [% RESERVE.waiting_expires_on | $KohaDates %]
595
                                                                    until [% RESERVE.expirationdate | $KohaDates %]
596
                                                                [% END %]
596
                                                                [% END %]
597
                                                            [% END %]
597
                                                            [% END %]
598
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
598
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
(-)a/reserve/request.pl (-1 lines)
Lines 558-564 foreach my $biblionumber (@biblionumbers) { Link Here
558
        $reserve{'surname'}        = $res->borrower()->surname();
558
        $reserve{'surname'}        = $res->borrower()->surname();
559
        $reserve{'notes'}          = $res->reservenotes();
559
        $reserve{'notes'}          = $res->reservenotes();
560
        $reserve{'waiting_date'}   = $res->waitingdate();
560
        $reserve{'waiting_date'}   = $res->waitingdate();
561
        $reserve{'waiting_until'}  = $res->is_waiting() ? $res->waiting_expires_on() : undef;
562
        $reserve{'ccode'}          = $res->item() ? $res->item()->ccode() : undef;
561
        $reserve{'ccode'}          = $res->item() ? $res->item()->ccode() : undef;
563
        $reserve{'barcode'}        = $res->item() ? $res->item()->barcode() : undef;
562
        $reserve{'barcode'}        = $res->item() ? $res->item()->barcode() : undef;
564
        $reserve{'priority'}       = $res->priority();
563
        $reserve{'priority'}       = $res->priority();
(-)a/svc/holds (-5 lines)
Lines 114-124 while ( my $h = $holds_rs->next() ) { Link Here
114
        : q{},
114
        : q{},
115
    };
115
    };
116
116
117
    if ( my $e = $h->waiting_expires_on() ) {
118
        $hold->{expirationdate} = $e->ymd();
119
        $hold->{expirationdate_formatted} = output_pref( { dt => $e, dateonly => 1 });
120
    }
121
122
    $hold->{transfered}     = 0;
117
    $hold->{transfered}     = 0;
123
    $hold->{not_transfered} = 0;
118
    $hold->{not_transfered} = 0;
124
119
(-)a/t/db_dependent/Hold.t (-14 / +1 lines)
Lines 27-33 use Koha::Item; Link Here
27
use Koha::DateUtils;
27
use Koha::DateUtils;
28
use t::lib::TestBuilder;
28
use t::lib::TestBuilder;
29
29
30
use Test::More tests => 32;
30
use Test::More tests => 28;
31
use Test::Warn;
31
use Test::Warn;
32
32
33
use_ok('Koha::Hold');
33
use_ok('Koha::Hold');
Lines 97-125 my $hold_borrower = $hold->borrower(); Link Here
97
ok( $hold_borrower, 'Got hold borrower' );
97
ok( $hold_borrower, 'Got hold borrower' );
98
is( $hold_borrower->borrowernumber(), $borrower->{borrowernumber}, 'Hold borrower matches correct borrower' );
98
is( $hold_borrower->borrowernumber(), $borrower->{borrowernumber}, 'Hold borrower matches correct borrower' );
99
99
100
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '' );
101
$dt = $hold->waiting_expires_on();
102
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if ReservesMaxPickUpDelay is not set" );
103
104
is( $hold->is_waiting, 1, 'The hold is waiting' );
100
is( $hold->is_waiting, 1, 'The hold is waiting' );
105
is( $hold->is_found, 1, 'The hold is found');
101
is( $hold->is_found, 1, 'The hold is found');
106
ok( !$hold->is_in_transit, 'The hold is not in transit' );
102
ok( !$hold->is_in_transit, 'The hold is not in transit' );
107
103
108
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '5' );
104
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '5' );
109
$dt = $hold->waiting_expires_on();
110
is( $dt->ymd, "2000-01-06",
111
    "Koha::Hold->waiting_expires_on returns DateTime of waitingdate + ReservesMaxPickUpDelay if set" );
112
113
$hold->found('T');
105
$hold->found('T');
114
$dt = $hold->waiting_expires_on();
115
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to 'T' )" );
116
isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' );
106
isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' );
117
is( $hold->is_found, 1, 'The hold is found');
107
is( $hold->is_found, 1, 'The hold is found');
118
is( $hold->is_in_transit, 1, 'The hold is in transit' );
108
is( $hold->is_in_transit, 1, 'The hold is in transit' );
119
109
120
$hold->found(q{});
110
$hold->found(q{});
121
$dt = $hold->waiting_expires_on();
122
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to empty string )" );
123
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
111
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
124
is( $hold->is_found, 0, 'The hold is not found' );
112
is( $hold->is_found, 0, 'The hold is not found' );
125
ok( !$hold->is_in_transit, 'The hold is not in transit' );
113
ok( !$hold->is_in_transit, 'The hold is not in transit' );
126
- 

Return to bug 12063