From 948bfef89a7bccc334380fc4e150501c339a1089 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 11 Dec 2013 10:56:56 -0500 Subject: [PATCH] Bug 6427 [Part 5] - Implement new accounting system in the opac --- .../bootstrap/en/includes/browser-strings.inc | 34 ++ .../opac-tmpl/bootstrap/en/modules/opac-account.tt | 403 ++++++++++++++++-- .../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 | 448 +++++++++++++++++--- 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, 820 insertions(+), 161 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 diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/browser-strings.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/browser-strings.inc new file mode 100644 index 0000000..f6c74f6 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/browser-strings.inc @@ -0,0 +1,34 @@ +[% USE KohaAuthorisedValues %] + diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt index bbab1d0..294bf12 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt @@ -1,9 +1,13 @@ [% 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 'browser-strings.inc' %] + [% INCLUDE 'masthead.inc' %] @@ -11,7 +15,7 @@
@@ -25,53 +29,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 %] - [% SWITCH ACCOUNT_LINE.accounttype %] - [% CASE 'Pay' %]Payment,thanks - [% CASE 'Pay00' %]Payment,thanks (cash via SIP2) - [% CASE 'Pay01' %]Payment,thanks (VISA via SIP2) - [% CASE 'Pay02' %]Payment,thanks (credit card via SIP2) - [% 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 ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title %])[% 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 %] @@ -82,4 +90,305 @@
[% INCLUDE 'opac-bottom.inc' %] + +[% 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 %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/images/details_close.png b/koha-tmpl/opac-tmpl/bootstrap/images/details_close.png new file mode 100644 index 0000000000000000000000000000000000000000..fcc23c63e22f9883bef72c9e3adae3d5ddfb35cc GIT binary patch literal 841 zcmV-P1GfB$P)DA_on|3pY;aiIaw_AzX~% z0wEzG!5U~A62!y<6#_3!Y0@BA($@0c+jVBUFF+~kfo;CbzTKH`cV=g%b|^n=hzi67 zM5UV3FcF6cUCnu^p}pjrsWm6Ug}98UR-~ZFvWN`g0Fg%+2vP1rl3*$mmwr5rOIH=?}WDABr;u?U4@YDw`9eOu1C&^?L7Z zY;1fZBc9KT-2A-Q9Uc}tJv}1T-7R)sycF4)8NstzNldzAgSOWc2V?31C|17Z<>j$J zAke}0_aQSe0l9^R;<1c^#DEC_0!d$>Do3Jo15TlYl9m;-_3M7y&8+fGbP>p=udnZ^^3rY*Ry8&@-XZS}=H{ef zDUJ>}0_oCdYHA|eDvG0BC2ghK?XIQGd^|3d(Ko2a8%4c^+ z2RQuxqA|Bf6p=-Yhg81x*8ObQBJv5%iB0 zU9{XrXRDi=!8bAj&V~kvL?Uy+VDJ@gXo|Fa=^duiBKhvUSnKK%G5>85_4~!w&Q6gS z9~Xt4ozl{)vr6y0nuGJKj&rJgrBbPcMMU#|wJ-Lc4fdkiFZ`>)vh)56_#?mow%h=n ThIkt{00000NkvXXu0mjfW_^Rc literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/bootstrap/images/details_open.png b/koha-tmpl/opac-tmpl/bootstrap/images/details_open.png new file mode 100644 index 0000000000000000000000000000000000000000..6f034d0f2d5c7902dce190355b12defdc07d6c9a GIT binary patch literal 881 zcmV-%1CIQOP)P5xVIgh(4gM3Zjdy!n~2N zjD^FnHQ1(tR(9cJl^-l~RyvtO-;dMt9M4;+6T9$?ALpFs)Rcr6nirw3t>UzAPx#r5M&8N9I=W>B2)xRbt)puL>xs_c64-H@%#Or zXf!&j>$*muHOWXvHo`VD#lg6MPE~+#^!N8aRTO1|?J`J5He@S&wvbBVO8K%ZpNm8y zAIT}HC7Cxi$gY3tW-XzMtU1`kx+go?tM3CWp(Z#n*^&?X9upjrBoaWeDh>vNcO4E# z)3UM*kH0>GH%mi2IAp}6%}CKyd$~2W6jvjYwyv(OhW7UM zP7O5aPWUzq$A-}#e>#Hw16_xihIJroxfm&IbSiP6!~SxS;g5FTo6ZM`H( zlIh)&4}38nXc|&$DyX^!-nt?1)(-JKW(QQ%jr|ydxA>>z)7I8@S=`cW5N4N`m!G77 zdZMpERgp|rK~d3JRsUp;HJ6lA@hNmr@UjvF zT!Ag6;H&rZ+37vY=g+HO_-wIQtVRQvx7QEFj83+*vi=TLQ+cY^m5t3Z!D|~jv(ZlR zc>I^mX3LW^WSCo>=P5lkaGKBKE#utS*o(YFK~4deqwi1AMVd+US~dit;|^yb25sIpdZA`Wys(O1dAvo2(I ziyc~u+*C?>Z*T8&(cem%afeVS6nDGb_L8EKvNL%#5MBx6)#tXj`d$yLwBMhA-vSH(T>k(8(cOU?00000NkvXX Hu0mjf8E% +// + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt index 0fc80ad..a46122d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt @@ -1,79 +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 'Pay00' %]Payment,thanks (cash via SIP2) - [% CASE 'Pay01' %]Payment,thanks (VISA via SIP2) - [% CASE 'Pay02' %]Payment,thanks (credit card via SIP2) - [% 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 ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title %])[% 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 %] diff --git a/koha-tmpl/opac-tmpl/prog/images/details_close.png b/koha-tmpl/opac-tmpl/prog/images/details_close.png new file mode 100644 index 0000000000000000000000000000000000000000..fcc23c63e22f9883bef72c9e3adae3d5ddfb35cc GIT binary patch literal 841 zcmV-P1GfB$P)DA_on|3pY;aiIaw_AzX~% z0wEzG!5U~A62!y<6#_3!Y0@BA($@0c+jVBUFF+~kfo;CbzTKH`cV=g%b|^n=hzi67 zM5UV3FcF6cUCnu^p}pjrsWm6Ug}98UR-~ZFvWN`g0Fg%+2vP1rl3*$mmwr5rOIH=?}WDABr;u?U4@YDw`9eOu1C&^?L7Z zY;1fZBc9KT-2A-Q9Uc}tJv}1T-7R)sycF4)8NstzNldzAgSOWc2V?31C|17Z<>j$J zAke}0_aQSe0l9^R;<1c^#DEC_0!d$>Do3Jo15TlYl9m;-_3M7y&8+fGbP>p=udnZ^^3rY*Ry8&@-XZS}=H{ef zDUJ>}0_oCdYHA|eDvG0BC2ghK?XIQGd^|3d(Ko2a8%4c^+ z2RQuxqA|Bf6p=-Yhg81x*8ObQBJv5%iB0 zU9{XrXRDi=!8bAj&V~kvL?Uy+VDJ@gXo|Fa=^duiBKhvUSnKK%G5>85_4~!w&Q6gS z9~Xt4ozl{)vr6y0nuGJKj&rJgrBbPcMMU#|wJ-Lc4fdkiFZ`>)vh)56_#?mow%h=n ThIkt{00000NkvXXu0mjfW_^Rc literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/details_open.png b/koha-tmpl/opac-tmpl/prog/images/details_open.png new file mode 100644 index 0000000000000000000000000000000000000000..6f034d0f2d5c7902dce190355b12defdc07d6c9a GIT binary patch literal 881 zcmV-%1CIQOP)P5xVIgh(4gM3Zjdy!n~2N zjD^FnHQ1(tR(9cJl^-l~RyvtO-;dMt9M4;+6T9$?ALpFs)Rcr6nirw3t>UzAPx#r5M&8N9I=W>B2)xRbt)puL>xs_c64-H@%#Or zXf!&j>$*muHOWXvHo`VD#lg6MPE~+#^!N8aRTO1|?J`J5He@S&wvbBVO8K%ZpNm8y zAIT}HC7Cxi$gY3tW-XzMtU1`kx+go?tM3CWp(Z#n*^&?X9upjrBoaWeDh>vNcO4E# z)3UM*kH0>GH%mi2IAp}6%}CKyd$~2W6jvjYwyv(OhW7UM zP7O5aPWUzq$A-}#e>#Hw16_xihIJroxfm&IbSiP6!~SxS;g5FTo6ZM`H( zlIh)&4}38nXc|&$DyX^!-nt?1)(-JKW(QQ%jr|ydxA>>z)7I8@S=`cW5N4N`m!G77 zdZMpERgp|rK~d3JRsUp;HJ6lA@hNmr@UjvF zT!Ag6;H&rZ+37vY=g+HO_-wIQtVRQvx7QEFj83+*vi=TLQ+cY^m5t3Z!D|~jv(ZlR zc>I^mX3LW^WSCo>=P5lkaGKBKE#utS*o(YFK~4deqwi1AMVd+US~dit;|^yb25sIpdZA`Wys(O1dAvo2(I ziyc~u+*C?>Z*T8&(cem%afeVS6nDGb_L8EKvNL%#5MBx6)#tXj`d$yLwBMhA-vSH(T>k(8(cOU?00000NkvXX Hu0mjf8E% "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; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index beba580..8f50a48 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -168,19 +168,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'} ); -- 1.7.2.5