Bug 29902 - While upgrading all empty deleteditems.datelastborrowed turned deleteditems.timestamp to date of upgrade
Summary: While upgrading all empty deleteditems.datelastborrowed turned deleteditems.t...
Status: RESOLVED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (command-line installer) (show other bugs)
Version: 19.05
Hardware: All All
: P5 - low major (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 23081
Blocks:
  Show dependency treegraph
 
Reported: 2022-01-18 18:17 UTC by Wolfgang Moch
Modified: 2023-06-25 11:13 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Moch 2022-01-18 18:17:51 UTC
After upgrading from 19.06 to latest we recognized in our deleted items report a wrong amount of deleted items for 2021.
Digging onto the problem we found, that every dataset in deleteditems with an empty deleteditems.datelastborrowed field, caused a deleteditems.timestamp set to the actual date by overwriting the former content of the field.
We got the former content back by importing additionally the old database so called "koha_library_old" and the follwing SQL request (2021-12-01 was the date of our upgrade)
UPDATE koha_library.deleteditems, koha_library_old.deleteditems SET koha_library.deleteditems.timestamp = koha_library_old.deleteditems.timestamp WHERE koha_library.deleteditems.barcode = koha_library_old.deleteditems.barcode AND koha_library.deleteditems.timestamp LIKE '2021-12-01%';
Comment 1 Fridolin Somers 2022-01-21 21:09:26 UTC
Hi,

Maybe this comes from Bug 23081.
It changes value of deleteditems.issues :

$DBversion = '19.12.00.080';
if( CheckVersion( $DBversion ) ) {
     $dbh->do( "UPDATE items set issues=0 where issues is null" );
     $dbh->do( "UPDATE deleteditems set issues=0 where issues is null" );

This impact on deleteditems.timestamp is an unwanted side effect.

I don't know if it is technically possible to avoid it.
Comment 2 Katrin Fischer 2022-01-21 23:26:17 UTC
It is technically possible if you include the timestamp in the update statement I think, set timestamp = timestamp or something like that. We have had the issue before... just don't remember the bug, it's been a longer while.
Comment 3 Katrin Fischer 2022-03-30 08:24:52 UTC
Wish now I had remembered this one.
Comment 4 Katrin Fischer 2023-06-25 11:13:21 UTC
A little too late to fix this update since the version in question is no longer maintained. Something to keep in mind still for new updates.