<<

NAME

Koha::Item::Availability::Checkin - Check-in availability validation for items

SYNOPSIS

    my $availability = Koha::Item::Availability::Checkin->check( $item,
        {
            library    => $branchcode,
            to_library => $destination_branchcode,
        }
    );

    # Or via instance method
    my $availability = $item->checkin_availability(
        {
            library    => $branchcode,
            to_library => $destination_branchcode,
        }
    );

    # Collect all blockers (e.g. for API responses)
    my $availability = $item->checkin_availability(
        {
            library          => $branchcode,
            to_library       => $destination_branchcode,
            no_short_circuit => 1,
        }
    );

DESCRIPTION

This class provides validation logic for item check-in operations, extracting and centralizing checks from C4::Circulation::AddReturn.

The result categorizes conditions as: - blockers: Prevent check-in (e.g., BlockReturnOfWithdrawnItems enabled) - confirmations: Noteworthy conditions (e.g., item not checked out) - warnings: Informational (e.g., item is withdrawn but check-in allowed)

API

Class methods

check

    my $availability = Koha::Item::Availability::Checkin->check( $item,
        {
            library          => $branchcode,
            to_library       => $destination_branchcode,
            no_short_circuit => 1,
        }
    );

Validates check-in availability for an item.

Parameters: $item - Koha::Item object (required) $params - hashref with: library => branchcode where the return takes place (required) to_library => branchcode where the item should be sent after return (optional, for transfer limit validation) no_short_circuit => boolean, if true all checks are performed and all blockers collected. Default: false (short-circuit on first blocker). This follows the same pattern as Koha::Patron->can_place_holds.

Returns a Koha::Result::Availability object with: blockers => {} # Conditions that prevent check-in confirmations => {} # Conditions requiring confirmation warnings => {} # Informational messages context => { checkout => $checkout # Koha::Checkout object if checked out patron => $patron # Koha::Patron object if item is checked out }

AUTHOR

Koha Development Team <https://koha-community.org/>

<<