Koha::Biblio - Koha Biblio Object class
Overloaded store method to set default values
my $metadata = $biblio->metadata();
Returns a Koha::Biblio::Metadata object
my $record = $biblio->record();
Returns a Marc::Record object
my $schema = $biblio->record_schema();
Returns the record schema (MARC21, USMARC or UNIMARC).
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.
my $orders = $biblio->orders();
Returns a Koha::Acquisition::Orders object
my $uncancelled_orders = $biblio->uncancelled_orders;
Returns acquisition orders related to this biblio that are not cancelled.
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
my $tickets = $biblio->tickets();
Returns all tickets linked to the biblio
my $ill_requests = $biblio->ill_requests();
Returns a Koha::ILL::Requests object
my $item_groups = $biblio->item_groups();
Returns a Koha::Biblio::ItemGroups object
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
if ( $biblio->can_be_edited( $patron ) ) { ... }
Returns a boolean denoting whether the passed $patron meets the required conditions to manually edit the record.
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.
$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.
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.
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.
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
my $type = $biblio->article_request_type_for_bib
Returns the article request type 'yes', 'no', 'item_only', 'bib_only', for the given record
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.
my $article_requests = $biblio->article_requests
Returns the article requests associated with this biblio
my $current_checkouts = $biblio->current_checkouts
Returns the current checkouts associated with this biblio
my $old_checkouts = $biblio->old_checkouts
Returns the past checkouts associated with this biblio
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
my $bookable_items = $biblio->bookable_items;
Returns the related Koha::Items resultset filtered to those items that can be booked.
my $host_items = $biblio->host_items();
Return the host items (easy analytical record)
my $host_itemnumber = $biblio->_host_itemnumbers();
Return the itemnumbers for analytical items on this record
my $itemtype = $biblio->itemtype();
Returns the itemtype for this record.
my $holds = $biblio->holds();
return the current holds placed on this record
my $old_holds = $biblio->old_holds();
return the historic holds placed on this record
my $holds = $biblio->current_holds
Return the holds placed on this bibliographic record. It does not include future holds.
my $field = $self->biblioitem
Returns the related Koha::Biblioitem object for this Biblio object
my $bookings = $item->bookings();
Returns the bookings attached to this biblio.
my $suggestions = $self->suggestions
Returns the related Koha::Suggestions object for this Biblio object
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)
Returns a query which can be used to search for all component parts of MARC21 biblios
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)
Returns a query which can be used to search for all component parts of MARC21 biblios
my $subscriptions = $self->subscriptions
Returns the related Koha::Subscriptions object for this Biblio object
my $serials = $self->serials
Returns the related Koha::Serials object for this Biblio object
my $subscription_histories = $self->subscription_histories
Returns the related Koha::Subscription::Histories object for this Biblio object
my $itemsWaitingOrInTransit = $biblio->has_items_waiting_or_intransit
Tells if this bibliographic record has items waiting or in transit.
my $coins = $biblio->get_coins;
Returns the COinS (a span) which can be included in a biblio record
my $url = $biblio->get_openurl;
Returns url for OpenURL resolver set in OpenURLResolverURL system preference
my $serial = $biblio->is_serial
Return boolean true if this bibbliographic record is continuing resource
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
Return the cover images associated with this biblio.
$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.
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.
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)
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).
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.
This method returns the list of publicly readable database fields for both API and UI output purposes
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)
my $normalized_upc = $biblio->normalized_upc
Normalizes and returns the UPC value found in the MARC record.
my $normalized_oclc = $biblio->normalized_oclc
Normalizes and returns the OCLC number found in the MARC record.
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.
This method returns the mapping for representing a Koha::Biblio object on the API.
$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.
my $host = $biblio->get_marc_host_only;
Return host only
my $relatedparts = $biblio->get_marc_relatedparts_only;
Return related parts only
my $hostinfo = $biblio->get_marc_hostinfo_only;
Return host info only
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.
$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.
my $recalls = $biblio->recalls;
Return recalls linked to this biblio
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
my $ratings = $biblio->ratings
Return a Koha::Ratings object representing the ratings of this bibliographic record
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.
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
Kyle M Hall <kyle@bywatersolutions.com>