Lines 109-114
if ($add) {
Link Here
|
109 |
# If barcode is passed, attempt to find the associated item |
109 |
# If barcode is passed, attempt to find the associated item |
110 |
my $failed; |
110 |
my $failed; |
111 |
my $item_id; |
111 |
my $item_id; |
|
|
112 |
my $olditem; # FIXME: When items and deleted_items are merged, we can remove this |
112 |
my $issue_id; |
113 |
my $issue_id; |
113 |
if ($barcode) { |
114 |
if ($barcode) { |
114 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
115 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
Lines 116-124
if ($add) {
Link Here
|
116 |
$item_id = $item->itemnumber; |
117 |
$item_id = $item->itemnumber; |
117 |
} |
118 |
} |
118 |
else { |
119 |
else { |
119 |
$item = Koha::Old::Items->find( { barcode => $barcode } ); |
120 |
$item = Koha::Old::Items->search( { barcode => $barcode }, |
120 |
if ($item) { |
121 |
{ order_by => { -desc => 'timestamp' }, rows => 1 } ); |
121 |
$item_id = $item->itemnumber; |
122 |
if ($item->count) { |
|
|
123 |
$item_id = $item->next->itemnumber; |
124 |
$olditem = 1; |
122 |
} |
125 |
} |
123 |
else { |
126 |
else { |
124 |
$template->param( error => 'itemnumber' ); |
127 |
$template->param( error => 'itemnumber' ); |
Lines 158-164
if ($add) {
Link Here
|
158 |
interface => 'intranet', |
161 |
interface => 'intranet', |
159 |
library_id => $library_id, |
162 |
library_id => $library_id, |
160 |
type => $debit_type, |
163 |
type => $debit_type, |
161 |
item_id => $item_id, |
164 |
( $olditem ? () : ( item_id => $item_id ) ), |
162 |
issue_id => $issue_id |
165 |
issue_id => $issue_id |
163 |
} |
166 |
} |
164 |
); |
167 |
); |
165 |
- |
|
|