<<

Methods

new

Missing POD for new.

format

This method uses a template to build a string from a Koha::Patron object If errors are encountered in processing template we log them and return nothing

format

Missing POD for format.

too_many_lost

This method checks if number of checkouts of lost items exceeds a threshold (defined in server account).

too_many_lost

Missing POD for too_many_lost.

fines_amount

Missing POD for fines_amount.

expired

Missing POD for expired.

x_items

Missing POD for x_items.

hold_items

Missing POD for hold_items.

overdue_items

Missing POD for overdue_items.

charged_items

Missing POD for charged_items.

fine_items

Missing POD for fine_items.

recall_items

Missing POD for recall_items.

unavail_holds

Missing POD for unavail_holds.

inet_privileges

Missing POD for inet_privileges.

excessive_fees

Missing POD for excessive_fees.

excessive_fines

Missing POD for excessive_fines.

holds_blocked_by_excessive_fees

Missing POD for holds_blocked_by_excessive_fees.

library_name

Missing POD for library_name.

invalid_patron

Missing POD for invalid_patron.

charge_denied

Missing POD for charge_denied.

build_patron_attributes_string

This method builds the part of the sip message for extended patron attributes as defined in the sip config

build_patron_attributes_string

Missing POD for build_patron_attributes_string.

build_custom_field_string

This method builds the part of the sip message for custom patron fields as defined in the sip config

build_custom_field_string

Missing POD for build_custom_field_string.

EXAMPLES

  our %patron_example = (
          djfiander => {
              name => "David J. Fiander",
              id => 'djfiander',
              password => '6789',
              ptype => 'A', # 'A'dult.  Whatever.
              birthdate => '19640925',
              address => '2 Meadowvale Dr. St Thomas, ON',
              home_phone => '(519) 555 1234',
              email_addr => 'djfiander@hotmail.com',
              charge_ok => 1,
              renew_ok => 1,
              recall_ok => 0,
              hold_ok => 1,
              card_lost => 0,
              claims_returned => 0,
              fines => 100,
              fees => 0,
              recall_overdue => 0,
              items_billed => 0,
              screen_msg => '',
              print_line => '',
              items => [],
              hold_items => [],
              overdue_items => [],
              fine_items => ['Computer Time'],
              recall_items => [],
              unavail_holds => [],
              inet => 1,
          },
  );

 From borrowers table:
