@@ -, +, @@ --- .../data/mysql/atomicupdate/bug_22809.perl | 61 +++++++++++++++++++ .../mysql/en/mandatory/sample_notices.sql | 55 +++++++++++++++++ .../prog/en/modules/members/printinvoice.tt | 54 +--------------- members/printinvoice.pl | 22 +++++-- 4 files changed, 133 insertions(+), 59 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_22809.perl --- a/installer/data/mysql/atomicupdate/bug_22809.perl +++ a/installer/data/mysql/atomicupdate/bug_22809.perl @@ -0,0 +1,61 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ +INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES +('circulation', 'ACCOUNT_DEBIT', '', 'Account fee', 0, 'Account fee', ' + [% IF ( LibraryName ) %] + + + + [% END %] + + + + + + + + + + + + + + + + + + + [% FOREACH account IN accounts %] + + + + + [% IF ( account.amountcredit ) %] + [% IF ( account.amountoutstandingcredit ) %] + + [% END %] + + + + + [% IF ( totalcredit ) %] + + +
+

[% LibraryName | html %]

+
+

INVOICE

+
+

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

+
+ Bill to: [% patron.firstname | html %] [% patron.surname | html %]
+ Card number: [% patron.cardnumber | html %]
+
DateDescription of chargesNoteAmountAmount outstanding
[% account.date | $KohaDates%] + [% PROCESS account_type_description account=account %] + [%- IF account.description %], [% account.description | html %][% END %] + [% account.note | html %][% ELSE %][% END %][% account.amount | $Price %][% ELSE %][% END %][% account.amountoutstanding | $Price %]
Total outstanding dues as on date: [% ELSE %][% END %][% total | $Price %]
', 'print', 'default'); + }); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; +} --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ a/installer/data/mysql/en/mandatory/sample_notices.sql @@ -233,5 +233,60 @@ INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title` ', 'print', 'default'); +INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES +('circulation', 'ACCOUNT_DEBIT', '', 'Account fee', 0, 'Account fee', ' + [% IF ( LibraryName ) %] + + + + [% END %] + + + + + + + + + + + + + + + + + + + [% FOREACH account IN accounts %] + + + + + [% IF ( account.amountcredit ) %] + [% IF ( account.amountoutstandingcredit ) %] + + [% END %] + + + + + [% IF ( totalcredit ) %] + + +
+

[% LibraryName | html %]

+
+

INVOICE

+
+

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

+
+ Bill to: [% patron.firstname | html %] [% patron.surname | html %]
+ Card number: [% patron.cardnumber | html %]
+
DateDescription of chargesNoteAmountAmount outstanding
[% account.date | $KohaDates%] + [% PROCESS account_type_description account=account %] + [%- IF account.description %], [% account.description | html %][% END %] + [% account.note | html %][% ELSE %][% END %][% account.amount | $Price %][% ELSE %][% END %][% account.amountoutstanding | $Price %]
Total outstanding dues as on date: [% ELSE %][% END %][% total | $Price %]
', 'print', 'default'); + INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES ('circulation', 'SR_SLIP', '', 'Stock rotation slip', 0, 'Stock rotation report', 'Stock rotation report for [% branch.name %]:\r\n\r\n[% IF branch.items.size %][% branch.items.size %] items to be processed for this branch.\r\n[% ELSE %]No items to be processed for this branch\r\n[% END %][% FOREACH item IN branch.items %][% IF item.reason != \'in-demand\' %]Title: [% item.title %]\r\nAuthor: [% item.author %]\r\nCallnumber: [% item.callnumber %]\r\nLocation: [% item.location %]\r\nBarcode: [% item.barcode %]\r\nOn loan?: [% item.onloan %]\r\nStatus: [% item.reason %]\r\nCurrent library: [% item.branch.branchname %] [% item.branch.branchcode %]\r\n\r\n[% END %][% END %]', 'email'); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt @@ -17,59 +17,7 @@
- - -[% IF ( LibraryName ) %] - - - -[% END %] - - - - - - - - - - - - - - - - - - [% FOREACH account IN accounts %] - - - - - [% IF ( account.amountcredit ) %] - [% IF ( account.amountoutstandingcredit ) %] - - - [% END %] - - - - [% IF ( totalcredit ) %] - - -
-

[% LibraryName | html %]

-
-

INVOICE

-
-

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

-
- Bill to: [% patron.firstname | html %] [% patron.surname | html %]
- Card number: [% patron.cardnumber | html %]
-
DateDescription of chargesNoteAmountAmount outstanding
[% account.date | $KohaDates%] - [% PROCESS account_type_description account=account %] - [%- IF account.description %], [% account.description | html %][% END %] - [% account.note | html %][% ELSE %][% END %][% account.amount | $Price %][% ELSE %][% END %][% account.amountoutstanding | $Price %]
Total outstanding dues as on date: [% ELSE %][% END %][% total | $Price %]
+ [% letter.content | evaltt %]
[% MACRO jsinclude BLOCK %] --- a/members/printinvoice.pl +++ a/members/printinvoice.pl @@ -55,7 +55,8 @@ output_and_exit_if_error( $input, $cookie, $template, { module => 'members', log #get account details my $total = $patron->account->balance; -my $accountline = Koha::Account::Lines->find($accountlines_id)->unblessed; +my $accountline_object = Koha::Account::Lines->find($accountlines_id); +my $accountline = $accountline_object->unblessed; my $totalcredit; if ( $total <= 0 ) { @@ -85,12 +86,21 @@ my %row = ( 'note' => $accountline->{'note'}, ); +my @account_offsets = Koha::Account::Offsets->search( { debit_id => $accountline_object->id } ); + +my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_DEBIT', C4::Context::mybranch, 'print', $patron->lang ); + $template->param( - patron => $patron, - finesview => 1, - total => sprintf( "%.2f", $total ), - totalcredit => $totalcredit, - accounts => [$accountline], # FIXME There is always only 1 row! + letter => $letter, + patron => $patron, + library => C4::Context::mybranch, + offsets => \@account_offsets, + debit => $accountline_object, + + finesview => 1, + total => sprintf( "%.2f", $total ), + totalcredit => $totalcredit, + accounts => [$accountline], # FIXME There is always only 1 row! ); output_html_with_http_headers $input, $cookie, $template->output; --