<<

NAME

Koha::Biblio - Koha Biblio Object class

API

Class Methods

store

Overloaded store method to set default values

metadata

my $metadata = $biblio->metadata();

Returns a Koha::Biblio::Metadata object

record

my $record = $biblio->record();

Returns a Marc::Record object

record_schema

my $schema = $biblio->record_schema();

Returns the record schema (MARC21, USMARC or UNIMARC).

metadata_record

    my $record = $biblio->metadata_record(
        {
            [
                embed_items         => 1 | 0,
                interface           => 'opac' | 'intranet',
                patron              => $patron,
                expand_coded_fields => 1 | 0
            ]
        }
    );

Returns the metadata serialized as appropriate for the metadata object type. Currently only MARC::Record objects are returned.

orders

my $orders = $biblio->orders();

Returns a Koha::Acquisition::Orders object

uncancelled_orders

my $uncancelled_orders = $biblio->uncancelled_orders;

Returns acquisition orders related to this biblio that are not cancelled.

acq_status

    print $biblio->acq_status;

    This status can be:
    - unlinked:   not any linked order found in the system
    - acquired:   some lines are complete, rest is cancelled
    - cancelled:  all lines are cancelled
    - processing: some lines are active or new

tickets

  my $tickets = $biblio->tickets();

Returns all tickets linked to the biblio

ill_requests

    my $ill_requests = $biblio->ill_requests();

Returns a Koha::ILL::Requests object

item_groups

my $item_groups = $biblio->item_groups();

Returns a Koha::Biblio::ItemGroups object

can_article_request

my $bool = $biblio->can_article_request( $borrower );

Returns true if article requests can be made for this record

$borrower must be a Koha::Patron object

can_be_edited

    if ( $biblio->can_be_edited( $patron ) ) { ... }

Returns a boolean denoting whether the passed $patron meets the required conditions to manually edit the record.

check_booking

  my $bookable =
    $biblio->check_booking( { start_date => $datetime, end_date => $datetime, [ booking_id => $booking_id ] } );

Returns a boolean denoting whether the passed booking can be made without clashing.

Optionally, you may pass a booking id to exclude from the checks; This is helpful when you are updating an existing booking.

can_be_transferred

$biblio->can_be_transferred({ to => $to_library, from => $from_library })

Checks if at least one item of a biblio 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

Performance-wise, it is recommended to use this method for a biblio instead of iterating each item of a biblio with Koha::Item->can_be_transferred().

Takes HASHref that can have the following parameters: MANDATORY PARAMETERS: $to : Koha::Library OPTIONAL PARAMETERS: $from : Koha::Library # if given, only items from that # holdingbranch are considered

Returns 1 if at least one of the item of a biblio can be transferred to $to_library, otherwise 0.

pickup_locations

    my $pickup_locations = $biblio->pickup_locations({ patron => $patron });

Returns a Koha::Libraries set of possible pickup locations for this biblio's items, according to patron's home library and if item can be transferred to each pickup location.

Throws a Koha::Exceptions::MissingParameter exception if the mandatory parameter patron is not passed.

hidden_in_opac

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

Returns true if the biblio matches the hidding criteria defined in $rules. Returns false otherwise. It involves the OpacHiddenItems and OpacHiddenItemsHidesRecord system preferences.

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.

article_request_type

my $type = $biblio->article_request_type( $borrower );

Returns the article request type based on items, or on the record itself if there are no items.

$borrower must be a Koha::Patron object

article_request_type_for_bib

my $type = $biblio->article_request_type_for_bib

Returns the article request type 'yes', 'no', 'item_only', 'bib_only', for the given record

article_request_type_for_items

my $type = $biblio->article_request_type_for_items

Returns the article request type 'yes', 'no', 'item_only', 'bib_only', for the given record's items

If there is a conflict where some items are 'bib_only' and some are 'item_only', 'bib_only' will be returned.

