<<

NAME

Koha::Hold - Koha Hold object class

API

Class methods

age

returns the number of days since a hold was placed, optionally using the calendar

my $age = $hold->age( $use_calendar );

suspend_hold

my $hold = $hold->suspend_hold( $suspend_until );

resume

my $hold = $hold->resume();

delete

$hold->delete();

set_transfer

set_waiting

is_pickup_location_valid

    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.

set_pickup_location

    $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.

set_processing

$hold->set_processing;

Mark the hold as in processing.

is_found

Returns true if hold is waiting, in transit or in processing

is_waiting

Returns true if hold is a waiting hold

is_in_transit

Returns true if hold is a in_transit hold

is_in_processing

Returns true if hold is a in_processing hold

is_cancelable_from_opac

Returns true if hold is a cancelable hold

Holds may be only canceled if they are not found.

This is used from the OPAC.

cancellation_requestable_from_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:

'hold_not_waiting': the hold is expected to be waiting and it is not.
'no_item_linked': the waiting hold doesn't have an item properly linked.

is_at_destination

Returns true if hold is waiting and the hold's pickup branch matches the hold item's holding branch

biblio

Returns the related Koha::Biblio object for this hold

patron

Returns the related Koha::Patron object for this hold

item

Returns the related Koha::Item object for this Hold

item_group

Returns the related Koha::Biblio::ItemGroup object for this Hold

branch

Returns the related Koha::Library object for this hold

DEPRECATED

pickup_library

Returns the related Koha::Library object for this hold

desk

Returns the related Koha::Desk object for this Hold

borrower

Returns the related Koha::Patron object for this Hold

is_suspended

my $bool = $hold->is_suspended();

add_cancellation_request

    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.

cancellation_requests

    my $cancellation_requests = $hold->cancellation_requests;

Returns related a Koha::Hold::CancellationRequests resultset.

cancellation_requested

    if ( $hold->cancellation_requested ) { ... }

Returns true if a cancellation request has been placed for the hold.

cancel

my $cancel_hold = $hold->cancel( { [ charge_cancel_fee => 1||0, ] [ cancellation_reason => $cancellation_reason, ] [ skip_holds_queue => 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

fill

    $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.

sub change_type

    $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.

store

Override base store method to set default expirationdate for holds.

_move_to_old

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

to_api_mapping

This method returns the mapping for representing a Koha::Hold object on the API.

can_update_pickup_location_opac

    my $can_update_pickup_location_opac = $hold->can_update_pickup_location_opac;

Returns if a hold can change pickup location from opac

strings_map

Returns a map of column name to string representations including the string.

Internal methods

_type

AUTHORS

Kyle M Hall <kyle@bywatersolutions.com> Jonathan Druart <jonathan.druart@bugs.koha-community.org> Martin Renvoize <martin.renvoize@ptfs-europe.com>

<<