From 1b905e4acb4f2884346b65350166ac876c8527ce Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 27 Dec 2022 20:21:15 +0000 Subject: [PATCH] Bug 32537: Add no-block option to SIP cli emulator This patch adds the option to pass a no-block option and use this in checkout/checkin/renew messages To test: 1 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m checkin --item 39999000010831 2 - Confirm out like: SEND: 09N20221227 20183920221227 201839APCPL|AOCPL|AB39999000010831|ACterm1|BIN| (Note the N after 09) 3 - Apply patch 4 - Restart SIP, repeat 1 5 - Confirm still an N 6 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m checkin --item 39999000010831 -n N 7 - Confirm still an N 8 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m checkin --item 39999000010831 -n Y 9 - Confirm the send has a Y after 09 Signed-off-by: David Nind Signed-off-by: Martin Renvoize --- misc/sip_cli_emulator.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/misc/sip_cli_emulator.pl b/misc/sip_cli_emulator.pl index 8336ced436a..441234dd7e4 100755 --- a/misc/sip_cli_emulator.pl +++ b/misc/sip_cli_emulator.pl @@ -54,6 +54,7 @@ my $fee_identifier; my $transaction_id; my $pickup_location; my $hold_mode; +my $no_block; my $terminator = q{}; @@ -83,6 +84,7 @@ GetOptions( "transaction-id=s" => \$transaction_id, "pickup-location=s" => \$pickup_location, "hold-mode=s" => \$hold_mode, + "n|no-block=s" => \$no_block, "t|terminator=s" => \$terminator, @@ -101,6 +103,8 @@ if ( $help exit(); } +$no_block //= 'N'; + $terminator = ( $terminator eq 'CR' ) ? $CR : $CRLF; # Set perl to expect the same record terminator it is sending @@ -174,7 +178,7 @@ my $handlers = { subroutine => \&build_checkout_command_message, parameters => { SC_renewal_policy => 'Y', - no_block => 'N', + no_block => $no_block, transaction_date => $transaction_date, nb_due_date => undef, institution_id => $location_code, @@ -198,7 +202,7 @@ my $handlers = { name => 'Checkin', subroutine => \&build_checkin_command_message, parameters => { - no_block => 'N', + no_block => $no_block, transaction_date => $transaction_date, return_date => $transaction_date, current_location => $location_code, @@ -220,7 +224,7 @@ my $handlers = { subroutine => \&build_renew_command_message, parameters => { third_party_allowed => 'N', - no_block => 'N', + no_block => $no_block, transaction_date => $transaction_date, nb_due_date => undef, institution_id => $location_code, @@ -654,6 +658,7 @@ Options: --transaction-id Transaction id for Fee Paid message, optional --pickup-location Pickup location (branchcode) for Hold message, optional --hold-mode Accepts "+" to add hold or "-" to cancel hold, defaults to + + -n --no-block Accepts "N" for standard operatoin, "Y" for no-block, defaults to "N" -m --message SIP2 message to execute -- 2.39.1