Bug 27589

Summary: Error when specifying CR field in SIP Config
Product: Koha Reporter: Nick Clemens <nick>
Component: SIP2Assignee: Nick Clemens <nick>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: andrew, caroline.cyr-la-rose, fridolin.somers, kyle, martin.renvoize
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.03
Bug Depends on: 21979    
Bug Blocks:    
Attachments: Bug 27589: Unit test
Bug 27589: Access item fields as hash
Bug 27589: Unit test
Bug 27589: Unit test
Bug 27589: Access item fields as hash
Bug 27589: Unit test
Bug 27589: Access item fields as hash

Description Nick Clemens 2021-02-01 20:36:29 UTC
Bug 21979 added the ability to define a custom CR field in SIP responses - the code in handle_checkin uses:
$item->{$CR}
but in handle_item_information:
$item->$CR

To recreate:
1 - set cr_item_field to 'itype' In SIP Config
2 - Attempt item_information request
3 - it Fails!
Comment 1 Nick Clemens 2021-02-04 12:06:19 UTC
Created attachment 116311 [details] [review]
Bug 27589: Unit test

Previous tests only covered CHECKIN, this adds a test for ITEM_INFORMATION
Comment 2 Nick Clemens 2021-02-04 12:06:22 UTC
Created attachment 116312 [details] [review]
Bug 27589: Access item fields as hash

SIP item stores the item unblessed so field must be accessed as a hashref

This patch changes the code in handle_item_information to match the code in
handle_checkin

To test:
1 - In sip config set the cr_item_field='itype' for a sip account
2 - Restart SIP
3 - Attempt an item information requests using the sip_cli_emulator
     perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m item_information --item 39999000011791
4 - It fails!
5 - Apply patch and restart
6 - It succeeds!
Comment 3 Kyle M Hall 2021-02-04 12:13:03 UTC
Created attachment 116313 [details] [review]
Bug 27589: Unit test

Previous tests only covered CHECKIN, this adds a test for ITEM_INFORMATION

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Kyle M Hall 2021-02-04 12:46:47 UTC
Created attachment 116315 [details] [review]
Bug 27589: Unit test

Previous tests only covered CHECKIN, this adds a test for ITEM_INFORMATION

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2021-02-04 12:46:55 UTC
Created attachment 116316 [details] [review]
Bug 27589: Access item fields as hash

SIP item stores the item unblessed so field must be accessed as a hashref

This patch changes the code in handle_item_information to match the code in
handle_checkin

To test:
1 - In sip config set the cr_item_field='itype' for a sip account
2 - Restart SIP
3 - Attempt an item information requests using the sip_cli_emulator
     perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m item_information --item 39999000011791
4 - It fails!
5 - Apply patch and restart
6 - It succeeds!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Martin Renvoize 2021-02-04 13:07:36 UTC
Created attachment 116317 [details] [review]
Bug 27589: Unit test

Previous tests only covered CHECKIN, this adds a test for ITEM_INFORMATION

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2021-02-04 13:07:39 UTC
Created attachment 116318 [details] [review]
Bug 27589: Access item fields as hash

SIP item stores the item unblessed so field must be accessed as a hashref

This patch changes the code in handle_item_information to match the code in
handle_checkin

To test:
1 - In sip config set the cr_item_field='itype' for a sip account
2 - Restart SIP
3 - Attempt an item information requests using the sip_cli_emulator
     perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m item_information --item 39999000011791
4 - It fails!
5 - Apply patch and restart
6 - It succeeds!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2021-02-04 13:08:22 UTC
I'm loving that the test coverage for SIP is slowly starting to creep up and we're doing proper TDD here.

Works well, solves the problem with no regressions.

Passing QA!
Comment 9 Jonathan Druart 2021-02-08 13:58:01 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 10 Fridolin Somers 2021-02-12 13:00:26 UTC
Pushed to 20.11.x for 20.11.03
Comment 11 Andrew Fuerste-Henry 2021-02-17 19:41:28 UTC
Missing dependency, not backported to 20.05