VuFind API Documentation

Unicorn extends AbstractBase
in package
implements HttpServiceAwareInterface, HasSorterInterface Uses HttpServiceAwareTrait, HasSorterTrait

SirsiDynix Unicorn ILS Driver (VuFind side)

IMPORTANT: To use this driver you need to download the SirsiDynix API driver.pl from http://code.google.com/p/vufind-unicorn/ and install it on your Sirsi Unicorn/Symphony server. Please note: currently you will need to download the driver.pl in the yorku branch on google code to use this driver.

Tags
category

VuFind

author

Tuan Nguyen tuan@yorku.ca

author

Drew Farrugia vufind-unicorn-l@lists.lehigh.edu

license

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

link

vufind-unicorn project

Interfaces, Classes, Traits and Enums

HttpServiceAwareInterface
HasSorterInterface
Interface SortingInterface

Table of Contents

$config  : array<string|int, mixed>
Driver configuration
$dateConverter  : Converter
Date converter object
$host  : string
Host
$port  : string
Port
$search_prog  : string
Name of API program
$sorter  : SorterInterface|null
Sorter
$url  : string
Full URL to API (alternative to host/port/search_prog)
__construct()  : mixed
Constructor
cancelHolds()  : array<string|int, mixed>
Cancel Holds
findReserves()  : array<string|int, mixed>
Find Reserves
getCancelHoldDetails()  : string
Get Cancel Hold 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()  : 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()  : mixed
Get Patron Fines
getMyHolds()  : array<string|int, mixed>
Get Patron Holds
getMyProfile()  : array<string|int, mixed>
Get Patron Profile
getMyTransactions()  : array<string|int, mixed>
Get Patron Transactions
getNewItems()  : array<string|int, mixed>
Get New Items
getPickUpLocations()  : array<string|int, mixed>
Get Pick Up Locations
getPurchaseHistory()  : array<string|int, mixed>
Get Purchase History
getRenewDetails()  : string
Get Renew Details
getSorter()  : SorterInterface
Get the sorter
getStatus()  : mixed
Get Status
getStatuses()  : array<string|int, mixed>
Get Statuses
getSuppressedRecords()  : array<string|int, mixed>
Get suppressed records.
init()  : void
Initialize the driver.
patronLogin()  : mixed
Patron Login
placeHold()  : mixed
Place Hold
renewMyItems()  : array<string|int, mixed>
Renew My Items
setConfig()  : void
Set configuration.
setSorter()  : void
Set the sorter
calculateRecallDueDate()  : int
Given the date recalled, calculate the new due date based on circulation policy.
decodeMarcHoldingRecord()  : array<string|int, mixed>
Decode a MARC holding record.
formatDateTime()  : string
Format the given unix time stamp to a human readable format. The format is configurable in Unicorn.ini
getMarcHoldings()  : array<string|int, mixed>
Get textual holdings summary.
mapLibrary()  : string
Maps the library code to friendly library name.
mapLocation()  : string
Map the location code to friendly name.
parseDateTime()  : int
Take a date/time string from SIRSI seltool and convert it into unix time stamp.
parseStatusLine()  : array<string|int, mixed>
Parse a pipe-delimited status line received from the script on the Unicorn/Symphony server.
processMarcHoldingLocation()  : array<string|int, mixed>
Given a location field, return the values relevant to VuFind.
querySirsi()  : string
Send a request to the SIRSI side API script and returns the response.
throwAsIlsException()  : never
Rethrow the provided exception as an ILS exception.
toUTF8()  : string
Convert the given ISO-8859-1 string to UTF-8 if it is not already UTF-8.

Properties

$config

Driver configuration

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

$dateConverter

Date converter object

protected Converter $dateConverter

$search_prog

Name of API program

protected string $search_prog

$url

Full URL to API (alternative to host/port/search_prog)

protected string $url

Methods

__construct()

Constructor

public __construct(Converter $dateConverter) : mixed
Parameters
$dateConverter : Converter

Date converter object

Return values
mixed

cancelHolds()

Cancel Holds

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

Attempts to Cancel a hold or recall on a particular item. The data in $cancelDetails['details'] is determined by getCancelHoldDetails().

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)

findReserves()

Find Reserves

public findReserves(string $courseId, string $instructorId, string $departmentId) : array<string|int, mixed>

Obtain information on course reserves.

Parameters
$courseId : string

ID from getCourses (empty string to match all)

$instructorId : string

ID from getInstructors (empty string to match all)

$departmentId : 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.

getCancelHoldDetails()

Get Cancel Hold Details

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

In order to cancel a hold, Voyager requires the patron details an item ID and a recall ID. This function returns the item id and recall id as a string separated by a pipe, which is then submitted as form data in Hold.php. This value is then extracted by the CancelHolds function.

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

A single hold array from getMyHolds

