View | Details | Raw Unified | Return to bug 9865
Collapse All | Expand All

(-)a/C4/SIP/Sip.pm (-2 / +4 lines)
Lines 7-13 package Sip; Link Here
7
use strict;
7
use strict;
8
use warnings;
8
use warnings;
9
use Exporter;
9
use Exporter;
10
10
use Encode;
11
use Sys::Syslog qw(syslog);
11
use Sys::Syslog qw(syslog);
12
use POSIX qw(strftime);
12
use POSIX qw(strftime);
13
use Socket qw(:crlf);
13
use Socket qw(:crlf);
Lines 209-219 sub read_SIP_packet { Link Here
209
#
209
#
210
210
211
sub write_msg {
211
sub write_msg {
212
    my ($self, $msg, $file, $terminator) = @_;
212
    my ($self, $msg, $file, $terminator, $encoding) = @_;
213
213
214
    $terminator ||= q{};
214
    $terminator ||= q{};
215
    $terminator = ( $terminator eq 'CR' ) ? $CR : $CRLF;
215
    $terminator = ( $terminator eq 'CR' ) ? $CR : $CRLF;
216
216
217
    $msg = encode($encoding, $msg) if ( $encoding );
218
217
    my $cksum;
219
    my $cksum;
218
220
219
    # $msg = encode_utf8($msg);
221
    # $msg = encode_utf8($msg);
(-)a/C4/SIP/Sip/MsgType.pm (-17 / +17 lines)
Lines 490-496 sub handle_patron_status { Link Here
490
    $ils->check_inst_id($fields->{(FID_INST_ID)}, "handle_patron_status");
490
    $ils->check_inst_id($fields->{(FID_INST_ID)}, "handle_patron_status");
491
    $patron = $ils->find_patron($fields->{(FID_PATRON_ID)});
491
    $patron = $ils->find_patron($fields->{(FID_PATRON_ID)});
492
    $resp = build_patron_status($patron, $lang, $fields, $server );
492
    $resp = build_patron_status($patron, $lang, $fields, $server );
493
    $self->write_msg($resp,undef,$server->{account}->{terminator});
493
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
494
    return (PATRON_STATUS_REQ);
494
    return (PATRON_STATUS_REQ);
495
}
495
}
496
496
Lines 608-614 sub handle_checkout { Link Here
608
	}
608
	}
609
    }
609
    }
610
610
611
    $self->write_msg($resp,undef,$server->{account}->{terminator});
611
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
612
    return(CHECKOUT);
612
    return(CHECKOUT);
613
}
613
}
614
614
Lines 696-702 sub handle_checkin { Link Here
696
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
696
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
697
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
697
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
698
698
699
    $self->write_msg($resp,undef,$server->{account}->{terminator});
699
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
700
700
701
    return(CHECKIN);
701
    return(CHECKIN);
702
}
702
}
Lines 740-746 sub handle_block_patron { Link Here
740
	}
740
	}
741
741
742
    $resp = build_patron_status( $patron, $patron->language, $fields, $server );
742
    $resp = build_patron_status( $patron, $patron->language, $fields, $server );
743
    $self->write_msg($resp,undef,$server->{account}->{terminator});
743
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
744
    return(BLOCK_PATRON);
744
    return(BLOCK_PATRON);
745
}
745
}
746
746
Lines 782-788 sub handle_request_acs_resend { Link Here
782
    if (!$last_response) {
782
    if (!$last_response) {
783
	# We haven't sent anything yet, so respond with a
783
	# We haven't sent anything yet, so respond with a
784
	# REQUEST_SC_RESEND msg (p. 16)
784
	# REQUEST_SC_RESEND msg (p. 16)
785
   $self->write_msg(REQUEST_SC_RESEND,undef,$server->{account}->{terminator});
785
   $self->write_msg(REQUEST_SC_RESEND,undef,$server->{account}->{terminator},$server->{account}->{encoding});
786
    } elsif ((length($last_response) < 9)
786
    } elsif ((length($last_response) < 9)
787
	     || substr($last_response, -9, 2) ne 'AY') {
787
	     || substr($last_response, -9, 2) ne 'AY') {
788
	# When resending a message, we aren't supposed to include
788
	# When resending a message, we aren't supposed to include
Lines 794-800 sub handle_request_acs_resend { Link Here
794
	# Cut out the sequence number and checksum, since the old
794
	# Cut out the sequence number and checksum, since the old
795
	# checksum is wrong for the resent message.
795
	# checksum is wrong for the resent message.
796
	my $rebuilt = substr($last_response, 0, -9);
796
	my $rebuilt = substr($last_response, 0, -9);
797
   $self->write_msg($rebuilt,undef,$server->{account}->{terminator});
797
   $self->write_msg($rebuilt,undef,$server->{account}->{terminator},$server->{account}->{encoding});
798
    }
798
    }
799
799
800
    return REQUEST_ACS_RESEND;
800
    return REQUEST_ACS_RESEND;
Lines 870-876 sub handle_login { Link Here
870
    }
870
    }
871
	else { $status = login_core($server,$uid,$pwd); }
871
	else { $status = login_core($server,$uid,$pwd); }
872
872
873
   $self->write_msg(LOGIN_RESP . $status,undef,$server->{account}->{terminator});
873
   $self->write_msg(LOGIN_RESP . $status,undef,$server->{account}->{terminator},$server->{account}->{encoding});
874
    return $status ? LOGIN : '';
874
    return $status ? LOGIN : '';
875
}
875
}
876
876
Lines 1019-1025 sub handle_patron_info { Link Here
1019
        }
