View | Details | Raw Unified | Return to bug 32418
Collapse All | Expand All

(-)a/cataloguing/additem.pl (-6 / +12 lines)
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
        output_and_exit( $input, $cookie, $template, 'unknown_item' );
165
    }
166
}
159
167
160
# Does the user have a restricted item editing permission?
168
# Does the user have a restricted item editing permission?
161
my $patron = Koha::Patrons->find( $loggedinuser );
169
my $patron = Koha::Patrons->find( $loggedinuser );
Lines 471-490 if ($op eq "additem") { Link Here
471
#-------------------------------------------------------------------------------
479
#-------------------------------------------------------------------------------
472
# retrieve item if exist => then, it's a modif
480
# retrieve item if exist => then, it's a modif
473
    $current_item = Koha::Items->find($itemnumber)->unblessed;
481
    $current_item = Koha::Items->find($itemnumber)->unblessed;
474
    # FIXME Handle non existent item
482
    $nextop       = "saveitem";
475
    $nextop = "saveitem";
476
#-------------------------------------------------------------------------------
483
#-------------------------------------------------------------------------------
477
} elsif ($op eq "dupeitem") {
484
} elsif ($op eq "dupeitem") {
478
#-------------------------------------------------------------------------------
485
#-------------------------------------------------------------------------------
479
# retrieve item if exist => then, it's a modif
486
# retrieve item if exist => then, it's a modif
480
    $current_item = Koha::Items->find($itemnumber)->unblessed;
487
    $current_item = Koha::Items->find($itemnumber)->unblessed;
481
    # FIXME Handle non existent item
488
    if ( C4::Context->preference('autoBarcode') eq 'incremental' ) {
482
    if (C4::Context->preference('autoBarcode') eq 'incremental') {
489
        my ($barcode) = C4::Barcodes::ValueBuilder::incremental::get_barcode;
483
        my ( $barcode ) = C4::Barcodes::ValueBuilder::incremental::get_barcode;
484
        $current_item->{barcode} = $barcode;
490
        $current_item->{barcode} = $barcode;
485
    }
491
    }
486
    else {
492
    else {
487
        $current_item->{barcode} = undef; # Don't save it!
493
        $current_item->{barcode} = undef;    # Don't save it!
488
    }
494
    }
489
495
490
    $nextop = "additem";
496
    $nextop = "additem";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-2 / +13 lines)
Lines 26-32 Link Here
26
[% INCLUDE 'str/cataloging_additem.inc' %]
26
[% INCLUDE 'str/cataloging_additem.inc' %]
27
[% Asset.js("js/cataloging_additem.js") | $raw %]
27
[% Asset.js("js/cataloging_additem.js") | $raw %]
28
    <script>
28
    <script>
29
      var has_item_groups = "[% item_groups.size | html %]";
29
        var has_item_groups = "[% item_groups.size | html %]";
30
        $(document).ready(function() {
31
            [% IF item_doesnt_exist %]
32
                $("#itemst_wrapper").hide();
33
                $("#menu").hide();
34
                $("#cataloguing_additem_newitem").hide();
35
            [% END %]
36
        });
30
    </script>
37
    </script>
31
</head>
38
</head>
32
39
Lines 59-64 Link Here
59
    <div class="row">
66
    <div class="row">
60
        <div class="col-sm-12">
67
        <div class="col-sm-12">
61
            <main>
68
            <main>
69
                [% IF item_doesnt_exist %]
70
                    <div class="dialog alert">
71
                        <a href="/cgi/bin/koha/catloguing/additem.pl?biblionumber=[% biblio.biblionumber | uri %]">Add a new item</a> or <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]#holdings">go to the records holdings</a>.
72
                    </div>
73
                [% END %]
62
                [% INCLUDE 'blocking_errors.inc' %]
74
                [% INCLUDE 'blocking_errors.inc' %]
63
<h1>Items for [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</h1>
75
<h1>Items for [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</h1>
64
76
65
- 

Return to bug 32418