]> git.koha-community.org Git - koha.git/blob - C4/SIP/ILS/Patron.pm
Bug 22037: (QA follow-up) Implement use of CHARGES_GUARANTEES
[koha.git] / C4 / SIP / ILS / Patron.pm
1 #
2 # ILS::Patron.pm
3
4 # A Class for hiding the ILS's concept of the patron from the OpenSIP
5 # system
6 #
7
8 package C4::SIP::ILS::Patron;
9
10 use strict;
11 use warnings;
12 use Exporter;
13 use Carp;
14
15 use Sys::Syslog qw(syslog);
16 use Data::Dumper;
17
18 use C4::SIP::Sip qw(add_field);
19
20 use C4::Debug;
21 use C4::Context;
22 use C4::Koha;
23 use C4::Members;
24 use C4::Reserves;
25 use C4::Auth qw(checkpw);
26
27 use Koha::Items;
28 use Koha::Libraries;
29 use Koha::Patrons;
30
31 our $kp;    # koha patron
32
33 =head1 Methods
34
35 =cut
36
37 sub new {
38     my ($class, $patron_id) = @_;
39     my $type = ref($class) || $class;
40     my $self;
41     my $patron = Koha::Patrons->find( { cardnumber => $patron_id } )
42       || Koha::Patrons->find( { userid => $patron_id } );
43     $debug and warn "new Patron: " . Dumper($patron->unblessed) if $patron;
44     unless ($patron) {
45         syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id);
46         return;
47     }
48     $kp = $patron->unblessed;
49     my $pw        = $kp->{password};
50     my $flags     = C4::Members::patronflags( $kp );
51     my $debarred  = $patron->is_debarred;
52     $debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')); # Do we need more debug info here?
53     my ($day, $month, $year) = (localtime)[3,4,5];
54     my $today    = sprintf '%04d-%02d-%02d', $year+1900, $month+1, $day;
55     my $expired  = ($today gt $kp->{dateexpiry}) ? 1 : 0;
56     if ($expired) {
57         if ($kp->{opacnote} ) {
58             $kp->{opacnote} .= q{ };
59         }
60         $kp->{opacnote} .= 'PATRON EXPIRED';
61     }
62     my %ilspatron;
63     my $adr     = _get_address($kp);
64     my $dob     = $kp->{dateofbirth};
65     $dob and $dob =~ s/-//g;    # YYYYMMDD
66     my $dexpiry     = $kp->{dateexpiry};
67     $dexpiry and $dexpiry =~ s/-//g;    # YYYYMMDD
68
69     my $fines_amount = $flags->{CHARGES}->{amount}; # This "amount" is the negative balance or the one of the guarantees
70     $fines_amount = ($fines_amount and $fines_amount > 0) ? $fines_amount : 0;
71     my $guarantees_fines_amount = $flags->{CHARGES_GUARANTEES} ? $flags->{CHARGES_GUARANTEES}->{amount} : 0;
72     $fines_amount += $guarantees_fines_amount;
73
74     my $fee_limit = _fee_limit();
75     my $fine_blocked = $fines_amount > $fee_limit;
76     my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" &&  defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
77     {
78     no warnings;    # any of these $kp->{fields} being concat'd could be undef
79     %ilspatron = (
80         name => $kp->{firstname} . " " . $kp->{surname},
81         id   => $kp->{cardnumber},    # to SIP, the id is the BARCODE, not userid
82         password        => $pw,
83         ptype           => $kp->{categorycode},     # 'A'dult.  Whatever.
84         dateexpiry      => $dexpiry,
85         dateexpiry_iso  => $kp->{dateexpiry},
86         birthdate       => $dob,
87         birthdate_iso   => $kp->{dateofbirth},
88         branchcode      => $kp->{branchcode},
89         library_name    => "",                      # only populated if needed, cached here
90         borrowernumber  => $kp->{borrowernumber},
91         address         => $adr,
92         home_phone      => $kp->{phone},
93         email_addr      => $kp->{email},
94         charge_ok       => ( !$debarred && !$expired && !$fine_blocked && !$circ_blocked),
95         renew_ok        => ( !$debarred && !$expired && !$fine_blocked),
96         recall_ok       => ( !$debarred && !$expired && !$fine_blocked),
97         hold_ok         => ( !$debarred && !$expired && !$fine_blocked),
98         card_lost       => ( $kp->{lost} || $kp->{gonenoaddress} || $flags->{LOST} ),
99         claims_returned => 0,
100         fines           => $fines_amount,
101         fees            => 0,             # currently not distinct from fines
102         recall_overdue  => 0,
103         items_billed    => 0,
104         screen_msg      => 'Greetings from Koha. ' . $kp->{opacnote},
105         print_line      => '',
106         items           => [],
107         hold_items      => $flags->{WAITING}->{itemlist},
108         overdue_items   => $flags->{ODUES}->{itemlist},
109         fine_items      => [],
110         recall_items    => [],
111         unavail_holds   => [],
112         inet            => ( !$debarred && !$expired ),
113         expired         => $expired,
114         fee_limit       => $fee_limit,
115         userid          => $kp->{userid},
116     );
117     }
118     $debug and warn "patron fines: $ilspatron{fines} ... amountoutstanding: $kp->{amountoutstanding} ... CHARGES->amount: $flags->{CHARGES}->{amount}";
119
120     if ( $patron->is_debarred and $patron->debarredcomment ) {
121         $ilspatron{screen_msg} .= " -- " . $patron->debarredcomment;
122     }
123     for (qw(EXPIRED CHARGES CREDITS GNA LOST DBARRED NOTES)) {
124         ($flags->{$_}) or next;
125         if ($_ ne 'NOTES' and $flags->{$_}->{message}) {
126             $ilspatron{screen_msg} .= " -- " . $flags->{$_}->{message};  # show all but internal NOTES
127         }
128         if ($flags->{$_}->{noissues}) {
129             foreach my $toggle (qw(charge_ok renew_ok recall_ok hold_ok inet)) {
130                 $ilspatron{$toggle} = 0;    # if we get noissues, disable everything
131             }
132         }
133     }
134
135     # FIXME: populate fine_items recall_items
136     $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
137
138     my $pending_checkouts = $patron->pending_checkouts;
139     my @barcodes;
140     while ( my $c = $pending_checkouts->next ) {
141         push @barcodes, { barcode => $c->item->barcode };
142     }
143     $ilspatron{items} = \@barcodes;
144
145     $self = \%ilspatron;
146     $debug and warn Dumper($self);
147     syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id});
148     bless $self, $type;
149     return $self;
150 }
151
152
153 # 0 means read-only
154 # 1 means read/write
155
156 my %fields = (
157     id                      => 0,
158     name                    => 0,
159     address                 => 0,
160     email_addr              => 0,
161     home_phone              => 0,
162     birthdate               => 0,
163     birthdate_iso           => 0,
164     dateexpiry              => 0,
165     dateexpiry_iso          => 0,
166     ptype                   => 0,
167     charge_ok               => 0,   # for patron_status[0] (inverted)
168     renew_ok                => 0,   # for patron_status[1] (inverted)
169     recall_ok               => 0,   # for patron_status[2] (inverted)
170     hold_ok                 => 0,   # for patron_status[3] (inverted)
171     card_lost               => 0,   # for patron_status[4]
172     recall_overdue          => 0,
173     currency                => 1,
174     fee_limit               => 0,
175     screen_msg              => 1,
176     print_line              => 1,
177     too_many_charged        => 0,   # for patron_status[5]
178     too_many_overdue        => 0,   # for patron_status[6]
179     too_many_renewal        => 0,   # for patron_status[7]
180     too_many_claim_return   => 0,   # for patron_status[8]
181     too_many_lost           => 0,   # for patron_status[9]
182 #   excessive_fines         => 0,   # for patron_status[10]
183 #   excessive_fees          => 0,   # for patron_status[11]
184     recall_overdue          => 0,   # for patron_status[12]
185     too_many_billed         => 0,   # for patron_status[13]
186     inet                    => 0,   # EnvisionWare extension
187 );
188
189 our $AUTOLOAD;
190
191 sub DESTROY {
192     # be cool.  needed for AUTOLOAD(?)
193 }
194
195 sub AUTOLOAD {
196     my $self = shift;
197     my $class = ref($self) or croak "$self is not an object";
198     my $name = $AUTOLOAD;
199
200     $name =~ s/.*://;
201
202     unless (exists $fields{$name}) {
203         croak "Cannot access '$name' field of class '$class'";
204     }
205
206     if (@_) {
207         $fields{$name} or croak "Field '$name' of class '$class' is READ ONLY.";
208         return $self->{$name} = shift;
209     } else {
210         return $self->{$name};
211     }
212 }
213
214 sub name {
215     my ( $self, $template ) = @_;
216
217     if ($template) {
218         require Template;
219         require Koha::Patrons;
220
221         my $tt = Template->new();
222
223         my $patron = Koha::Patrons->find( $self->{borrowernumber} );
224
225         my $output;
226         $tt->process( \$template, { patron => $patron }, \$output );
227         return $output;
228     }
229     else {
230         return $self->{name};
231     }
232 }
233
234 sub check_password {
235     my ( $self, $pwd ) = @_;
236
237     # you gotta give me something (at least ''), or no deal
238     return 0 unless defined $pwd;
239
240     # If the record has a NULL password, accept '' as match
241     return $pwd eq q{} unless $self->{password};
242
243     my $dbh = C4::Context->dbh;
244     my $ret = 0;
245     ($ret) = checkpw( $dbh, $self->{userid}, $pwd, undef, undef, 1 ); # dbh, userid, query, type, no_set_userenv
246     return $ret;
247 }
248
249 # A few special cases, not in AUTOLOADed %fields
250 sub fee_amount {
251     my $self = shift;
252     if ( $self->{fines} ) {
253         return $self->{fines};
254     }
255     return 0;
256 }
257
258 sub fines_amount {
259     my $self = shift;
260     return $self->fee_amount;
261 }
262
263 sub language {
264     my $self = shift;
265     return $self->{language} || '000'; # Unspecified
266 }
267
268 sub expired {
269     my $self = shift;
270     return $self->{expired};
271 }
272
273 #
274 # remove the hold on item item_id from my hold queue.
275 # return true if I was holding the item, false otherwise.
276
277 sub drop_hold {
278     my ($self, $item_id) = @_;
279     return if !$item_id;
280     my $result = 0;
281     foreach (qw(hold_items unavail_holds)) {
282         $self->{$_} or next;
283         for (my $i = 0; $i < scalar @{$self->{$_}}; $i++) {
284             my $held_item = $self->{$_}[$i]->{item_id} or next;
285             if ($held_item eq $item_id) {
286                 splice @{$self->{$_}}, $i, 1;
287                 $result++;
288             }
289         }
290     }
291     return $result;
292 }
293
294 # Accessor method for array_ref values, designed to get the "start" and "end" values
295 # from the SIP request.  Note those incoming values are 1-indexed, not 0-indexed.
296 #
297 sub x_items {
298     my $self      = shift;
299     my $array_var = shift or return;
300     my ($start, $end) = @_;
301
302     my $item_list = [];
303     if ($self->{$array_var}) {
304         if ($start && $start > 1) {
305             --$start;
306         }
307         else {
308             $start = 0;
309         }
310         if ( $end && $end < @{$self->{$array_var}} ) {
311         }
312         else {
313             $end = @{$self->{$array_var}};
314             --$end;
315         }
316         @{$item_list} = @{$self->{$array_var}}[ $start .. $end ];
317
318     }
319     return $item_list;
320 }
321
322 #
323 # List of outstanding holds placed
324 #
325 sub hold_items {
326     my $self = shift;
327     my $item_arr = $self->x_items('hold_items', @_);
328     foreach my $item (@{$item_arr}) {
329         my $item_obj = Koha::Items->find($item->{itemnumber});
330         $item->{barcode} = $item_obj ? $item_obj->barcode : undef;
331     }
332     return $item_arr;
333 }
334
335 sub overdue_items {
336     my $self = shift;
337     return $self->x_items('overdue_items', @_);
338 }
339 sub charged_items {
340     my $self = shift;
341     return $self->x_items('items', @_);
342 }
343 sub fine_items {
344     require Koha::Database;
345     require Template;
346
347     my $self = shift;
348     my $start = shift;
349     my $end = shift;
350     my $server = shift;
351
352     my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
353         {
354             borrowernumber    => $self->{borrowernumber},
355             amountoutstanding => { '>' => '0' },
356         }
357     );
358
359     $start = $start ? $start - 1 : 0;
360     $end   = $end   ? $end       : scalar @fees - 1;
361
362     my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
363     $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
364
365     my $tt = Template->new();
366
367     my @return_values;
368     for ( my $i = $start; $i <= $end; $i++ ) {
369         my $fee = $fees[$i];
370
371         my $output;
372         $tt->process( \$av_field_template, { accountline => $fee }, \$output );
373         push( @return_values, { barcode => $output } );
374     }
375
376     return \@return_values;
377 }
378 sub recall_items {
379     my $self = shift;
380     return $self->x_items('recall_items', @_);
381 }
382 sub unavail_holds {
383     my $self = shift;
384     return $self->x_items('unavail_holds', @_);
385 }
386
387 sub block {
388     my ($self, $card_retained, $blocked_card_msg) = @_;
389     foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok', 'inet') {
390         $self->{$field} = 0;
391     }
392     $self->{screen_msg} = "Block feature not implemented";  # $blocked_card_msg || "Card Blocked.  Please contact library staff";
393     # TODO: not really affecting patron record
394     return $self;
395 }
396
397 sub enable {
398     my $self = shift;
399     foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok', 'inet') {
400         $self->{$field} = 1;
401     }
402     syslog("LOG_DEBUG", "Patron(%s)->enable: charge: %s, renew:%s, recall:%s, hold:%s",
403        $self->{id}, $self->{charge_ok}, $self->{renew_ok},
404        $self->{recall_ok}, $self->{hold_ok});
405     $self->{screen_msg} = "Enable feature not implemented."; # "All privileges restored.";   # TODO: not really affecting patron record
406     return $self;
407 }
408
409 sub inet_privileges {
410     my $self = shift;
411     return $self->{inet} ? 'Y' : 'N';
412 }
413
414 sub _fee_limit {
415     return C4::Context->preference('noissuescharge') || 5;
416 }
417
418 sub excessive_fees {
419     my $self = shift;
420     return ($self->fee_amount and $self->fee_amount > $self->fee_limit);
421 }
422
423 sub excessive_fines {
424     my $self = shift;
425     return $self->excessive_fees;   # excessive_fines is the same thing as excessive_fees for Koha
426 }
427
428 sub holds_blocked_by_excessive_fees {
429     my $self = shift;
430     return ( $self->fee_amount
431           && $self->fee_amount > C4::Context->preference("maxoutstanding") );
432 }
433     
434 sub library_name {
435     my $self = shift;
436     unless ($self->{library_name}) {
437         my $library = Koha::Libraries->find( $self->{branchcode} );
438         $self->{library_name} = $library ? $library->branchname : '';
439     }
440     return $self->{library_name};
441 }
442 #
443 # Messages
444 #
445
446 sub invalid_patron {
447     my $self = shift;
448     return "Please contact library staff";
449 }
450
451 sub charge_denied {
452     my $self = shift;
453     return "Please contact library staff";
454 }
455
456 =head2 update_lastseen
457
458     $patron->update_lastseen();
459
460     Patron method to update lastseen field in borrower
461     to record that patron has been seen via sip connection
462
463 =cut
464
465 sub update_lastseen {
466     my $self = shift;
467     my $kohaobj = Koha::Patrons->find( $self->{borrowernumber} );
468     $kohaobj->track_login if $kohaobj; # track_login checks the pref
469 }
470
471 sub _get_address {
472     my $patron = shift;
473
474     my $address = $patron->{streetnumber} || q{};
475     for my $field (qw( roaddetails address address2 city state zipcode country))
476     {
477         next unless $patron->{$field};
478         if ($address) {
479             $address .= q{ };
480             $address .= $patron->{$field};
481         }
482         else {
483             $address .= $patron->{$field};
484         }
485     }
486     return $address;
487 }
488
489 sub _get_outstanding_holds {
490     my $borrowernumber = shift;
491
492     my $patron = Koha::Patrons->find( $borrowernumber );
493     my $holds = $patron->holds->search( { -or => [ { found => undef }, { found => { '!=' => 'W' } } ] } );
494     my @holds;
495     while ( my $hold = $holds->next ) {
496         my $item;
497         if ($hold->itemnumber) {
498             $item = $hold->item;
499         }
500         else {
501             # We need to return a barcode for the biblio so the client
502             # can request the biblio info
503             my $items = $hold->biblio->items;
504             $item = $items->count ? $items->next : undef;
505         }
506         my $unblessed_hold = $hold->unblessed;
507
508         $unblessed_hold->{barcode} = $item ? $item->barcode : undef;
509
510         push @holds, $unblessed_hold;
511     }
512     return \@holds;
513 }
514
515 =head2 build_patron_attributes_string
516
517 This method builds the part of the sip message for extended patron
518 attributes as defined in the sip config
519
520 =cut
521
522 sub build_patron_attributes_string {
523     my ( $self, $server ) = @_;
524
525     my $string = q{};
526
527     if ( $server->{account}->{patron_attribute} ) {
528         my @attributes_to_send =
529           ref $server->{account}->{patron_attribute} eq "ARRAY"
530           ? @{ $server->{account}->{patron_attribute} }
531           : ( $server->{account}->{patron_attribute} );
532
533         foreach my $a ( @attributes_to_send ) {
534             my @attributes = Koha::Patron::Attributes->search(
535                 {
536                     borrowernumber => $self->{borrowernumber},
537                     code           => $a->{code}
538                 }
539             );
540
541             foreach my $attribute ( @attributes ) {
542                 my $value = $attribute->attribute();
543                 $string .= add_field( $a->{field}, $value );
544             }
545         }
546     }
547
548     return $string;
549 }
550
551 1;
552 __END__
553
554 =head1 EXAMPLES
555
556   our %patron_example = (
557           djfiander => {
558               name => "David J. Fiander",
559               id => 'djfiander',
560               password => '6789',
561               ptype => 'A', # 'A'dult.  Whatever.
562               birthdate => '19640925',
563               address => '2 Meadowvale Dr. St Thomas, ON',
564               home_phone => '(519) 555 1234',
565               email_addr => 'djfiander@hotmail.com',
566               charge_ok => 1,
567               renew_ok => 1,
568               recall_ok => 0,
569               hold_ok => 1,
570               card_lost => 0,
571               claims_returned => 0,
572               fines => 100,
573               fees => 0,
574               recall_overdue => 0,
575               items_billed => 0,
576               screen_msg => '',
577               print_line => '',
578               items => [],
579               hold_items => [],
580               overdue_items => [],
581               fine_items => ['Computer Time'],
582               recall_items => [],
583               unavail_holds => [],
584               inet => 1,
585           },
586   );
587
588  From borrowers table:
589 +---------------------+--------------+------+-----+---------+----------------+
590 | Field               | Type         | Null | Key | Default | Extra          |
591 +---------------------+--------------+------+-----+---------+----------------+
592 | borrowernumber      | int(11)      | NO   | PRI | NULL    | auto_increment |
593 | cardnumber          | varchar(16)  | YES  | UNI | NULL    |                |
594 | surname             | mediumtext   | NO   |     | NULL    |                |
595 | firstname           | text         | YES  |     | NULL    |                |
596 | title               | mediumtext   | YES  |     | NULL    |                |
597 | othernames          | mediumtext   | YES  |     | NULL    |                |
598 | initials            | text         | YES  |     | NULL    |                |
599 | streetnumber        | varchar(10)  | YES  |     | NULL    |                |
600 | streettype          | varchar(50)  | YES  |     | NULL    |                |
601 | address             | mediumtext   | NO   |     | NULL    |                |
602 | address2            | text         | YES  |     | NULL    |                |
603 | city                | mediumtext   | NO   |     | NULL    |                |
604 | state               | mediumtext   | YES  |     | NULL    |                |
605 | zipcode             | varchar(25)  | YES  |     | NULL    |                |
606 | country             | text         | YES  |     | NULL    |                |
607 | email               | mediumtext   | YES  |     | NULL    |                |
608 | phone               | text         | YES  |     | NULL    |                |
609 | mobile              | varchar(50)  | YES  |     | NULL    |                |
610 | fax                 | mediumtext   | YES  |     | NULL    |                |
611 | emailpro            | text         | YES  |     | NULL    |                |
612 | phonepro            | text         | YES  |     | NULL    |                |
613 | B_streetnumber      | varchar(10)  | YES  |     | NULL    |                |
614 | B_streettype        | varchar(50)  | YES  |     | NULL    |                |
615 | B_address           | varchar(100) | YES  |     | NULL    |                |
616 | B_address2          | text         | YES  |     | NULL    |                |
617 | B_city              | mediumtext   | YES  |     | NULL    |                |
618 | B_state             | mediumtext   | YES  |     | NULL    |                |
619 | B_zipcode           | varchar(25)  | YES  |     | NULL    |                |
620 | B_country           | text         | YES  |     | NULL    |                |
621 | B_email             | text         | YES  |     | NULL    |                |
622 | B_phone             | mediumtext   | YES  |     | NULL    |                |
623 | dateofbirth         | date         | YES  |     | NULL    |                |
624 | branchcode          | varchar(10)  | NO   | MUL |         |                |
625 | categorycode        | varchar(10)  | NO   | MUL |         |                |
626 | dateenrolled        | date         | YES  |     | NULL    |                |
627 | dateexpiry          | date         | YES  |     | NULL    |                |
628 | gonenoaddress       | tinyint(1)   | YES  |     | NULL    |                |
629 | lost                | tinyint(1)   | YES  |     | NULL    |                |
630 | debarred            | tinyint(1)   | YES  |     | NULL    |                |
631 | contactname         | mediumtext   | YES  |     | NULL    |                |
632 | contactfirstname    | text         | YES  |     | NULL    |                |
633 | contacttitle        | text         | YES  |     | NULL    |                |
634 | borrowernotes       | mediumtext   | YES  |     | NULL    |                |
635 | relationship        | varchar(100) | YES  |     | NULL    |                |
636 | ethnicity           | varchar(50)  | YES  |     | NULL    |                |
637 | ethnotes            | varchar(255) | YES  |     | NULL    |                |
638 | sex                 | varchar(1)   | YES  |     | NULL    |                |
639 | password            | varchar(30)  | YES  |     | NULL    |                |
640 | flags               | int(11)      | YES  |     | NULL    |                |
641 | userid              | varchar(30)  | YES  | MUL | NULL    |                |
642 | opacnote            | mediumtext   | YES  |     | NULL    |                |
643 | contactnote         | varchar(255) | YES  |     | NULL    |                |
644 | sort1               | varchar(80)  | YES  |     | NULL    |                |
645 | sort2               | varchar(80)  | YES  |     | NULL    |                |
646 | altcontactfirstname | varchar(255) | YES  |     | NULL    |                |
647 | altcontactsurname   | varchar(255) | YES  |     | NULL    |                |
648 | altcontactaddress1  | varchar(255) | YES  |     | NULL    |                |
649 | altcontactaddress2  | varchar(255) | YES  |     | NULL    |                |
650 | altcontactaddress3  | varchar(255) | YES  |     | NULL    |                |
651 | altcontactstate     | mediumtext   | YES  |     | NULL    |                |
652 | altcontactzipcode   | varchar(50)  | YES  |     | NULL    |                |
653 | altcontactcountry   | text         | YES  |     | NULL    |                |
654 | altcontactphone     | varchar(50)  | YES  |     | NULL    |                |
655 | smsalertnumber      | varchar(50)  | YES  |     | NULL    |                |
656 | privacy             | int(11)      | NO   |     | 1       |                |
657 +---------------------+--------------+------+-----+---------+----------------+
658
659
660  From C4::Members
661
662  $flags->{KEY}
663  {CHARGES}
664     {message}     Message showing patron's credit or debt
665     {noissues}    Set if patron owes >$5.00
666  {GNA}             Set if patron gone w/o address
667     {message}     "Borrower has no valid address"
668     {noissues}    Set.
669  {LOST}            Set if patron's card reported lost
670     {message}     Message to this effect
671     {noissues}    Set.
672  {DBARRED}         Set if patron is debarred
673     {message}     Message to this effect
674     {noissues}    Set.
675  {NOTES}           Set if patron has notes
676     {message}     Notes about patron
677  {ODUES}           Set if patron has overdue books
678     {message}     "Yes"
679     {itemlist}    ref-to-array: list of overdue books
680     {itemlisttext}    Text list of overdue items
681  {WAITING}         Set if there are items available that the patron reserved
682     {message}     Message to this effect
683     {itemlist}    ref-to-array: list of available items
684
685 =cut
686