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

(-)a/C4/SIP/Sip.pm (-10 / +9 lines)
Lines 187-197 sub boolspace { Link Here
187
#
187
#
188
188
189
sub write_msg {
189
sub write_msg {
190
    my ($self, $msg, $file, $terminator, $encoding) = @_;
190
    my ($self, $msg, $server) = @_;
191
    my $terminator = $server->{account}->{terminator};
192
    my $encoding = $server->{account}->{encoding};
191
193
192
    $terminator ||= q{};
194
    $terminator ||= q{};
193
    $terminator = ( $terminator eq 'CR' ) ? $CR : $CRLF;
195
    $terminator = ( $terminator eq 'CR' ) ? $CR : $CRLF;
194
196
197
    my $separator = $server->{account}->{convert_nonprinting_characters};
198
    $msg =~ s/[^[:print:]]/$separator/g if defined $separator;
199
195
    $msg = encode($encoding, $msg) if ( $encoding );
200
    $msg = encode($encoding, $msg) if ( $encoding );
196
201
197
    my $cksum;
202
    my $cksum;
Lines 206-220 sub write_msg { Link Here
206
        $msg .= sprintf('%04.4X', $cksum);
211
        $msg .= sprintf('%04.4X', $cksum);
207
    }
212
    }
208
213
209
214
    STDOUT->autoflush(1);
210
    if ($file) {
215
    print $msg, $terminator;
211
        $file->autoflush(1);
216
    siplog("LOG_INFO", "OUTPUT MSG: '$msg'");
212
        print $file $msg, $terminator;
213
    } else {
214
        STDOUT->autoflush(1);
215
        print $msg, $terminator;
216
        siplog("LOG_INFO", "OUTPUT MSG: '$msg'");
217
    }
218
217
219
    $last_response = $msg;
218
    $last_response = $msg;
220
}
219
}
(-)a/C4/SIP/Sip/MsgType.pm (-17 / +17 lines)
Lines 509-515 sub handle_patron_status { Link Here
509
        $koha_patron->update_lastseen('connection');
509
        $koha_patron->update_lastseen('connection');
510
    }
510
    }
511
    $resp = build_patron_status( $patron, $lang, $fields, $server );
511
    $resp = build_patron_status( $patron, $lang, $fields, $server );
512
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
512
    $self->write_msg( $resp, $server );
513
    return (PATRON_STATUS_REQ);
513
    return (PATRON_STATUS_REQ);
514
}
514
}
515
515
Lines 649-655 sub handle_checkout { Link Here
649
        }
649
        }
650
    }
650
    }
651
651
652
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
652
    $self->write_msg( $resp, $server );
653
    return (CHECKOUT);
653
    return (CHECKOUT);
654
}
654
}
655
655
Lines 748-754 sub handle_checkin { Link Here
748
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
748
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
749
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
749
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
750
750
751
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
751
    $self->write_msg( $resp, $server );
752
752
753
    return (CHECKIN);
753
    return (CHECKIN);
754
}
754
}
Lines 795-801 sub handle_block_patron { Link Here
795
    }
795
    }
796
796
797
    $resp = build_patron_status( $patron, $patron->language, $fields, $server );
797
    $resp = build_patron_status( $patron, $patron->language, $fields, $server );
798
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
798
    $self->write_msg( $resp, $server );
799
    return (BLOCK_PATRON);
799
    return (BLOCK_PATRON);
