Bug 13159

Summary: Enhancements to the SIP2 command line emulator
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: SIP2Assignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: benjamin.rokseth, colin.campbell, f.demians, jonathan.druart, olli-antti.kivilahti, tomascohen, veron
Version: unspecified   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12820
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13411
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13666
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 23883    
Attachments: Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 [QA Followup] - Fix flag parameters
Bug 13159 [QA Followup] - Fix changed namespace for Sip::Constants
Bug 13159 [QA Followup] - Move script back to it's original path
Bug 13159 - Enhancements to the SIP2 command line emulator
Bug 13159 [QA Followup] - Fix flag parameters
Bug 13159 [QA Followup] - Fix changed namespace for Sip::Constants
Bug 13159 [QA Followup] - Move script back to it's original path
Bug 13159 [QA Followup] - Fix transaction_date and undefined warning
Bug 13159 [QA Followup] - Move script back to it's original path
Bug 13159 [QA Followup] - Remove unused call to localtime()

Description Kyle M Hall (khall) 2014-10-29 12:56:37 UTC
I needed to be able to perform checkout operations for testing from the command line. I ended up reengineering the SIP2 command line tester quite a bit.

Enhancements:
* Moved message generation code to subroutines
* Added checkout message support
* Added command line switches for each supported message
* Enabled use of Sip::Constants to keep code DRY and more understandable
* Moved script from misc to C4/SIP
* Designed with an eye towards possibly moving some code to CPAN in the future
Comment 1 Kyle M Hall (khall) 2014-10-29 12:59:14 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall (khall) 2014-10-29 13:54:11 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall (khall) 2014-10-29 15:13:01 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall (khall) 2014-10-29 15:15:51 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall (khall) 2014-10-30 10:51:06 UTC Comment hidden (obsolete)
Comment 6 Kyle M Hall (khall) 2014-10-30 10:52:34 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall (khall) 2014-11-18 13:02:28 UTC Comment hidden (obsolete)
Comment 8 Kyle M Hall (khall) 2014-11-25 14:41:33 UTC Comment hidden (obsolete)
Comment 9 Kyle M Hall (khall) 2014-11-25 15:22:01 UTC Comment hidden (obsolete)
Comment 10 Kyle M Hall (khall) 2015-01-09 11:44:33 UTC Comment hidden (obsolete)
Comment 11 Kyle M Hall (khall) 2015-01-13 14:42:05 UTC Comment hidden (obsolete)
Comment 12 Kyle M Hall (khall) 2015-01-22 12:12:40 UTC Comment hidden (obsolete)
Comment 13 Benjamin Rokseth 2015-02-05 08:50:01 UTC Comment hidden (obsolete)
Comment 14 Jonathan Druart 2015-02-11 10:47:15 UTC
This looks awesome!
I am just wondering why you have moved the script to C4/Sip.
Comment 15 Kyle M Hall (khall) 2015-02-24 14:42:21 UTC
(In reply to Jonathan Druart from comment #14)
> This looks awesome!
> I am just wondering why you have moved the script to C4/Sip.

Because it uses Sip::MsgType

Moving it there means no need to run it with perl -I at the command line.
Comment 16 Kyle M Hall (khall) 2015-02-24 14:59:46 UTC Comment hidden (obsolete)
Comment 17 Kyle M Hall (khall) 2015-03-02 13:33:05 UTC Comment hidden (obsolete)
Comment 18 Kyle M Hall (khall) 2015-03-02 13:33:55 UTC Comment hidden (obsolete)
Comment 19 Benjamin Rokseth 2015-03-03 08:54:13 UTC
Still works as intended, so leaving this bug as Signed off for QA
Comment 20 Olli-Antti Kivilahti 2015-03-03 12:06:28 UTC
Testing SIP2 messages, looking into 3M SIP2.0 manual. MEssages are not standards compliant:

63 && 23:
- Non-standard compliant, has no zero padded month, day and second. Distorts fixed-length fields.
- fields ok


24:
- OK


64:
- OK

No institution ID anywhere??
Will be fixed by 13666.

Silly warning:
Use of uninitialized value $value in concatenation (.) or string at ./sip_cli_emulator.pl line 462, <GEN0> chunk 1.
is ruining my day.


Otherwise works as expected.

Will proceed to fix and provide a followup.
Comment 21 Olli-Antti Kivilahti 2015-03-03 16:24:28 UTC
Created attachment 36419 [details] [review]
Bug 13159 - Enhancements to the SIP2 command line emulator

I needed to be able to perform checkout operations for testing from the
command line. I ended up reengineering the SIP2 command line tester
quite a bit.

Enhancements:
* Moved message generation code to subroutines
* Added support for more messages
* Added command line switches for each supported message
* Enabled use of Sip::Constants to keep code DRY and more understandable
* Moved script from misc to C4/SIP
* Designed with an eye towards possibly moving some code to CPAN in the future
* Also designed to make adding new messages much easier in the future

Test Plan:
1) Apply this patch
2) Look at help via ./C4/SIP/sip_cli_emulator.pl --help
3) Test patron status request and patron information, should work as before
   except you need to pass the command line switche -m <message_name>
4) Test the new checkout option using -m checkout -i <item barcode>

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Worked as advertised, with one warning at renew only:

Trying 'renew'
Use of uninitialized value $value in concatenation (.) or string at ./sip_cli_emulator.pl line 462, <GEN0> chunk 1.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Comment 22 Olli-Antti Kivilahti 2015-03-03 16:24:56 UTC
Created attachment 36420 [details] [review]
Bug 13159 [QA Followup] - Fix flag parameters

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Comment 23 Olli-Antti Kivilahti 2015-03-03 16:25:41 UTC
Created attachment 36421 [details] [review]
Bug 13159 [QA Followup] - Fix changed namespace for Sip::Constants

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Comment 24 Olli-Antti Kivilahti 2015-03-03 16:26:36 UTC
Created attachment 36422 [details] [review]
Bug 13159 [QA Followup] - Move script back to it's original path

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Comment 25 Olli-Antti Kivilahti 2015-03-03 16:27:07 UTC
Created attachment 36423 [details] [review]
Bug 13159 [QA Followup] - Fix transaction_date and undefined warning

cli-client doesnt respect the transaction_date format
  "YYYYMMDDZZZZHHMMSS"
Using timestamp() to generate the proper datetime format.

"String $value undefined"-warning in build_field() fixed.
Comment 26 Benjamin Rokseth 2015-03-03 16:47:21 UTC Comment hidden (obsolete)
Comment 27 Benjamin Rokseth 2015-03-03 16:50:14 UTC
Comment on attachment 36426 [details] [review]
Bug 13159 [QA Followup] - Move script back to it's original path

patched the wrong bug, silly me!
Comment 28 Kyle M Hall (khall) 2015-04-07 14:29:40 UTC
Created attachment 37547 [details] [review]
Bug 13159 [QA Followup] - Remove unused call to localtime()
Comment 29 Colin Campbell 2015-04-17 11:51:41 UTC
NB this is fairly self contained to the emulator should have no effects on other parts of the system - applies cleanly. RM may want to squash these into one patch
Comment 30 Tomás Cohen Arazi (tcohen) 2015-04-22 16:29:20 UTC
Patches pushed to master.

Thanks Kyle!