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

(-)a/Koha/Hold.pm (-24 lines)
Lines 107-136 sub delete { Link Here
107
    return $deleted;
107
    return $deleted;
108
}
108
}
109
109
110
=head3 waiting_expires_on
111
112
Returns a DateTime for the date a waiting holds expires on.
113
Returns undef if the system peference ReservesMaxPickUpDelay is not set.
114
Returns undef if the hold is not waiting ( found = 'W' ).
115
116
=cut
117
118
sub waiting_expires_on {
119
    my ($self) = @_;
120
121
    my $found = $self->found;
122
    return unless $found && $found eq 'W';
123
124
    my $ReservesMaxPickUpDelay = C4::Context->preference('ReservesMaxPickUpDelay');
125
    return unless $ReservesMaxPickUpDelay;
126
127
    my $dt = dt_from_string( $self->waitingdate() );
128
129
    $dt->add( days => $ReservesMaxPickUpDelay );
130
131
    return $dt;
132
}
133
134
=head3 set_waiting
110
=head3 set_waiting
135
111
136
=cut
112
=cut
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 / +2 lines)
Lines 830-837 No patron matched <span class="ex">[% message | html %]</span> Link Here
830
830
831
                                <br/>
831
                                <br/>
832
                                [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
832
                                [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
833
                                    [% SET waiting_expires_on = w.waiting_expires_on %]
833
                                    [% SET expires_on = w.expirationdate %]
834
                                    Waiting at [% w.branch.branchname | html %] [% IF waiting_expires_on %] until [% waiting_expires_on | $KohaDates %] [% END %]
834
                                    Waiting at [% w.branch.branchname | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
835
                                </strong>
835
                                </strong>
836
                            </li>
836
                            </li>
837
                        </ul>
837
                        </ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-7 / +1 lines)
Lines 783-795 function checkMultiHold() { Link Here
783
        </td>
783
        </td>
784
        <td>[% reserveloo.notes %]</td>
784
        <td>[% reserveloo.notes %]</td>
785
        <td>[% reserveloo.date %]</td>
785
        <td>[% reserveloo.date %]</td>
786
        <td>
786
        <td>[% reserveloo.expirationdate %]</td>
787
            [% IF reserveloo.waiting_until %]
788
                [% reserveloo.waiting_until | $KohaDates %]
789
            [% ELSE %]
790
                [% reserveloo.expirationdate %]
791
            [% END %]
792
        </td>
793
        <td>
787
        <td>
794
    [% IF ( reserveloo.found ) %]
788
    [% IF ( reserveloo.found ) %]
795
    	[% IF ( reserveloo.atdestination ) %]
789
    	[% IF ( reserveloo.atdestination ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-2 / +2 lines)
Lines 617-624 Using this account is not recommended because some parts of Koha will not functi Link Here
617
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
617
                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
618
                                                            [% IF ( RESERVE.waitingdate ) %]
618
                                                            [% IF ( RESERVE.waitingdate ) %]
619
                                                                since [% RESERVE.waitingdate | $KohaDates %]
619
                                                                since [% RESERVE.waitingdate | $KohaDates %]
620
                                                                [% IF RESERVE.waiting_expires_on %]
620
                                                                [% IF RESERVE.expirationdate %]
621
                                                                    until [% RESERVE.waiting_expires_on | $KohaDates %]
621
                                                                    until [% RESERVE.expirationdate | $KohaDates %]
622
                                                                [% END %]
622
                                                                [% END %]
623
                                                            [% END %]
623
                                                            [% END %]
624
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
624
                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
(-)a/reserve/request.pl (-1 lines)
Lines 573-579 foreach my $biblionumber (@biblionumbers) { Link Here
573
        $reserve{'surname'}        = $res->borrower()->surname();
573
        $reserve{'surname'}        = $res->borrower()->surname();
574
        $reserve{'notes'}          = $res->reservenotes();
574
        $reserve{'notes'}          = $res->reservenotes();
575
        $reserve{'waiting_date'}   = $res->waitingdate();
575
        $reserve{'waiting_date'}   = $res->waitingdate();
576
        $reserve{'waiting_until'}  = $res->is_waiting() ? $res->waiting_expires_on() : undef;
577
        $reserve{'ccode'}          = $res->item() ? $res->item()->ccode() : undef;
576
        $reserve{'ccode'}          = $res->item() ? $res->item()->ccode() : undef;
578
        $reserve{'barcode'}        = $res->item() ? $res->item()->barcode() : undef;
577
        $reserve{'barcode'}        = $res->item() ? $res->item()->barcode() : undef;
579
        $reserve{'priority'}       = $res->priority();
578
        $reserve{'priority'}       = $res->priority();
(-)a/svc/holds (-5 lines)
Lines 119-129 while ( my $h = $holds_rs->next() ) { Link Here
119
        : q{},
119
        : q{},
120
    };
120
    };
121
121
122
    if ( my $e = $h->waiting_expires_on() ) {
123
        $hold->{expirationdate} = $e->ymd();
124
        $hold->{expirationdate_formatted} = output_pref( { dt => $e, dateonly => 1 });
125
    }
126
127
    $hold->{transfered}     = 0;
122
    $hold->{transfered}     = 0;
128
    $hold->{not_transfered} = 0;
123
    $hold->{not_transfered} = 0;
129
124
(-)a/t/db_dependent/Hold.t (-14 / +1 lines)
Lines 28-34 use Koha::Item; Link Here
28
use Koha::DateUtils;
28
use Koha::DateUtils;
29
use t::lib::TestBuilder;
29
use t::lib::TestBuilder;
30
30
31
use Test::More tests => 33;
31
use Test::More tests => 29;
32
use Test::Warn;
32
use Test::Warn;
33
33
34
use_ok('Koha::Hold');
34
use_ok('Koha::Hold');
Lines 98-126 my $hold_borrower = $hold->borrower(); Link Here
98
ok( $hold_borrower, 'Got hold borrower' );
98
ok( $hold_borrower, 'Got hold borrower' );
99
is( $hold_borrower->borrowernumber(), $borrower->{borrowernumber}, 'Hold borrower matches correct borrower' );
99
is( $hold_borrower->borrowernumber(), $borrower->{borrowernumber}, 'Hold borrower matches correct borrower' );
100
100
101
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '' );
102
$dt = $hold->waiting_expires_on();
103
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if ReservesMaxPickUpDelay is not set" );
104
105
is( $hold->is_waiting, 1, 'The hold is waiting' );
101
is( $hold->is_waiting, 1, 'The hold is waiting' );
106
is( $hold->is_found, 1, 'The hold is found');
102
is( $hold->is_found, 1, 'The hold is found');
107
ok( !$hold->is_in_transit, 'The hold is not in transit' );
103
ok( !$hold->is_in_transit, 'The hold is not in transit' );
108
104
109
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '5' );
105
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '5' );
110
$dt = $hold->waiting_expires_on();
111
is( $dt->ymd, "2000-01-06",
112
    "Koha::Hold->waiting_expires_on returns DateTime of waitingdate + ReservesMaxPickUpDelay if set" );
113
114
$hold->found('T');
106
$hold->found('T');
115
$dt = $hold->waiting_expires_on();
116
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to 'T' )" );
117
isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' );
107
isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' );
118
is( $hold->is_found, 1, 'The hold is found');
108
is( $hold->is_found, 1, 'The hold is found');
119
is( $hold->is_in_transit, 1, 'The hold is in transit' );
109
is( $hold->is_in_transit, 1, 'The hold is in transit' );
120
110
121
$hold->found(q{});
111
$hold->found(q{});
122
$dt = $hold->waiting_expires_on();
123
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to empty string )" );
124
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
112
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
125
is( $hold->is_found, 0, 'The hold is not found' );
113
is( $hold->is_found, 0, 'The hold is not found' );
126
ok( !$hold->is_in_transit, 'The hold is not in transit' );
114
ok( !$hold->is_in_transit, 'The hold is not in transit' );
127
- 

Return to bug 12063