+---------------------+--------------+------+-----+---------+----------------+
| Field               | Type         | Null | Key | Default | Extra          |
+---------------------+--------------+------+-----+---------+----------------+
| borrowernumber      | int(11)      | NO   | PRI | NULL    | auto_increment |
| cardnumber          | varchar(16)  | YES  | UNI | NULL    |                |
| surname             | mediumtext   | NO   |     | NULL    |                |
| firstname           | text         | YES  |     | NULL    |                |
| title               | mediumtext   | YES  |     | NULL    |                |
| othernames          | mediumtext   | YES  |     | NULL    |                |
| initials            | text         | YES  |     | NULL    |                |
| streetnumber        | varchar(10)  | YES  |     | NULL    |                |
| streettype          | varchar(50)  | YES  |     | NULL    |                |
| address             | mediumtext   | NO   |     | NULL    |                |
| address2            | text         | YES  |     | NULL    |                |
| city                | mediumtext   | NO   |     | NULL    |                |
| state               | mediumtext   | YES  |     | NULL    |                |
| zipcode             | varchar(25)  | YES  |     | NULL    |                |
| country             | text         | YES  |     | NULL    |                |
| email               | mediumtext   | YES  |     | NULL    |                |
| phone               | text         | YES  |     | NULL    |                |
| mobile              | varchar(50)  | YES  |     | NULL    |                |
| fax                 | mediumtext   | YES  |     | NULL    |                |
| emailpro            | text         | YES  |     | NULL    |                |
| phonepro            | text         | YES  |     | NULL    |                |
| B_streetnumber      | varchar(10)  | YES  |     | NULL    |                |
| B_streettype        | varchar(50)  | YES  |     | NULL    |                |
| B_address           | varchar(100) | YES  |     | NULL    |                |
| B_address2          | text         | YES  |     | NULL    |                |
| B_city              | mediumtext   | YES  |     | NULL    |                |
| B_state             | mediumtext   | YES  |     | NULL    |                |
| B_zipcode           | varchar(25)  | YES  |     | NULL    |                |
| B_country           | text         | YES  |     | NULL    |                |
| B_email             | text         | YES  |     | NULL    |                |
| B_phone             | mediumtext   | YES  |     | NULL    |                |
| dateofbirth         | date         | YES  |     | NULL    |                |
| branchcode          | varchar(10)  | NO   | MUL |         |                |
| categorycode        | varchar(10)  | NO   | MUL |         |                |
| dateenrolled        | date         | YES  |     | NULL    |                |
| dateexpiry          | date         | YES  |     | NULL    |                |
| gonenoaddress       | tinyint(1)   | YES  |     | NULL    |                |
| lost                | tinyint(1)   | YES  |     | NULL    |                |
| debarred            | tinyint(1)   | YES  |     | NULL    |                |
| contactname         | mediumtext   | YES  |     | NULL    |                |
| contactfirstname    | text         | YES  |     | NULL    |                |
| contacttitle        | text         | YES  |     | NULL    |                |
| borrowernotes       | mediumtext   | YES  |     | NULL    |                |
| relationship        | varchar(100) | YES  |     | NULL    |                |
| ethnicity           | varchar(50)  | YES  |     | NULL    |                |
| ethnotes            | varchar(255) | YES  |     | NULL    |                |
| sex                 | varchar(1)   | YES  |     | NULL    |                |
| password            | varchar(30)  | YES  |     | NULL    |                |
| flags               | int(11)      | YES  |     | NULL    |                |
| userid              | varchar(30)  | YES  | MUL | NULL    |                |
| opacnote            | mediumtext   | YES  |     | NULL    |                |
| contactnote         | varchar(255) | YES  |     | NULL    |                |
| sort1               | varchar(80)  | YES  |     | NULL    |                |
| sort2               | varchar(80)  | YES  |     | NULL    |                |
| altcontactfirstname | varchar(255) | YES  |     | NULL    |                |
| altcontactsurname   | varchar(255) | YES  |     | NULL    |                |
| altcontactaddress1  | varchar(255) | YES  |     | NULL    |                |
| altcontactaddress2  | varchar(255) | YES  |     | NULL    |                |
| altcontactaddress3  | varchar(255) | YES  |     | NULL    |                |
| altcontactstate     | mediumtext   | YES  |     | NULL    |                |
| altcontactzipcode   | varchar(50)  | YES  |     | NULL    |                |
| altcontactcountry   | text         | YES  |     | NULL    |                |
| altcontactphone     | varchar(50)  | YES  |     | NULL    |                |
| smsalertnumber      | varchar(50)  | YES  |     | NULL    |                |
| privacy             | int(11)      | NO   |     | 1       |                |
+---------------------+--------------+------+-----+---------+----------------+


 From C4::Members

 $flags->{KEY}
 {CHARGES}
    {message}     Message showing patron's credit or debt
    {noissues}    Set if patron owes >$5.00
 {GNA}             Set if patron gone w/o address
    {message}     "Borrower has no valid address"
    {noissues}    Set.
 {LOST}            Set if patron's card reported lost
    {message}     Message to this effect
    {noissues}    Set.
 {DBARRED}         Set if patron is debarred
    {message}     Message to this effect
    {noissues}    Set.
 {NOTES}           Set if patron has notes
    {message}     Notes about patron
 {ODUES}           Set if patron has overdue books
    {message}     "Yes"
    {itemlist}    ref-to-array: list of overdue books
    {itemlisttext}    Text list of overdue items
 {WAITING}         Set if there are items available that the patron reserved
    {message}     Message to this effect
    {itemlist}    ref-to-array: list of available items

NAME

ILS::Patron - Portable Patron status object class for SIP

DESCRIPTION

A ILS::Patron object holds information about a patron that's used by self service terminals to authenticate and authorize a patron, and to display information about the patron's borrowing activity.

SYNOPSIS

    use ILS;
    use ILS::Patron;

    # Look up patron based on patron_id
    my $patron = new ILS::Patron $patron_id

    # Basic object access methods
    $patron_id = $patron->id;
    $str = $patron->name;
    $str = $patron->address;
    $str = $patron->email_addr;
    $str = $patron->home_phone;
    $str = $patron->sip_birthdate;
    $str = $patron->ptype;
    $str = $patron->language;
    $str = $patron->password;
    $str = $patron->check_password($password);
    $str = $patron->currency;
    $str = $patron->screen_msg;
    $str = $patron->print_line;

    # Check patron permissions
    $bool = $patron->charge_ok;
    $bool = $patron->renew_ok;
    $bool = $patron->recall_ok;
    $bool = $patron->hold_ok;
    $bool = $patron->card_lost;
    $bool = $patron->too_many_charged;
    $bool = $patron->too_many_overdue;
    $bool = $patron->too_many_renewal;
    $bool = $patron->too_many_claim_return;
    $bool = $patron->too_many_lost( $server );
    $bool = $patron->excessive_fines;
    $bool = $patron->excessive_fees;
    $bool = $patron->too_many_billed;

    # Patron borrowing activity
    $num = $patron->recall_overdue;
    $num = $patron->fee_amount;
    $bool = $patron->drop_hold($item_id);
    @holds = $patron->hold_items($start, $end);
    @items = $patron->overdue_items($start, $end);
    @items = $patron->charged_items($start, $end);
    @items = $patron->fine_items($start, $end);
    @items = $patron->recall_items($start, $end);
    @items = $patron->unavail_holds($start, $end);

    # Changing a patron's status
    $patron->block($card_retained, $blocked_msg);
    $patron->enable;

