|
Lines 156-161
my ($template, $loggedinuser, $cookie)
Link Here
|
| 156 |
flagsrequired => {editcatalogue => $userflags}, |
156 |
flagsrequired => {editcatalogue => $userflags}, |
| 157 |
}); |
157 |
}); |
| 158 |
|
158 |
|
|
|
159 |
if ( $op eq "edititem" || $op eq "dupeitem" ) { |
| 160 |
my $item = Koha::Items->find($itemnumber); |
| 161 |
if ( !$item ) { |
| 162 |
$itemnumber = undef; |
| 163 |
$template->param( item_doesnt_exist => 1 ); |
| 164 |
} |
| 165 |
} |
| 159 |
|
166 |
|
| 160 |
# Does the user have a restricted item editing permission? |
167 |
# Does the user have a restricted item editing permission? |
| 161 |
my $uid = Koha::Patrons->find( $loggedinuser )->userid; |
168 |
my $uid = Koha::Patrons->find( $loggedinuser )->userid; |
|
Lines 462-482
if ($op eq "additem") {
Link Here
|
| 462 |
} elsif ($op eq "edititem") { |
469 |
} elsif ($op eq "edititem") { |
| 463 |
#------------------------------------------------------------------------------- |
470 |
#------------------------------------------------------------------------------- |
| 464 |
# retrieve item if exist => then, it's a modif |
471 |
# retrieve item if exist => then, it's a modif |
| 465 |
$current_item = Koha::Items->find($itemnumber)->unblessed; |
472 |
$nextop = "additem"; |
| 466 |
# FIXME Handle non existent item |
473 |
if ($itemnumber) { |
| 467 |
$nextop = "saveitem"; |
474 |
$current_item = Koha::Items->find($itemnumber)->unblessed; |
|
|
475 |
$nextop = "saveitem"; |
| 476 |
} |
| 468 |
#------------------------------------------------------------------------------- |
477 |
#------------------------------------------------------------------------------- |
| 469 |
} elsif ($op eq "dupeitem") { |
478 |
} elsif ($op eq "dupeitem") { |
| 470 |
#------------------------------------------------------------------------------- |
479 |
#------------------------------------------------------------------------------- |
| 471 |
# retrieve item if exist => then, it's a modif |
480 |
# retrieve item if exist => then, it's a modif |
| 472 |
$current_item = Koha::Items->find($itemnumber)->unblessed; |
481 |
if ($itemnumber) { |
| 473 |
# FIXME Handle non existent item |
482 |
$current_item = Koha::Items->find($itemnumber)->unblessed; |
| 474 |
if (C4::Context->preference('autoBarcode') eq 'incremental') { |
483 |
if ( C4::Context->preference('autoBarcode') eq 'incremental' ) { |
| 475 |
my ( $barcode ) = C4::Barcodes::ValueBuilder::incremental::get_barcode; |
484 |
my ($barcode) = |
| 476 |
$current_item->{barcode} = $barcode; |
485 |
C4::Barcodes::ValueBuilder::incremental::get_barcode; |
| 477 |
} |
486 |
$current_item->{barcode} = $barcode; |
| 478 |
else { |
487 |
} |
| 479 |
$current_item->{barcode} = undef; # Don't save it! |
488 |
else { |
|
|
489 |
$current_item->{barcode} = undef; # Don't save it! |
| 490 |
} |
| 480 |
} |
491 |
} |
| 481 |
|
492 |
|
| 482 |
$nextop = "additem"; |
493 |
$nextop = "additem"; |