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

(-)a/C4/Reserves.pm (-1 / +11 lines)
Lines 1115-1120 item-level hold request. An item is available if Link Here
1115
* it is not lost AND
1115
* it is not lost AND
1116
* it is not damaged AND
1116
* it is not damaged AND
1117
* it is not withdrawn AND
1117
* it is not withdrawn AND
1118
* a waiting or in transit reserve is placed on
1118
* does not have a not for loan value > 0
1119
* does not have a not for loan value > 0
1119
1120
1120
Need to check the issuingrules onshelfholds column,
1121
Need to check the issuingrules onshelfholds column,
Lines 1174-1180 sub IsAvailableForItemLevelRequest { Link Here
1174
        return $any_available ? 0 : 1;
1175
        return $any_available ? 0 : 1;
1175
    }
1176
    }
1176
1177
1177
    return $item->{onloan} || GetReserveStatus($item->{itemnumber}) eq "Waiting";
1178
    if ($item->{onloan}) {
1179
        return 1;
1180
    }
1181
1182
    if ( Koha::Holds->search({itemnumber => $item->{itemnumber},
1183
                              found => ['W', 'T']})->count ) {
1184
        return 1;
1185
    }
1186
1187
    return 0;
1178
}
1188
}
1179
1189
1180
=head2 OnShelfHoldsAllowed
1190
=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 (-3 / +17 lines)
Lines 459-468 if ($session->param('busc')) { Link Here
459
}
459
}
460
}
460
}
461
461
462
my $itemsWaitingOrInTransit = Koha::Holds->search(
463
    {
464
        biblionumber => $biblionumber,
465
        found => ['W', 'T']
466
    })->count();
462
467
463
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
468
unless ($itemsWaitingOrInTransit) {
464
$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
469
    foreach my $item ( Koha::Items->search(biblionumber => $biblionumber) ) {
465
$template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") );
470
        $itemsWaitingOrInTransit = 1 if $item->get_transfer;
471
    }
472
}
473
474
$template->param(
475
    ItemsIssued => CountItemsIssued( $biblionumber ),
476
    ItemsWaitingOrInTransit => $itemsWaitingOrInTransit,
477
    OPACShowCheckoutName => C4::Context->preference("OPACShowCheckoutName"),
478
    OPACShowBarcode => C4::Context->preference("OPACShowBarcode")
479
);
466
480
467
# adding items linked via host biblios
481
# adding items linked via host biblios
468
482
(-)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 => 4;
10
use Test::More tests => 6;
11
11
12
use t::lib::TestBuilder;
12
use t::lib::TestBuilder;
13
13
Lines 114-118 AddIssue( $borrower2, $item2->{barcode} ); Link Here
114
$is = IsAvailableForItemLevelRequest( $item1, $borrower1);
114
$is = IsAvailableForItemLevelRequest( $item1, $borrower1);
115
is( $is, 1, "Item can be held, no items available" );
115
is( $is, 1, "Item can be held, no items available" );
116
116
117
my $biblio = $builder->build({
118
    source => 'Biblio',
119
});
120
121
my $item3 = $builder->build({
122
    source => 'Item',
123
    value => {
124
        biblionumber => $biblio->{biblionumber},
125
        itemlost     => 0,
126
        notforloan   => 0,
127
        withdrawn    => 0,
128
        damaged      => 0,
129
        onloan       => 0
130
    }
131
});
132
133
my $hold = $builder->build({
134
    source => 'Reserve',
135
    value =>{
136
        itemnumber => $item3->{itemnumber},
137
        found => 'T'
138
    }
139
});
140
141
$dbh->do("DELETE FROM issuingrules");
142
$rule = Koha::IssuingRule->new(
143
    {
144
        categorycode => '*',
145
        itemtype     => '*',
146
        branchcode   => '*',
147
        maxissueqty  => 99,
148
        issuelength  => 7,
149
        lengthunit   => 8,
150
        reservesallowed => 99,
151
        onshelfholds => 0,
152
    }
153
);
154
$rule->store();
155
156
$is = IsAvailableForItemLevelRequest( $item3, $borrower1);
157
is( $is, 1, "Item can be held, items in transit are not available" );
158
159
Koha::Holds->find($hold->{reserve_id})->found('F')->store;
160
161
$is = IsAvailableForItemLevelRequest( $item3, $borrower1);
162
is( $is, 0, "Item is neither waiting nor in transit." );
163
117
# Cleanup
164
# Cleanup
118
$schema->storage->txn_rollback;
165
$schema->storage->txn_rollback;
119
- 

Return to bug 4319