@@ -, +, @@ --- .../bootstrap/en/includes/browser-strings.inc | 34 ++ .../opac-tmpl/bootstrap/en/modules/opac-account.tt | 383 +++++++++++++++-- .../opac-tmpl/bootstrap/images/details_close.png | Bin 0 -> 841 bytes .../opac-tmpl/bootstrap/images/details_open.png | Bin 0 -> 881 bytes .../opac-tmpl/prog/en/includes/browser-strings.inc | 34 ++ .../opac-tmpl/prog/en/modules/opac-account.tt | 445 +++++++++++++++++--- koha-tmpl/opac-tmpl/prog/images/details_close.png | Bin 0 -> 841 bytes koha-tmpl/opac-tmpl/prog/images/details_open.png | Bin 0 -> 881 bytes opac/opac-account.pl | 48 +-- opac/opac-user.pl | 14 +- 10 files changed, 814 insertions(+), 144 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/browser-strings.inc create mode 100644 koha-tmpl/opac-tmpl/bootstrap/images/details_close.png create mode 100644 koha-tmpl/opac-tmpl/bootstrap/images/details_open.png create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/browser-strings.inc create mode 100644 koha-tmpl/opac-tmpl/prog/images/details_close.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/details_open.png --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/browser-strings.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/browser-strings.inc @@ -0,0 +1,34 @@ +[% USE KohaAuthorisedValues %] + --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt @@ -1,9 +1,12 @@ [% USE Koha %] [% USE KohaDates %] +[% USE Currency %] [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your fines and charges [% INCLUDE 'doc-head-close.inc' %] [% BLOCK cssinclude %][% END %] + + [% INCLUDE 'masthead.inc' %] @@ -11,7 +14,7 @@
@@ -25,38 +28,57 @@

Fines and charges

+ [% IF credits || debits %] + +

+

Account balance: [% borrower.account_balance | $Currency %]

+

+ +
+
+ View payments + + + + + + + + + + + + + + + + + +
Fees
IDDescriptionTypeAmountOutsandingCreated onUpdated on
+
- [% IF ( ACCOUNT_LINES ) %] - - - - - - - - - - - - - - - - - - - [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %] - [% IF ( ACCOUNT_LINE.odd ) %][% ELSE %][% END %] - - - [% IF ( ACCOUNT_LINE.amountcredit ) %] - [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %] - - [% END %] - - -
DateDescriptionFine amountAmount outstanding
Total due[% total %]
[% ACCOUNT_LINE.date | $KohaDates %][% ACCOUNT_LINE.description %] - [% IF ( ACCOUNT_LINE.title ) %][% ACCOUNT_LINE.title |html %][% END %][% ELSE %][% END %][% ACCOUNT_LINE.amount %][% ELSE %][% END %][% ACCOUNT_LINE.amountoutstanding %]
+
+ View fees + + + + + + + + + + + + + + + + + +
Payments
IDNotesTypeAmountRemainingCreated onUpdated on
+
+
[% ELSE %]

You have no fines or charges

[% END %] @@ -67,4 +89,299 @@
[% INCLUDE 'opac-bottom.inc' %] -[% BLOCK jsinclude %][% END %] +[% INCLUDE 'datatables.inc' %] + + + +[% BLOCK jsinclude %][% END %] + +[% BLOCK format_data %] + [% FOREACH key IN data.result_source.columns %] + [% IF key.match('^amount') %] + "[% key %]": "[% data.$key FILTER $Currency %]", + [% ELSIF key.match('_on$') %] + "[% key %]": "[% data.$key | $KohaDates %]", + [% ELSE %] + "[% key %]": "[% data.$key %]", + [% END %] + [% END %] +[% END %] --- a/koha-tmpl/opac-tmpl/prog/en/includes/browser-strings.inc +++ a/koha-tmpl/opac-tmpl/prog/en/includes/browser-strings.inc @@ -0,0 +1,34 @@ +[% USE KohaAuthorisedValues %] + --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt @@ -1,76 +1,393 @@ +[% SET accountview = 1 %] + [% USE Koha %] [% USE KohaDates %] +[% USE Currency %] [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your fines and charges [% INCLUDE 'doc-head-close.inc' %]
-
-[% INCLUDE 'masthead.inc' %] - +
+ [% INCLUDE 'masthead.inc' %]
-
-
- - [% FOREACH BORROWER_INF IN BORROWER_INFO %] -

[% BORROWER_INF.firstname %] [% BORROWER_INF.surname %]'s account ⇢ Fines and charges

- [% END %] +
+
+
+

[% borrower.firstname %] [% borrower.surname %]'s account ⇢ Fines and charges

- [% IF ( ACCOUNT_LINES ) %] - - - - - - - - - - - - - - - - - - - [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %] - [% IF ( ACCOUNT_LINE.odd ) %][% ELSE %][% END %] - - - [% IF ( ACCOUNT_LINE.amountcredit ) %] - [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %] - - [% END %] - - -
DateDescriptionFine amountAmount outstanding
Total due[% total %]
[% ACCOUNT_LINE.date | $KohaDates %] - [% SWITCH ACCOUNT_LINE.accounttype %] - [% CASE 'Pay' %]Payment,thanks - [% CASE 'N' %]New Card - [% CASE 'F' %]Fine - [% CASE 'A' %]Account management fee - [% CASE 'M' %]Sundry - [% CASE 'L' %]Lost Item - [% CASE 'W' %]Writeoff - [% CASE %][% ACCOUNT_LINE.accounttype %] - [%- END -%] - [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description %][% END %] - [% IF line.title %]([% line.title |html_entity %])[% END %] - [% ELSE %][% END %][% ACCOUNT_LINE.amount %][% ELSE %][% END %][% ACCOUNT_LINE.amountoutstanding %]
- [% ELSE %] -

You have no fines or charges

- [% END %] -
-
-
-
-
-
-[% INCLUDE 'navigation.inc' IsPatronPage=1 %] -
-
+ [% IF credits || debits %] + +

+

Account balance: [% borrower.account_balance | $Currency %]

+

+ +
+
+ View payments + + + + + + + + + + + + + + + + + +
Fees
IDDescriptionTypeAmountOutsandingCreated onUpdated on
+
+ +
+ View fees + + + + + + + + + + + + + + + + + +
Payments
IDNotesTypeAmountRemainingCreated onUpdated on
+
+
+ [% ELSE %] +

You have no fines or charges

+ [% END %] +
+
+
+
+ +
+
+ [% INCLUDE 'navigation.inc' IsPatronPage=1 %] +
+
[% INCLUDE 'opac-bottom.inc' %] + +[% INCLUDE 'datatables.inc' %] +[% INCLUDE 'browser-strings.inc' %] + + + +[% BLOCK jsinclude %][% END %] + +[% BLOCK format_data %] + [% FOREACH key IN data.result_source.columns %] + [% IF key.match('^amount') %] + "[% key %]": "[% data.$key FILTER $Currency %]", + [% ELSIF key.match('_on$') %] + "[% key %]": "[% data.$key | $KohaDates %]", + [% ELSE %] + "[% key %]": "[% data.$key %]", + [% END %] + [% END %] +[% END %] --- a/opac/opac-account.pl +++ a/opac/opac-account.pl @@ -18,7 +18,6 @@ # with Koha; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - use strict; use CGI; use C4::Members; @@ -30,7 +29,7 @@ use warnings; my $query = new CGI; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { - template_name => "opac-account.tmpl", + template_name => "opac-account.tt", query => $query, type => "opac", authnotrequired => 0, @@ -39,40 +38,21 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); -# get borrower information .... -my $borr = GetMemberDetails( $borrowernumber ); -my @bordat; -$bordat[0] = $borr; - -$template->param( BORROWER_INFO => \@bordat ); - -#get account details -my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber ); - -for ( my $i = 0 ; $i < $numaccts ; $i++ ) { - $accts->[$i]{'amount'} = sprintf( "%.2f", $accts->[$i]{'amount'} || '0.00'); - if ( $accts->[$i]{'amount'} >= 0 ) { - $accts->[$i]{'amountcredit'} = 1; - } - $accts->[$i]{'amountoutstanding'} = - sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} || '0.00' ); - if ( $accts->[$i]{'amountoutstanding'} >= 0 ) { - $accts->[$i]{'amountoutstandingcredit'} = 1; - } -} +my @debits = Koha::Database->new()->schema->resultset('AccountDebit')->search( + { 'me.borrowernumber' => $borrowernumber }, + { prefetch => { account_offsets => 'credit' } } +); -# add the row parity -my $num = 0; -foreach my $row (@$accts) { - $row->{'even'} = 1 if $num % 2 == 0; - $row->{'odd'} = 1 if $num % 2 == 1; - $num++; -} +my @credits = Koha::Database->new()->schema->resultset('AccountCredit')->search( + { 'me.borrowernumber' => $borrowernumber }, + { prefetch => { account_offsets => 'debit' } } +); -$template->param ( - ACCOUNT_LINES => $accts, - total => sprintf( "%.2f", $total ), - accountview => 1 +$template->param( + borrower => GetMemberDetails($borrowernumber), + debits => \@debits, + credits => \@credits, + accountview => 1 ); output_html_with_http_headers $query, $cookie, $template->output; --- a/opac/opac-user.pl +++ a/opac/opac-user.pl @@ -162,19 +162,7 @@ if ($issues){ $issue->{'reserved'} = 1; } - my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber ); - my $charges = 0; - foreach my $ac (@$accts) { - if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) { - $charges += $ac->{'amountoutstanding'} - if $ac->{'accounttype'} eq 'F'; - $charges += $ac->{'amountoutstanding'} - if $ac->{'accounttype'} eq 'FU'; - $charges += $ac->{'amountoutstanding'} - if $ac->{'accounttype'} eq 'L'; - } - } - $issue->{'charges'} = $charges; + $issue->{'charges'} = $borr->{account_balance}; $issue->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($issue->{'biblionumber'}), GetFrameworkCode($issue->{'biblionumber'})); # check if item is renewable my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} ); --