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;
Dissociates the last hold from a group if it is the only one remaining and no history exists. If no active holds remain and no history exists, the group is deleted. Groups with history are kept to preserve the hold_group_id reference in old_reserves.
$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::ILL::ISO18626::Request object for this hold
Adds iso18626 request relationship to this hold and respective biblio
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();
Returns the number (count) of item-level holds for this hold's biblionumber and patron
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.
$hold->progress_iso18626_request( $action, $iso18626_payload );
Process and update the associated ISO18626 request based on a specific hold action.
$actionRequired string. The hold-related event trigger (e.g., 'hold_created' or 'hold_cancelled').
$iso18626_payloadRequired hashref. Contains data for the ISO18626 message, such as expectedDeliveryDate, messageInfoNote, or reasonUnfilled.
Override base store method to set default expirationdate for holds.
$hold->_set_default_expirationdate;
Internal method to set the default expiration date based on DefaultHoldExpirationdatePeriod and DefaultHoldExpirationdateUnitOfTime system preferences.
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 $fee = $hold->calculate_hold_fee();
Calculate the hold fee for this hold using circulation rules. Returns the fee amount as a decimal.
my $should_charge = $hold->should_charge($stage);
Returns true if the hold fee should be charged at the given stage based on HoldFeeMode preference and current hold state.
Stage can be: - 'placement': When the hold is first placed - 'collection': When the hold is filled/collected
$hold->charge_hold_fee({ amount => $fee });
Charge the patron for the hold fee.
my $fee = $hold->_calculate_title_hold_fee();
Calculate the hold fee for a title-level hold using the TitleHoldFeeStrategy system preference to determine which fee to charge when items have different fees.
Helper method to find the most frequently occurring fee in a list.
Helper method to implement the 'not_always' HoldFeeMode logic. Returns true if a fee should be charged in not_always mode.
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>