Koha::Hold - Koha Hold object class
returns the number of days since a hold was placed, optionally using the calendar
my $age = $hold->age( $use_calendar );
my $hold = $hold->suspend_hold( $suspend_until );
my $hold = $hold->resume();
$hold->delete();
$hold->move_hold();
$self->cleanup_hold_group;
Check if a hold group is left with a single or zero holds. Delete hold_group if so. Accepts an optional $hold_group_id that, if defined, uses that instead of self->hold_group_id
$self->set_as_hold_group_target;
Sets this hold and its' hold group's target
$self->remove_as_hold_group_target;
Removes this hold as the target of its hold group if it is currently set as such, and if the DisplayAddHoldGroups system preference is enabled.
$self->is_hold_group_target;
Returns whether this hold is its hold group target
if ($hold->is_pickup_location_valid({ library_id => $library->id }) ) {
...
}
Returns a boolean representing if the passed pickup location is valid for the hold. It throws a Koha::Exceptions::_MissingParameter if the library_id parameter is not passed.
$hold->set_pickup_location(
{
library_id => $library->id,
[ force => 0|1 ]
}
);
Updates the hold pickup location. It throws a Koha::Exceptions::Hold::InvalidPickupLocation if the passed pickup location is not valid.
Note: It is up to the caller to verify if AllowHoldPolicyOverride is set when setting the force parameter.
$hold->set_processing;
Mark the hold as in processing.
Returns true if hold is waiting, in transit or in processing
Returns true if hold is a waiting hold
Returns true if hold is a in_transit hold
Returns true if hold is a in_processing hold
Returns true if hold is a cancelable hold
Holds may be only canceled if they are not found.
This is used from the OPAC.
if ( $hold->cancellation_requestable_from_opac ) { ... }
Returns a boolean representing if a cancellation request can be placed on the hold from the OPAC. It targets holds that cannot be cancelled from the OPAC (see the is_cancelable_from_opac method above), but for which circulation rules allow requesting cancellation.
Throws a Koha::Exceptions::InvalidStatus exception with the following invalid_status values:
Returns true if hold is waiting and the hold's pickup branch matches the hold item's holding branch
Returns the related Koha::Biblio object for this hold
Returns the related Koha::Patron object for this hold
Returns the related Koha::Item object for this Hold
Returns the related Koha::ItemType object for this hold
Returns the related Koha::Biblio::ItemGroup object for this Hold
Returns the related Koha::Library object for this hold
DEPRECATED
Returns the related Koha::Library object for this hold
Returns the related Koha::Desk object for this Hold
Returns the related Koha::Patron object for this Hold
my $bool = $hold->is_suspended();
my $cancellation_request = $hold->add_cancellation_request({ [ creation_date => $creation_date ] });
Adds a cancellation request to the hold. Returns the generated Koha::Hold::CancellationRequest object.
my $cancellation_requests = $hold->cancellation_requests;
Returns related a Koha::Hold::CancellationRequests resultset.
if ( $hold->cancellation_requested ) { ... }
Returns true if a cancellation request has been placed for the hold.
my $cancel_hold = $hold->cancel( { [ charge_cancel_fee => 1||0, ] [ cancellation_reason => $cancellation_reason, ] [ skip_holds_queue => 1||0 ] [ skip_hold_group_cleanup => 1||0 ] } );
Cancel a hold: - The hold will be moved to the old_reserves table with a priority=0 - The priority of other holds will be updated - The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set - The canceled hold will have the cancellation reason added to old_reserves.cancellation_reason if one is passed in - a CANCEL HOLDS log will be done if the pref HoldsLog is on
$hold->fill({ [ item_id => $item->id ] });
This method marks the hold as filled. It effectively moves it to old_reserves. The optional item_id parameter is used to set the information about the item that filled the hold.
$hold->revert_found();
Reverts any 'found' hold back to a regular hold with a priority of 1. This method can revert holds in 'waiting' (W), 'in transit' (T), or 'in processing' (P) status.
For waiting holds, the desk_id is also cleared since the hold is no longer waiting at a specific desk. For in transit and in processing holds, desk_id remains unchanged (typically NULL as these statuses don't set desk_id).
$hold->change_type # to record level
$hold->change_type( $itemnumber ) # to item level
Changes hold type between record and item level holds, only if record has exactly one hold for a patron. This is because Koha expects all holds for a patron on a record to be alike.
Override base store method to set default expirationdate for holds.
my $hold_group = $hold->hold_group;
my $hold_group_id = $hold_group->id if $hold_group;
Return the Koha::HoldGroup object of a hold if part of a hold group
my $is_moved = $hold->_move_to_old;
Move a hold to the old_reserve table following the same pattern as Koha::Patron->move_to_deleted
This method returns the mapping for representing a Koha::Hold object on the API.
my $can_update_pickup_location_opac = $hold->can_update_pickup_location_opac;
Returns if a hold can change pickup location from opac
Returns a map of column name to string representations including the string.
Kyle M Hall <kyle@bywatersolutions.com> Jonathan Druart <jonathan.druart@bugs.koha-community.org> Martin Renvoize <martin.renvoize@ptfs-europe.com>