Lines 23-28
use Carp;
Link Here
|
23 |
|
23 |
|
24 |
use Koha::Database; |
24 |
use Koha::Database; |
25 |
use Koha::Exceptions; |
25 |
use Koha::Exceptions; |
|
|
26 |
use Koha::Holds; |
26 |
use Koha::Items; |
27 |
use Koha::Items; |
27 |
use Koha::RotatingCollection::Trackings; |
28 |
use Koha::RotatingCollection::Trackings; |
28 |
|
29 |
|
Lines 62-68
$collection->add_item( $itemnumber );
Link Here
|
62 |
|
63 |
|
63 |
throws |
64 |
throws |
64 |
Koha::Exceptions::MissingParameter |
65 |
Koha::Exceptions::MissingParameter |
65 |
Koha::Exceptions::WrongParameter |
66 |
Koha::Exceptions::DuplicateObject |
|
|
67 |
Koha::Exceptions::ObjectNotFound |
66 |
|
68 |
|
67 |
=cut |
69 |
=cut |
68 |
|
70 |
|
Lines 74-79
sub add_item {
Link Here
|
74 |
Koha::Exceptions::DuplicateObject->throw |
76 |
Koha::Exceptions::DuplicateObject->throw |
75 |
if Koha::RotatingCollection::Trackings->search( { itemnumber => $itemnumber } )->count; |
77 |
if Koha::RotatingCollection::Trackings->search( { itemnumber => $itemnumber } )->count; |
76 |
|
78 |
|
|
|
79 |
Koha::Exceptions::ObjectNotFound->throw if not Koha::Items->find( $itemnumber ); |
80 |
|
77 |
my $col_tracking = Koha::RotatingCollection::Tracking->new( |
81 |
my $col_tracking = Koha::RotatingCollection::Tracking->new( |
78 |
{ |
82 |
{ |
79 |
colId => $self->colId, |
83 |
colId => $self->colId, |
Lines 126-135
sub transfer {
Link Here
|
126 |
|
130 |
|
127 |
$self->colBranchcode( $branchcode )->store; |
131 |
$self->colBranchcode( $branchcode )->store; |
128 |
|
132 |
|
129 |
for ( my $item = $self->items ) { |
133 |
my $items = $self->items; |
130 |
my ( $status ) = C4::Reserves::CheckReserves( $item->itemnumber ); |
134 |
while ( my $item = $items->next ) { |
131 |
my @transfers = C4::Circulation::GetTransfers( $item->itemnumber ); |
135 |
my $holds = Koha::Holds->search( { |
132 |
C4::Circulation::transferbook( $branchcode, $item->barcode, my $ignore_reserves = 1 ) unless ( $status eq 'Waiting' || @transfers ); |
136 |
itemnumber => $item->itemnumber, |
|
|
137 |
found => 'W', |
138 |
} ); |
139 |
C4::Circulation::transferbook( $branchcode, $item->barcode, my $ignore_reserves = 1 ) unless ( $holds->count || $item->get_transfer ); |
133 |
} |
140 |
} |
134 |
} |
141 |
} |
135 |
|
142 |
|