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