800
}
800
}
801
801
Lines 836-842 sub handle_request_acs_resend { Link Here
836
836
837
        # We haven't sent anything yet, so respond with a
837
        # We haven't sent anything yet, so respond with a
838
        # REQUEST_SC_RESEND msg (p. 16)
838
        # REQUEST_SC_RESEND msg (p. 16)
839
        $self->write_msg( REQUEST_SC_RESEND, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
839
        $self->write_msg( REQUEST_SC_RESEND, $server );
840
    } elsif ( ( length($last_response) < 9 )
840
    } elsif ( ( length($last_response) < 9 )
841
        || substr( $last_response, -9, 2 ) ne 'AY' ) {
841
        || substr( $last_response, -9, 2 ) ne 'AY' ) {
842
842
Lines 850-856 sub handle_request_acs_resend { Link Here
850
        # Cut out the sequence number and checksum, since the old
850
        # Cut out the sequence number and checksum, since the old
851
        # checksum is wrong for the resent message.
851
        # checksum is wrong for the resent message.
852
        my $rebuilt = substr( $last_response, 0, -9 );
852
        my $rebuilt = substr( $last_response, 0, -9 );
853
        $self->write_msg( $rebuilt, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
853
        $self->write_msg( $rebuilt, $server );
854
    }
854
    }
855
855
856
    return REQUEST_ACS_RESEND;
856
    return REQUEST_ACS_RESEND;
Lines 932-938 sub handle_login { Link Here
932
        $status = login_core( $server, $uid, $pwd );
932
        $status = login_core( $server, $uid, $pwd );
933
    }
933
    }
934
934
935
    $self->write_msg( LOGIN_RESP . $status, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
935
    $self->write_msg( LOGIN_RESP . $status, $server );
936
    return $status ? LOGIN : '';
936
    return $status ? LOGIN : '';
937
}
937
}
938
938
Lines 1110-1116 sub handle_patron_info { Link Here
1110
        $resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD, $server );
1110
        $resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD, $server );
1111
    }
1111
    }
1112
1112
1113
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1113
    $self->write_msg( $resp, $server );
1114
    return (PATRON_INFO);
1114
    return (PATRON_INFO);
1115
}
1115
}
1116
1116
Lines 1137-1143 sub handle_end_patron_session { Link Here
1137
    $resp .= maybe_add( FID_SCREEN_MSG, $screen_msg, $server );
1137
    $resp .= maybe_add( FID_SCREEN_MSG, $screen_msg, $server );
1138
    $resp .= maybe_add( FID_PRINT_LINE, $print_line, $server );
1138
    $resp .= maybe_add( FID_PRINT_LINE, $print_line, $server );
1139
1139
1140
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1140
    $self->write_msg( $resp, $server );
1141
1141
1142
    return (END_PATRON_SESSION);
1142
    return (END_PATRON_SESSION);
1143
}
1143
}
Lines 1219-1225 sub handle_fee_paid { Link Here
1219
    $resp .= maybe_add( FID_SCREEN_MSG,     $status->screen_msg, $server );
1219
    $resp .= maybe_add( FID_SCREEN_MSG,     $status->screen_msg, $server );
1220
    $resp .= maybe_add( FID_PRINT_LINE,     $status->print_line, $server );
1220
    $resp .= maybe_add( FID_PRINT_LINE,     $status->print_line, $server );
1221
1221
1222
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1222
    $self->write_msg( $resp, $server );
1223
1223
1224
    return (FEE_PAID);
1224
    return (FEE_PAID);
1225
}
1225
}
Lines 1312-1318 sub handle_item_information { Link Here
1312
        $resp .= $item->build_custom_field_string( $server );
1312
        $resp .= $item->build_custom_field_string( $server );
1313
    }
1313
    }
1314
1314
1315
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1315
    $self->write_msg( $resp, $server );
1316
1316
1317
    return (ITEM_INFORMATION);
1317
    return (ITEM_INFORMATION);
