Bugzilla – Attachment 116666 Details for
Bug 26734
Convert accounts (monetary) notices to use GetPreparedLetter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26734: Update existing notices to new syntax
Bug-26734-Update-existing-notices-to-new-syntax.patch (text/plain), 4.01 KB, created by
Martin Renvoize (ashimema)
on 2021-02-10 12:56:45 UTC
(
hide
)
Description:
Bug 26734: Update existing notices to new syntax
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-10 12:56:45 UTC
Size:
4.01 KB
patch
obsolete
>From 26b75120ae22f0e23cc421e5e4b5461d6cd3e189 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 19 Oct 2020 14:11:11 +0100 >Subject: [PATCH] Bug 26734: Update existing notices to new syntax > >This patch adds a database update to replace existing notice variable >used in ACCOUNT_CREDIT and ACCOUNT_DEBIT notices with the modern >equivilents. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../data/mysql/atomicupdate/bug_26734.perl | 45 +++++++++++++++++++ > 1 file changed, 45 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_26734.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_26734.perl b/installer/data/mysql/atomicupdate/bug_26734.perl >new file mode 100644 >index 0000000000..5ff88aaa87 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_26734.perl >@@ -0,0 +1,45 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ >+ # ACCOUNT_CREDIT UPDATES >+ # 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' "); >+ >+ # replace accounts foreach with basic check >+ $dbh->do("UPDATE letter SET content = REPLACE(content, '[% FOREACH account IN accounts %]', '[% IF credit %]') WHERE code = 'ACCOUNT_CREDIT' "); >+ # replace account with credit >+ $dbh->do("UPDATE letter SET content = REPLACE(content, 'account.', 'credit.') WHERE code = 'ACCOUNT_CREDIT' "); >+ # replace amountcredit with amount >= 0 >+ $dbh->do("UPDATE letter SET content = REPLACE(content, '( credit.amountcredit )', '( credit.amount <= 0 )') WHERE code = 'ACCOUNT_CREDIT' "); >+ >+ # ACCOUNT_DEBIT UPDATES >+ # 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 accounts foreach with basic check >+ $dbh->do("UPDATE letter SET content = REPLACE(content, '[% FOREACH account IN accounts %]', '[% IF debit %]') WHERE code = 'ACCOUNT_DEBIT' "); >+ # replace account with debit >+ $dbh->do("UPDATE letter SET content = REPLACE(content, 'account.', 'debit.') WHERE code = 'ACCOUNT_DEBIT' "); >+ # replace amountcredit with amount >= 0 >+ $dbh->do("UPDATE letter SET content = REPLACE(content, '( debit.amountcredit )', '( debit.amount <= 0 )') WHERE code = 'ACCOUNT_DEBIT' "); >+ # replace amountoutstandingcredit with amount >= 0 >+ $dbh->do("UPDATE letter SET content = REPLACE(content, '( debit.amountoutstandingcredit )', '( debit.amountoutstanding <= 0 )') 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' "); >+ >+ NewVersion( $DBversion, 26734, "Update notices to use standard variables"); >+} >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26734
:
111976
|
111977
|
111978
|
112023
|
112024
|
112025
|
112026
|
116257
|
116259
|
116260
|
116261
|
116262
|
116263
|
116272
|
116275
|
116276
|
116277
|
116278
|
116279
|
116644
|
116645
|
116646
|
116647
|
116648
|
116655
|
116656
|
116657
|
116658
|
116659
|
116663
|
116664
|
116665
|
116666
|
116667
|
117261
|
117262
|
117263
|
117264
|
117265
|
118191
|
118192
|
118193
|
118194
|
118195
|
118196
|
118197
|
118200
|
118482
|
118483
|
118484
|
118485
|
118486
|
118487
|
118488
|
118489
|
119350
|
119351
|
119352
|
119353
|
119354
|
119355
|
119356
|
119357
|
119358
|
119642
|
120077
|
121446
|
121449