|
Lines 72-85
use Koha::Items;
Link Here
|
| 72 |
=cut |
72 |
=cut |
| 73 |
|
73 |
|
| 74 |
sub new { |
74 |
sub new { |
| 75 |
my ($class, $item_id) = @_; |
75 |
my ($class, $item_id) = @_; |
| 76 |
my $type = ref($class) || $class; |
76 |
my $type = ref($class) || $class; |
| 77 |
my $item = Koha::Items->find( { barcode => $item_id } ); |
77 |
my $item = Koha::Items->find( { barcode => $item_id } ); |
| 78 |
unless ( $item ) { |
78 |
unless ( $item ) { |
| 79 |
syslog("LOG_DEBUG", "new ILS::Item('%s'): not found", $item_id); |
79 |
syslog("LOG_DEBUG", "new ILS::Item('%s'): not found", $item_id); |
| 80 |
warn "new ILS::Item($item_id) : No item '$item_id'."; |
80 |
warn "new ILS::Item($item_id) : No item '$item_id'."; |
| 81 |
return; |
81 |
return; |
| 82 |
} |
82 |
} |
| 83 |
my $self = $item->unblessed; |
83 |
my $self = $item->unblessed; |
| 84 |
$self->{ 'id' } = $item->barcode; # to SIP, the barcode IS the id. |
84 |
$self->{ 'id' } = $item->barcode; # to SIP, the barcode IS the id. |
| 85 |
$self->{permanent_location}= $item->homebranch; |
85 |
$self->{permanent_location}= $item->homebranch; |
|
Lines 90-96
sub new {
Link Here
|
| 90 |
my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it ); |
90 |
my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it ); |
| 91 |
$self->{sip_media_type} = $itemtype->sip_media_type() if $itemtype; |
91 |
$self->{sip_media_type} = $itemtype->sip_media_type() if $itemtype; |
| 92 |
|
92 |
|
| 93 |
# check if its on issue and if so get the borrower |
93 |
# check if its on issue and if so get the borrower |
| 94 |
my $issue = Koha::Checkouts->find( { itemnumber => $item->itemnumber } ); |
94 |
my $issue = Koha::Checkouts->find( { itemnumber => $item->itemnumber } ); |
| 95 |
if ($issue) { |
95 |
if ($issue) { |
| 96 |
$self->{due_date} = dt_from_string( $issue->date_due, 'sql' )->truncate( to => 'minute' ); |
96 |
$self->{due_date} = dt_from_string( $issue->date_due, 'sql' )->truncate( to => 'minute' ); |
|
Lines 102-111
sub new {
Link Here
|
| 102 |
$self->{hold_queue} = $holds; |
102 |
$self->{hold_queue} = $holds; |
| 103 |
$self->{hold_shelf} = [( grep { defined $_->{found} and $_->{found} eq 'W' } @{$self->{hold_queue}} )]; |
103 |
$self->{hold_shelf} = [( grep { defined $_->{found} and $_->{found} eq 'W' } @{$self->{hold_queue}} )]; |
| 104 |
$self->{pending_queue} = [( grep {(! defined $_->{found}) or $_->{found} ne 'W' } @{$self->{hold_queue}} )]; |
104 |
$self->{pending_queue} = [( grep {(! defined $_->{found}) or $_->{found} ne 'W' } @{$self->{hold_queue}} )]; |
| 105 |
bless $self, $type; |
105 |
bless $self, $type; |
| 106 |
|
106 |
|
| 107 |
syslog("LOG_DEBUG", "new ILS::Item('%s'): found with title '%s'", |
107 |
syslog( "LOG_DEBUG", "new ILS::Item('%s'): found with title '%s'", |
| 108 |
$item_id, $self->{title}//'' ); |
108 |
$item_id, $self->{title} // '' ); |
| 109 |
|
109 |
|
| 110 |
return $self; |
110 |
return $self; |
| 111 |
} |
111 |
} |
| 112 |
- |
|
|