<<

NAME

Koha::Item - Koha Item object class

API

Class methods

store

    $item->store;

$params can take an optional 'skip_record_index' parameter. If set, the reindexation process will not happen (index_records not called)

NOTE: This is a temporary fix to answer a performance issue when lot of items are added (or modified) at the same time. The correct way to fix this is to make the ES reindexation process async. You should not turn it on if you do not understand what it is doing exactly.

delete

safe_delete

safe_to_delete

returns 1 if the item is safe to delete,

"book_on_loan" if the item is checked out,

"not_same_branch" if the item is blocked by independent branches,

"book_reserved" if the there are holds aganst the item, or

"linked_analytics" if the item has linked analytic records.

"last_item_for_hold" if the item is the last one on a record on which a biblio-level hold is placed

move_to_deleted

my $is_moved = $item->move_to_deleted;

Move an item to the deleteditems table. This can be done before deleting an item, to make sure the data are not completely deleted.

effective_itemtype

Returns the itemtype for the item based on whether item level itemtypes are set or not.

home_branch

holding_branch

biblio

my $biblio = $item->biblio;

Return the bibliographic record of this item

biblioitem

my $biblioitem = $item->biblioitem;

Return the biblioitem record of this item

checkout

my $checkout = $item->checkout;

Return the checkout for this item

holds

my $holds = $item->holds(); my $holds = $item->holds($params); my $holds = $item->holds({ found => 'W'});

Return holds attached to an item, optionally accept a hashref of params to pass to search

get_transfer

my $transfer = $item->get_transfer;

Return the transfer if the item is in transit or undef

last_returned_by

Gets and sets the last borrower to return an item.

Accepts and returns Koha::Patron objects

$item->last_returned_by( $borrowernumber );

$last_returned_by = $item->last_returned_by();

can_article_request

my $bool = $item->can_article_request( $borrower )

Returns true if item can be specifically requested

$borrower must be a Koha::Patron object

hidden_in_opac

my $bool = $item->hidden_in_opac({ [ rules => $rules ] })

Returns true if item fields match the hidding criteria defined in $rules. Returns false otherwise.

Takes HASHref that can have the following parameters: OPTIONAL PARAMETERS: $rules : { <field> => [ value_1, ... ], ... }

Note: $rules inherits its structure from the parsed YAML from reading the OpacHiddenItems system preference.

can_be_transferred

$item->can_be_transferred({ to => $to_library, from => $from_library }) Checks if an item can be transferred to given library.

This feature is controlled by two system preferences: UseBranchTransferLimits to enable / disable the feature BranchTransferLimitsType to use either an itemnumber or ccode as an identifier for setting the limitations

Takes HASHref that can have the following parameters: MANDATORY PARAMETERS: $to : Koha::Library OPTIONAL PARAMETERS: $from : Koha::Library # if not given, item holdingbranch # will be used instead

Returns 1 if item can be transferred to $to_library, otherwise 0.

To find out whether at least one item of a Koha::Biblio can be transferred, please see Koha::Biblio->can_be_transferred() instead of using this method for multiple items of the same biblio.

pickup_locations

$pickup_locations = $item->pickup_locations( {patron => $patron } )

Returns possible pickup locations for this item, according to patron's home library (if patron is defined and holds are allowed only from hold groups) and if item can be transferred to each pickup location.

article_request_type

my $type = $item->article_request_type( $borrower )

returns 'yes', 'no', 'bib_only', or 'item_only'

$borrower must be a Koha::Patron object

current_holds

stockrotationitem

  my $sritem = Koha::Item->stockrotationitem;

Returns the stock rotation item associated with the current item.

add_to_rota

  my $item = $item->add_to_rota($rota_id);

Add this item to the rota identified by $ROTA_ID, which means associating it with the first stage of that rota. Should this item already be associated with a rota, then we will move it to the new rota.

has_pending_hold

  my $is_pending_hold = $item->has_pending_hold();

This method checks the tmp_holdsqueue to see if this item has been selected for a hold, but not filled yet and returns true or false

as_marc_field

    my $mss   = C4::Biblio::GetMarcSubfieldStructure( '', { unsafe => 1 } );
    my $field = $item->as_marc_field({ [ mss => $mss ] });

This method returns a MARC::Field object representing the Koha::Item object with the current mappings configuration.

renewal_branchcode

Returns the branchcode to be recorded in statistics renewal of the item

to_api_mapping

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

Internal methods

_after_item_action_hooks

Helper method that takes care of calling all plugin hooks

_type

AUTHOR

Kyle M Hall <kyle@bywatersolutions.com>

<<