From: miker Date: Mon, 13 Sep 2010 18:14:19 +0000 (+0000) Subject: method for generating a set of compressed holdings statements for a bib with optional... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=79a1d54df3c79cf657c1958eb5a6c38756e3e08c;p=evergreen%2Fbjwebb.git method for generating a set of compressed holdings statements for a bib with optional location and depth scoping, type filtering and item status filtering git-svn-id: svn://svn.open-ils.org/ILS/trunk@17637 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm index e09035879..bea039a1c 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm @@ -437,6 +437,55 @@ q/A hash of optional arguments. Valid keys and their meanings: ); +sub scoped_bib_holdings_summary { + my $self = shift; + my $client = shift; + my $bibid = shift; + my $args = shift; + + $args->{order} = 'asc'; + + my ($issuances) = $self->method_lookup('open-ils.serial.received_siss.retrieve.by_bib.atomic')->run( $bibid => $args ); + + # split into issuance type sets + my %type_blob = (basic => [], supplement => [], index => []); + my %statement_blob = %type_blob; + push @{ $type_blob{ $_->holding_type } }, $_ for (@$issuances); + + # generate a statement list for each type + for my $type ( keys %type_blob ) { + my ($mfhd,$list) = _summarize_contents(new_editor(), $type_blob{$type}); + $statement_blob{$type} = $list; + } + + return \%statement_blob; +} +__PACKAGE__->register_method( + method => 'scoped_bib_holdings_summary', + api_name => 'open-ils.serial.bib.summary_statements', + api_level => 1, + argc => 1, + signature => { + desc => 'Receives a Bib ID and other optional params and returns set of holdings statements', + params => [ + { name => 'bibid', + desc => 'id of the bre to which the issuances belong', + type => 'number' + }, + { name => 'args', + desc => +q/A hash of optional arguments. Valid keys and their meanings: + orgid := OU id used to scope retrieval, based on distribution.holding_lib + depth := OU depth used to range the scope of orgid + type := Holding type filter. Valid values are "basic", "supplement" and "index". Can be a scalar (one) or arrayref (one or more). + status := Item status filter. Valid values are "Bindery", "Bound", "Claimed", "Discarded", "Expected", "Not Held", "Not Published" and "Received". Can be a scalar (one) or arrayref (one or more). +/ + } + ] + } +); + + ########################################################################## # unit methods #