From: Chris Cormack Date: Mon, 18 Nov 2013 02:45:40 +0000 (+1300) Subject: Continuing work, If you hate the suroutine names now is the time to X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8393451bb2588616ced9f73818bb29b831c20a1d;p=NCIPServer.git Continuing work, If you hate the suroutine names now is the time to stop me --- diff --git a/lib/NCIP/Handler/LookupItem.pm b/lib/NCIP/Handler/LookupItem.pm index c101fa2..e5cd8da 100644 --- a/lib/NCIP/Handler/LookupItem.pm +++ b/lib/NCIP/Handler/LookupItem.pm @@ -33,6 +33,10 @@ sub handle { $xmldoc->getElementsByTagNameNS( $self->namespace(), 'ItemIdentifierValue' ); my $item = NCIP::Item->new( { itemid => $item_id->textContent(), ils => $self->ils} ); + my ($itemdata,$error) = $item->itemdata(); + if ($error){ +# handle error here + } warn $item->itemid(); } return $self->type; diff --git a/lib/NCIP/ILS/Koha.pm b/lib/NCIP/ILS/Koha.pm index 51156b1..d14256c 100644 --- a/lib/NCIP/ILS/Koha.pm +++ b/lib/NCIP/ILS/Koha.pm @@ -19,4 +19,9 @@ package NCIP::ILS::Koha; use Modern::Perl; use Object::Tiny qw{ name }; + +sub itemdata { + my $self = shift; + return ( {barcode=>'123',title=>'fish'}, undef); +} 1; diff --git a/lib/NCIP/Item.pm b/lib/NCIP/Item.pm index 3d9105f..93cfcaf 100644 --- a/lib/NCIP/Item.pm +++ b/lib/NCIP/Item.pm @@ -3,6 +3,18 @@ package NCIP::Item; use base qw(Class::Accessor); # Make accessors for the ones that makes sense -NCIP::Item->mk_accessors(qw(itemid)); +NCIP::Item->mk_accessors(qw(itemid ils)); + +# Call the apppropriate subroutine in the ILS specific code and get the data + +sub itemdata { + my $self = shift; + my $ils = $self->ils; + my ( $itemdata, $error ) = $ils->itemdata( $self->itemid ); + +# add anything NCIP specific not handled by the ILS to the itemdata object at this point, if no error + + return $itemdata, $error; +} 1;