INITIALIZATION

A patron object is created by calling

    $patron = new ILS::Patron $patron_id;

where $patron_id is the patron's barcode as received from the self service terminal. If the patron barcode is not registered, then new should return undef.

BASIC OBJECT ACCESS METHODS

The following functions return the corresponding information about the given patron, or undef if the information is unavailable.

    $patron_id = $patron-E<gt>id;
    $str = $patron-E<gt>name;
    $str = $patron-E<gt>address;
    $str = $patron-E<gt>email_addr;
    $str = $patron-E<gt>home_phone;

    $str = $patron-E<gt>screen_msg;
    $str = $patron-E<gt>print_line;

If there are outstanding display messages associated with the patron, then these return the screen message and print line, respectively, as with the ILS methods.

There are a few other object access methods that need a bit more explication however.

$str = $patron->sip_birthdate;

Returns the patron's birthday formatted according to the SIP specification:

    YYYYMMDD    HHMMSS

$str = $patron->ptype;

Returns the "patron type" of the patron. This is not used by the SIP server code, but is passed through to the self service terminal (using the non-standard protocol field "PC"). Some self service terminals use the patron type in determining what level of service to provide (for example, Envisionware computer management software can be configured to filter internet access based on patron type).

$str = $patron->language;

A three-digit string encoding the patron's preferred language. The full list is defined in the SIP specification, but some of the important values are:

    000 Unknown (default)
    001 English
    002 French
    008 Spanish
    011 Canadian French
    016 Arabic
    019 Chinese
    021 North American Spanish

$bool = $patron->check_password($password);

Returns true if $patron's password is $password.

$str = $patron->currency;

Returns the three character ISO 4217 currency code for the patron's preferred currency.

CHECKING PATRON PERMISSIONS

Most of the methods associated with Patrons are related to checking if they're authorized to perform various actions:

    $bool = $patron-E<gt>charge_ok;
    $bool = $patron-E<gt>renew_ok;
    $bool = $patron-E<gt>recall_ok;
    $bool = $patron-E<gt>hold_ok;
    $bool = $patron-E<gt>card_lost;
    $bool = $patron-E<gt>recall_overdue;
    $bool = $patron-E<gt>too_many_charged;
    $bool = $patron-E<gt>too_many_overdue;
    $bool = $patron-E<gt>too_many_renewal;
    $bool = $patron-E<gt>too_many_claim_return;
    $bool = $patron-E<gt>too_many_lost( $server );
    $bool = $patron-E<gt>excessive_fines;
    $bool = $patron-E<gt>excessive_fees;
    $bool = $patron-E<gt>too_many_billed;

LISTS OF ITEMS ASSOCIATED WITH THE USER

The $patron object provides a set of methods to find out information about various sets that are associated with the user. All these methods take two optional parameters: $start and $end, which define a subset of the list of items to be returned (1 is the first item in the list). The following methods all return a reference to a list of $item_ids:

    $items = $patron-E<gt>hold_items($start, $end);
    $items = $patron-E<gt>overdue_items($start, $end);
    $items = $patron-E<gt>charged_items($start, $end);
    $items = $patron-E<gt>recall_items($start, $end);
    $items = $patron-E<gt>unavail_holds($start, $end);

It is also possible to retrieve an itemized list of the fines outstanding. This method returns a reference to an itemized list of fines:

    $fines = $patron-E<gt>fine_items($start, $end);

PATRON BORROWING ACTIVITY

$num = $patron->fee_amount;

The total amount of fees and fines owed by the patron.

$bool = $patron->drop_hold($item_id);

Drops the hold that $patron has placed on the item $item_id. Returns false if the patron did not have a hold on the item, true otherwise.

CHANGING A PATRON'S STATUS

$status = $ils->block($card_retained, $blocked_card_msg);

Block the account of the patron identified by $patron_id. If the self check unit captured the patron's card, then $card_retained will be true. A message indicating why the card was retained will be provided by the parameter $blocked_card_msg.

This function returns an ILS::Patron object that has been updated to indicate that the patron's privileges have been blocked, or undef if the patron ID is not valid.

$patron->enable;

Re-enable the patron after she's been blocked. This is a test function and will not normally be called by self-service terminals in production.

<<