article_requests

    my $article_requests = $biblio->article_requests

Returns the article requests associated with this biblio

current_checkouts

    my $current_checkouts = $biblio->current_checkouts

Returns the current checkouts associated with this biblio

old_checkouts

    my $old_checkouts = $biblio->old_checkouts

Returns the past checkouts associated with this biblio

items

my $items = $biblio->items({ [ host_items => 1 ] });

The optional param host_items allows you to include 'analytical' items.

Returns the related Koha::Items object for this biblio

bookable_items

  my $bookable_items = $biblio->bookable_items;

Returns the related Koha::Items resultset filtered to those items that can be booked.

host_items

my $host_items = $biblio->host_items();

Return the host items (easy analytical record)

_host_itemnumbers

my $host_itemnumber = $biblio->_host_itemnumbers();

Return the itemnumbers for analytical items on this record

itemtype

my $itemtype = $biblio->itemtype();

Returns the itemtype for this record.

holds

my $holds = $biblio->holds();

return the current holds placed on this record

old_holds

my $old_holds = $biblio->old_holds();

return the historic holds placed on this record

current_holds

my $holds = $biblio->current_holds

Return the holds placed on this bibliographic record. It does not include future holds.

biblioitem

my $field = $self->biblioitem

Returns the related Koha::Biblioitem object for this Biblio object

bookings

  my $bookings = $item->bookings();

Returns the bookings attached to this biblio.

suggestions

my $suggestions = $self->suggestions

Returns the related Koha::Suggestions object for this Biblio object

get_marc_components

  my $components = $self->get_marc_components();

Returns an array of search results data, which are component parts of this object (MARC21 773 points to this)

get_components_query

Returns a query which can be used to search for all component parts of MARC21 biblios

get_marc_volumes

  my $volumes = $self->get_marc_volumes();

Returns an array of MARCXML data, which are volumes parts of this object (MARC21 773$w or 8xx$w point to this)

get_volumes_query

Returns a query which can be used to search for all component parts of MARC21 biblios

subscriptions

my $subscriptions = $self->subscriptions

Returns the related Koha::Subscriptions object for this Biblio object

serials

my $serials = $self->serials

Returns the related Koha::Serials object for this Biblio object

subscription_histories

my $subscription_histories = $self->subscription_histories

Returns the related Koha::Subscription::Histories object for this Biblio object

has_items_waiting_or_intransit

my $itemsWaitingOrInTransit = $biblio->has_items_waiting_or_intransit

Tells if this bibliographic record has items waiting or in transit.

get_coins

my $coins = $biblio->get_coins;

Returns the COinS (a span) which can be included in a biblio record

get_openurl

my $url = $biblio->get_openurl;

Returns url for OpenURL resolver set in OpenURLResolverURL system preference

is_serial

my $serial = $biblio->is_serial

Return boolean true if this bibbliographic record is continuing resource

custom_cover_image_url

my $image_url = $biblio->custom_cover_image_url

Return the specific url of the cover image for this bibliographic record. It is built regaring the value of the system preference CustomCoverImagesURL

cover_images

Return the cover images associated with this biblio.

get_marc_notes

    $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });

Get all notes from the MARC record and returns them in an array. The notes are stored in different fields depending on MARC flavour. MARC21 5XX $u subfields receive special attention as they are URIs.

_get_marc_authors

Private method to return the list of authors contained in the MARC record. See get get_marc_contributors and get_marc_authors for the public methods.

get_marc_contributors

    my $contributors = $biblio->get_marc_contributors;

Get all contributors (but first author) from the MARC record and returns them in an array. They are stored in different fields depending on MARC flavour (700..720 for MARC21)

get_marc_authors

    my $authors = $biblio->get_marc_authors;

Get all authors from the MARC record and returns them in an array. They are stored in different fields depending on MARC flavour (main author from 100 then secondary authors from 700..720).

normalized_isbn

    my $normalized_isbn = $biblio->normalized_isbn

