Work in progress on the SIP code
Signed-off-by: Chris Cormack <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
a10cb962ff
commit
cc67a70f10
6 changed files with 25 additions and 23 deletions
|
@ -61,21 +61,20 @@ sub new {
|
|||
my ($class, $patron_id) = @_;
|
||||
my $type = ref($class) || $class;
|
||||
my $self;
|
||||
my %ilspatron;
|
||||
my %ilspatron;
|
||||
my $kp = GetMember($patron_id,'cardnumber');
|
||||
use Data::Dumper;
|
||||
warn Dumper($kp);
|
||||
# use Data::Dumper;
|
||||
# warn Dumper($kp);
|
||||
if ($kp) {
|
||||
my $pw = $kp->{password}; ## FIXME - md5hash -- deal with .
|
||||
my $dob= $kp->{dateofbirth};
|
||||
$dob =~ s/\-//g;
|
||||
my $fines_out = GetMemberAccountRecords($kp->{borrowernumber});
|
||||
my ($num_cur_issues,$cur_issues) = GetPendingIssues($kp->{borrowernumber});
|
||||
|
||||
my $debarred = $kp->{debarred}; ### 1 if ($kp->{flags}->{DBARRED}->{noissues});
|
||||
warn "i am debarred: $debarred";
|
||||
my $pw = $kp->{password}; ## FIXME - md5hash -- deal with .
|
||||
my $dob= $kp->{dateofbirth};
|
||||
$dob =~ s/\-//g;
|
||||
my $fines_out = GetMemberAccountRecords($kp->{borrowernumber});
|
||||
my ($num_cur_issues,$cur_issues) = GetPendingIssues($kp->{borrowernumber});
|
||||
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};
|
||||
my $adr = $kp->{streetnumber} . " ". $kp->{address};
|
||||
%ilspatron = (
|
||||
name => $kp->{firstname} . " " . $kp->{surname},
|
||||
id => $kp->{cardnumber},
|
||||
|
@ -111,7 +110,7 @@ warn "i am debarred: $debarred";
|
|||
}
|
||||
|
||||
$self = \%ilspatron;
|
||||
warn Dumper($self);
|
||||
# warn Dumper($self);
|
||||
|
||||
syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id});
|
||||
|
||||
|
@ -206,8 +205,9 @@ sub recall_overdue {
|
|||
sub check_password {
|
||||
my ($self, $pwd) = @_;
|
||||
my $md5pwd=$self->{password}; ### FIXME - we're allowing access if user has no password.
|
||||
|
||||
return (!$self->{password} || md5_base64($pwd) eq $md5pwd );
|
||||
warn "check $self->{password} $pwd";
|
||||
warn "$self->{name}";
|
||||
return (!$self->{password} || md5_base64($pwd) eq $md5pwd );
|
||||
}
|
||||
|
||||
sub currency {
|
||||
|
|
|
@ -285,7 +285,7 @@ sub new {
|
|||
# so we'll just do it.
|
||||
$protocol_version = 2;
|
||||
}
|
||||
warn "PROTOCOL: $protocol_version";
|
||||
#warn "PROTOCOL: $protocol_version";
|
||||
if (!exists($handlers{$msgtag})) {
|
||||
syslog("LOG_WARNING",
|
||||
"new Sip::MsgType: Skipping message of unknown type '%s' in '%s'",
|
||||
|
@ -485,9 +485,9 @@ sub handle_patron_status {
|
|||
|
||||
($lang, $date) = @{$self->{fixed_fields}};
|
||||
$fields = $self->{fields};
|
||||
warn Dumper($fields);
|
||||
warn FID_INST_ID;
|
||||
warn $fields->{(FID_INST_ID)};
|
||||
#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)});
|
||||
|
|
|
@ -14,7 +14,7 @@ my $invalid_uname = { id => 'Invalid username',
|
|||
pat => qr/^940/,
|
||||
fields => [], };
|
||||
|
||||
my $invalid_pwd = { id => 'Invalid username',
|
||||
my $invalid_pwd = { id => 'Invalid password',
|
||||
msg => "9300CN$username|COinvalid$password|CPThe floor|",
|
||||
pat => qr/^940/,
|
||||
fields => [], };
|
||||
|
|
|
@ -14,7 +14,7 @@ my @tests = (
|
|||
$SIPtest::login_test,
|
||||
$SIPtest::sc_status_test,
|
||||
{ id => 'valid Patron Status',
|
||||
msg => "2300120060101 084237AO$SIPtest::instid|AA$user_barcode|AD$user_pin|AC|",
|
||||
msg => "2300120060101 084237AO$instid|AA$user_barcode|AD$user_pin|AC|",
|
||||
pat => qr/^24 [ Y]{13}\d{3}$datepat/,
|
||||
fields => [
|
||||
$SIPtest::field_specs{(FID_INST_ID)},
|
||||
|
|
|
@ -49,13 +49,13 @@ our $password = 'koha';
|
|||
|
||||
# Valid user barcode and corresponding user password/pin and full name
|
||||
our $user_barcode = '900002';
|
||||
our $user_pin = 'password';
|
||||
our $user_pin = 'sip test';
|
||||
our $user_fullname= 'Firstname SURNAME';
|
||||
our $user_homeaddr= '35 address';
|
||||
our $user_email = 'patron@liblime.com';
|
||||
our $user_phone = '555-1212';
|
||||
our $user_birthday= '1983-10-06';
|
||||
our $user_ptype = 'PATRON';
|
||||
our $user_ptype = 'A';
|
||||
our $user_inet = 'N';
|
||||
|
||||
# Valid item barcode and corresponding title
|
||||
|
|
|
@ -88,4 +88,6 @@ if ( $newpassword ) {
|
|||
|
||||
}
|
||||
|
||||
$template->param( member => $member);
|
||||
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
Loading…
Reference in a new issue