Bug 22789: Add non priority feature to C4 classes and staff interface
This patch implements necesary code to implement non priority feature To test: 1) Apply all patches. 2) Run updatedatabase. 3) Checkout a specific item for patron1. 4) Place a hold on the same item for patron2 (do not check non priority hold checkbox). 5) Try to renew the item for patron1. CHECK => in checkouts table, there is a message that the item could not be renewed because there was a hold. 6) Cleanup all checkouts and holds. 7) repeat steps 3 to 5, but this time check the non priority checkbox. SUCCESS => item was renewed 8) prove t/db_dependent/Holds.t Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
64340cfa52
commit
d390b2f7cf
|
|
@ -2761,6 +2761,8 @@ sub CanBookBeRenewed {
|
|||
|
||||
my ( $resfound, $resrec, undef ) = C4::Reserves::CheckReserves($itemnumber);
|
||||
|
||||
$resfound = 0 if $resrec->{non_priority};
|
||||
|
||||
# This item can fill one or more unfilled reserve, can those unfilled reserves
|
||||
# all be filled by other available items?
|
||||
if ( $resfound
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ sub AddReserve {
|
|||
my $checkitem = $params->{itemnumber};
|
||||
my $found = $params->{found};
|
||||
my $itemtype = $params->{itemtype};
|
||||
my $non_priority = $params->{non_priority};
|
||||
|
||||
$resdate = output_pref( { str => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' })
|
||||
or output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
|
||||
|
|
@ -248,6 +249,7 @@ sub AddReserve {
|
|||
expirationdate => $expdate,
|
||||
itemtype => $itemtype,
|
||||
item_level_hold => $checkitem ? 1 : 0,
|
||||
non_priority => $non_priority ? 1 : 0,
|
||||
}
|
||||
)->store();
|
||||
$hold->set_waiting() if $found && $found eq 'W';
|
||||
|
|
@ -1656,7 +1658,8 @@ sub _Findgroupreserve {
|
|||
biblioitems.biblioitemnumber AS biblioitemnumber,
|
||||
reserves.itemnumber AS itemnumber,
|
||||
reserves.reserve_id AS reserve_id,
|
||||
reserves.itemtype AS itemtype
|
||||
reserves.itemtype AS itemtype,
|
||||
reserves.non_priority AS non_priority
|
||||
FROM reserves
|
||||
JOIN biblioitems USING (biblionumber)
|
||||
JOIN hold_fill_targets USING (biblionumber, borrowernumber, itemnumber)
|
||||
|
|
@ -1691,7 +1694,8 @@ sub _Findgroupreserve {
|
|||
biblioitems.biblioitemnumber AS biblioitemnumber,
|
||||
reserves.itemnumber AS itemnumber,
|
||||
reserves.reserve_id AS reserve_id,
|
||||
reserves.itemtype AS itemtype
|
||||
reserves.itemtype AS itemtype,
|
||||
reserves.non_priority AS non_priority
|
||||
FROM reserves
|
||||
JOIN biblioitems USING (biblionumber)
|
||||
JOIN hold_fill_targets USING (biblionumber, borrowernumber)
|
||||
|
|
@ -1725,7 +1729,8 @@ sub _Findgroupreserve {
|
|||
reserves.timestamp AS timestamp,
|
||||
reserves.itemnumber AS itemnumber,
|
||||
reserves.reserve_id AS reserve_id,
|
||||
reserves.itemtype AS itemtype
|
||||
reserves.itemtype AS itemtype,
|
||||
reserves.non_priority AS non_priority
|
||||
FROM reserves
|
||||
WHERE reserves.biblionumber = ?
|
||||
AND (reserves.itemnumber IS NULL OR reserves.itemnumber = ?)
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ sub add {
|
|||
my $expiration_date = $body->{expiration_date};
|
||||
my $notes = $body->{notes};
|
||||
my $hold_date = $body->{hold_date};
|
||||
my $non_priority = $body->{non_priority};
|
||||
|
||||
if(!C4::Context->preference( 'AllowHoldDateInFuture' ) && $hold_date) {
|
||||
return $c->render(
|
||||
|
|
@ -174,6 +175,7 @@ sub add {
|
|||
itemnumber => $item_id,
|
||||
found => undef, # TODO: Why not?
|
||||
itemtype => $item_type,
|
||||
non_priority => $non_priority,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@
|
|||
"format": "date-time",
|
||||
"description": "Date until which the hold has been suspended"
|
||||
},
|
||||
"non_priority": {
|
||||
"description": "Set this hold as non priority",
|
||||
"type": "boolean"
|
||||
},
|
||||
"item_type": {
|
||||
"type": ["string", "null"],
|
||||
"description": "If record level hold, the optional itemtype of the item the patron is requesting"
|
||||
|
|
|
|||
|
|
@ -103,6 +103,12 @@
|
|||
"description": "Suspended until",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "non_priority",
|
||||
"in": "query",
|
||||
"description": "Non priority hold",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "../parameters.json#/match"
|
||||
},
|
||||
|
|
@ -201,6 +207,10 @@
|
|||
"item_type": {
|
||||
"description": "Limit hold on one itemtype (ignored for item-level holds)",
|
||||
"type": [ "string", "null" ]
|
||||
},
|
||||
"non_priority": {
|
||||
"description": "Set this hold as non priority",
|
||||
"type": [ "boolean", "null" ]
|
||||
}
|
||||
},
|
||||
"required": [ "patron_id", "pickup_library_id" ]
|
||||
|
|
|
|||
|
|
@ -476,6 +476,11 @@
|
|||
<input type="hidden" name="holds_to_place_count" value="1" />
|
||||
[% END %]
|
||||
[% END # /UNLESS multi_hold %]
|
||||
|
||||
<li>
|
||||
<label for="non_priority">Non priority hold:</label>
|
||||
<input name="non_priority" id="non_priority" type="checkbox" />
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
[% UNLESS ( multi_hold ) %]
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ my $title = $input->param('title');
|
|||
my $checkitem = $input->param('checkitem');
|
||||
my $expirationdate = $input->param('expiration_date');
|
||||
my $itemtype = $input->param('itemtype') || undef;
|
||||
my $non_priority = $input->param('non_priority');
|
||||
|
||||
my $borrower = Koha::Patrons->find( $borrowernumber );
|
||||
$borrower = $borrower->unblessed if $borrower;
|
||||
|
|
@ -114,6 +115,7 @@ if ( $type eq 'str8' && $borrower ) {
|
|||
itemnumber => $checkitem,
|
||||
found => $found,
|
||||
itemtype => $itemtype,
|
||||
non_priority => $non_priority,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -135,6 +137,7 @@ if ( $type eq 'str8' && $borrower ) {
|
|||
itemnumber => $checkitem,
|
||||
found => $found,
|
||||
itemtype => $itemtype,
|
||||
non_priority => $non_priority,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -155,6 +158,7 @@ if ( $type eq 'str8' && $borrower ) {
|
|||
itemnumber => $checkitem,
|
||||
found => $found,
|
||||
itemtype => $itemtype,
|
||||
non_priority => $non_priority,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue