From 87d3c28cfaf8a2d3938ac083707369574785ff37 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 16 Mar 2011 18:19:20 +0000 Subject: [PATCH] make payment receipt print/email run inside a transaction. instead of using authoritative, force the xact for reasons mentioned in the comments git-svn-id: svn://svn.open-ils.org/ILS/trunk@19782 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/lib/OpenILS/Application/Circ/Money.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm index a88cdacea4..460244a845 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm @@ -520,8 +520,12 @@ sub format_payment_receipt { my $for_print = ($self->api_name =~ /print/); my $for_email = ($self->api_name =~ /email/); - my $e = new_editor(authtoken => $auth); - return $e->event unless $e->checkauth; + + # manually use xact (i.e. authoritative) so we can kill the cstore + # connection before sending the action/trigger request. This prevents our cstore + # backend from sitting idle while A/T (which uses its own transactions) runs. + my $e = new_editor(xact => 1, authtoken => $auth); + return $e->die_event unless $e->checkauth; my $payments = []; for my $id (@$mp_ids) { @@ -534,15 +538,17 @@ sub format_payment_receipt { mbt => ['usr'] } } - ]) or return $e->event; + ]) or return $e->die_event; - return $e->event unless + return $e->die_event unless $e->requestor->id == $payment->xact->usr->id or $e->allowed('VIEW_TRANSACTION', $payment->xact->usr->home_ou); push @$payments, $payment; } + $e->rollback; + if ($for_print) { return $U->fire_object_event(undef, 'money.format.payment_receipt.print', $payments, $$payments[0]->xact->usr->home_ou); -- 2.43.2