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

(-)a/C4/Reserves.pm (-1 / +14 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 1131-1136 and canreservefromotherbranches. Link Here
1131
sub IsAvailableForItemLevelRequest {
1132
sub IsAvailableForItemLevelRequest {
1132
    my $item = shift;
1133
    my $item = shift;
1133
    my $borrower = shift;
1134
    my $borrower = shift;
1135
    my $flag = shift;
1134
1136
1135
    my $dbh = C4::Context->dbh;
1137
    my $dbh = C4::Context->dbh;
1136
    # must check the notforloan setting of the itemtype
1138
    # must check the notforloan setting of the itemtype
Lines 1174-1180 sub IsAvailableForItemLevelRequest { Link Here
1174
        return $any_available ? 0 : 1;
1176
        return $any_available ? 0 : 1;
1175
    }
1177
    }
1176
1178
1177
    return $item->{onloan} || GetReserveStatus($item->{itemnumber}) eq "Waiting";
1179
    if ($item->{onloan}) {
1180
        return 1;
1181
    }
1182
1183
    if (Koha::Holds->search({itemnumber => $item->{itemnumber},
1184
                             found => ['W', 'T']},
1185
                             {order_by => {-asc => 'priority'}})) {
1186
        return 1;
1187
    }
1188
1189
    return 0;
1190
    return GetReserveStatus($item->{itemnumber}) eq "Waiting";
1178
}
1191
}
1179
1192
1180
=head2 OnShelfHoldsAllowed
1193
=head2 OnShelfHoldsAllowed
(-)a/opac/opac-detail.pl (-1 / +11 lines)
Lines 459-467 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();
467
468
foreach my $item ( Koha::Items->search(biblionumber => $biblionumber) ) {
469
    $itemsWaitingOrInTransit = 1 if $item->get_transfer;
470
}
471
462
$template->param(
472
$template->param(
463
    ItemsIssued => CountItemsIssued( $biblionumber ),
473
    ItemsIssued => CountItemsIssued( $biblionumber ),
464
    ItemsWaitingOrInTransit => Koha::Holds->search({biblionumber => $biblionumber, found => ['W', 'T']})->count(),
474
    ItemsWaitingOrInTransit => $itemsWaitingOrInTransit,
465
    OPACShowCheckoutName => C4::Context->preference("OPACShowCheckoutName"),
475
    OPACShowCheckoutName => C4::Context->preference("OPACShowCheckoutName"),
466
    OPACShowBarcode => C4::Context->preference("OPACShowBarcode")
476
    OPACShowBarcode => C4::Context->preference("OPACShowBarcode")
467
);
477
);
(-)a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t (-2 / +43 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 => 5;
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, 'ici');
157
is( $is, 1, "Item can be held, items in transit are not available" );
158
117
# Cleanup
159
# Cleanup
118
$schema->storage->txn_rollback;
160
$schema->storage->txn_rollback;
119
- 

Return to bug 4319