From 83bf0922cfb9e6224b15a1b5f810fbed341e4dc2 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 29 Jan 2021 08:47:37 +0000 Subject: [PATCH] Bug 27574: Update \NOW() to dt_from_string for Accounts This patch replaces all instances of setting the date/timestamp fields for accounts related tables from the SQL literal \'NOW()' to Koha::DateUtils dt_from_string so we get properly localised dates. --- Koha/Account.pm | 4 ++-- Koha/Account/Line.pm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index b4838bcdf2..4a79adf9e7 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -413,7 +413,7 @@ sub add_credit { $line = Koha::Account::Line->new( { borrowernumber => $self->{patron_id}, - date => \'NOW()', + date => dt_from_string, amount => $amount, description => $description, credit_type_code => $credit_type, @@ -560,7 +560,7 @@ sub add_debit { $line = Koha::Account::Line->new( { borrowernumber => $self->{patron_id}, - date => \'NOW()', + date => dt_from_string, amount => $amount, description => $description, debit_type_code => $debit_type, diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 2cc81993ef..3d37317d13 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -341,7 +341,7 @@ sub cancel { # A 'cancellation' is a 'credit' $cancellation = Koha::Account::Line->new( { - date => \'NOW()', + date => dt_from_string, amount => 0 - $self->amount, credit_type_code => 'CANCELLATION', status => 'ADDED', @@ -465,7 +465,7 @@ sub reduce { # A 'reduction' is a 'credit' $reduction = Koha::Account::Line->new( { - date => \'NOW()', + date => dt_from_string, amount => 0 - $params->{amount}, credit_type_code => $params->{reduction_type}, status => 'ADDED', @@ -687,7 +687,7 @@ sub payout { # A 'payout' is a 'debit' $payout = Koha::Account::Line->new( { - date => \'NOW()', + date => dt_from_string, amount => $amount, debit_type_code => 'PAYOUT', payment_type => $params->{payout_type}, @@ -801,7 +801,7 @@ sub adjust { # Update the account line $self->set( { - date => \'NOW()', + date => dt_from_string, amount => $amount, amountoutstanding => $new_outstanding, } -- 2.20.1