Bug 27589 - Error when specifying CR field in SIP Config
Summary: Error when specifying CR field in SIP Config
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on: 21979
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-01 20:36 UTC by Nick Clemens
Modified: 2021-02-17 19:41 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.03


Attachments
Bug 27589: Unit test (1.68 KB, patch)
2021-02-04 12:06 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 27589: Access item fields as hash (1.41 KB, patch)
2021-02-04 12:06 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 27589: Unit test (1.75 KB, patch)
2021-02-04 12:13 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 27589: Unit test (1.75 KB, patch)
2021-02-04 12:46 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 27589: Access item fields as hash (1.48 KB, patch)
2021-02-04 12:46 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 27589: Unit test (1.80 KB, patch)
2021-02-04 13:07 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27589: Access item fields as hash (1.53 KB, patch)
2021-02-04 13:07 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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