From baec57eb8e1124bd204446d059b0a75930ba4c32 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 16 Jul 2020 14:35:43 +0100 Subject: [PATCH] Bug 24381: Update notices if defaults used 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 | 248 ++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_24381.perl diff --git a/installer/data/mysql/atomicupdate/bug_24381.perl b/installer/data/mysql/atomicupdate/bug_24381.perl new file mode 100644 index 0000000000..1d4dbb735e --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24381.perl @@ -0,0 +1,248 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if ( CheckVersion($DBversion) ) { + + # ACCOUNT_CREDIT + my $account_credit = q{ + [% PROCESS "accounts.inc" %] + + [% IF ( LibraryName ) %] + + + + [% END %] + [% IF credit.library %] + + + + [% END %] + + + + + + + + + + + + + + + + + + + + + + + + + + [% FOREACH offset IN credit.credit_offsets %] + + + + + [% END %] + + + + + + + + + + + + + + + + + +
+

[% LibraryName | html %]

+
+

[% credit.library.branchname | html %]

+
+

[% credit.date | $KohaDates %]

+
Transaction ID: [% credit.accountlines_id %]
Operator ID: [% credit.manager_id %]
Payment type: [% credit.payment_type %]
+

Payment receipt

+
+ Received with thanks from [% credit.patron.firstname | html %] [% credit.patron.surname | html %]
+ Card number: [% credit.patron.cardnumber | html %]
+
Description of chargesAmount
[% PROCESS account_type_description account=offset.debit %][% offset.amount * -1 | $Price %]
Total:[% credit.amount * -1 | $Price %]
Change given: [% change | $Price %]
Account balance as on date:[% credit.patron.account.balance * -1 | $Price %]
+ }; + + my $account_credit_old = q{[%IF(LibraryName)%]

[%LibraryName|html%]

[%END%]

Feereceipt

[%Branches.GetName(patron.branchcode)|html%]

Receivedwiththanksfrom[%patron.firstname|html%][%patron.surname|html%]
Cardnumber:[%patron.cardnumber|html%]
[%FOREACHaccountINaccounts%][%IF(account.amountcredit)%][%ELSE%][%END%][%account.amount|$Price%][%END%]Totaloutstandingduesasondate:[%IF(totalcredit)%][%ELSE%][%END%][%total|$Price%]
DateDescriptionofchargesNoteAmount
[%account.date|$KohaDates%][%PROCESSaccount_type_descriptionaccount=account%][%-IFaccount.description%],[%account.description|html%][%END%][%account.note|html%]
}; + + my $sth = $dbh->prepare( +q{UPDATE letter SET content = ? WHERE code = 'ACCOUNT_CREDIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = ?} + ); + $sth->execute( $account_credit, $account_credit_old ); + + + # ACCOUNT_DEBIT + my $account_debit = q{ + [% PROCESS "accounts.inc" %] + + [% IF ( LibraryName ) %] + + + + [% END %] + [% IF debit.library %] + + + + [% END %] + + + + + + + + [% IF credit.manager_id %] + + + + + [% END %] + + + + + + + [% IF debit.amount != debit.amountoutstanding %] + + + + + + [% FOREACH offset IN debit.debit_offsets %] + + + + + + [% END %] + + + + + [% END %] + + + + + + + + + + + + + +
+

[% LibraryName | html %]

+
+

[% debit.library.branchname | html %]

+
+

[% debit.date | $KohaDates %]

+
Fee ID: [% debit.accountlines_id %]
Operator ID: [% credit.manager_id %]
+

Invoice

+
+ Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %]
+ Card number: [% debit.patron.cardnumber | html %]
+
DateDescription of paymentsAmount
[% offset.credit.date | $KohaDates %][% PROCESS account_type_description account=offset.credit %][% offset.amount * -1 | $Price %]
Total paid:[% debit.amount - debit.amountoutstanding | $Price %]
Total owed:[% debit.amount | $Price %]
Total outstanding:[% debit.amountoutstanding | $Price %]
+ }; + + my $account_debit_old = q{[%IF(LibraryName)%]

[%LibraryName|html%]

[%END%]

INVOICE

[%Branches.GetName(patron.branchcode)|html%]

Billto:[%patron.firstname|html%][%patron.surname|html%]
Cardnumber:[%patron.cardnumber|html%]
AmountAmountoutstanding[%FOREACHaccountINaccounts%][%IF(account.amountcredit)%][%ELSE%][%END%][%account.amount|$Price%][%IF(account.amountoutstandingcredit)%][%ELSE%][%END%][%account.amountoutstanding|$Price%][%END%]Totaloutstandingduesasondate:[%IF(totalcredit)%][%ELSE%][%END%][%total|$Price%]
DateDescriptionofchargesNote
[%account.date|$KohaDates%][%PROCESSaccount_type_descriptionaccount=account%][%-IFaccount.description%],[%account.description|html%][%END%][%account.note|html%]
}; + + $sth = $dbh->prepare( +q{UPDATE letter SET content = ? WHERE code = 'ACCOUNT_DEBIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = ?} + ); + $sth->execute($account_debit, $account_debit_old); + + # RECEIPT + my $receipt = q{ + [% PROCESS "accounts.inc" %] + + [% IF ( LibraryName ) %] + + + + [% END %] + [% IF credit.library %] + + + + [% END %] + + + + + + + + + + + + + + + + + + + + + + + [% FOREACH offset IN payment.credit_offsets %] + + + + + [% END %] + + + + + + + + + + + + + + +
+

[% LibraryName | html %]

+
+

[% payment.library.branchname ) | html %]

+
+

[% payment.date | $KohaDates %]

+
Transaction ID: [% payment.accountlines_id %]
Operator ID: [% payment.manager_id %]
Payment type: [% payment.payment_type %]
+

Payment receipt

+
Description of chargesAmount
[% PROCESS account_type_description account=offset.debit %][% offset.amount * -1 | $Price %]
Total:[% payment.amount * -1 | $Price %]
Tendered: [% tendered | $Price %]
Change given:[% change | $Price %]
+ }; + + my $receipt_old = q{[%PROCESS"accounts.inc"%][%IF(LibraryName)%]

[%LibraryName|html%]

[%END%]

[%Branches.GetName(payment.branchcode)|html%]

[%payment.date|$KohaDates%]

Feereceipt

[%FOREACHoffsetINoffsets%][%END%]
TransactionID:[%payment.accountlines_id%]
OperatorID:[%payment.manager_id%]
Paymenttype:[%payment.payment_type%]
DescriptionofchargesAmount
[%PROCESSaccount_type_descriptionaccount=offset.debit%][%offset.amount*-1|$Price%]
Total:[%payment.amount*-1|$Price%]
Tendered:[%collected|$Price%]
Change:[%change|$Price%]
}; + + $sth = $dbh->prepare( +q{UPDATE letter SET content = ? WHERE code = 'RECEIPT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = ? } + ); + $sth->execute($receipt,$receipt_old); + + NewVersion( $DBversion, 24381, "Update accounts notices" ); +} -- 2.39.5