<<

NAME

Koha::Item::List - Koha Item List object class

API

Class methods

store

Persist the object in the database.

delete

Delete the object from the database

items

    my $items = $list->items;

Returns a resultset of Koha::Items representing the content of this item list.

add_item

    $list->add_item($itemnumber);

Adds a new Koha::Item to the item list by its itemnumber.

remove_item

    $list->remove_item($itemnumber);

Removes a new Koha::Item from the item list by its itemnumber.

remove_items

    $list->remove_items([100, 250, 310]);

Removes multiple Koha::Item objects from the item list by their itemnumbers.

share

    $list->share({ borrowernumber => $borrowernumber, permission => 'edit' });

Shares the item list with a Koha::Patron, with a given permission ('view' or 'edit').

remove_share

    $list->remove_share($borrowernumber);

Stop sharing the item list with a Koha::Patron.

is_shared_with

    return unless $list->is_shared_with({ borrowernumber => $borrowernumber });
    return unless $list->is_shared_with({ borrowernumber => $borrowernumber, permission => 'edit' });

Returns whether the item list has been shared with the given patron. If 'permission' is specified, the share must be with that permission.

can_be_read_by

    return unless $list->can_be_read_by($patron);

Returns whether the item list may be read by the given patron, accounting for the list visibility, its shares, and the patron's permissions.

can_be_updated_by

    return unless $list->can_be_updated_by($patron);

Returns whether the item list may be updated by the given patron, accounting for the list visibility, its shares, and the patron's permissions.

can_be_deleted_by

    return unless $list->can_be_deleted_by($patron);

Returns whether the item list may be deleted by the given patron, accounting for the list visibility, its shares, and the patron's permissions.

can_be_managed_by

    return unless $list->can_be_managed_by($patron);

Returns whether the item list's contents may be managed by the given patron, accounting for the list visibility, its shares, and the patron's permissions.

item_list_contents

    my $contents = $list->item_list_contents;

Returns a Koha::Item::ListContents representing the contents of this item list.

item_list_shares

    my $shares = $list->item_list_shares;

Returns a Koha::Item::ListShares representing the shares of this item list.

to_api_mapping

Returns the mapping required to represent this object through the REST API.

to_api

Overloaded to_api method to add permission booleans

Internal methods

_check_access

Helper method to check whether a patron has a specified level of access to an item list, taking into account ownership, shares, and patron permissions.

Takes a HASHref with the following parameters: 'patron': the patron the check the access for 'subpermission' (optional): if specified, the item_lists subpermission required by the patron if they do not have explicit access through ownership or shares 'share_permission': the required permission level of a share to grant this access ('view' or 'edit')

_type

The Result type of this object

<<