https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27946
--- Comment #24 from Martin Renvoize <[email protected]> --- Comment on attachment 122531 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122531 Bug 27946: Add article request fee feature Review of attachment 122531: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=27946&attachment=122531) ----------------------------------------------------------------- ::: Koha/ArticleRequest.pm @@ +103,5 @@ > > $self->status(Koha::ArticleRequest::Status::Canceled); > $self->notes($notes) if $notes; > + if ( $self->debit_line_id ) { > + my $line = Koha::Account::Lines->find( $self->debit_line_id ); Hmm, having looked at this a little more closely now I've read the concerns/discussion above.. I think we may need to add some additional considerations here. a) What should happen if a fee was 'Written off' or 'Reduced' (You've taken care of 'Cancelled' by the looks). b) We could use the 'reduce' method to cover both cases and allow the passing of 'CANCELLED' credit type perhaps? I'm thinking something along the lines of ``` my $refundable = 0; if ( $line->amount != $line->amountoutstanding ) { my $refundable_offsets = Koha::Account::Offsets->search( { debit_id => $line->id, credit_id => { '!=' => undef }, # Not the debt itself type => { '!=' => [ 'Writeoff', 'Refund', 'Cancellation', 'Discount' ] }, amount => { '<' => 0 } # credits are negative on the DB ); $refundable = ( $refundable_offsets->count > 0 ) ? $credits_offsets->total * -1 # credits are negative on the DB : 0; } $refundable += $line->amountoutstanding; $line->reduce( reduction_type => REQUEST_CANCELLATION, amount => $refundable, staff_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, interface => C4::Context->interface, branchcode => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef ); } ``` -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
