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 1101-1107 sub handle_patron_info { Link Here
1101
        $resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD, $server );
1101
        $resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD, $server );
1102
    }
1102
    }
1103
1103
1104
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1104
    $self->write_msg( $resp, $server );
1105
    return (PATRON_INFO);
1105
    return (PATRON_INFO);
1106
}
1106
}
1107
1107
Lines 1128-1134 sub handle_end_patron_session { Link Here
1128
    $resp .= maybe_add( FID_SCREEN_MSG, $screen_msg, $server );
1128
    $resp .= maybe_add( FID_SCREEN_MSG, $screen_msg, $server );
1129
    $resp .= maybe_add( FID_PRINT_LINE, $print_line, $server );
1129
    $resp .= maybe_add( FID_PRINT_LINE, $print_line, $server );
1130
1130
1131
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1131
    $self->write_msg( $resp, $server );
1132
1132
1133
    return (END_PATRON_SESSION);
1133
    return (END_PATRON_SESSION);
1134
}
1134
}
Lines 1210-1216 sub handle_fee_paid { Link Here
1210
    $resp .= maybe_add( FID_SCREEN_MSG,     $status->screen_msg, $server );
1210
    $resp .= maybe_add( FID_SCREEN_MSG,     $status->screen_msg, $server );
1211
    $resp .= maybe_add( FID_PRINT_LINE,     $status->print_line, $server );
1211
    $resp .= maybe_add( FID_PRINT_LINE,     $status->print_line, $server );
1212
1212
1213
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1213
    $self->write_msg( $resp, $server );
1214
1214
1215
    return (FEE_PAID);
1215
    return (FEE_PAID);
1216
}
1216
}
Lines 1303-1309 sub handle_item_information { Link Here
1303
        $resp .= $item->build_custom_field_string( $server );
1303
        $resp .= $item->build_custom_field_string( $server );
1304
    }
1304
    }
1305
1305
1306
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1306
    $self->write_msg( $resp, $server );
1307
1307
1308
    return (ITEM_INFORMATION);
1308
    return (ITEM_INFORMATION);
1309
}
1309
}
Lines 1353-1359 sub handle_item_status_update { Link Here
1353
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1353
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1354
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1354
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1355
1355
1356
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1356
    $self->write_msg( $resp, $server );
1357
1357
1358
    return (ITEM_STATUS_UPDATE);
1358
    return (ITEM_STATUS_UPDATE);
1359
}
1359
}
Lines 1407-1413 sub handle_patron_enable { Link Here
1407
1407
1408
    $resp .= add_field( FID_INST_ID, $ils->institution, $server );
1408
    $resp .= add_field( FID_INST_ID, $ils->institution, $server );
1409
1409
1410
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1410
    $self->write_msg( $resp, $server );
1411
1411
1412
    return (PATRON_ENABLE);
1412
    return (PATRON_ENABLE);
1413
}
1413
}
Lines 1472-1478 sub handle_hold { Link Here
1472
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1472
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1473
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1473
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1474
1474
1475
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1475
    $self->write_msg( $resp, $server );
1476
1476
1477
    return (HOLD);
1477
    return (HOLD);
1478
}
1478
}
Lines 1559-1565 sub handle_renew { Link Here
1559
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1559
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1560
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1560
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1561
1561
1562
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1562
    $self->write_msg( $resp, $server );
1563
1563
1564
    return (RENEW);
1564
    return (RENEW);
1565
}
1565
}
Lines 1612-1618 sub handle_renew_all { Link Here
1612
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1612
    $resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
1613
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1613
    $resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
1614
1614
1615
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1615
    $self->write_msg( $resp, $server );
1616
1616
1617
    return (RENEW_ALL);
1617
    return (RENEW_ALL);
1618
}
1618
}
Lines 1718-1724 sub send_acs_status { Link Here
1718
1718
1719
    # Do we want to tell the terminal its location?
1719
    # Do we want to tell the terminal its location?
1720
1720
1721
    $self->write_msg( $msg, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
1721
    $self->write_msg( $msg, $server );
1722
    return 1;
1722
    return 1;
1723
}
1723
}
1724
1724
(-)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