1019
        }
1020
    }
1020
    }
1021
1021
1022
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1022
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1023
    return(PATRON_INFO);
1023
    return(PATRON_INFO);
1024
}
1024
}
1025
1025
Lines 1046-1052 sub handle_end_patron_session { Link Here
1046
    $resp .= maybe_add(FID_SCREEN_MSG, $screen_msg);
1046
    $resp .= maybe_add(FID_SCREEN_MSG, $screen_msg);
1047
    $resp .= maybe_add(FID_PRINT_LINE, $print_line);
1047
    $resp .= maybe_add(FID_PRINT_LINE, $print_line);
1048
1048
1049
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1049
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1050
1050
1051
    return(END_PATRON_SESSION);
1051
    return(END_PATRON_SESSION);
1052
}
1052
}
Lines 1080-1086 sub handle_fee_paid { Link Here
1080
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1080
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1081
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1081
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1082
1082
1083
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1083
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1084
1084
1085
    return(FEE_PAID);
1085
    return(FEE_PAID);
1086
}
1086
}
Lines 1147-1153 sub handle_item_information { Link Here
1147
	$resp .= maybe_add(FID_PRINT_LINE, $item->print_line);
1147
	$resp .= maybe_add(FID_PRINT_LINE, $item->print_line);
1148
    }
1148
    }
1149
1149
1150
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1150
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1151
1151
1152
    return(ITEM_INFORMATION);
1152
    return(ITEM_INFORMATION);
1153
}
1153
}
Lines 1196-1202 sub handle_item_status_update { Link Here
1196
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1196
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1197
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1197
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1198
1198
1199
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1199
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1200
1200
1201
    return(ITEM_STATUS_UPDATE);
1201
    return(ITEM_STATUS_UPDATE);
1202
}
1202
}
Lines 1247-1253 sub handle_patron_enable { Link Here
1247
1247
1248
    $resp .= add_field(FID_INST_ID, $ils->institution);
1248
    $resp .= add_field(FID_INST_ID, $ils->institution);
1249
1249
1250
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1250
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1251
1251
1252
    return(PATRON_ENABLE);
1252
    return(PATRON_ENABLE);
1253
}
1253
}
Lines 1313-1319 sub handle_hold { Link Here
1313
    $resp .= maybe_add(FID_SCREEN_MSG,  $status->screen_msg);
1313
    $resp .= maybe_add(FID_SCREEN_MSG,  $status->screen_msg);
1314
    $resp .= maybe_add(FID_PRINT_LINE,  $status->print_line);
1314
    $resp .= maybe_add(FID_PRINT_LINE,  $status->print_line);
1315
1315
1316
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1316
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1317
1317
1318
    return(HOLD);
1318
    return(HOLD);
1319
}
1319
}
Lines 1402-1408 sub handle_renew { Link Here
1402
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1402
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1403
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1403
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1404
1404
1405
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1405
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1406
1406
1407
    return(RENEW);
1407
    return(RENEW);
1408
}
1408
}
Lines 1452-1458 sub handle_renew_all { Link Here
1452
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1452
    $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg);
1453
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1453
    $resp .= maybe_add(FID_PRINT_LINE, $status->print_line);
1454
1454
1455
    $self->write_msg($resp,undef,$server->{account}->{terminator});
1455
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1456
1456
1457
    return(RENEW_ALL);
1457
    return(RENEW_ALL);
1458
}
1458
}
Lines 1562-1568 sub send_acs_status { Link Here
1562
1562
1563
    # Do we want to tell the terminal its location?
1563
    # Do we want to tell the terminal its location?
1564
1564
1565
    $self->write_msg($msg,undef,$server->{account}->{terminator});
1565
    $self->write_msg($msg,undef,$server->{account}->{terminator},$server->{account}->{encoding});
1566
    return 1;
1566
    return 1;
1567
}
1567
}
1568
1568
(-)a/etc/SIPconfig.xml (-3 / +2 lines)
Lines 36-43 Link Here
36
  </listeners>
36
  </listeners>
37
37
38
  <accounts>
38
  <accounts>
39
      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" />
39
      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="" />
40
      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" />
40
      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="" />
41
      <login id="koha2"  password="koha" institution="kohalibrary2" terminator="CR" />
41
      <login id="koha2"  password="koha" institution="kohalibrary2" terminator="CR" />
42
      <login id="lpl-sc" password="1234" institution="LPL" />
42
      <login id="lpl-sc" password="1234" institution="LPL" />
43
      <login id="lpl-sc-beacock" password="xyzzy"
43
      <login id="lpl-sc-beacock" password="xyzzy"
44
- 

Return to bug 9865