Normalizes and returns the first valid ISBN found in the record. ISBN13 are converted into ISBN10. This is required to get some book cover images.

public_read_list

This method returns the list of publicly readable database fields for both API and UI output purposes

metadata_extractor

    my $extractor = $biblio->metadata_extractor

Return a Koha::Biblio::Metadata::Extractor object to use to extract data from the metadata (ie. MARC record for now)

normalized_upc

    my $normalized_upc = $biblio->normalized_upc

Normalizes and returns the UPC value found in the MARC record.

normalized_oclc

    my $normalized_oclc = $biblio->normalized_oclc

Normalizes and returns the OCLC number found in the MARC record.

to_api

    my $json = $biblio->to_api;

Overloaded method that returns a JSON representation of the Koha::Biblio object, suitable for API output. The related Koha::Biblioitem object is merged as expected on the API.

to_api_mapping

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

get_marc_host

    $host = $biblio->get_marc_host;
    # OR:
    ( $host, $relatedparts, $hostinfo ) = $biblio->get_marc_host;

    Returns host biblio record from MARC21 773 (undef if no 773 present).
    It looks at the first 773 field with MARCorgCode or only a control
    number. Complete $w or numeric part is used to search host record.
    The optional parameter no_items triggers a check if $biblio has items.
    If there are, the sub returns undef.
    Called in list context, it also returns 773$g (related parts).

    If there is no $w, we use $0 (host biblionumber) or $9 (host itemnumber)
    to search for the host record. If there is also no $0 and no $9, we search
    using author and title. Failing all of that, we return an undef host and
    form a concatenation of strings with 773$agt for host information,
    returned when called in list context.

get_marc_host_only

    my $host = $biblio->get_marc_host_only;

Return host only

get_marc_relatedparts_only

    my $relatedparts = $biblio->get_marc_relatedparts_only;

Return related parts only

get_marc_hostinfo_only

    my $hostinfo = $biblio->get_marc_hostinfo_only;

Return host info only

generate_marc_host_field

  my $link_field = $biblio->generate_marc_host_field;
  $child->link_marc_host( $link_field );

This method generates a MARC link field from the host record that can be added to child records to link them to the host record.

NOTE: This replicates and partially enhances C4::Biblio::prepare_marc_host(). We should merge functionality from C4::Biblio::PrepareMarcHost() too and then replace all calls to those methods with this one and remove those alternatives from the codebase.

link_marc_host

  $biblio->link_marc_host({ field => $link_field});
  $biblio->link_marc_host({ host => $biblio });
  $biblio->link_marc_host({ host => $biblionumber });

Links a child MARC record to the parent. Expects either a pre-formed link field as generated by $parent->get_link_field, the biblio object or biblionumber of the host to link to.

recalls

    my $recalls = $biblio->recalls;

Return recalls linked to this biblio

can_be_recalled

    my @items_for_recall = $biblio->can_be_recalled({ patron => $patron_object });

Does biblio-level checks and returns the items attached to this biblio that are available for recall

ratings

    my $ratings = $biblio->ratings

Return a Koha::Ratings object representing the ratings of this bibliographic record

opac_summary_html

    my $summary_html = $biblio->opac_summary_html

Based on the syspref OPACMySummaryHTML, returns a string representing the summary of this bibliographic record. {AUTHOR}, {TITLE}, {ISBN} and {BIBLIONUMBER} will be replaced.

merge_with

    my $biblio = Koha::Biblios->find($biblionumber);
    $biblio->merge_with(\@biblio_ids);

    This subroutine merges a list of bibliographic records into the bibliographic record.
    This function DOES NOT CHANGE the bibliographic metadata of the record. But it links all
    items, holds, subscriptions, serials issues and article_requests to the record. After doing changes
    bibliographic records listed are deleted

Internal methods

type

AUTHOR

Kyle M Hall <kyle@bywatersolutions.com>

<<