From b0c03ad9a42dd34824a6a16634c2c306c81de558 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Mon, 6 May 2013 14:13:13 -0400 Subject: [PATCH] Serials: Test method to identify holdings that lead to summarization bugs This adds a simple test method that allows testing of problem holdings. See the next commit. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Remington Steed Signed-off-by: Dan Wells --- .../lib/OpenILS/Application/Serial.pm | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm index 377069dcf4..19b14aa438 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm @@ -3643,4 +3643,35 @@ sub clone_subscription { return $result; } +__PACKAGE__->register_method( + "method" => "summary_test", + "api_name" => "open-ils.serial.summary_test", + "stream" => 1, + "api_level" => 1, + "argc" => 3 +); + +# This crummy little test method allows quicker reproduction of certain +# failures (e.g. at item receive time) of the holdings summarization code. +# Pass it an authtoken, an array of issuance IDs, and a single sdist ID +sub summary_test { + my ($self, $conn, $authtoken, $iss_id_list, $sdist_id) = @_; + + my $e = new_editor(authtoken => $authtoken, xact => 1); + return $e->die_event unless $e->checkauth; + return $e->die_event unless $e->allowed("RECEIVE_SERIAL"); + + my @issuances; + foreach my $id (@$iss_id_list) { + my $iss = $e->retrieve_serial_issuance($id) or return $e->die_event; + push @issuances, $iss; + } + + my $dist = $e->retrieve_serial_distribution($sdist_id) or return $e->die_event; + + $conn->respond(_summarize_contents($e, \@issuances, $dist)); + $e->rollback; + return; +} + 1; -- 2.43.2