VuFind API Documentation

KohaRest extends AbstractBase
in package
implements HttpServiceAwareInterface, TranslatorAwareInterface, LoggerAwareInterface, HasSorterInterface Uses HttpServiceAwareTrait, TranslatorAwareTrait, CacheTrait, OAuth2TokenTrait, HasSorterTrait

VuFind Driver for Koha, using REST API

Minimum Koha Version: 20.05 + koha-plugin-rest-di REST API plugin from https://github.com/natlibfi/koha-plugin-rest-di

Tags
category

VuFind

author

Bohdan Inhliziian bohdan.inhliziian@gmail.com.cz

author

Ere Maijala ere.maijala@helsinki.fi

author

Josef Moravec josef.moravec@mzk.cz

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Interfaces, Classes, Traits and Enums

HttpServiceAwareInterface
TranslatorAwareInterface
Lightweight translator aware marker interface (used as an alternative to \Laminas\I18n\Translator\TranslatorAwareInterface, which requires an excessive number of methods to be implemented).
LoggerAwareInterface
HasSorterInterface
Interface SortingInterface

Table of Contents

$allowCancelInTransit  : bool
Whether to allow canceling holds in transit. Default is false.
$cache  : StorageInterface
Cache for storing data temporarily (e.g. patron blocks with the ILS driver)
$cacheLifetime  : int
Lifetime of cache (in seconds).
$config  : array<string|int, mixed>
Driver configuration
$currencyFormatter  : CurrencyFormatter
Currency formatter
$dateConverter  : Converter
Date converter object
$defaultPickUpLocation  : string
Default pickup location
$dontValidatePasswords  : bool
Validate passwords
$feeTypeMappings  : array<string|int, mixed>
Mappings from fee (account line) types
$includeSuspendedHoldsInQueueLength  : bool
Whether to include suspended holds in hold queue length calculation.
$itemStatusMappingMethods  : array<string|int, mixed>
Item status mapping methods used when the item status mappings above (or in the configuration file) don't contain a direct mapping.
$itemStatusMappings  : array<string|int, mixed>
Item status mappings
$locationField  : string
Whether the location field in holdings/status results is populated from - branch (Koha library branch/physical location) or - shelving (Koha permanent shelving location of an item) Default is 'branch'.
$patronStatusMappings  : array<string|int, mixed>
Patron status mappings
$permanentRenewalBlocks  : array<string|int, mixed>
Permanent renewal blocks
$renewalBlockMappings  : array<string|int, mixed>
Mappings from renewal block reasons
$sessionCache  : Container
Session cache
$sessionFactory  : callable
Factory function for constructing the SessionContainer.
$sorter  : SorterInterface|null
Sorter
$sortItemsBySerialIssue  : bool
Whether to sort items by serial issue. Default is true.
$source  : string
Library prefix
$statusRankings  : array<string|int, mixed>
Item status rankings. The lower the value, the more important the status.
$translator  : TranslatorInterface
Translator
$useHomeLibrary  : bool
Whether to display home library instead of holding library
__construct()  : mixed
Constructor
cancelHolds()  : array<string|int, mixed>
Cancel Holds
cancelStorageRetrievalRequests()  : array<string|int, mixed>
Cancel Storage Retrieval Requests (article requests)
changePassword()  : array<string|int, mixed>
Change Password
checkRequestIsValid()  : mixed
Check if request is valid
checkStorageRetrievalRequestIsValid()  : bool
Check if storage retrieval request is valid
findReserves()  : array<string|int, mixed>
Find Reserves
getAccountBlocks()  : mixed
Check whether the patron has any blocks on their account.
getCancelStorageRetrievalRequestDetails()  : string
Get Cancel Storage Retrieval Request (article request) Details
getConfig()  : array<string|int, mixed>
Public Function which retrieves renew, hold and cancel settings from the driver ini file.
getCourses()  : array<string|int, mixed>
Get Courses
getDefaultPickUpLocation()  : false|string
Get Default Pick Up Location
getDepartments()  : array<string|int, mixed>
Get Departments
getHolding()  : array<string|int, mixed>
Get Holding
getInstructors()  : array<string|int, mixed>
Get Instructors
getMyFines()  : array<string|int, mixed>
Get Patron Fines
getMyHolds()  : array<string|int, mixed>
Get Patron Holds
getMyProfile()  : array<string|int, mixed>
Get Patron Profile
getMyStorageRetrievalRequests()  : array<string|int, mixed>
Get Patron Storage Retrieval Requests
getMyTransactionHistory()  : array<string|int, mixed>
Get Patron Transaction History
getMyTransactions()  : array<string|int, mixed>
Get Patron Transactions
getNewItems()  : array<string|int, mixed>
Get New Items
getNewOAuth2Token()  : AuthToken
Get new authorization token from API using given credentials
getPickUpLocations()  : array<string|int, mixed>
Get Pick Up Locations
getPurchaseHistory()  : mixed
Get Purchase History
getRenewDetails()  : string
Get Renew Details
getRequestBlocks()  : mixed
Check whether the patron is blocked from placing requests (holds/ILL/SRR).
getSorter()  : SorterInterface
Get the sorter
getStatus()  : array<string|int, mixed>
Get Status
getStatuses()  : mixed
Get Statuses
getTranslator()  : TranslatorInterface
Get translator object.
getTranslatorLocale()  : string
Get the locale from the translator.
getUrlsForRecord()  : array<string|int, mixed>
Provide an array of URL data (in the same format returned by the record driver's getURLs method) for the specified bibliographic record.
init()  : void
Initialize the driver.
patronLogin()  : mixed
Patron Login
placeHold()  : mixed
Place Hold
placeStorageRetrievalRequest()  : mixed
Place Storage Retrieval Request (Call Slip)
purgeTransactionHistory()  : array<string|int, mixed>
Purge Patron Transaction History
renewMyItems()  : array<string|int, mixed>
Renew My Items
setCacheStorage()  : void
Set a cache storage object.
setConfig()  : void
Set configuration.
setSorter()  : void
Set the sorter
setTranslator()  : TranslatorAwareInterface
Set a translator
supportsMethod()  : bool
Helper method to determine whether or not a certain method can be called on this driver. Required method for any smart drivers.
translate()  : string
Translate a string (or string-castable object)
translateWithPrefix()  : string
Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
updateHolds()  : array<string|int, mixed>
Update holds
convertDate()  : string
Convert a date to display format
createHttpClient()  : Client
Create a HTTP client
extractTextDomain()  : array<string|int, mixed>
Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
formatMoney()  : string
Helper function for formatting currency
getBiblio()  : array<string|int, mixed>|null
Fetch a biblio record from Koha
getBiblioTitle()  : string
Get a complete title from all the title-related fields
getCachedData()  : mixed|null
Helper function for fetching cached data.
getCacheKey()  : string
Method to ensure uniform cache keys for cached VuFind objects.
getDebugTranslation()  : string
Build a debug-mode translation
getHoldBlockReason()  : string
Get a reason for why a hold cannot be placed
getItem()  : array<string|int, mixed>|null
Fetch an item record from Koha
getItemCallNumber()  : string
Return a call number for a Koha item
getItemLocationName()  : string
Return a location (branch or shelving) for a Koha item
getItemStatusCodes()  : array<string|int, mixed>
Get statuses for an item
getItemStatusesForBiblio()  : array<string|int, mixed>
Get Item Statuses
getLibraries()  : array<string|int, mixed>
Get libraries from cache or from the API
getLibraryName()  : string
Get library name
getOAuth2Token()  : string
Get a new or cached OAuth2 token (type + token)
getPatronBlockReason()  : string
Get a description for a block
getPatronBlocks()  : mixed
Get patron's blocks, if any
getShelvingLocations()  : array<string|int, mixed>
Get shelving locations from cache or from the API
getSortParamValue()  : string
Converts given key to corresponding parameter
getStatusCodeItemCheckedOut()  : string
Get item status code for CheckedOut status
getStatusCodeItemNotForLoanOrLost()  : string
Get item status code for NotForLoan or Lost status
getStatusCodeItemTransfer()  : string
Get item status code for Transfer status
getStatusRanking()  : int
Support method for pickStatus() -- get the ranking value of the specified status message.
getTransactions()  : array<string|int, mixed>
Get Patron Transactions
holdError()  : array<string|int, mixed>
Return a hold error message
itemArticleRequestAllowed()  : bool
Check if an article request can be placed on the item
itemHoldAllowed()  : bool
Check if an item is holdable
makeRequest()  : array<string|int, mixed>
Make Request
mapRenewalBlockReason()  : string
Map a Koha renewal block reason code to a VuFind translation string
pickStatus()  : string
Protected support method to pick which status message to display when multiple options are present.
pickUpLocationIsValid()  : bool
Is the selected pickup location valid for the hold?
putCachedData()  : void
Helper function for storing cached data.
removeCachedData()  : void
Helper function for removing cached data.
sanitizeTranslationKey()  : string
Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
statusSortFunction()  : int
Status item sort function
throwAsIlsException()  : never
Rethrow the provided exception as an ILS exception.
translateLocation()  : string
Translate location name
translateString()  : string
Get translation for a string

Properties

$allowCancelInTransit

Whether to allow canceling holds in transit. Default is false.

protected bool $allowCancelInTransit = false

$cache

Cache for storing data temporarily (e.g. patron blocks with the ILS driver)

protected StorageInterface $cache = null

$cacheLifetime

Lifetime of cache (in seconds).

protected int $cacheLifetime = 30

$config

Driver configuration

protected array<string|int, mixed> $config = []

$dateConverter

Date converter object

protected Converter $dateConverter

$defaultPickUpLocation

Default pickup location

protected string $defaultPickUpLocation

$dontValidatePasswords

Validate passwords

protected bool $dontValidatePasswords = false

$feeTypeMappings

Mappings from fee (account line) types

protected array<string|int, mixed> $feeTypeMappings = ['A' => 'Account', 'C' => 'Credit', 'Copie' => 'Copier Fee', 'F' => 'Overdue', 'FU' => 'Accrued Fine', 'L' => 'Lost Item Replacement', 'M' => 'Sundry', 'N' => 'New Card', 'ODUE' => 'Overdue', 'Res' => 'Hold Fee', 'HE' => 'Hold Expired', 'RENT' => 'Rental']

$includeSuspendedHoldsInQueueLength

Whether to include suspended holds in hold queue length calculation.

protected bool $includeSuspendedHoldsInQueueLength = false

$itemStatusMappingMethods

Item status mapping methods used when the item status mappings above (or in the configuration file) don't contain a direct mapping.

protected array<string|int, mixed> $itemStatusMappingMethods = ['Item::CheckedOut' => 'getStatusCodeItemCheckedOut', 'Item::Lost' => 'getStatusCodeItemNotForLoanOrLost', 'Item::NotForLoan' => 'getStatusCodeItemNotForLoanOrLost', 'Item::NotForLoanForcing' => 'getStatusCodeItemNotForLoanOrLost', 'Item::Transfer' => 'getStatusCodeItemTransfer', 'ItemType::NotForLoan' => 'getStatusCodeItemNotForLoanOrLost']

$itemStatusMappings

Item status mappings

protected array<string|int, mixed> $itemStatusMappings = ['Item::Held' => 'On Hold', 'Item::Waiting' => 'On Holdshelf', 'Item::Recalled' => 'Recalled']

$locationField

Whether the location field in holdings/status results is populated from - branch (Koha library branch/physical location) or - shelving (Koha permanent shelving location of an item) Default is 'branch'.

protected string $locationField = 'branch'

$patronStatusMappings

Patron status mappings

protected array<string|int, mixed> $patronStatusMappings = ['Hold::MaximumHoldsReached' => 'patron_status_maximum_requests', 'Patron::CardExpired' => 'patron_status_card_expired', 'Patron::DebarredOverdue' => 'patron_status_debarred_overdue', 'Patron::Debt' => 'patron_status_debt_limit_reached', 'Patron::DebtGuarantees' => 'patron_status_guarantees_debt_limit_reached', 'Patron::GoneNoAddress' => 'patron_status_address_missing']

$permanentRenewalBlocks

Permanent renewal blocks

protected array<string|int, mixed> $permanentRenewalBlocks = ['onsite_checkout', 'on_reserve', 'too_many']

$renewalBlockMappings

Mappings from renewal block reasons

protected array<string|int, mixed> $renewalBlockMappings = ['too_soon' => 'ILSMessages::renewal_too_soon', 'auto_too_soon' => 'ILSMessages::will_auto_renew', 'onsite_checkout' => 'ILSMessages::special_circulation', 'on_reserve' => 'renew_item_requested', 'too_many' => 'renew_item_limit', 'restriction' => 'ILSMessages::renewal_block', 'overdue' => 'renew_item_overdue', 'cardlost' => 'ILSMessages::lost_card', 'gonenoaddress' => 'patron_status_address_missing', 'debarred' => 'patron_status_card_blocked', 'debt' => 'ILSMessages::too_much_debt', 'recalled' => 'ILSMessages::renewal_recalled']

$sessionCache

Session cache

protected Container $sessionCache

$sessionFactory

Factory function for constructing the SessionContainer.

protected callable $sessionFactory

$sortItemsBySerialIssue

Whether to sort items by serial issue. Default is true.

protected bool $sortItemsBySerialIssue = true

$source

Library prefix

protected string $source = ''

$statusRankings

Item status rankings. The lower the value, the more important the status.

protected array<string|int, mixed> $statusRankings = ['Charged' => 1, 'On Hold' => 2, 'HoldingStatus::transit_to' => 3, 'HoldingStatus::transit_to_date' => 4]

$useHomeLibrary

Whether to display home library instead of holding library

protected bool $useHomeLibrary = false

Methods

__construct()

Constructor

public __construct(Converter $dateConverter, callable $sessionFactory, CurrencyFormatter $currencyFormatter) : mixed
Parameters
$dateConverter : Converter

Date converter object

$sessionFactory : callable

Factory function returning SessionContainer object

$currencyFormatter : CurrencyFormatter

Currency formatter

Return values
mixed

cancelHolds()

Cancel Holds

public cancelHolds(array<string|int, mixed> $cancelDetails) : array<string|int, mixed>

Attempts to Cancel a hold. The data in $cancelDetails['details'] is taken from holds' cancel_details field.

Parameters
$cancelDetails : array<string|int, mixed>

An array of item and patron data

Return values
array<string|int, mixed>

An array of data on each request including whether or not it was successful and a system message (if available)

cancelStorageRetrievalRequests()

Cancel Storage Retrieval Requests (article requests)

public cancelStorageRetrievalRequests(array<string|int, mixed> $cancelDetails) : array<string|int, mixed>

Attempts to Cancel an article request on a particular item. The data in $cancelDetails['details'] is determined by getCancelStorageRetrievalRequestDetails().

Parameters
$cancelDetails : array<string|int, mixed>

An array of item and patron data

Return values
array<string|int, mixed>

An array of data on each request including whether or not it was successful and a system message (if available)

changePassword()

Change Password

public changePassword(array<string|int, mixed> $details) : array<string|int, mixed>

Attempts to change patron password (PIN code)

Parameters
$details : array<string|int, mixed>

An array of patron id and old and new password:

'patron' The patron array from patronLogin 'oldPassword' Old password 'newPassword' New password

Return values
array<string|int, mixed>

An array of data on the request including whether or not it was successful and a system message (if available)

checkRequestIsValid()

Check if request is valid

public checkRequestIsValid(string $id, array<string|int, mixed> $data, array<string|int, mixed> $patron) : mixed

This is responsible for determining if an item is requestable

Parameters
$id : string

The Bib ID

$data : array<string|int, mixed>

An Array of item data

$patron : array<string|int, mixed>

An array of patron data

Return values
mixed

An array of data on the request including whether or not it is valid and a status message. Alternatively a boolean true if request is valid, false if not.

checkStorageRetrievalRequestIsValid()

Check if storage retrieval request is valid

public checkStorageRetrievalRequestIsValid(string $id, array<string|int, mixed> $data, array<string|int, mixed> $patron) : bool

This is responsible for determining if an item is requestable

Parameters
$id : string

The Bib ID

$data : array<string|int, mixed>

An Array of item data

$patron : array<string|int, mixed>

An array of patron data

Return values
bool

True if request is valid, false if not

findReserves()

Find Reserves

public findReserves(string $course, string $inst, string $dept) : array<string|int, mixed>

Obtain information on course reserves.

Parameters
$course : string

ID from getCourses (empty string to match all)

$inst : string

ID from getInstructors (empty string to match all)

$dept : string

ID from getDepartments (empty string to match all)

Tags
throws
ILS
Return values
array<string|int, mixed>

An array of associative arrays representing reserve items.

getAccountBlocks()

Check whether the patron has any blocks on their account.

public getAccountBlocks(array<string|int, mixed> $patron) : mixed
Parameters
$patron : array<string|int, mixed>

Patron data from patronLogin().

Return values
mixed

A boolean false if no blocks are in place and an array of block reasons if blocks are in place

getCancelStorageRetrievalRequestDetails()

Get Cancel Storage Retrieval Request (article request) Details

public getCancelStorageRetrievalRequestDetails(array<string|int, mixed> $details, array<string|int, mixed> $patron) : string
Parameters
$details : array<string|int, mixed>

An array of item data

$patron : array<string|int, mixed>

Patron information from patronLogin

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

Data for use in a form field

getConfig()

Public Function which retrieves renew, hold and cancel settings from the driver ini file.

public getConfig(string $function[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$function : string

The name of the feature to be checked

$params : array<string|int, mixed> = []

Optional feature-specific parameters (array)

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

An array with key-value pairs.

getCourses()

Get Courses

public getCourses() : array<string|int, mixed>
Tags
throws
ILS
Return values
array<string|int, mixed>

An associative array with key = ID, value = name.

getDefaultPickUpLocation()

Get Default Pick Up Location

public getDefaultPickUpLocation([array<string|int, mixed> $patron = false ][, array<string|int, mixed> $holdDetails = null ]) : false|string

Returns the default pick up location

Parameters
$patron : array<string|int, mixed> = false

Patron information returned by the patronLogin method.

$holdDetails : array<string|int, mixed> = null

Optional array, only passed in when getting a list in the context of placing a hold; contains most of the same values passed to placeHold, minus the patron data. May be used to limit the pickup options or may be ignored.

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
false|string

The default pickup location for the patron or false if the user has to choose.

getDepartments()

Get Departments

public getDepartments() : array<string|int, mixed>
Tags
throws
ILS
Return values
array<string|int, mixed>

An associative array with key = ID, value = dept. name.

getHolding()

Get Holding

public getHolding(string $id[, array<string|int, mixed> $patron = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>

This is responsible for retrieving the holding information of a certain record.

Parameters
$id : string

The record id to retrieve the holdings for

$patron : array<string|int, mixed> = null

Patron data

$options : array<string|int, mixed> = []

Extra options

Tags
throws
ILS
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

On success, an associative array with the following keys: id, availability (boolean), status, location, reserve, callnumber, duedate, number, barcode.

getInstructors()

Get Instructors

public getInstructors() : array<string|int, mixed>
Tags
throws
ILS
Return values
array<string|int, mixed>

An associative array with key = ID, value = name.

getMyFines()

Get Patron Fines

public getMyFines(array<string|int, mixed> $patron) : array<string|int, mixed>

This is responsible for retrieving all fines by a specific patron.

Parameters
$patron : array<string|int, mixed>

The patron array from patronLogin

Tags
throws
DateException
throws
ILS
Return values
array<string|int, mixed>

Array of the patron's fines on success.

getMyHolds()

Get Patron Holds

public getMyHolds(array<string|int, mixed> $patron) : array<string|int, mixed>

This is responsible for retrieving all holds by a specific patron.

Parameters
$patron : array<string|int, mixed>

The patron array from patronLogin

Tags
throws
DateException
throws
ILS
Return values
array<string|int, mixed>

Array of the patron's holds on success.

getMyProfile()

Get Patron Profile

public getMyProfile(array<string|int, mixed> $patron) : array<string|int, mixed>

This is responsible for retrieving the profile for a specific patron.

Parameters
$patron : array<string|int, mixed>

The patron array

Tags
throws
ILS
Return values
array<string|int, mixed>

Array of the patron's profile data on success.

getMyStorageRetrievalRequests()

Get Patron Storage Retrieval Requests

public getMyStorageRetrievalRequests(array<string|int, mixed> $patron) : array<string|int, mixed>

This is responsible for retrieving all article requests by a specific patron.

Parameters
$patron : array<string|int, mixed>

The patron array from patronLogin

Return values
array<string|int, mixed>

Array of the patron's storage retrieval requests.

getMyTransactionHistory()

Get Patron Transaction History

public getMyTransactionHistory(array<string|int, mixed> $patron, array<string|int, mixed> $params) : array<string|int, mixed>

This is responsible for retrieving all historical transactions (i.e. checked out items) by a specific patron.

Parameters
$patron : array<string|int, mixed>

The patron array from patronLogin

$params : array<string|int, mixed>

Parameters

Tags
throws
DateException
throws
ILS
Return values
array<string|int, mixed>

Array of the patron's transactions on success.

getMyTransactions()

Get Patron Transactions

public getMyTransactions(array<string|int, mixed> $patron[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>

This is responsible for retrieving all transactions (i.e. checked out items) by a specific patron.

Parameters
$patron : array<string|int, mixed>

The patron array from patronLogin

$params : array<string|int, mixed> = []

Parameters

Tags
throws
DateException
throws
ILS
Return values
array<string|int, mixed>

Array of the patron's transactions on success.

getNewItems()

Get New Items

public getNewItems(int $page, int $limit, int $daysOld[, int $fundId = null ]) : array<string|int, mixed>

Retrieve the IDs of items recently added to the catalog.

Parameters
$page : int

Page number of results to retrieve (counting starts at 1)

$limit : int

The size of each page of results to retrieve

$daysOld : int

The maximum age of records to retrieve in days (max. 30)

$fundId : int = null

optional fund ID to use for limiting results (use a value returned by getFunds, or exclude for no limit); note that "fund" may be a misnomer - if funds are not an appropriate way to limit your new item results, you can return a different set of values from getFunds. The important thing is that this parameter supports an ID returned by getFunds, whatever that may mean.

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

Associative array with 'count' and 'results' keys

getNewOAuth2Token()

Get new authorization token from API using given credentials

public getNewOAuth2Token(string $tokenEndpoint, string $clientId, string $clientSecret[, string $grantType = 'client_credentials' ][, bool $useHttpBasic = false ]) : AuthToken
Parameters
$tokenEndpoint : string

URL of token endpoint

$clientId : string

Client id

$clientSecret : string

Client secret

$grantType : string = 'client_credentials'

Grant type (usually 'client_credentials')

$useHttpBasic : bool = false

Use HTTP Basic authorization for getting token

Tags
throws
AuthToken
Return values
AuthToken

getPickUpLocations()

Get Pick Up Locations

public getPickUpLocations([array<string|int, mixed> $patron = false ][, array<string|int, mixed> $holdDetails = null ]) : array<string|int, mixed>

This is responsible for gettting a list of valid library locations for holds / recall retrieval

Parameters
$patron : array<string|int, mixed> = false

Patron information returned by the patronLogin method.

$holdDetails : array<string|int, mixed> = null

Optional array, only passed in when getting a list in the context of placing or editing a hold. When placing a hold, it contains most of the same values passed to placeHold, minus the patron data. When editing a hold it contains all the hold information returned by getMyHolds. May be used to limit the pickup options or may be ignored. The driver must not add new options to the return array based on this data or other areas of VuFind may behave incorrectly.

Tags
throws
ILS
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

An array of associative arrays with locationID and locationDisplay keys

getPurchaseHistory()

Get Purchase History

public getPurchaseHistory(string $id) : mixed

This is responsible for retrieving the acquisitions history data for the specific record (usually recently received issues of a serial).

Parameters
$id : string

The record id to retrieve the info for

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
mixed

An array with the acquisitions data on success.

getRenewDetails()

Get Renew Details

public getRenewDetails(array<string|int, mixed> $checkOutDetails) : string
Parameters
$checkOutDetails : array<string|int, mixed>

An array of item data

Return values
string

Data for use in a form field

getRequestBlocks()

Check whether the patron is blocked from placing requests (holds/ILL/SRR).

public getRequestBlocks(array<string|int, mixed> $patron) : mixed
Parameters
$patron : array<string|int, mixed>

Patron data from patronLogin().

Return values
mixed

A boolean false if no blocks are in place and an array of block reasons if blocks are in place

getStatus()

Get Status

public getStatus(string $id) : array<string|int, mixed>

This is responsible for retrieving the status information of a certain record.

Parameters
$id : string

The record id to retrieve the holdings for

Return values
array<string|int, mixed>

An associative array with the following keys: id, availability (boolean), status, location, reserve, callnumber.

getStatuses()

Get Statuses

public getStatuses(array<string|int, mixed> $ids) : mixed

This is responsible for retrieving the status information for a collection of records.

Parameters
$ids : array<string|int, mixed>

The array of record ids to retrieve the status for

Return values
mixed

An array of getStatus() return values on success.

getTranslator()

Get translator object.

public getTranslator() : TranslatorInterface
Return values
TranslatorInterface

getTranslatorLocale()

Get the locale from the translator.

public getTranslatorLocale([string $default = 'en' ]) : string
Parameters
$default : string = 'en'

Default to use if translator absent.

Return values
string

getUrlsForRecord()

Provide an array of URL data (in the same format returned by the record driver's getURLs method) for the specified bibliographic record.

public getUrlsForRecord(string $id) : array<string|int, mixed>
Parameters
$id : string

Bibliographic record ID

Return values
array<string|int, mixed>

init()

Initialize the driver.

public init() : void

Validate configuration and perform all resource-intensive tasks needed to make the driver active.

Tags
throws
ILS
Return values
void

patronLogin()

Patron Login

public patronLogin(string $username, string $password) : mixed

This is responsible for authenticating a patron against the catalog.

Parameters
$username : string

The patron username

$password : string

The patron password

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
mixed

Associative array of patron info on successful login, null on unsuccessful login.

placeHold()

Place Hold

public placeHold(array<string|int, mixed> $holdDetails) : mixed

Attempts to place a hold or recall on a particular item and returns an array with result details or throws an exception on failure of support classes

Parameters
$holdDetails : array<string|int, mixed>

An array of item and patron data

Tags
throws
ILS
Return values
mixed

An array of data on the request including whether or not it was successful and a system message (if available)

placeStorageRetrievalRequest()

Place Storage Retrieval Request (Call Slip)

public placeStorageRetrievalRequest(array<string|int, mixed> $details) : mixed

Attempts to place a call slip request on a particular item and returns an array with result details

Parameters
$details : array<string|int, mixed>

An array of item and patron data

Return values
mixed

An array of data on the request including whether or not it was successful and a system message (if available)

purgeTransactionHistory()

Purge Patron Transaction History

public purgeTransactionHistory(array<string|int, mixed> $patron, array<string|int, mixed>|null $ids) : array<string|int, mixed>
Parameters
$patron : array<string|int, mixed>

The patron array from patronLogin

$ids : array<string|int, mixed>|null

IDs to purge, or null for all

Tags
throws
ILS
Return values
array<string|int, mixed>

Associative array of the results

renewMyItems()

Renew My Items

public renewMyItems(array<string|int, mixed> $renewDetails) : array<string|int, mixed>

Function for attempting to renew a patron's items. The data in $renewDetails['details'] is determined by getRenewDetails().

Parameters
$renewDetails : array<string|int, mixed>

An array of data required for renewing items including the Patron ID and an array of renewal IDS

Return values
array<string|int, mixed>

An array of renewal information keyed by item ID

setCacheStorage()

Set a cache storage object.

public setCacheStorage([StorageInterface $cache = null ]) : void
Parameters
$cache : StorageInterface = null

Cache storage interface

Return values
void

setConfig()

Set configuration.

public setConfig(array<string|int, mixed> $config) : void

Set the configuration for the driver.

Parameters
$config : array<string|int, mixed>

Configuration array (usually loaded from a VuFind .ini file whose name corresponds with the driver class name).

Return values
void

supportsMethod()

Helper method to determine whether or not a certain method can be called on this driver. Required method for any smart drivers.

public supportsMethod(string $method, array<string|int, mixed> $params) : bool
Parameters
$method : string

The name of the called method.

$params : array<string|int, mixed>

Array of passed parameters

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
bool

True if the method can be called with the given parameters, false otherwise.

translate()

Translate a string (or string-castable object)

public translate(string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

$tokens : array<string|int, mixed> = []

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

$fallbackDomains : array<string|int, string> = []

Text domains to check if no match is found in the domain specified in $target

Return values
string

translateWithPrefix()

Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.

public translateWithPrefix(string $prefix, string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
$prefix : string

Translation key prefix

$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

$tokens : array<string|int, mixed> = []

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

$fallbackDomains : array<string|int, string> = []

Text domains to check if no match is found in the domain specified in $target

Return values
string

updateHolds()

Update holds

public updateHolds(array<string|int, mixed> $holdsDetails, array<string|int, mixed> $fields, array<string|int, mixed> $patron) : array<string|int, mixed>

This is responsible for changing the status of hold requests

Parameters
$holdsDetails : array<string|int, mixed>

The details identifying the holds

$fields : array<string|int, mixed>

An associative array of fields to be updated

$patron : array<string|int, mixed>

Patron array

Return values
array<string|int, mixed>

Associative array of the results

convertDate()

Convert a date to display format

protected convertDate(string $date[, bool $withTime = false ]) : string
Parameters
$date : string

Date

$withTime : bool = false

Whether the date includes time

Return values
string

createHttpClient()

Create a HTTP client

protected createHttpClient(string $url) : Client
Parameters
$url : string

Request URL

Return values
Client

extractTextDomain()

Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.

protected extractTextDomain(string|object|array<string|int, mixed> $target) : array<string|int, mixed>
Parameters
$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

Return values
array<string|int, mixed>

formatMoney()

Helper function for formatting currency

protected formatMoney(float $amount) : string
Parameters
$amount : float

Number to format

Return values
string

getBiblio()

Fetch a biblio record from Koha

protected getBiblio(int $id) : array<string|int, mixed>|null
Parameters
$id : int

Bib record id

Return values
array<string|int, mixed>|null

getBiblioTitle()

Get a complete title from all the title-related fields

protected getBiblioTitle(array<string|int, mixed> $biblio) : string
Parameters
$biblio : array<string|int, mixed>

Biblio record (or something with the correct fields)

Return values
string

getCachedData()

Helper function for fetching cached data.

protected getCachedData(string $key) : mixed|null

Data is cached for up to $this->cacheLifetime.

Parameters
$key : string

Cache entry key

Return values
mixed|null

Cached entry or null if not cached or expired

getCacheKey()

Method to ensure uniform cache keys for cached VuFind objects.

protected getCacheKey([string|null $suffix = null ]) : string
Parameters
$suffix : string|null = null

Optional suffix that will get appended to the object class name calling getCacheKey()

Return values
string

getDebugTranslation()

Build a debug-mode translation

protected getDebugTranslation(string $domain, string $str, array<string|int, mixed> $tokens) : string
Parameters
$domain : string

Text domain

$str : string

String to translate

$tokens : array<string|int, mixed>

Tokens to inject into the translated string

Return values
string

getHoldBlockReason()

Get a reason for why a hold cannot be placed

protected getHoldBlockReason(array<string|int, mixed> $result) : string
Parameters
$result : array<string|int, mixed>

Hold check result

Return values
string

getItem()

Fetch an item record from Koha

protected getItem(int $id) : array<string|int, mixed>|null
Parameters
$id : int

Item id

Return values
array<string|int, mixed>|null

getItemCallNumber()

Return a call number for a Koha item

protected getItemCallNumber(array<string|int, mixed> $item) : string
Parameters
$item : array<string|int, mixed>

Item

Return values
string

getItemLocationName()

Return a location (branch or shelving) for a Koha item

protected getItemLocationName(array<string|int, mixed> $item) : string
Parameters
$item : array<string|int, mixed>

Item

Return values
string

getItemStatusCodes()

Get statuses for an item

protected getItemStatusCodes(array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
$item : array<string|int, mixed>

Item from Koha

Return values
array<string|int, mixed>

Status array and possible due date

getItemStatusesForBiblio()

Get Item Statuses

protected getItemStatusesForBiblio(string $id[, array<string|int, mixed> $patron = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>

This is responsible for retrieving the status information of a certain record.

Parameters
$id : string

The record id to retrieve the holdings for

$patron : array<string|int, mixed> = null

Patron information, if available

$options : array<string|int, mixed> = []

Extra options

Return values
array<string|int, mixed>

On success an array with the key "total" containing the total number of items for the given bib id, and the key "holdings" containing an array of holding information each one with these keys: id, availability (boolean), status, location, reserve, callnumber.

getLibraries()

Get libraries from cache or from the API

protected getLibraries() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLibraryName()

Get library name

protected getLibraryName(string $library) : string
Parameters
$library : string

Library ID

Return values
string

getOAuth2Token()

Get a new or cached OAuth2 token (type + token)

protected getOAuth2Token([bool $renew = false ]) : string
Parameters
$renew : bool = false

Force renewal of token

Return values
string

getPatronBlockReason()

Get a description for a block

protected getPatronBlockReason(string $reason, array<string|int, mixed> $details) : string
Parameters
$reason : string

Koha block reason

$details : array<string|int, mixed>

Any details related to the reason

Return values
string

getPatronBlocks()

Get patron's blocks, if any

protected getPatronBlocks(array<string|int, mixed> $patron) : mixed
Parameters
$patron : array<string|int, mixed>

Patron

Return values
mixed

A boolean false if no blocks are in place and an array of block reasons if blocks are in place

getShelvingLocations()

Get shelving locations from cache or from the API

protected getShelvingLocations() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSortParamValue()

Converts given key to corresponding parameter

protected getSortParamValue(string $key[, string $default = '' ]) : string
Parameters
$key : string

to convert

$default : string = ''

value to return

Return values
string

getStatusCodeItemCheckedOut()

Get item status code for CheckedOut status

protected getStatusCodeItemCheckedOut(string $code, array<string|int, mixed> $data, array<string|int, mixed> $item) : string
Parameters
$code : string

Status code

$data : array<string|int, mixed>

Status data

$item : array<string|int, mixed>

Item

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

getStatusCodeItemNotForLoanOrLost()

Get item status code for NotForLoan or Lost status

protected getStatusCodeItemNotForLoanOrLost(string $code, array<string|int, mixed> $data, array<string|int, mixed> $item) : string
Parameters
$code : string

Status code

$data : array<string|int, mixed>

Status data

$item : array<string|int, mixed>

Item

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

getStatusCodeItemTransfer()

Get item status code for Transfer status

protected getStatusCodeItemTransfer(string $code, array<string|int, mixed> $data, array<string|int, mixed> $item) : string
Parameters
$code : string

Status code

$data : array<string|int, mixed>

Status data

$item : array<string|int, mixed>

Item

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

getStatusRanking()

Support method for pickStatus() -- get the ranking value of the specified status message.

protected getStatusRanking(string $status) : int
Parameters
$status : string

Status message to look up

Return values
int

getTransactions()

Get Patron Transactions

protected getTransactions(array<string|int, mixed> $patron, array<string|int, mixed> $params, bool $checkedIn) : array<string|int, mixed>

This is responsible for retrieving all transactions (i.e. checked-out items or checked-in items) by a specific patron.

Parameters
$patron : array<string|int, mixed>

The patron array from patronLogin

$params : array<string|int, mixed>

Parameters

$checkedIn : bool

Whether to list checked-in items

Tags
throws
DateException
throws
ILS
Return values
array<string|int, mixed>

Array of the patron's transactions on success.

holdError()

Return a hold error message

protected holdError(string $error) : array<string|int, mixed>
Parameters
$error : string

Error message

Return values
array<string|int, mixed>

itemArticleRequestAllowed()

Check if an article request can be placed on the item

protected itemArticleRequestAllowed(array<string|int, mixed> $item) : bool
Parameters
$item : array<string|int, mixed>

Item from Koha

Return values
bool

itemHoldAllowed()

Check if an item is holdable

protected itemHoldAllowed(array<string|int, mixed> $item) : bool
Parameters
$item : array<string|int, mixed>

Item from Koha

Return values
bool

makeRequest()

Make Request

protected makeRequest(array<string|int, mixed> $request) : array<string|int, mixed>

Makes a request to the Koha REST API

Parameters
$request : array<string|int, mixed>

Either a path as string or non-keyed array of path elements, or a keyed array of request parameters:

path String or array of values to embed in the URL path. String is taken as is, array elements are url-encoded. query URL parameters (optional) method HTTP method (default is GET) form Form request params (optional) json JSON request as a PHP array (optional, only when form is not specified) headers Headers errors If true, return errors instead of raising an exception

Tags
throws
ILS
Return values
array<string|int, mixed>

mapRenewalBlockReason()

Map a Koha renewal block reason code to a VuFind translation string

protected mapRenewalBlockReason(string $reason, string $itype) : string
Parameters
$reason : string

Koha block code

$itype : string

Koha item type

Return values
string

pickStatus()

Protected support method to pick which status message to display when multiple options are present.

protected pickStatus(array<string|int, mixed> $statusArray) : string
Parameters
$statusArray : array<string|int, mixed>

Array of status messages to choose from.

Tags
throws
ILS
Return values
string

The best status message to display.

pickUpLocationIsValid()

Is the selected pickup location valid for the hold?

protected pickUpLocationIsValid(string $pickUpLocation, array<string|int, mixed> $patron, array<string|int, mixed> $holdDetails) : bool
Parameters
$pickUpLocation : string

Selected pickup location

$patron : array<string|int, mixed>

Patron information returned by the patronLogin method.

$holdDetails : array<string|int, mixed>

Details of hold being placed

Return values
bool

putCachedData()

Helper function for storing cached data.

protected putCachedData(string $key, mixed $entry[, int $lifetime = null ]) : void

Data is cached for up to $this->cacheLifetime seconds.

Parameters
$key : string

Cache entry key

$entry : mixed

Entry to be cached

$lifetime : int = null

Optional lifetime for the entry in seconds

Return values
void

removeCachedData()

Helper function for removing cached data.

protected removeCachedData(string $key) : void
Parameters
$key : string

Cache entry key

Return values
void

sanitizeTranslationKey()

Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.

protected sanitizeTranslationKey(string $key) : string
Parameters
$key : string

Key to sanitize

Return values
string

Sanitized key

statusSortFunction()

Status item sort function

protected statusSortFunction(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

First status record to compare

$b : array<string|int, mixed>

Second status record to compare

Return values
int

throwAsIlsException()

Rethrow the provided exception as an ILS exception.

protected throwAsIlsException(Throwable $exception[, string $msg = null ]) : never
Parameters
$exception : Throwable

Exception to rethrow

$msg : string = null

Override exception message (optional)

Tags
throws
ILS
Return values
never

translateLocation()

Translate location name

protected translateLocation(string $location[, string $default = null ]) : string
Parameters
$location : string

Location code

$default : string = null

Default value if translation is not available

Return values
string

translateString()

Get translation for a string

protected translateString(string $rawStr[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, string $domain = 'default' ][, bool $useIcuFormatter = false ]) : string
Parameters
$rawStr : string

String to translate

$tokens : array<string|int, mixed> = []

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$domain : string = 'default'

Text domain (omit for default)

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

Return values
string

Search results