[Koha-bugs] [Bug 17712] Move availability calculation to the Koha namespace

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Feb 13 13:18:43 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17712

Lari Taskula <lari.taskula at jns.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58451|0                           |1
        is obsolete|                            |

--- Comment #20 from Lari Taskula <lari.taskula at jns.fi> ---
Created attachment 60151
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60151&action=edit
Bug 17712: Item availability for hold

Adds Koha::Item::Availability::Hold class for item hold availability.

This patch adds item holdability queries in two contexts:
1. in_opac     (perspective of patron themselves)
2. in_intranet (perspective of a librarian to patron)

Returns a Koha::Item::Availability::Hold object, which contains all information
on
availability for hold in that context. This may include additional notes,
reasons
to ask for confirmation or reasons for unavailability.

Example: To find out if patron can hold an item in OPAC, we will write:

my $availability = Koha::Availability::Hold->item({
    patron => $patron,
    item => $item,
    to_branch => $branchcode, # transfer allowed from holdingbranch to
to_branch?
})->in_opac;
if ($availability->available) {
    # yes!
} else {
    foreach my $reason (keys %{$availability->unavailabilities}) {
        # each reason for unavailability
    }
    foreach my $reason (keys %{$availability->confirmations}) {
        # each reason that requires confirmation
    }
    foreach my $reason (keys %{$availability->notes}) {
        # each additional note
    }
}

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list