<field reporter:label="Owning Library" name="owning_lib" oils_obj:array_position="11" oils_persist:virtual="false" reporter:datatype="org_unit"/>
<field reporter:label="Bib Record" name="record" oils_obj:array_position="12" oils_persist:virtual="false" reporter:datatype="link"/>
<field reporter:label="Notes" name="notes" oils_obj:array_position="13" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="URI Maps" name="uri_maps" oils_obj:array_position="14" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="URIs" name="uris" oils_obj:array_position="15" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="editor" reltype="has_a" key="id" map="" class="au"/>
<link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
<link field="notes" reltype="has_many" key="call_number" map="" class="acnn"/>
<link field="copies" reltype="has_many" key="call_number" map="" class="acp"/>
+ <link field="uris" reltype="has_many" key="call_number" map="uri" class="auricnm"/>
+ <link field="uri_maps" reltype="has_many" key="call_number" map="" class="auricnm"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
<field reporter:label="Label" name="label" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text"/>
<field reporter:label="Use Information" name="use_restriction" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text"/>
<field reporter:label="Active" name="active" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="bool"/>
+ <field reporter:label="Call Number Maps" name="call_number_maps" oils_obj:array_position="8" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Call Numbers" name="call_numbers" oils_obj:array_position="9" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
- <links/>
+ <links>
+ <link field="call_numbers" reltype="has_many" key="uri" map="call_number" class="auricnm"/>
+ <link field="call_number_maps" reltype="has_many" key="uri" map="" class="auricnm"/>
+ </links>
</class>
<class id="auricnm" controller="open-ils.cstore" oils_obj:fieldmapper="asset::uri_call_number_map" oils_persist:tablename="asset.uri_call_number_map" reporter:label="Electronic Access URI to Call Number Map">
<fields oils_persist:primary="id" oils_persist:sequence="asset.uri_call_number_map_id_seq">
my $orgs = $_storage->request(
"open-ils.cstore.direct.actor.org_unit.search",
$o_search,
- { flesh => 3,
+ { flesh => 100,
flesh_fields => { aou => [qw/children/] }
}
)->gather(1);
my $orgs = $_storage->request(
"open-ils.cstore.direct.actor.org_unit.search",
{ shortname => $ou },
- { flesh => 10,
+ { flesh => 100,
flesh_fields => { aou => [qw/children/] }
}
)->gather(1);
my $orgs = $_storage->request(
"open-ils.cstore.direct.actor.org_unit.search",
{ shortname => $ou },
- { flesh => 10,
+ { flesh => 100,
flesh_fields => { aou => [qw/children/] }
}
)->gather(1);
}
__PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.acn.formats', api_level => 1 );
__PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.acp.formats', api_level => 1 );
+__PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.auri.formats', api_level => 1 );
__PACKAGE__->register_method(
+ method => 'retrieve_uri',
+ api_name => 'open-ils.supercat.auri.marcxml.retrieve',
+ api_level => 1,
+ argc => 1,
+ signature =>
+ { desc => <<" DESC",
+Returns a fleshed call number object
+ DESC
+ params =>
+ [
+ { name => 'uri_id',
+ desc => 'An OpenILS asset::uri id',
+ type => 'number' },
+ ],
+ 'return' =>
+ { desc => 'fleshed uri',
+ type => 'object' }
+ }
+);
+sub retrieve_uri {
+ my $self = shift;
+ my $client = shift;
+ my $cpid = shift;
+ my $args = shift;
+
+ return OpenILS::Application::SuperCat::unAPI
+ ->new(OpenSRF::AppSession
+ ->create( 'open-ils.cstore' )
+ ->request(
+ "open-ils.cstore.direct.asset.uri.retrieve",
+ $cpid,
+ { flesh => 10,
+ flesh_fields => {
+ auri => [qw/call_number_maps/],
+ acn => [qw/owning_lib record/],
+ auricnm => [qw/uri/],
+ }
+ })
+ ->gather(1))
+ ->as_xml($args);
+}
+
+__PACKAGE__->register_method(
method => 'retrieve_copy',
api_name => 'open-ils.supercat.acp.marcxml.retrieve',
api_level => 1,
->request(
"open-ils.cstore.direct.asset.call_number.retrieve",
$cnid,
- { flesh => 2,
+ { flesh => 5,
flesh_fields => {
- acn => [qw/owning_lib record copies/],
+ acn => [qw/owning_lib record copies uri_maps/],
+ auricnm => [qw/uri/],
acp => [qw/location status circ_lib stat_cat_entries notes/],
}
})
my $orgs = $_storage->request(
"open-ils.cstore.direct.actor.org_unit.search",
$o_search,
- { flesh => 3,
+ { flesh => 100,
flesh_fields => { aou => [qw/children/] }
}
)->gather(1);
{ flesh => 5,
flesh_fields => {
bre => [qw/call_numbers/],
- acn => [qw/copies owning_lib/],
+ acn => [qw/copies owning_lib uri_maps/],
+ auricnm => [qw/uri/],
acp => [qw/location status circ_lib stat_cat_entries notes/],
asce => [qw/stat_cat/],
}
my $orgs = $_storage->request(
"open-ils.cstore.direct.actor.org_unit.search",
$o_search,
- { flesh => 3,
+ { flesh => 100,
flesh_fields => { aou => [qw/children/] }
}
)->gather(1);
$found = 1;
last;
}
+
+ if (!$found && ref($cn->uri_maps) && @{$cn->uri_maps}) {
+ $found = 1 if (grep {$cn->owning_lib->id == $_} @ou_ids);
+ }
next unless $found;
$client->respond(
return $self->{obj};
}
+package OpenILS::Application::SuperCat::unAPI::auri;
+use base qw/OpenILS::Application::SuperCat::unAPI/;
+
+sub as_xml {
+ my $self = shift;
+ my $args = shift;
+
+ my $xml = '<uri xmlns="http://open-ils.org/spec/holdings/v1" ';
+ $xml .= 'id="tag:open-ils.org:asset-uri/' . $self->obj->id . '" ';
+ $xml .= 'use_restriction="' . $self->escape( $self->obj->use_restriction ) . '" ';
+ $xml .= 'label="' . $self->escape( $self->obj->label ) . '" ';
+ $xml .= 'href="' . $self->escape( $self->obj->href ) . '">';
+
+ if (!$args->{no_volumes} && ref($self->obj->call_number_maps) && @{ $self->obj->call_number_maps }) {
+ $xml .= '<volumes>' . join(
+ '',
+ map {
+ OpenILS::Application::SuperCat::unAPI
+ ->new( $_->call_number )
+ ->as_xml({ %$args, no_uris=>1, no_copies=>1 })
+ } @{ $self->obj->call_number_maps }
+ ) . '</volumes>';
+
+ } else {
+ $xml .= '<volumes/>';
+ }
+
+ $xml .= '</uri>';
+
+ return $xml;
+}
+
package OpenILS::Application::SuperCat::unAPI::acn;
use base qw/OpenILS::Application::SuperCat::unAPI/;
$xml .= '<copies/>';
}
+ if (!$args->{no_uris} && ref($self->obj->uri_maps) && @{ $self->obj->uri_maps }) {
+ $xml .= '<uris>' . join(
+ '',
+ map {
+ OpenILS::Application::SuperCat::unAPI
+ ->new( $_->uri )
+ ->as_xml({ %$args, no_volumes=>1 })
+ } @{ $self->obj->uri_maps }
+ ) . '</uris>';
+
+ } else {
+ $xml .= '<uris/>';
+ }
+
$xml .= '<owning_lib xmlns="http://open-ils.org/spec/actors/v1" ';
$xml .= 'id="tag:open-ils.org:actor-org_unit/' . $self->obj->owning_lib->id . '" ';
$xml .= '<status>' . $self->escape( $self->obj->status->name ) . '</status>';
$xml .= '<location>' . $self->escape( $self->obj->location->name ) . '</location>';
+ $xml .= '<circlib>' . $self->escape( $self->obj->circ_lib->name ) . '</circlib>';
- $xml .= '<circlib xmlns="http://open-ils.org/spec/actors/v1" ';
+ $xml .= '<circ_lib xmlns="http://open-ils.org/spec/actors/v1" ';
$xml .= 'id="tag:open-ils.org:actor-org_unit/' . $self->obj->circ_lib->id . '" ';
$xml .= 'shortname="'.$self->escape( $self->obj->circ_lib->shortname ) .'" ';
- $xml .= 'name="'.$self->escape( $self->obj->circ_lib->name ) .'">' . $self->escape( $self->obj->circ_lib->name ) . '</circlib>';
+ $xml .= 'name="'.$self->escape( $self->obj->circ_lib->name ) .'"/>';
$xml .= "<copy_notes>";
if (ref($self->obj->notes) && $self->obj->notes) {