From 25ed7f9d6291e8e6bae00f7c5a0f4935e83e573c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 16 Jul 2020 17:01:50 +0100 Subject: [PATCH] Bug 24381: Update notice params If the update to catch defaults fails, we need to attempt to update renamed template variables Signed-off-by: Kyle M Hall Signed-off-by: Lucas Gass Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_24381.perl | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/installer/data/mysql/atomicupdate/bug_24381.perl b/installer/data/mysql/atomicupdate/bug_24381.perl index 1d4dbb735e..1538d8a3ab 100644 --- a/installer/data/mysql/atomicupdate/bug_24381.perl +++ b/installer/data/mysql/atomicupdate/bug_24381.perl @@ -84,6 +84,14 @@ q{UPDATE letter SET content = ? WHERE code = 'ACCOUNT_CREDIT' AND REPLACE(REPLAC ); $sth->execute( $account_credit, $account_credit_old ); + # replace patron variable with credit.patron + $dbh->do("UPDATE letter SET content = REPLACE(content, '[% patron', '[% credit.patron') WHERE code = 'ACCOUNT_CREDIT' "); + # replace library variable with credit.library.branchname + $dbh->do("UPDATE letter SET content = REPLACE(content, '[% library', '[% credit.library.branchname') WHERE code = 'ACCOUNT_CREDIT' "); + # replace offsets variable with credit.offsets + $dbh->do("UPDATE letter SET content = REPLACE(content, ' offsets %]', ' credit.offsets %]') WHERE code = 'ACCOUNT_CREDIT' "); + # replace change_given variable with change + $dbh->do("UPDATE letter SET content = REPLACE(content, '[% change_given', '[% change') WHERE code = 'ACCOUNT_CREDIT' "); # ACCOUNT_DEBIT my $account_debit = q{ @@ -170,6 +178,17 @@ q{UPDATE letter SET content = ? WHERE code = 'ACCOUNT_DEBIT' AND REPLACE(REPLACE ); $sth->execute($account_debit, $account_debit_old); + # replace patron variable with debit.patron + $dbh->do("UPDATE letter SET content = REPLACE(content, '[% patron', '[% debit.patron') WHERE code = 'ACCOUNT_DEBIT' "); + # replace library variable with debit.library.branchname + $dbh->do("UPDATE letter SET content = REPLACE(content, '[% library', '[% debit.library.branchname') WHERE code = 'ACCOUNT_DEBIT' "); + # replace offsets variable with debit.offsets + $dbh->do("UPDATE letter SET content = REPLACE(content, ' offsets %]', ' debit.offsets %]') WHERE code = 'ACCOUNT_DEBIT' "); + # replace total variable with debit.patron.account.balance + $dbh->do("UPDATE letter SET content = REPLACE(content, '[% total ', '[% debit.patron.account.balance ') WHERE code = 'ACCOUNT_DEBIT' "); + # replace totalcredit variable with debit.patron.account.balance <= 0 + $dbh->do("UPDATE letter SET content = REPLACE(content, 'totalcredit', 'debit.patron.account.balance <= 0') WHERE code = 'ACCOUNT_DEBIT' "); + # RECEIPT my $receipt = q{ [% PROCESS "accounts.inc" %] @@ -244,5 +263,10 @@ q{UPDATE letter SET content = ? WHERE code = 'RECEIPT' AND REPLACE(REPLACE(conte ); $sth->execute($receipt,$receipt_old); + # replace offsets variable with debit.offsets + $dbh->do("UPDATE letter SET content = REPLACE(content, ' offsets %]', ' payment.offsets %]') WHERE code = 'RECEIPT' "); + # replace collected variable with tendered + $dbh->do("UPDATE letter SET content = REPLACE(content, '[% collected', '[% tendered') WHERE code = 'RECEIPT' "); + NewVersion( $DBversion, 24381, "Update accounts notices" ); } -- 2.39.5