@@ -, +, @@ in pay fines. - Replace all sub deleted - Using Koha::Template::Plugin::AuthorisedValues - Delete unit tests --- Koha/Account.pm | 4 ++++ Koha/Schema/Result/Accountline.pm | 2 ++ .../atomicupdate/bug5620_Add_Mode_Of_Payment.sql | 6 ++++++ installer/data/mysql/kohastructure.sql | 1 + .../prog/en/modules/members/boraccount.tt | 3 +++ .../prog/en/modules/members/paycollect.tt | 19 +++++++++++++++++++ members/paycollect.pl | 8 +++++--- 7 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug5620_Add_Mode_Of_Payment.sql --- a/Koha/Account.pm +++ a/Koha/Account.pm @@ -68,6 +68,7 @@ sub pay { my $library_id = $params->{library_id}; my $lines = $params->{lines}; my $type = $params->{type} || 'payment'; + my $paymentmode = $params->{paymentmode}; my $userenv = C4::Context->userenv; @@ -121,6 +122,7 @@ sub pay { accountno => $fine->accountno, manager_id => $manager_id, note => $note, + paymentmode => $paymentmode, } ) ); @@ -164,6 +166,7 @@ sub pay { accountno => $fine->accountno, manager_id => $manager_id, note => $note, + paymentmode => $paymentmode, } ) ); @@ -192,6 +195,7 @@ sub pay { amountoutstanding => 0 - $balance_remaining, manager_id => $manager_id, note => $note, + paymentmode => $paymentmode, } )->store(); --- a/Koha/Schema/Result/Accountline.pm +++ a/Koha/Schema/Result/Accountline.pm @@ -169,6 +169,8 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 1 }, "manager_id", { data_type => "integer", is_nullable => 1 }, + "paymentmode", + {data_type => "text", is_nullable => 0 }, ); =head1 PRIMARY KEY --- a/installer/data/mysql/atomicupdate/bug5620_Add_Mode_Of_Payment.sql +++ a/installer/data/mysql/atomicupdate/bug5620_Add_Mode_Of_Payment.sql @@ -0,0 +1,6 @@ +ALTER table accountlines ADD COLUMN paymentmode TEXT NOT NULL; +INSERT INTO authorised_value_categories VALUES ('PAYMODE'); +INSERT INTO authorised_values (category, authorised_value, lib, lib_opac) VALUES +('PAYMODE','CASH','Cash', 'Cash'), +('PAYMODE','CC','Credit Card', 'Credit Card'), +('PAYMODE','DEBIG','Debit', 'Debit'); --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -2703,6 +2703,7 @@ CREATE TABLE `accountlines` ( `notify_level` int(2) NOT NULL default 0, `note` text NULL default NULL, `manager_id` int(11) NULL, + `paymentmode` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`accountlines_id`), KEY `acctsborridx` (`borrowernumber`), KEY `timeidx` (`timestamp`), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -1,6 +1,7 @@ [% USE Koha %] [% USE KohaDates %] [% USE ColumnsSettings %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' %] [% INCLUDE 'doc-head-close.inc' %] @@ -67,6 +68,7 @@ $(document).ready(function() { Date Description of charges Note + Payment mode Amount Outstanding [% IF ( reverse_col ) %] @@ -108,6 +110,7 @@ $(document).ready(function() { [%- IF account.description %], [% account.description %][% END %]  [% IF ( account.itemnumber ) %][% account.title |html %][% END %] [% account.note | html_line_break %] + [% AuthorisedValues.GetByCode('PAYMODE',account.paymentmode) %] [% IF ( account.amountcredit ) %][% ELSE %][% END %][% account.amount %] [% IF ( account.amountoutstandingcredit ) %][% ELSE %][% END %][% account.amountoutstanding %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE Branches %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Collect fine payment for [% borrower.firstname %] [% borrower.surname %] [% INCLUDE 'doc-head-close.inc' %] @@ -148,6 +149,15 @@ function moneyFormat(textObj) { +
  • + + +
  • + @@ -213,6 +223,15 @@ function moneyFormat(textObj) { +
  • + + +
  • +
  • --- a/members/paycollect.pl +++ a/members/paycollect.pl @@ -55,6 +55,7 @@ my $branch = C4::Context->userenv->{'branch'}; my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber); my $total_paid = $input->param('paid'); +my $paymentmode = $input->param('paymentmode'); my $individual = $input->param('pay_individual'); my $writeoff = $input->param('writeoff_individual'); @@ -117,7 +118,8 @@ if ( $total_paid and $total_paid ne '0.00' ) { lines => [$line], amount => $total_paid, library_id => $branch, - note => $payment_note + note => $payment_note, + paymentmode => $paymentmode, } ); print $input->redirect( @@ -129,7 +131,6 @@ if ( $total_paid and $total_paid ne '0.00' ) { } my @acc = split /,/, $select; my $note = $input->param('selected_accts_notes'); - my @lines = Koha::Account::Lines->search( { borrowernumber => $borrowernumber, @@ -148,13 +149,14 @@ if ( $total_paid and $total_paid ne '0.00' ) { amount => $total_paid, lines => \@lines, note => $note, + paymentmode => $paymentmode, } ); } else { my $note = $input->param('selected_accts_notes'); Koha::Account->new( { patron_id => $borrowernumber } ) - ->pay( { amount => $total_paid, note => $note } ); + ->pay( { amount => $total_paid, note => $note, paymentmode => $paymentmode } ); } print $input->redirect( --