@@ -, +, @@
---
.../data/mysql/atomicupdate/bug_24381.perl | 244 ++++++++++++++++++
1 file changed, 244 insertions(+)
create mode 100644 installer/data/mysql/atomicupdate/bug_24381.perl
--- a/installer/data/mysql/atomicupdate/bug_24381.perl
+++ a/installer/data/mysql/atomicupdate/bug_24381.perl
@@ -0,0 +1,244 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+
+ # ACCOUNT_CREDIT
+ my $account_credit = q{
+ [% PROCESS "accounts.inc" %]
+
+ [% IF ( LibraryName ) %]
+
+
+ [% LibraryName | html %]
+ |
+
+ [% END %]
+ [% IF credit.library %]
+
+
+ [% credit.library.branchname | html %]
+ |
+
+ [% END %]
+
+
+ [% 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 charges |
+ Amount |
+
+ [% FOREACH offset IN credit.credit_offsets %]
+
+ [% PROCESS account_type_description account=offset.debit %] |
+ [% offset.amount * -1 | $Price %] |
+
+ [% END %]
+
+
+ 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%]
Date | Descriptionofcharges | Note | Amount |
[%FOREACHaccountINaccounts%][%account.date|$KohaDates%] | [%PROCESSaccount_type_descriptionaccount=account%][%-IFaccount.description%],[%account.description|html%][%END%] | [%account.note|html%] | [%IF(account.amountcredit)%][%ELSE%][%END%][%account.amount|$Price%][%END%]Totaloutstandingduesasondate:[%IF(totalcredit)%][%ELSE%][%END%][%total|$Price%]
};
+
+ $dbh->do(
+qq{UPDATE letter SET content = $account_credit_new WHERE code = 'ACCOUNT_CREDIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = $account_credit_old;}
+ );
+
+ # ACCOUNT_DEBIT
+ my $account_debit = q{
+ [% PROCESS "accounts.inc" %]
+
+ [% IF ( LibraryName ) %]
+
+
+ [% LibraryName | html %]
+ |
+
+ [% END %]
+ [% IF debit.library %]
+
+
+ [% debit.library.branchname | html %]
+ |
+
+ [% END %]
+
+
+ [% debit.date | $KohaDates %]
+ |
+
+
+ Fee ID: |
+ [% debit.accountlines_id %] |
+
+ [% IF credit.manager_id %]
+
+ Operator ID: |
+ [% credit.manager_id %] |
+
+ [% END %]
+
+
+ Invoice
+ |
+
+
+
+ Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %]
+ Card number: [% debit.patron.cardnumber | html %]
+ |
+
+ [% IF debit.amount != debit.amountoutstanding %]
+
+ Date |
+ Description of payments |
+ Amount |
+
+ [% FOREACH offset IN debit.debit_offsets %]
+
+ [% offset.credit.date | $KohaDates %] |
+ [% PROCESS account_type_description account=offset.credit %] |
+ [% offset.amount * -1 | $Price %] |
+
+ [% END %]
+
+ Total paid: |
+ [% debit.amount - debit.amountoutstanding | $Price %] |
+
+ [% END %]
+
+ |
+
+
+
+ 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%]
Date | Descriptionofcharges | Note | AmountAmountoutstanding
[%FOREACHaccountINaccounts%][%account.date|$KohaDates%] | [%PROCESSaccount_type_descriptionaccount=account%][%-IFaccount.description%],[%account.description|html%][%END%] | [%account.note|html%] | [%IF(account.amountcredit)%][%ELSE%][%END%][%account.amount|$Price%][%IF(account.amountoutstandingcredit)%][%ELSE%][%END%][%account.amountoutstanding|$Price%][%END%]Totaloutstandingduesasondate:[%IF(totalcredit)%][%ELSE%][%END%][%total|$Price%]
};
+
+ $dbh->do(
+qq{UPDATE letter SET content = $account_debit_new WHERE code = 'ACCOUNT_DEBIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = $account_debit_old;}
+ );
+
+ # RECEIPT
+ my $receipt = q{
+ [% PROCESS "accounts.inc" %]
+
+ [% IF ( LibraryName ) %]
+
+
+ [% LibraryName | html %]
+ |
+
+ [% END %]
+ [% IF credit.library %]
+
+
+ [% payment.library.branchname ) | html %]
+ |
+
+ [% END %]
+
+
+ [% payment.date | $KohaDates %]
+ |
+
+
+ Transaction ID: |
+ [% payment.accountlines_id %] |
+
+
+ Operator ID: |
+ [% payment.manager_id %] |
+
+
+ Payment type: |
+ [% payment.payment_type %] |
+
+
+
+ Payment receipt
+ |
+
+
+ Description of charges |
+ Amount |
+
+ [% FOREACH offset IN payment.credit_offsets %]
+
+ [% PROCESS account_type_description account=offset.debit %] |
+ [% offset.amount * -1 | $Price %] |
+
+ [% END %]
+
+
+ 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%]
|
TransactionID: | [%payment.accountlines_id%] |
OperatorID: | [%payment.manager_id%] |
Paymenttype: | [%payment.payment_type%] |
|
Feereceipt
|
|
Descriptionofcharges | Amount |
[%FOREACHoffsetINoffsets%][%PROCESSaccount_type_descriptionaccount=offset.debit%] | [%offset.amount*-1|$Price%] |
[%END%]Total: | [%payment.amount*-1|$Price%] | Tendered: | [%collected|$Price%] |
Change: | [%change|$Price%] |
};
+
+ $dbh->do(
+qq{UPDATE letter SET content = $receipt WHERE code = 'RECEIPT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = $receipt_old;}
+ );
+
+ NewVersion( $DBversion, 24381, "Update accounts notices" );
+}
--