Bug 20629: Remove ability to 'reverse' payments
Test Plan: 1) Apply this patch 2) Note all references to reversing payments have been removed 3) Note ability to void payments remains unchanged Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
88eb4d3e20
commit
fb15a96310
|
|
@ -40,7 +40,6 @@ BEGIN {
|
|||
&manualinvoice
|
||||
&getnextacctno
|
||||
&chargelostitem
|
||||
&ReversePayment
|
||||
&purge_zero_balance_fees
|
||||
);
|
||||
}
|
||||
|
|
@ -279,50 +278,21 @@ sub manualinvoice {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#FIXME: ReversePayment should be replaced with a Void Payment feature
|
||||
sub ReversePayment {
|
||||
my ($accountlines_id) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
sub getcharges {
|
||||
my ( $borrowerno, $timestamp, $accountno ) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $timestamp2 = $timestamp - 1;
|
||||
my $query = "";
|
||||
my $sth = $dbh->prepare(
|
||||
"SELECT * FROM accountlines WHERE borrowernumber=? AND accountno = ?"
|
||||
);
|
||||
$sth->execute( $borrowerno, $accountno );
|
||||
|
||||
my $accountline = Koha::Account::Lines->find($accountlines_id);
|
||||
my $amount_outstanding = $accountline->amountoutstanding;
|
||||
|
||||
my $new_amountoutstanding =
|
||||
$amount_outstanding <= 0 ? $accountline->amount * -1 : 0;
|
||||
|
||||
$accountline->description( $accountline->description . " Reversed -" );
|
||||
$accountline->amountoutstanding($new_amountoutstanding);
|
||||
$accountline->store();
|
||||
|
||||
my $account_offset = Koha::Account::Offset->new(
|
||||
{
|
||||
credit_id => $accountline->id,
|
||||
type => 'Reverse Payment',
|
||||
amount => $amount_outstanding - $new_amountoutstanding,
|
||||
}
|
||||
)->store();
|
||||
|
||||
if ( C4::Context->preference("FinesLog") ) {
|
||||
my $manager_id = 0;
|
||||
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
|
||||
|
||||
logaction(
|
||||
"FINES", 'MODIFY',
|
||||
$accountline->borrowernumber,
|
||||
Dumper(
|
||||
{
|
||||
action => 'reverse_fee_payment',
|
||||
borrowernumber => $accountline->borrowernumber,
|
||||
old_amountoutstanding => $amount_outstanding,
|
||||
new_amountoutstanding => $new_amountoutstanding,
|
||||
,
|
||||
accountlines_id => $accountline->id,
|
||||
accountno => $accountline->accountno,
|
||||
manager_id => $manager_id,
|
||||
}
|
||||
)
|
||||
);
|
||||
my @results;
|
||||
while ( my $data = $sth->fetchrow_hashref ) {
|
||||
push @results,$data;
|
||||
}
|
||||
return (@results);
|
||||
}
|
||||
|
||||
=head2 purge_zero_balance_fees
|
||||
|
|
|
|||
|
|
@ -77,13 +77,8 @@
|
|||
[% END %]
|
||||
<a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
|
||||
[% IF ( reverse_col) %]
|
||||
[% IF ( account.payment || account.amount < 0 ) %]
|
||||
[% IF account.payment %]
|
||||
<a href="boraccount.pl?action=reverse&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-undo"></i> Reverse</a>
|
||||
[% END %]
|
||||
[% IF account.amount < 0 %]
|
||||
<a href="boraccount.pl?action=void&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
|
||||
[% END %]
|
||||
[% IF account.object.is_credit %]
|
||||
<a href="boraccount.pl?action=void&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
|
||||
[% ELSE %]
|
||||
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -60,10 +60,7 @@ unless ( $patron ) {
|
|||
|
||||
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
|
||||
|
||||
if ( $action eq 'reverse' ) {
|
||||
ReversePayment( scalar $input->param('accountlines_id') );
|
||||
}
|
||||
elsif ( $action eq 'void' ) {
|
||||
if ( $action eq 'void' ) {
|
||||
my $payment_id = scalar $input->param('accountlines_id');
|
||||
my $payment = Koha::Account::Lines->find( $payment_id );
|
||||
$payment->void();
|
||||
|
|
@ -87,6 +84,7 @@ my @accountlines;
|
|||
while ( my $line = $accts->next ) {
|
||||
# FIXME We should pass the $accts iterator to the template and do this formatting part there
|
||||
my $accountline = $line->unblessed;
|
||||
$accountline->{object} = $line;
|
||||
$accountline->{amount} += 0.00;
|
||||
if ($accountline->{amount} <= 0 ) {
|
||||
$accountline->{amountcredit} = 1;
|
||||
|
|
|
|||
|
|
@ -54,10 +54,6 @@ my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"
|
|||
my $patron = Koha::Patrons->find( $borrowernumber );
|
||||
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
|
||||
|
||||
if ( $action eq 'print' ) {
|
||||
# ReversePayment( $borrowernumber, $input->param('accountno') );
|
||||
}
|
||||
|
||||
#get account details
|
||||
my $total = $patron->account->balance;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ can_ok( 'C4::Accounts',
|
|||
getnextacctno
|
||||
chargelostitem
|
||||
manualinvoice
|
||||
ReversePayment
|
||||
getcharges
|
||||
purge_zero_balance_fees )
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue