Bugzilla – Attachment 24091 Details for
Bug 9865
Make SIP2 message encoding configurable via SIPconfig.xml
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Sorry about the confusion. I forgot to start the SIP server manually, using the koha-start-sip command instead. So naturally then I couldnt see any effect.
SIGNED-OFF-Sorry-about-the-confusion-I-forgot-to-s.patch (text/plain), 8.40 KB, created by
Petter Goksøyr Åsen
on 2014-01-09 14:29:31 UTC
(
hide
)
Description:
[SIGNED-OFF] Sorry about the confusion. I forgot to start the SIP server manually, using the koha-start-sip command instead. So naturally then I couldnt see any effect.
Filename:
MIME Type:
Creator:
Petter Goksøyr Åsen
Created:
2014-01-09 14:29:31 UTC
Size:
8.40 KB
patch
obsolete
>From 6499c91e7681cff26abadb354ee66a652062f048 Mon Sep 17 00:00:00 2001 >From: Christophe Croullebois <christophe.croullebois@biblibre.com> >Date: Fri, 8 Nov 2013 11:49:56 +0100 >Subject: [PATCH] [SIGNED-OFF] Sorry about the confusion. I forgot to start the > SIP server manually, using the koha-start-sip command instead. So naturally > then I couldnt see any effect. > >But now I did it the right way! And I can confirm that this patch solves >all issues with mangled characters in SIP messages. Confirmed that it looks >good with Norwegian characters in patron name and in book titles. > >Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com> > >http://bugs.koha-community.org/show_bug.cgi?id=9865 >--- > C4/SIP/Sip.pm | 6 ++++-- > C4/SIP/Sip/MsgType.pm | 34 +++++++++++++++++----------------- > etc/SIPconfig.xml | 4 ++-- > 3 files changed, 23 insertions(+), 21 deletions(-) > >diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm >index f407634..b6f1916 100644 >--- a/C4/SIP/Sip.pm >+++ b/C4/SIP/Sip.pm >@@ -7,7 +7,7 @@ package Sip; > use strict; > use warnings; > use Exporter; >- >+use Encode; > use Sys::Syslog qw(syslog); > use POSIX qw(strftime); > use Socket qw(:crlf); >@@ -209,11 +209,13 @@ sub read_SIP_packet { > # > > sub write_msg { >- my ($self, $msg, $file, $terminator) = @_; >+ my ($self, $msg, $file, $terminator, $encoding) = @_; > > $terminator ||= q{}; > $terminator = ( $terminator eq 'CR' ) ? $CR : $CRLF; > >+ $msg = encode($encoding, $msg) if ( $encoding ); >+ > my $cksum; > > # $msg = encode_utf8($msg); >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 17185e0..fceb16b 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -490,7 +490,7 @@ sub handle_patron_status { > $ils->check_inst_id($fields->{(FID_INST_ID)}, "handle_patron_status"); > $patron = $ils->find_patron($fields->{(FID_PATRON_ID)}); > $resp = build_patron_status($patron, $lang, $fields, $server ); >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > return (PATRON_STATUS_REQ); > } > >@@ -608,7 +608,7 @@ sub handle_checkout { > } > } > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > return(CHECKOUT); > } > >@@ -696,7 +696,7 @@ sub handle_checkin { > $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg); > $resp .= maybe_add(FID_PRINT_LINE, $status->print_line); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(CHECKIN); > } >@@ -740,7 +740,7 @@ sub handle_block_patron { > } > > $resp = build_patron_status( $patron, $patron->language, $fields, $server ); >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > return(BLOCK_PATRON); > } > >@@ -782,7 +782,7 @@ sub handle_request_acs_resend { > if (!$last_response) { > # We haven't sent anything yet, so respond with a > # REQUEST_SC_RESEND msg (p. 16) >- $self->write_msg(REQUEST_SC_RESEND,undef,$server->{account}->{terminator}); >+ $self->write_msg(REQUEST_SC_RESEND,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > } elsif ((length($last_response) < 9) > || substr($last_response, -9, 2) ne 'AY') { > # When resending a message, we aren't supposed to include >@@ -794,7 +794,7 @@ sub handle_request_acs_resend { > # Cut out the sequence number and checksum, since the old > # checksum is wrong for the resent message. > my $rebuilt = substr($last_response, 0, -9); >- $self->write_msg($rebuilt,undef,$server->{account}->{terminator}); >+ $self->write_msg($rebuilt,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > } > > return REQUEST_ACS_RESEND; >@@ -870,7 +870,7 @@ sub handle_login { > } > else { $status = login_core($server,$uid,$pwd); } > >- $self->write_msg(LOGIN_RESP . $status,undef,$server->{account}->{terminator}); >+ $self->write_msg(LOGIN_RESP . $status,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > return $status ? LOGIN : ''; > } > >@@ -1019,7 +1019,7 @@ sub handle_patron_info { > } > } > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > return(PATRON_INFO); > } > >@@ -1046,7 +1046,7 @@ sub handle_end_patron_session { > $resp .= maybe_add(FID_SCREEN_MSG, $screen_msg); > $resp .= maybe_add(FID_PRINT_LINE, $print_line); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(END_PATRON_SESSION); > } >@@ -1080,7 +1080,7 @@ sub handle_fee_paid { > $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg); > $resp .= maybe_add(FID_PRINT_LINE, $status->print_line); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(FEE_PAID); > } >@@ -1147,7 +1147,7 @@ sub handle_item_information { > $resp .= maybe_add(FID_PRINT_LINE, $item->print_line); > } > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(ITEM_INFORMATION); > } >@@ -1196,7 +1196,7 @@ sub handle_item_status_update { > $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg); > $resp .= maybe_add(FID_PRINT_LINE, $status->print_line); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(ITEM_STATUS_UPDATE); > } >@@ -1247,7 +1247,7 @@ sub handle_patron_enable { > > $resp .= add_field(FID_INST_ID, $ils->institution); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(PATRON_ENABLE); > } >@@ -1313,7 +1313,7 @@ sub handle_hold { > $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg); > $resp .= maybe_add(FID_PRINT_LINE, $status->print_line); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(HOLD); > } >@@ -1402,7 +1402,7 @@ sub handle_renew { > $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg); > $resp .= maybe_add(FID_PRINT_LINE, $status->print_line); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(RENEW); > } >@@ -1452,7 +1452,7 @@ sub handle_renew_all { > $resp .= maybe_add(FID_SCREEN_MSG, $status->screen_msg); > $resp .= maybe_add(FID_PRINT_LINE, $status->print_line); > >- $self->write_msg($resp,undef,$server->{account}->{terminator}); >+ $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > > return(RENEW_ALL); > } >@@ -1562,7 +1562,7 @@ sub send_acs_status { > > # Do we want to tell the terminal its location? > >- $self->write_msg($msg,undef,$server->{account}->{terminator}); >+ $self->write_msg($msg,undef,$server->{account}->{terminator},$server->{account}->{encoding}); > return 1; > } > >diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml >index bd464e2..6da9c01 100644 >--- a/etc/SIPconfig.xml >+++ b/etc/SIPconfig.xml >@@ -36,8 +36,8 @@ > </listeners> > > <accounts> >- <login id="term1" password="term1" delimiter="|" error-detect="enabled" institution="CPL" /> >- <login id="koha" password="koha" delimiter="|" error-detect="enabled" institution="kohalibrary" /> >+ <login id="term1" password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="" /> >+ <login id="koha" password="koha" delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="" /> > <login id="koha2" password="koha" institution="kohalibrary2" terminator="CR" /> > <login id="lpl-sc" password="1234" institution="LPL" /> > <login id="lpl-sc-beacock" password="xyzzy" >-- >1.8.1.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9865
:
16503
|
22808
|
23760
|
24091
|
24124
|
24127