3 # A Class for hiding the ILS's concept of the item from the OpenSIP
7 package OpenILS::SIP::Item;
12 use Sys::Syslog qw(syslog);
14 use OpenILS::SIP::Transaction;
15 use OpenILS::Application::AppUtils;
16 my $U = 'OpenILS::Application::AppUtils';
21 my ($class, $item_id) = @_;
22 my $type = ref($class) || $class;
26 require OpenILS::Utils::CStoreEditor;
27 my $e = OpenILS::Utils::CStoreEditor->new;
29 if(!UNIVERSAL::can($e, 'search_actor_card')) {
30 syslog("LOG_WARNING", "Reloading CStoreEditor...");
31 delete $INC{'OpenILS/Utils/CStoreEditor.pm'};
32 require OpenILS::Utils::CStoreEditor;
33 $e = OpenILS::Utils::CStoreEditor->new;
38 my $copy = $e->search_asset_copy(
40 { barcode => $item_id },
44 acp => [ 'circ_lib', 'call_number' ],
45 acn => [ 'owning_lib', 'record' ],
52 syslog("LOG_DEBUG", "OpenILS: Item '%s' : not found", $item_id);
58 # XXX See if i am checked out, if so set $self->{patron} to the user's barcode
59 my ($circ) = $U->fetch_open_circulation($copy->id);
61 my $user = $e->retrieve_actor_user(
73 $self->{patron} = $user->card->barcode if $user;
74 $self->{patron_object} = $user;
77 $self->{id} = $item_id;
78 $self->{copy} = $copy;
79 $self->{volume} = $copy->call_number;
80 $self->{record} = $copy->call_number->record;
82 $self->{mods} = $U->record_to_mvr($self->{record}) if $self->{record}->marc;
84 syslog("LOG_DEBUG", "new OpenILS Item('%s'): found with title '%s'",
85 $item_id, $self->title_id);
100 sub sip_item_properties {
106 my ($self, $props) = @_;
107 my $status = new OpenILS::SIP::Transaction;
108 $self->{sip_item_properties} = $props;
121 return ($self->{mods}) ? $self->{mods}->title : $self->{copy}->dummy_title;
124 sub permanent_location {
126 return $self->{volume}->owning_lib->name;
129 sub current_location {
131 return $self->{copy}->circ_lib->name;
136 sub sip_circulation_status {
141 sub sip_security_marker {
162 return $self->{volume}->owning_lib->name;
170 sub hold_queue_position {
171 my ($self, $patron_id) = @_;
185 sub hold_pickup_date {
190 # message to display on console
193 return $self->{screen_msg} || '';
200 return $self->{print_line} || '';
204 # An item is available for a patron if
205 # 1) It's not checked out and (there's no hold queue OR patron
206 # is at the front of the queue)
208 # 2) It's checked out to the patron and there's no hold queue
210 my ($self, $for_patron) = @_;