# system
#
-package ILS::Patron;
+package C4::SIP::ILS::Patron;
use strict;
use warnings;
use Exporter;
use Carp;
-use Sys::Syslog qw(syslog);
+use C4::SIP::Sip qw(syslog);
use Data::Dumper;
+use C4::SIP::Sip qw(add_field);
+
use C4::Debug;
use C4::Context;
-# use C4::Dates;
use C4::Koha;
use C4::Members;
use C4::Reserves;
-use C4::Branch qw(GetBranchName);
-use Digest::MD5 qw(md5_base64);
+use C4::Auth qw(checkpw);
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
+use Koha::Items;
+use Koha::Libraries;
+use Koha::Patrons;
-BEGIN {
- $VERSION = 2.03;
- @ISA = qw(Exporter);
- @EXPORT_OK = qw(invalid_patron);
-}
+our $kp; # koha patron
+
+=head1 Methods
-our $kp; # koha patron
+=cut
sub new {
- my ($class, $patron_id) = @_;
+ my ($class, $patron_id) = @_;
my $type = ref($class) || $class;
my $self;
- $kp = GetMember(cardnumber=>$patron_id);
- $debug and warn "new Patron (GetMember): " . Dumper($kp);
- unless (defined $kp) {
- syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id);
- return undef;
- }
- $kp = GetMemberDetails(undef,$patron_id);
- $debug and warn "new Patron (GetMemberDetails): " . Dumper($kp);
- my $pw = $kp->{password}; ### FIXME - md5hash -- deal with .
- my $flags = $kp->{flags}; # or warn "Warning: No flags from patron object for '$patron_id'";
- my $debarred = $kp->{debarred}; # 1 if ($kp->{flags}->{DBARRED}->{noissues});
- $debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')) . Dumper(%{$kp->{flags}});
+ my $patron = Koha::Patrons->find( { cardnumber => $patron_id } )
+ || Koha::Patrons->find( { userid => $patron_id } );
+ $debug and warn "new Patron: " . Dumper($patron->unblessed) if $patron;
+ unless ($patron) {
+ syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id);
+ return;
+ }
+ $kp = $patron->unblessed;
+ my $pw = $kp->{password};
+ my $flags = C4::Members::patronflags( $kp );
+ my $debarred = $patron->is_debarred;
+ $debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')); # Do we need more debug info here?
my ($day, $month, $year) = (localtime)[3,4,5];
my $today = sprintf '%04d-%02d-%02d', $year+1900, $month+1, $day;
my $expired = ($today gt $kp->{dateexpiry}) ? 1 : 0;
}
$kp->{opacnote} .= 'PATRON EXPIRED';
}
- my %ilspatron;
- my $adr = $kp->{streetnumber} || '';
- my $address = $kp->{address} || '';
+ my %ilspatron;
+ my $adr = _get_address($kp);
my $dob = $kp->{dateofbirth};
$dob and $dob =~ s/-//g; # YYYYMMDD
my $dexpiry = $kp->{dateexpiry};
$dexpiry and $dexpiry =~ s/-//g; # YYYYMMDD
- $adr .= ($adr && $address) ? " $address" : $address;
- my $fines_amount = $flags->{CHARGES}->{amount};
+ my $fines_amount = $patron->account->balance;
$fines_amount = ($fines_amount and $fines_amount > 0) ? $fines_amount : 0;
+ my $fee_limit = _fee_limit();
+ my $fine_blocked = $fines_amount > $fee_limit;
+ my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" && defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
{
- no warnings; # any of these $kp->{fields} being concat'd could be undef
+ no warnings; # any of these $kp->{fields} being concat'd could be undef
%ilspatron = (
- getmemberdetails_object => $kp,
name => $kp->{firstname} . " " . $kp->{surname},
id => $kp->{cardnumber}, # to SIP, the id is the BARCODE, not userid
password => $pw,
address => $adr,
home_phone => $kp->{phone},
email_addr => $kp->{email},
- charge_ok => ( !$debarred && !$expired ),
- renew_ok => ( !$debarred && !$expired ),
- recall_ok => ( !$debarred && !$expired ),
- hold_ok => ( !$debarred && !$expired ),
+ charge_ok => ( !$debarred && !$expired && !$fine_blocked && !$circ_blocked),
+ renew_ok => ( !$debarred && !$expired && !$fine_blocked),
+ recall_ok => ( !$debarred && !$expired && !$fine_blocked),
+ hold_ok => ( !$debarred && !$expired && !$fine_blocked),
card_lost => ( $kp->{lost} || $kp->{gonenoaddress} || $flags->{LOST} ),
claims_returned => 0,
- fines => $fines_amount, # GetMemberAccountRecords($kp->{borrowernumber})
+ fines => $fines_amount,
fees => 0, # currently not distinct from fines
recall_overdue => 0,
items_billed => 0,
screen_msg => 'Greetings from Koha. ' . $kp->{opacnote},
print_line => '',
items => [],
- hold_items => $flags->{WAITING}{itemlist},
- overdue_items => $flags->{ODUES}{itemlist},
+ hold_items => $flags->{WAITING}->{itemlist},
+ overdue_items => $flags->{ODUES}->{itemlist},
fine_items => [],
recall_items => [],
unavail_holds => [],
inet => ( !$debarred && !$expired ),
expired => $expired,
+ fee_limit => $fee_limit,
+ userid => $kp->{userid},
);
}
$debug and warn "patron fines: $ilspatron{fines} ... amountoutstanding: $kp->{amountoutstanding} ... CHARGES->amount: $flags->{CHARGES}->{amount}";
- for (qw(EXPIRED CHARGES CREDITS GNA LOST DEBARRED NOTES)) {
- ($flags->{$_}) or next;
+
+ if ( $patron->is_debarred and $patron->debarredcomment ) {
+ $ilspatron{screen_msg} .= " -- " . $patron->debarredcomment;
+ }
+ for (qw(EXPIRED CHARGES CREDITS GNA LOST DBARRED NOTES)) {
+ ($flags->{$_}) or next;
if ($_ ne 'NOTES' and $flags->{$_}->{message}) {
$ilspatron{screen_msg} .= " -- " . $flags->{$_}->{message}; # show all but internal NOTES
}
- if ($flags->{$_}->{noissues}) {
- foreach my $toggle (qw(charge_ok renew_ok recall_ok hold_ok inet)) {
- $ilspatron{$toggle} = 0; # if we get noissues, disable everything
- }
- }
- }
+ if ($flags->{$_}->{noissues}) {
+ foreach my $toggle (qw(charge_ok renew_ok recall_ok hold_ok inet)) {
+ $ilspatron{$toggle} = 0; # if we get noissues, disable everything
+ }
+ }
+ }
# FIXME: populate fine_items recall_items
-# $ilspatron{hold_items} = (GetReservesFromBorrowernumber($kp->{borrowernumber},'F'));
- $ilspatron{unavail_holds} = [(GetReservesFromBorrowernumber($kp->{borrowernumber}))];
- $ilspatron{items} = GetPendingIssues($kp->{borrowernumber});
- $self = \%ilspatron;
- $debug and warn Dumper($self);
+ $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
+
+ my $pending_checkouts = $patron->pending_checkouts;
+ my @barcodes;
+ while ( my $c = $pending_checkouts->next ) {
+ push @barcodes, { barcode => $c->item->barcode };
+ }
+ $ilspatron{items} = \@barcodes;
+
+ $self = \%ilspatron;
+ $debug and warn Dumper($self);
syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id});
bless $self, $type;
return $self;
card_lost => 0, # for patron_status[4]
recall_overdue => 0,
currency => 1,
-# fee_limit => 0,
+ fee_limit => 0,
screen_msg => 1,
print_line => 1,
too_many_charged => 0, # for patron_status[5]
recall_overdue => 0, # for patron_status[12]
too_many_billed => 0, # for patron_status[13]
inet => 0, # EnvisionWare extension
- getmemberdetails_object => 0,
);
our $AUTOLOAD;
$name =~ s/.*://;
unless (exists $fields{$name}) {
- croak "Cannot access '$name' field of class '$class'";
+ croak "Cannot access '$name' field of class '$class'";
}
- if (@_) {
+ if (@_) {
$fields{$name} or croak "Field '$name' of class '$class' is READ ONLY.";
- return $self->{$name} = shift;
- } else {
- return $self->{$name};
- }
+ return $self->{$name} = shift;
+ } else {
+ return $self->{$name};
+ }
+}
+
+sub name {
+ my ( $self, $template ) = @_;
+
+ if ($template) {
+ require Template;
+ require Koha::Patrons;
+
+ my $tt = Template->new();
+
+ my $patron = Koha::Patrons->find( $self->{borrowernumber} );
+
+ my $output;
+ $tt->process( \$template, { patron => $patron }, \$output );
+ return $output;
+ }
+ else {
+ return $self->{name};
+ }
}
sub check_password {
- my ($self, $pwd) = @_;
- my $md5pwd = $self->{password};
- # warn sprintf "check_password for %s: '%s' vs. '%s'",($self->{name}||''),($self->{password}||''),($pwd||'');
- (defined $pwd ) or return 0; # you gotta give me something (at least ''), or no deal
- (defined $md5pwd) or return($pwd eq ''); # if the record has a NULL password, accept '' as match
- return (md5_base64($pwd) eq $md5pwd);
+ my ( $self, $pwd ) = @_;
+
+ # you gotta give me something (at least ''), or no deal
+ return 0 unless defined $pwd;
+
+ # If the record has a NULL password, accept '' as match
+ return $pwd eq q{} unless $self->{password};
+
+ my $dbh = C4::Context->dbh;
+ my $ret = 0;
+ ($ret) = checkpw( $dbh, $self->{userid}, $pwd, undef, undef, 1 ); # dbh, userid, query, type, no_set_userenv
+ return $ret;
}
# A few special cases, not in AUTOLOADed %fields
sub fee_amount {
my $self = shift;
- return $self->{fines} || undef;
+ if ( $self->{fines} ) {
+ return $self->{fines};
+ }
+ return;
}
sub fines_amount {
#
sub drop_hold {
my ($self, $item_id) = @_;
- $item_id or return undef;
- my $result = 0;
- foreach (qw(hold_items unavail_holds)) {
- $self->{$_} or next;
- for (my $i = 0; $i < scalar @{$self->{$_}}; $i++) {
- my $held_item = $self->{$_}[$i]->{item_id} or next;
- if ($held_item eq $item_id) {
- splice @{$self->{$_}}, $i, 1;
- $result++;
- }
- }
- }
+ return if !$item_id;
+ my $result = 0;
+ foreach (qw(hold_items unavail_holds)) {
+ $self->{$_} or next;
+ for (my $i = 0; $i < scalar @{$self->{$_}}; $i++) {
+ my $held_item = $self->{$_}[$i]->{item_id} or next;
+ if ($held_item eq $item_id) {
+ splice @{$self->{$_}}, $i, 1;
+ $result++;
+ }
+ }
+ }
return $result;
}
# from the SIP request. Note those incoming values are 1-indexed, not 0-indexed.
#
sub x_items {
- my $self = shift or return;
+ my $self = shift;
my $array_var = shift or return;
my ($start, $end) = @_;
- $self->{$array_var} or return [];
- $start = 1 unless defined($start);
- $end = scalar @{$self->{$array_var}} unless defined($end);
- # syslog("LOG_DEBUG", "$array_var: start = %d, end = %d; items(%s)", $start, $end, join(', ', @{$self->{items}}));
- return [@{$self->{$array_var}}[$start-1 .. $end-1]];
+ my $item_list = [];
+ if ($self->{$array_var}) {
+ if ($start && $start > 1) {
+ --$start;
+ }
+ else {
+ $start = 0;
+ }
+ if ( $end && $end < @{$self->{$array_var}} ) {
+ }
+ else {
+ $end = @{$self->{$array_var}};
+ --$end;
+ }
+ @{$item_list} = @{$self->{$array_var}}[ $start .. $end ];
+
+ }
+ return $item_list;
}
#
# List of outstanding holds placed
#
sub hold_items {
- my $self = shift or return;
- return $self->x_items('hold_items', @_);
+ my $self = shift;
+ my $item_arr = $self->x_items('hold_items', @_);
+ foreach my $item (@{$item_arr}) {
+ my $item_obj = Koha::Items->find($item->{itemnumber});
+ $item->{barcode} = $item_obj ? $item_obj->barcode : undef;
+ }
+ return $item_arr;
}
sub overdue_items {
- my $self = shift or return;
+ my $self = shift;
return $self->x_items('overdue_items', @_);
}
sub charged_items {
- my $self = shift or return;
+ my $self = shift;
return $self->x_items('items', @_);
}
sub fine_items {
- my $self = shift or return;
- return $self->x_items('fine_items', @_);
+ require Koha::Database;
+ require Template;
+
+ my $self = shift;
+ my $start = shift;
+ my $end = shift;
+ my $server = shift;
+
+ my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
+ {
+ borrowernumber => $self->{borrowernumber},
+ amountoutstanding => { '>' => '0' },
+ }
+ );
+
+ $start = $start ? $start - 1 : 0;
+ $end = $end ? $end : scalar @fees - 1;
+
+ my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
+ $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
+
+ my $tt = Template->new();
+
+ my @return_values;
+ for ( my $i = $start; $i <= $end; $i++ ) {
+ my $fee = $fees[$i];
+
+ my $output;
+ $tt->process( \$av_field_template, { accountline => $fee }, \$output );
+ push( @return_values, { barcode => $output } );
+ }
+
+ return \@return_values;
}
sub recall_items {
- my $self = shift or return;
+ my $self = shift;
return $self->x_items('recall_items', @_);
}
sub unavail_holds {
- my $self = shift or return;
+ my $self = shift;
return $self->x_items('unavail_holds', @_);
}
sub block {
my ($self, $card_retained, $blocked_card_msg) = @_;
foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok', 'inet') {
- $self->{$field} = 0;
+ $self->{$field} = 0;
}
$self->{screen_msg} = "Block feature not implemented"; # $blocked_card_msg || "Card Blocked. Please contact library staff";
# TODO: not really affecting patron record
sub enable {
my $self = shift;
foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok', 'inet') {
- $self->{$field} = 1;
+ $self->{$field} = 1;
}
syslog("LOG_DEBUG", "Patron(%s)->enable: charge: %s, renew:%s, recall:%s, hold:%s",
- $self->{id}, $self->{charge_ok}, $self->{renew_ok},
- $self->{recall_ok}, $self->{hold_ok});
+ $self->{id}, $self->{charge_ok}, $self->{renew_ok},
+ $self->{recall_ok}, $self->{hold_ok});
$self->{screen_msg} = "Enable feature not implemented."; # "All privileges restored."; # TODO: not really affecting patron record
return $self;
}
return $self->{inet} ? 'Y' : 'N';
}
-sub fee_limit {
- # my $self = shift;
- return C4::Context->preference("noissuescharge") || 5;
+sub _fee_limit {
+ return C4::Context->preference('noissuescharge') || 5;
}
sub excessive_fees {
- my $self = shift or return;
+ my $self = shift;
return ($self->fee_amount and $self->fee_amount > $self->fee_limit);
}
+
sub excessive_fines {
- my $self = shift or return;
+ my $self = shift;
return $self->excessive_fees; # excessive_fines is the same thing as excessive_fees for Koha
}
+
+sub holds_blocked_by_excessive_fees {
+ my $self = shift;
+ return ( $self->fee_amount
+ && $self->fee_amount > C4::Context->preference("maxoutstanding") );
+}
sub library_name {
my $self = shift;
unless ($self->{library_name}) {
- $self->{library_name} = GetBranchName($self->{branchcode});
+ my $library = Koha::Libraries->find( $self->{branchcode} );
+ $self->{library_name} = $library ? $library->branchname : '';
}
return $self->{library_name};
}
#
sub invalid_patron {
+ my $self = shift;
return "Please contact library staff";
}
sub charge_denied {
+ my $self = shift;
return "Please contact library staff";
}
+=head2 update_lastseen
+
+ $patron->update_lastseen();
+
+ Patron method to update lastseen field in borrower
+ to record that patron has been seen via sip connection
+
+=cut
+
+sub update_lastseen {
+ my $self = shift;
+ my $kohaobj = Koha::Patrons->find( $self->{borrowernumber} );
+ $kohaobj->track_login if $kohaobj; # track_login checks the pref
+}
+
+sub _get_address {
+ my $patron = shift;
+
+ my $address = $patron->{streetnumber} || q{};
+ for my $field (qw( roaddetails address address2 city state zipcode country))
+ {
+ next unless $patron->{$field};
+ if ($address) {
+ $address .= q{ };
+ $address .= $patron->{$field};
+ }
+ else {
+ $address .= $patron->{$field};
+ }
+ }
+ return $address;
+}
+
+sub _get_outstanding_holds {
+ my $borrowernumber = shift;
+
+ my $patron = Koha::Patrons->find( $borrowernumber );
+ my $holds = $patron->holds->search( { -or => [ { found => undef }, { found => { '!=' => 'W' } } ] } );
+ my @holds;
+ while ( my $hold = $holds->next ) {
+ my $item;
+ if ($hold->itemnumber) {
+ $item = $hold->item;
+ }
+ else {
+ # We need to return a barcode for the biblio so the client
+ # can request the biblio info
+ my $items = $hold->biblio->items;
+ $item = $items->count ? $items->next : undef;
+ }
+ my $unblessed_hold = $hold->unblessed;
+
+ $unblessed_hold->{barcode} = $item ? $item->barcode : undef;
+
+ push @holds, $unblessed_hold;
+ }
+ return \@holds;
+}
+
+=head2 build_patron_attributes_string
+
+This method builds the part of the sip message for extended patron
+attributes as defined in the sip config
+
+=cut
+
+sub build_patron_attributes_string {
+ my ( $self, $server ) = @_;
+
+ my $string = q{};
+
+ if ( $server->{account}->{patron_attribute} ) {
+ my @attributes_to_send =
+ ref $server->{account}->{patron_attribute} eq "ARRAY"
+ ? @{ $server->{account}->{patron_attribute} }
+ : ( $server->{account}->{patron_attribute} );
+
+ foreach my $a ( @attributes_to_send ) {
+ my @attributes = Koha::Patron::Attributes->search(
+ {
+ borrowernumber => $self->{borrowernumber},
+ code => $a->{code}
+ }
+ );
+
+ foreach my $attribute ( @attributes ) {
+ my $value = $attribute->attribute();
+ $string .= add_field( $a->{field}, $value );
+ }
+ }
+ }
+
+ return $string;
+}
+
1;
__END__
=head1 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,
- },
+ 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 |
- +---------------------+--------------+------+-----+
- | borrowernumber | int(11) | NO | PRI |
- | cardnumber | varchar(16) | YES | UNI |
- | surname | mediumtext | NO | |
- | firstname | text | YES | |
- | title | mediumtext | YES | |
- | othernames | mediumtext | YES | |
- | initials | text | YES | |
- | streetnumber | varchar(10) | YES | |
- | streettype | varchar(50) | YES | |
- | address | mediumtext | NO | |
- | address2 | text | YES | |
- | city | mediumtext | NO | |
- | zipcode | varchar(25) | YES | |
- | country | text | YES | |
- | email | mediumtext | YES | |
- | phone | text | YES | |
- | mobile | varchar(50) | YES | |
- | fax | mediumtext | YES | |
- | emailpro | text | YES | |
- | phonepro | text | YES | |
- | B_streetnumber | varchar(10) | YES | |
- | B_streettype | varchar(50) | YES | |
- | B_address | varchar(100) | YES | |
- | B_address2 | text | YES | |
- | B_city | mediumtext | YES | |
- | B_zipcode | varchar(25) | YES | |
- | B_country | text | YES | |
- | B_email | text | YES | |
- | B_phone | mediumtext | YES | |
- | dateofbirth | date | YES | |
- | branchcode | varchar(10) | NO | MUL |
- | categorycode | varchar(10) | NO | MUL |
- | dateenrolled | date | YES | |
- | dateexpiry | date | YES | |
- | gonenoaddress | tinyint(1) | YES | |
- | lost | tinyint(1) | YES | |
- | debarred | tinyint(1) | YES | |
- | contactname | mediumtext | YES | |
- | contactfirstname | text | YES | |
- | contacttitle | text | YES | |
- | guarantorid | int(11) | YES | |
- | borrowernotes | mediumtext | YES | |
- | relationship | varchar(100) | YES | |
- | ethnicity | varchar(50) | YES | |
- | ethnotes | varchar(255) | YES | |
- | sex | varchar(1) | YES | |
- | password | varchar(30) | YES | |
- | flags | int(11) | YES | |
- | userid | varchar(30) | YES | MUL |
- | opacnote | mediumtext | YES | |
- | contactnote | varchar(255) | YES | |
- | sort1 | varchar(80) | YES | |
- | sort2 | varchar(80) | YES | |
- | altcontactfirstname | varchar(255) | YES | |
- | altcontactsurname | varchar(255) | YES | |
- | altcontactaddress1 | varchar(255) | YES | |
- | altcontactaddress2 | varchar(255) | YES | |
- | altcontactaddress3 | varchar(255) | YES | |
- | altcontactzipcode | varchar(50) | YES | |
- | altcontactcountry | text | YES | |
- | altcontactphone | varchar(50) | YES | |
- | smsalertnumber | varchar(50) | YES | |
- +---------------------+--------------+------+-----+
++---------------------+--------------+------+-----+---------+----------------+
+| 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 | |
+| guarantorid | int(11) | YES | MUL | 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
+ {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
=cut