Line 0
Link Here
|
0 |
- |
1 |
$DBversion = 'XXX'; |
|
|
2 |
if( CheckVersion( $DBversion ) ) { |
3 |
|
4 |
# ACCOUNT_CREDIT UPDATES |
5 |
# replace patron variable with credit.patron |
6 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% patron', '[% credit.patron') WHERE code = 'ACCOUNT_CREDIT' "); |
7 |
# replace library variable with credit.library.branchname |
8 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% library', '[% credit.library.branchname') WHERE code = 'ACCOUNT_CREDIT' "); |
9 |
|
10 |
# replace offsets variable with credit.offsets |
11 |
$dbh->do("UPDATE letter SET content = REPLACE(content, ' offsets %]', ' credit.offsets %]') WHERE code = 'ACCOUNT_CREDIT' "); |
12 |
# replace change_given variable with change |
13 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% change_given', '[% change') WHERE code = 'ACCOUNT_CREDIT' "); |
14 |
|
15 |
# replace accounts foreach with basic check |
16 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% FOREACH account IN accounts %]', '[% IF credit %]') WHERE code = 'ACCOUNT_CREDIT' "); |
17 |
# replace account with credit |
18 |
$dbh->do("UPDATE letter SET content = REPLACE(content, 'account.', 'credit.') WHERE code = 'ACCOUNT_CREDIT' "); |
19 |
# replace amountcredit with amount >= 0 |
20 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '( credit.amountcredit )', '( credit.amount <= 0 )') WHERE code = 'ACCOUNT_CREDIT' "); |
21 |
|
22 |
# ACCOUNT_DEBIT UPDATES |
23 |
# replace patron variable with debit.patron |
24 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% patron', '[% debit.patron') WHERE code = 'ACCOUNT_DEBIT' "); |
25 |
# replace library variable with debit.library.branchname |
26 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% library', '[% debit.library.branchname') WHERE code = 'ACCOUNT_DEBIT' "); |
27 |
# replace offsets variable with debit.offsets |
28 |
$dbh->do("UPDATE letter SET content = REPLACE(content, ' offsets %]', ' debit.offsets %]') WHERE code = 'ACCOUNT_DEBIT' "); |
29 |
|
30 |
# replace accounts foreach with basic check |
31 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% FOREACH account IN accounts %]', '[% IF debit %]') WHERE code = 'ACCOUNT_DEBIT' "); |
32 |
# replace account with debit |
33 |
$dbh->do("UPDATE letter SET content = REPLACE(content, 'account.', 'debit.') WHERE code = 'ACCOUNT_DEBIT' "); |
34 |
# replace amountcredit with amount >= 0 |
35 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '( debit.amountcredit )', '( debit.amount <= 0 )') WHERE code = 'ACCOUNT_DEBIT' "); |
36 |
# replace amountoutstandingcredit with amount >= 0 |
37 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '( debit.amountoutstandingcredit )', '( debit.amountoutstanding <= 0 )') WHERE code = 'ACCOUNT_DEBIT' "); |
38 |
|
39 |
# replace total variable with debit.patron.account.balance |
40 |
$dbh->do("UPDATE letter SET content = REPLACE(content, '[% total ', '[% debit.patron.account.balance ') WHERE code = 'ACCOUNT_DEBIT' "); |
41 |
# replace totalcredit variable with debit.patron.account.balance <= 0 |
42 |
$dbh->do("UPDATE letter SET content = REPLACE(content, 'totalcredit', 'debit.patron.account.balance <= 0') WHERE code = 'ACCOUNT_DEBIT' "); |
43 |
|
44 |
NewVersion( $DBversion, 26734, "Update notices to use standard variables"); |
45 |
} |