@@ -, +, @@ - Removes the attempted retrospective addition of issuers to old issues. - Removes the conversion of a NULL issuer to the anonymous borrowernumber when --- Koha/Patrons.pm | 3 +- .../bug_23916_add_issues_issuer.perl | 32 ------------------- 2 files changed, 1 insertion(+), 34 deletions(-) --- a/Koha/Patrons.pm +++ a/Koha/Patrons.pm @@ -196,8 +196,7 @@ sub anonymise_issue_history { ); my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; $nb_rows += $old_issues_to_anonymise->update( { - 'old_issues.borrowernumber' => $anonymous_patron, - 'old_issues.issuer' => $anonymous_patron + 'old_issues.borrowernumber' => $anonymous_patron } ); } return $nb_rows; --- a/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl +++ a/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl @@ -13,38 +13,6 @@ if( CheckVersion( $DBversion ) ) { $dbh->do( q| ALTER TABLE old_issues ADD CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); } - # Now attempt to migrate previously action logged issues into issues.issuer - # We assume that an item issued to a borrower on the same day is the same issue - # - # Get existing action logs - # - user = issuer - # - object = borrowernumber - # - info = itemnumber - my $action_logs = $dbh->selectall_arrayref("SELECT DATE(timestamp) AS dt, user, object, info FROM action_logs WHERE module='CIRCULATION' and action='ISSUE'", { Slice => {} }); - - foreach my $log( @{$action_logs} ) { - # Look for an issue of this item, to this borrower, on this day - # We're doing DATE comparison in the database to avoid invoking - # DateTime and it's performance sapping ways... - # - # If we're dealing with an actual borrower - if ($log->{user} != 0) { - my $done_issue = $dbh->do( - "UPDATE issues SET issuer = ? WHERE DATE(timestamp) = ? AND borrowernumber = ? AND itemnumber = ?", - undef, - ( $log->{user}, $log->{dt}, $log->{object}, $log->{info} ) - ); - # If we didn't find the issue in 'issues', look in 'old_issues' - if (!$done_issue) { - $dbh->do( - "UPDATE old_issues SET issuer = ? WHERE DATE(timestamp) = ? AND borrowernumber = ? AND itemnumber = ?", - undef, - ( $log->{user}, $log->{dt}, $log->{object}, $log->{info} ) - ); - } - } - } - SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 23916 - Add issues.issuer)\n"; } --