$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>

Obtain a list of courses for use in limiting the reserves list.

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 ]) : string

Returns the default pick up location set in VoyagerRestful.ini

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
string

The default pickup location for the patron.

getDepartments()

Get Departments

public getDepartments() : array<string|int, mixed>

Obtain a list of departments for use in limiting the reserves list.

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

An associative array with key = dept. 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 (not currently used)

Tags
throws
DateException
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>

Obtain a list of instructors for use in limiting the reserves list.

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) : 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
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.

getMyTransactions()

Get Patron Transactions

public getMyTransactions(array<string|int, mixed> $patron) : 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

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
throws
ILS
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

Associative array with 'count' and 'results' keys

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) : array<string|int, 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
throws
ILS
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

An array with the acquisitions data on success.

getRenewDetails()

Get Renew Details

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

In order to renew an item, Voyager requires the patron details and an item id. This function returns the item id as a string which is then used as submitted form data in checkedOut.php. This value is then extracted by the RenewMyItems function.

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

An array of item data

Return values
string

Data for use in a form field

getStatus()

Get Status

public getStatus(string $id) : mixed

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

Parameters
$id : string

The record id to retrieve the holdings for

Tags
throws
ILS
Return values
mixed

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

getStatuses()

Get Statuses

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

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

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

The array of record ids to retrieve the status for

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

An array of getStatus() return values on success.

getSuppressedRecords()

Get suppressed records.

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

ID numbers of suppressed records in the system.

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's password

Tags
throws
ILS
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)

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

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

calculateRecallDueDate()

Given the date recalled, calculate the new due date based on circulation policy.

protected calculateRecallDueDate(int $dateRecalled, int $recallPeriod, int $duedate) : int
Parameters
$dateRecalled : int

Unix time stamp of when the recall was issued.

$recallPeriod : int

Number of days to due date (from date recalled).

$duedate : int

Original duedate.

Return values
int

New due date as unix time stamp.

decodeMarcHoldingRecord()

Decode a MARC holding record.

protected decodeMarcHoldingRecord(MarcReader $record) : array<string|int, mixed>
Parameters
$record : MarcReader

Holding record to decode..

Tags
todo

Check if is OK to print multiple times textual holdings that had more than one $8.

Return values
array<string|int, mixed>

Has two elements: the first is the list of locations found in the record, the second are the decoded holdings per se.

formatDateTime()

Format the given unix time stamp to a human readable format. The format is configurable in Unicorn.ini

protected formatDateTime(int $time) : string
Parameters
$time : int

Unix time stamp.

Return values
string

Formatted date/time.

getMarcHoldings()

Get textual holdings summary.

protected getMarcHoldings(string $marc) : array<string|int, mixed>
Parameters
$marc : string

Raw marc holdings records.

Return values
array<string|int, mixed>

Array of holdings data similar to the one returned by getHolding.

mapLibrary()

Maps the library code to friendly library name.

protected mapLibrary(string $code) : string
Parameters
$code : string

The library code from Unicorn/Symphony

Return values
string

The library friendly name if defined, otherwise the code is returned.

mapLocation()

Map the location code to friendly name.

protected mapLocation(string $code) : string
Parameters
$code : string

The location code from Unicorn/Symphony

Return values
string

The friendly name if defined, otherwise the code is returned.

parseDateTime()

Take a date/time string from SIRSI seltool and convert it into unix time stamp.

protected parseDateTime(string $date) : int
Parameters
$date : string

The input date string. Expected format YYYYMMDDHHMM.

Return values
int

Unix time stamp if successful, false otherwise.

parseStatusLine()

Parse a pipe-delimited status line received from the script on the Unicorn/Symphony server.

protected parseStatusLine(string $line) : array<string|int, mixed>
Parameters
$line : string

The pipe-delimited status line to parse.

Return values
array<string|int, mixed>

Associative array of holding information

processMarcHoldingLocation()

Given a location field, return the values relevant to VuFind.

protected processMarcHoldingLocation(MarcReader $record, array<string|int, mixed> $field) : array<string|int, mixed>

This method is meant to be overridden in inheriting classes to reflect local policies regarding interpretation of the a, b and c subfields of 852.

Parameters
$record : MarcReader

MARC record.

$field : array<string|int, mixed>

Location field to be processed.

Return values
array<string|int, mixed>

Location information.

querySirsi()

Send a request to the SIRSI side API script and returns the response.

protected querySirsi(array<string|int, mixed> $params) : string
Parameters
$params : array<string|int, mixed>

Associative array of query parameters to send.

Return values
string

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

toUTF8()

Convert the given ISO-8859-1 string to UTF-8 if it is not already UTF-8.

protected toUTF8(string $s) : string
Parameters
$s : string

The string to convert.

Return values
string

The input string converted to UTF-8

Search results