Bug 20971

Summary: Corrupted storable string breaks SubfieldsToUseWhenPrefill functionality
Product: Koha Reporter: paxed <pasi.kallinen>
Component: CatalogingAssignee: paxed <pasi.kallinen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: black23, caroline.cyr-la-rose, didier.gautheron, fridolin.somers, hayleypelham, m.de.rooy, wizzyrea
Version: MainKeywords: Academy
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14844
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.02
Attachments: Perl script to demonstrate uri (un)escape problem and base64url correctness
Bug 20971: additem Corrupted storable string
Bug 20971: additem Corrupted storable string
Bug 20971: additem Corrupted storable string
Bug 20971: Prevent Storable::thaw to fail on LastCreatedItem

Description paxed 2018-06-21 08:25:08 UTC
Sometimes additem.pl will complain about "Storable::thaw failed to thaw LastCreatedItem-cookie.", see bug 14844. Now, actually fix the bug.
    
The bug is caused by trying to URI (un)escape MARC::Record, binary data.
We'll use a base64 url-safe version instead.
Comment 1 paxed 2018-06-21 08:26:47 UTC
Created attachment 76223 [details]
Perl script to demonstrate uri (un)escape problem and base64url correctness
Comment 2 paxed 2018-06-21 08:28:33 UTC
Created attachment 76224 [details] [review]
Bug 20971: additem Corrupted storable string

Sometimes additem.pl will complain about "Storable::thaw failed to
thaw LastCreatedItem-cookie.", see bug 14844. Now, actually fix the bug.

The bug is caused by trying to URI (un)escape MARC::Record, binary data.
We'll use a base64 url-safe version instead.
Comment 3 Michal Denar 2018-09-22 19:06:30 UTC
Hi,
some test plan?

Thanks

Mike
Comment 4 Hayley Pelham 2019-03-08 01:51:44 UTC
Bump, any test plan to follow for this?
Comment 5 Liz Rea 2019-04-30 00:45:53 UTC
Hi,

We can't test this without a plan, please provide one. :)

Cheers,
Liz
Comment 6 Didier Gautheron 2020-09-08 13:56:36 UTC
Hi

Without this patch  PrefillItem functionality is broken when adding unrelated items.

TEST:
1: Set PrefillItem to 'The new item is prefilled...'
2: Set a SubfieldsToUseWhenPrefill, 'c' for example
3: Add a new item for biblio A with 'c' set.
4: Double check 'c' value is set for next new item A.
5: search and add a new item for biblio B
6: 'c' is not set
Apply patch
7: logout, login
8: repeat steps 3, 4, and 5 .
9: now 'c' is set.
Comment 7 James O'Keeffe 2021-01-18 23:13:47 UTC
Created attachment 115257 [details] [review]
Bug 20971: additem Corrupted storable string

Sometimes additem.pl will complain about "Storable::thaw failed to
thaw LastCreatedItem-cookie.", see bug 14844. Now, actually fix the bug.

The bug is caused by trying to URI (un)escape MARC::Record, binary data.
We'll use a base64 url-safe version instead.

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>
Signed-off-by: James O'Keeffe <jamespfk@gmail.com>
Comment 8 Katrin Fischer 2021-01-18 23:26:23 UTC
We've recently also run into this in a workshop - glad to find a fix here!
Comment 9 Katrin Fischer 2021-01-18 23:26:58 UTC
Created attachment 115260 [details] [review]
Bug 20971: additem Corrupted storable string

Sometimes additem.pl will complain about "Storable::thaw failed to
thaw LastCreatedItem-cookie.", see bug 14844. Now, actually fix the bug.

The bug is caused by trying to URI (un)escape MARC::Record, binary data.
We'll use a base64 url-safe version instead.

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>
Signed-off-by: James O'Keeffe <jamespfk@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2021-01-18 23:27:17 UTC
Thank you, James!
Comment 11 Jonathan Druart 2021-01-19 15:02:55 UTC
Created attachment 115332 [details] [review]
Bug 20971: Prevent Storable::thaw to fail on LastCreatedItem

Sometimes additem.pl will complain about "Storable::thaw failed to
thaw LastCreatedItem-cookie.", see bug 14844. Now, actually fix the bug.

The bug is caused by trying to URI (un)escape MARC::Record, binary data.
We'll use a base64 url-safe version instead.

Test plan:
1: Set PrefillItem to 'The new item is prefilled...'
2: Set a SubfieldsToUseWhenPrefill, 'c' for example
3: Add a new item for biblio A with 'c' set.
4: Double check 'c' value is set for next new item A.
5: search and add a new item for biblio B
6: 'c' is not set
Apply patch
7: logout, login
8: repeat steps 3, 4, and 5 .
9: now 'c' is set.

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>
Signed-off-by: James O'Keeffe <jamespfk@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: fix commit title and add test plan
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Jonathan Druart 2021-01-19 15:24:05 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 13 Fridolin Somers 2021-01-20 09:04:17 UTC
Pushed to 20.11.x for 20.11.02