Work in progress on the SIP code
authorChris Cormack <crc@liblime.com>
Mon, 5 Nov 2007 23:14:04 +0000 (17:14 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 6 Nov 2007 12:33:04 +0000 (06:33 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/SIP/ILS/Patron.pm
C4/SIP/Sip/MsgType.pm
C4/SIP/koha_test/00sc_status.t
C4/SIP/koha_test/01patron_status.t
C4/SIP/koha_test/SIPtest.pm
members/member-password.pl

index da5586b..b536e2b 100644 (file)
@@ -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 {
index 5f62503..29ea036 100644 (file)
@@ -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)});
index 9a4f840..1469d18 100644 (file)
@@ -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 => [], };
index a00c074..e002875 100644 (file)
@@ -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)},
index 4b7aa68..6dee85e 100644 (file)
@@ -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
index 315d07c..e4c0fca 100755 (executable)
@@ -88,4 +88,6 @@ if ( $newpassword ) {
 
 }
 
+$template->param( member => $member);
+
 output_html_with_http_headers $input, $cookie, $template->output;