From cc67a70f104ab1fd5cd9e476423598b16488ee66 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 5 Nov 2007 17:14:04 -0600 Subject: [PATCH] Work in progress on the SIP code Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/SIP/ILS/Patron.pm | 30 +++++++++++++++--------------- C4/SIP/Sip/MsgType.pm | 8 ++++---- C4/SIP/koha_test/00sc_status.t | 2 +- C4/SIP/koha_test/01patron_status.t | 2 +- C4/SIP/koha_test/SIPtest.pm | 4 ++-- members/member-password.pl | 2 ++ 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index da5586b5a0..b536e2b4bc 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -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 { diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 5f625039c6..29ea0367d9 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -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)}); diff --git a/C4/SIP/koha_test/00sc_status.t b/C4/SIP/koha_test/00sc_status.t index 9a4f840fcd..1469d18d87 100644 --- a/C4/SIP/koha_test/00sc_status.t +++ b/C4/SIP/koha_test/00sc_status.t @@ -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 => [], }; diff --git a/C4/SIP/koha_test/01patron_status.t b/C4/SIP/koha_test/01patron_status.t index a00c074f14..e0028755a0 100644 --- a/C4/SIP/koha_test/01patron_status.t +++ b/C4/SIP/koha_test/01patron_status.t @@ -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)}, diff --git a/C4/SIP/koha_test/SIPtest.pm b/C4/SIP/koha_test/SIPtest.pm index 4b7aa681f3..6dee85e02e 100644 --- a/C4/SIP/koha_test/SIPtest.pm +++ b/C4/SIP/koha_test/SIPtest.pm @@ -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 diff --git a/members/member-password.pl b/members/member-password.pl index 315d07c675..e4c0fca9c0 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -88,4 +88,6 @@ if ( $newpassword ) { } +$template->param( member => $member); + output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5