From 67be3ebebe4d218596bcff775b71c05f3732bebc Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sun, 6 Oct 2013 10:22:57 -0400 Subject: [PATCH] Add void_bills_of_type method to CircCommon.pm. A handly little subroutine to void all bills of a given type on a circulation transaction. Signed-off-by: Jason Stephenson --- .../lib/OpenILS/Application/Circ/CircCommon.pm | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm index 86b0103181..a00a4a3316 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm @@ -68,6 +68,33 @@ sub void_overdues { return undef; } +# ------------------------------------------------------------------ +# Void all bills of a given type on a circulation. +# +# Takes an editor, a circ object, the btype number for the bills you +# want to void, and an optional note. +# +# Returns undef on success or the result from real_void_bills. +# ------------------------------------------------------------------ +sub void_bills_of_type { + my ($class, $e, $circ, $btype, $note) = @_; + + my $bills = $e->search_money_billing( + { + xact => $circ->id, + btype => $btype + } + ); + + if ($bills && @$bills) { + my $result = $class->real_void_bills($e->authtoken, $bills, $note); + if (ref($result)) { + return $result; + } + } + + return undef; +} sub reopen_xact { my($class, $e, $xactid) = @_; -- 2.11.0