#
-# ILS.pm: Test ILS interface module
+# ILS.pm: Koha ILS interface module
#
package ILS;
my ($class, $institution) = @_;
my $type = ref($class) || $class;
my $self = {};
-
+use Data::Dumper;
+warn " INSTITUTION:";
+warn Dumper($institution);
syslog("LOG_DEBUG", "new ILS '%s'", $institution->{id});
$self->{institution} = $institution;
use Sys::Syslog qw(syslog);
use Data::Dumper;
+use C4::Context;
+use C4::Koha;
+use C4::Members;
+use Digest::MD5 qw(md5_base64);
+
our (@ISA, @EXPORT_OK);
@ISA = qw(Exporter);
unavail_holds => [],
inet => 1,
},
- miker => {
- name => "Mike Rylander",
- id => 'miker',
- password => '6789',
- ptype => 'A', # 'A'dult. Whatever.
- birthdate => '19640925',
- address => 'Somewhere in Atlanta',
- home_phone => '(404) 555 1235',
- email_addr => 'mrylander@gmail.com',
- charge_ok => 1,
- renew_ok => 1,
- recall_ok => 0,
- hold_ok => 1,
- card_lost => 0,
+ );
+
+sub new {
+ my ($class, $patron_id) = @_;
+ my $type = ref($class) || $class;
+ my $self;
+my %ilspatron;
+ my $kp = GetMember($patron_id,'cardnumber');
+warn "THIS IS what we et from getmember...";
+use Data::Dumper;
+warn Dumper($kp);
+ if ($kp) {
+ my $pw = $kp->{password}; ## FIXME - md5hash -- deal with .
+ my $dob= $kp->{dateofbirth};
+ $dob =~ s/\-//g;
+
+ my $debarred = $kp->{debarred}; ### 1 if ($kp->{flags}->{DBARRED}->{noissues});
+warn "i am debarred: $debarred";
+#warn Dumper(%{$kp->{flags}});
+ my $adr = $kp->{streetnumber} . " ". $kp->{address};
+ %ilspatron = (
+ name => $kp->{firstname} . " " . $kp->{surname},
+ id => $kp->{cardnumber},
+ password => $pw,
+ ptype => $kp->{categorycode}, # 'A'dult. Whatever.
+ birthdate => $dob,
+ address => $adr,
+ home_phone => $kp->{phone},
+ email_addr => $kp->{email},
+ charge_ok => (!$debarred) , ## (C4::Context->preference('FinesMode') eq 'charge') || 0,
+ renew_ok => 0,
+ recall_ok => 0,
+ hold_ok => 0,
+ card_lost => 0,#$kp->{flags}->{LOST},
claims_returned => 0,
- fines => 0,
+ fines => 0,#$kp->{flags}->{CHARGES},
fees => 0,
recall_overdue => 0,
items_billed => 0,
screen_msg => '',
print_line => '',
- items => [],
- hold_items => [],
- overdue_items => [],
+ items => [] ,
+ hold_items => [],#$kp->{flags}->{WAITING}{itemlist}->{biblionumber},
+ overdue_items =>[], # [$kp->{flags}->{ODUES}{itemlisttext}], ### FIXME -> this should be array, not texts string.
fine_items => [],
recall_items => [],
unavail_holds => [],
inet => 0,
- },
- );
-
-sub new {
- my ($class, $patron_id) = @_;
- my $type = ref($class) || $class;
- my $self;
-
- if (!exists($patron_db{$patron_id})) {
- syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id);
- return undef;
+ );
+ } else {
+ syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id);
+ return undef;
}
- $self = $patron_db{$patron_id};
+ $self = \%ilspatron;
+ warn Dumper($self);
- syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,
- $self->{id});
+ syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id});
bless $self, $type;
return $self;
sub check_password {
my ($self, $pwd) = @_;
+ my $md5pwd=$self->{password}; ### FIXME - we're allowing access if user has no password.
- # If the patron doesn't have a password,
- # then we don't need to check
- return (!$self->{password} || ($pwd && ($self->{password} eq $pwd)));
+return (!$self->{password} || md5_base64($pwd) eq $md5pwd );
}
sub currency {
alarm $service->{timeout};
$input = Sip::read_SIP_packet(*STDIN);
alarm 0;
-
- if (!$input) {
+ if (!$input) {
# EOF on the socket
syslog("LOG_INFO", "raw_transport: shutting down: EOF during login");
return;
local $SIG{ALRM} = sub { die "alarm\n"; };
local $|;
my $timeout = 0;
-
$| = 1; # Unbuffered output
$timeout = $config->{timeout} if (exists($config->{timeout}));
my $service = $self->{service};
my $config = $self->{config};
my $input;
-
# Now that the terminal has logged in, the first message
# we recieve must be an SC_STATUS message. But it might be
# an SC_REQUEST_RESEND. So, as long as we keep receiving
$status = Sip::MsgType::handle($input, $self, $expect);
next if $status eq REQUEST_ACS_RESEND;
-
+#### stopped here rch
if (!$status) {
syslog("LOG_ERR", "raw_transport: failed to handle %s",
substr($input, 0, 2));
</listeners>
<accounts>
- <login id="koha" password="koha" institution="kohalibrary">
- </login>
- <login id="koha2" password="koha2" institution="kohalibrary" />
+ <login id="koha" password="koha" delimiter="|" error-detect="enabled" institution="kohalibrary" />
+ <login id="koha2" password="koha" institution="kohalibrary2" />
<login id="lpl-sc" password="1234" institution="LPL" />
<login id="lpl-sc-beacock" password="xyzzy"
delimiter="|" error-detect="enabled" institution="LPL" />
<policy checkin="true" renewal="false"
status_update="false" offline="false"
timeout="600"
+ retries="5" />
+ </institution>
+ <institution id="kohalibrary2" implementation="ILS" parms="">
+ <policy checkin="true" renewal="false"
+ timeout="600"
retries="3" />
</institution>
# so we'll just do it.
$protocol_version = 2;
}
+warn "PROTOCOL: $protocol_version";
if (!exists($handlers{$msgtag})) {
syslog("LOG_WARNING",
"new Sip::MsgType: Skipping message of unknown type '%s' in '%s'",
return $resp;
}
+use Data::Dumper;
sub handle_patron_status {
my ($self, $server) = @_;
- my $ils = $server->{ils};
+#warn Dumper($server);
+ my $ils = $server->{ils};
my ($lang, $date);
my $fields;
my $patron;
($lang, $date) = @{$self->{fixed_fields}};
$fields = $self->{fields};
-
+warn Dumper($fields);
+warn FID_INST_ID;
+warn $fields->{(FID_INST_ID)};
$ils->check_inst_id($fields->{(FID_INST_ID)}, "handle_patron_status");
$patron = $ils->find_patron($fields->{(FID_PATRON_ID)});
97AZFEF5
-2300120060101 084235AOUWOLS|AAdjfiander|ACterminal password|ADuser password|
+2300120071003 084235AOkohalibrary|AArch|ACkoha|ADkoha|
+
2300120060101 084236AOUWOLS|AAmjandkilde|ACterminal password|ADuser password|
2300120060101 084237AOUWOLS|AAdjfiander|ACterminal password|ADuser password|
9300CNLoginUserID|COLoginPassword|CPLocationCode|
11YN20060329 203000 AOUWOLS|AAdjfiander|AB1565921879|AC|
09Y20060102 08423620060113 084235APUnder the bed|AOUWOLS|AB1565921879|ACterminal password|
01N20060102 084238AOUWOLS|ALHe's a jerk|AAdjfiander|ACterminal password|
+
2520060102 084238AOUWOLS|AAdjfiander|ACterminal password|AD6789|
9910302.00
-3520060110 084237AOUWOLS|AAdjfiander|AD6789|
+
+3520060110 084237AOkohalibrary|AArch|ADkoha|
1720060110 215612AOUWOLS|AB1565921879|
-6300020060329 201700Y AOUWOLS|AAdjfiander|
+
+patron information:
+6300020060329 201700Y AOkohalibrary|AArch|ACkoha|ADkoha|
+
15+20060415 110158BW20060815 110158|BSTaylor|BY2|AOUWOLS|AAdjfiander|AB1565921879|
15-20060415 110158AOUWOLS|AAdjfiander|AB1565921879|
29NN20060415 110158 AOUWOLS|AAdjfiander|AD6789|AB1565921879|
6520060415 110158AOUWOLS|AAdjfiander|AD6789|
+
+working:
+
+9300CNkoha|COkoha|CPkohalibrary|