1318
}
1318
}
Lines 1362-1368 sub handle_item_status_update { Link Here
1362
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1362
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1363
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1363
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1364
1364
1365
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1365
    $self->write_msg( $resp, $server );
1366
1366
1367
    return (ITEM_STATUS_UPDATE);
1367
    return (ITEM_STATUS_UPDATE);
1368
}
1368
}
Lines 1416-1422 sub handle_patron_enable { Link Here
1416
1416
1417
    $resp .= add_field( FID_INST_ID, $ils->institution, $server );
1417
    $resp .= add_field( FID_INST_ID, $ils->institution, $server );
1418
1418
1419
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1419
    $self->write_msg( $resp, $server );
1420
1420
1421
    return (PATRON_ENABLE);
1421
    return (PATRON_ENABLE);
1422
}
1422
}
Lines 1481-1487 sub handle_hold { Link Here
1481
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1481
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1482
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1482
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1483
1483
1484
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1484
    $self->write_msg( $resp, $server );
1485
1485
1486
    return (HOLD);
1486
    return (HOLD);
1487
}
1487
}
Lines 1568-1574 sub handle_renew { Link Here
1568
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1568
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1569
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1569
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1570
1570
1571
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1571
    $self->write_msg( $resp, $server );
1572
1572
1573
    return (RENEW);
1573
    return (RENEW);
1574
}
1574
}
Lines 1621-1627 sub handle_renew_all { Link Here
1621
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1621
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1622
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1622
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1623
1623
1624
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1624
    $self->write_msg( $resp, $server );
1625
1625
1626
    return (RENEW_ALL);
1626
    return (RENEW_ALL);
1627
}
1627
}
Lines 1727-1733 sub send_acs_status { Link Here
1727
1727
1728
    # Do we want to tell the terminal its location?
1728
    # Do we want to tell the terminal its location?
1729
1729
1730
    $self->write_msg( $msg, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1730
    $self->write_msg( $msg, $server );
1731
    return 1;
1731
    return 1;
1732
}
1732
}
1733
1733
(-)a/etc/SIPconfig.xml (-1 / +2 lines)
Lines 59-64 Link Here
59
      <login id="lpl-sc" password="1234" institution="LPL" allow_fields="AO,AA,AE"/>
59
      <login id="lpl-sc" password="1234" institution="LPL" allow_fields="AO,AA,AE"/>
60
      <!-- allow_fields hides all fields not in the list, it is the inverse of hide_fields ( hide_fields takes precedence ) -->
60
      <!-- allow_fields hides all fields not in the list, it is the inverse of hide_fields ( hide_fields takes precedence ) -->
61
      <login id="lpl-sc-beacock" password="xyzzy"
61
      <login id="lpl-sc-beacock" password="xyzzy"
62
             convert_nonprinting_characters=" "
62
             delimiter="|" error-detect="enabled" institution="LPL"
63
             delimiter="|" error-detect="enabled" institution="LPL"
63
             send_patron_home_library_in_af="1"
64
             send_patron_home_library_in_af="1"
64
             cv_send_00_on_success="1"
65
             cv_send_00_on_success="1"
Lines 84-89 Link Here
84
             lost_status_for_missing="4"
85
             lost_status_for_missing="4"
85
             blocked_item_types="VM|MU"
86
             blocked_item_types="VM|MU"
86
             seen_on_item_information="mark_found"> <!-- could be "keep_lost", empty to disable -->
87
             seen_on_item_information="mark_found"> <!-- could be "keep_lost", empty to disable -->
88
             <!-- convert_nonprinting_characters: Convert control and non-space separator characters into the givens string -->
87
             <!-- show_checkin_message: If enabled, successful checking responses will contain an AF screen message -->
89
             <!-- show_checkin_message: If enabled, successful checking responses will contain an AF screen message -->
88
             <!-- lost_block_checkout sets flag if patron has more than the given current checkouts that are lost ( itemlost > 0 by default ) -->
90
             <!-- lost_block_checkout sets flag if patron has more than the given current checkouts that are lost ( itemlost > 0 by default ) -->
89
             <!-- lost_block_checkout_value determines the minimum lost item value to count ( that is, the value in items.itemlost ) -->
91
             <!-- lost_block_checkout_value determines the minimum lost item value to count ( that is, the value in items.itemlost ) -->
90
- 

Return to bug 37582