Bug 32456

Summary: Date accessioned is now cleared when items are replaced
Product: Koha Reporter: Nick Clemens <nick>
Component: ToolsAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, Laura.escamilla, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.02,22.05.09
Bug Depends on: 29958    
Bug Blocks:    
Attachments: Bug 32456: Preserve date accessioned if a date is not explicitly passed
Bug 32456: Preserve date accessioned if a date is not explicitly passed
Bug 32456: Preserve date accessioned if a date is not explicitly passed
Bug 32456: Unit tests
Bug 32456: Preserve date accessioned if a date is not explicitly passed
Bug 32456: Unit tests
Bug 32456: Preserve date accessioned if a date is not explicitly passed
Bug 32456: Preserve date accessioned if a date is not explicitly passed

Description Nick Clemens 2022-12-13 14:23:56 UTC
Bug 29958 changed item edits so that a blank date accessioned would not auto populate. This broke workflows for libraries who have vendors processing their item records. 

When a library imports the final records, the date accessioned is not included, as the vendor doesn't know the date, and existing date is now blanked.

I believe we should preserve the date accessioned unless the file includes a new one.
Comment 1 Nick Clemens 2022-12-13 14:27:22 UTC
Created attachment 144553 [details] [review]
Bug 32456: Preserve date accessioned if a date is not explicitly passed

To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field
Comment 2 Andrew Fuerste-Henry 2022-12-14 20:21:41 UTC
Created attachment 144593 [details] [review]
Bug 32456: Preserve date accessioned if a date is not explicitly passed

To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 3 Martin Renvoize 2022-12-16 07:37:48 UTC
Created attachment 144637 [details] [review]
Bug 32456: Preserve date accessioned if a date is not explicitly passed

To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2022-12-16 07:39:22 UTC
This works as described and I believe resolves a regression without causing further issues with the feature that introduced the regression.

I'd love to see a Unit Test though so we don't risk regressing again?
Comment 5 Nick Clemens 2022-12-16 15:48:23 UTC
Created attachment 144692 [details] [review]
Bug 32456: Unit tests
Comment 6 Nick Clemens 2022-12-16 15:48:27 UTC
Created attachment 144693 [details] [review]
Bug 32456: Preserve date accessioned if a date is not explicitly passed

To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2022-12-20 14:54:54 UTC
Created attachment 144740 [details] [review]
Bug 32456: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2022-12-20 14:54:58 UTC
Created attachment 144741 [details] [review]
Bug 32456: Preserve date accessioned if a date is not explicitly passed

To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2022-12-20 14:55:26 UTC
Works well, resolves the regression.

Passing QA
Comment 10 Tomás Cohen Arazi 2022-12-27 13:48:06 UTC
Created attachment 144851 [details] [review]
Bug 32456: Preserve date accessioned if a date is not explicitly passed

To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 11 Tomás Cohen Arazi 2022-12-27 14:09:39 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 12 Jacob O'Mara 2023-01-13 11:55:46 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 13 Lucas Gass 2023-01-19 23:56:07 UTC
Backported to 22.05.x for upcoming 22.05.09
Comment 14 Arthur Suzuki 2023-01-26 11:10:30 UTC
patch conflicts + new tests are failing on 21.11.x.
won't backport.
Comment 15 Lisette Scheer 2023-03-30 21:46:39 UTC
*** Bug 32451 has been marked as a duplicate of this bug. ***