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

(-)a/C4/Reserves.pm (-1 / +11 lines)
Lines 1080-1085 item-level hold request. An item is available if Link Here
1080
* it is not lost AND
1080
* it is not lost AND
1081
* it is not damaged AND
1081
* it is not damaged AND
1082
* it is not withdrawn AND
1082
* it is not withdrawn AND
1083
* a waiting or in transit reserve is placed on
1083
* does not have a not for loan value > 0
1084
* does not have a not for loan value > 0
1084
1085
1085
Need to check the issuingrules onshelfholds column,
1086
Need to check the issuingrules onshelfholds column,
Lines 1144-1150 sub IsAvailableForItemLevelRequest { Link Here
1144
        return $any_available ? 0 : 1;
1145
        return $any_available ? 0 : 1;
1145
    }
1146
    }
1146
1147
1147
    return $item->{onloan} || GetReserveStatus($item->{itemnumber}) eq "Waiting";
1148
    if ($item->{onloan}) {
1149
        return 1;
1150
    }
1151
1152
    if ( Koha::Holds->search({itemnumber => $item->{itemnumber},
1153
                              found => ['W', 'T']})->count ) {
1154
        return 1;
1155
    }
1156
1157
    return 0;
1148
}
1158
}
1149
1159
1150
=head2 OnShelfHoldsAllowed
1160
=head2 OnShelfHoldsAllowed
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (-1 / +1 lines)
Lines 3-9 Link Here
3
    [% UNLESS ( norequests ) %]
3
    [% UNLESS ( norequests ) %]
4
        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
4
        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
5
            [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
5
            [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
6
                [% IF ( AllowOnShelfHolds OR ItemsIssued ) %]
6
                [% IF ( AllowOnShelfHolds OR ItemsIssued OR ItemsWaitingOrInTransit ) %]
7
                    <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber | html %]">Place hold</a></li>
7
                    <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber | html %]">Place hold</a></li>
8
                [% END %]
8
                [% END %]
9
            [% END %]
9
            [% END %]
(-)a/opac/opac-detail.pl (-2 / +15 lines)
Lines 458-466 if ($session->param('busc')) { Link Here
458
}
458
}
459
}
459
}
460
460
461
my $itemsWaitingOrInTransit = Koha::Holds->search(
462
    {
463
        biblionumber => $biblionumber,
464
        found => ['W', 'T']
465
    })->count();
466
unless ($itemsWaitingOrInTransit) {
467
    foreach my $item ( Koha::Items->search(biblionumber => $biblionumber) ) {
468
        $itemsWaitingOrInTransit = 1 if $item->get_transfer;
469
    }
470
}
461
471
462
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
472
$template->param(
463
$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
473
    ItemsIssued => CountItemsIssued( $biblionumber ),
474
    ItemsWaitingOrInTransit => $itemsWaitingOrInTransit,
475
    OPACShowCheckoutName => C4::Context->preference("OPACShowCheckoutName"),
476
);
464
477
465
# adding items linked via host biblios
478
# adding items linked via host biblios
466
479
(-)a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t (-2 / +48 lines)
Lines 7-13 use C4::Items; Link Here
7
use C4::Circulation;
7
use C4::Circulation;
8
use Koha::IssuingRule;
8
use Koha::IssuingRule;
9
9
10
use Test::More tests => 5;
10
use Test::More tests => 7;
11
11
12
use t::lib::TestBuilder;
12
use t::lib::TestBuilder;
13
use t::lib::Mocks;
13
use t::lib::Mocks;
Lines 213-217 AddReturn( $item1->{barcode} ); Link Here
213
    };
213
    };
214
}
214
}
215
215
216
my $biblio = $builder->build({
217
    source => 'Biblio',
218
});
219
220
my $item3 = $builder->build({
221
    source => 'Item',
222
    value => {
223
        biblionumber => $biblio->{biblionumber},
224
        itemlost     => 0,
225
        notforloan   => 0,
226
        withdrawn    => 0,
227
        damaged      => 0,
228
        onloan       => 0
229
    }
230
});
231
232
my $hold = $builder->build({
233
    source => 'Reserve',
234
    value =>{
235
        itemnumber => $item3->{itemnumber},
236
        found => 'T'
237
    }
238
});
239
240
$dbh->do("DELETE FROM issuingrules");
241
$rule = Koha::IssuingRule->new(
242
    {
243
        categorycode => '*',
244
        itemtype     => '*',
245
        branchcode   => '*',
246
        maxissueqty  => 99,
247
        issuelength  => 7,
248
        lengthunit   => 8,
249
        reservesallowed => 99,
250
        onshelfholds => 0,
251
    }
252
);
253
$rule->store();
254
255
$is = IsAvailableForItemLevelRequest( $item3, $borrower1);
256
is( $is, 1, "Item can be held, items in transit are not available" );
257
258
Koha::Holds->find($hold->{reserve_id})->found('F')->store;
259
260
$is = IsAvailableForItemLevelRequest( $item3, $borrower1);
261
is( $is, 0, "Item is neither waiting nor in transit." );
262
216
# Cleanup
263
# Cleanup
217
$schema->storage->txn_rollback;
264
$schema->storage->txn_rollback;
218
- 

Return to bug 4319