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

(-)a/cataloguing/additem.pl (-6 / +13 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 $uid = Koha::Patrons->find( $loggedinuser )->userid;
169
my $uid = Koha::Patrons->find( $loggedinuser )->userid;
Lines 463-482 if ($op eq "additem") { Link Here
463
#-------------------------------------------------------------------------------
471
#-------------------------------------------------------------------------------
464
# retrieve item if exist => then, it's a modif
472
# retrieve item if exist => then, it's a modif
465
    $current_item = Koha::Items->find($itemnumber)->unblessed;
473
    $current_item = Koha::Items->find($itemnumber)->unblessed;
466
    # FIXME Handle non existent item
474
    $nextop       = "saveitem";
467
    $nextop = "saveitem";
468
#-------------------------------------------------------------------------------
475
#-------------------------------------------------------------------------------
469
} elsif ($op eq "dupeitem") {
476
} elsif ($op eq "dupeitem") {
470
#-------------------------------------------------------------------------------
477
#-------------------------------------------------------------------------------
471
# retrieve item if exist => then, it's a modif
478
# retrieve item if exist => then, it's a modif
472
    $current_item = Koha::Items->find($itemnumber)->unblessed;
479
    $current_item = Koha::Items->find($itemnumber)->unblessed;
473
    # FIXME Handle non existent item
480
    if ( C4::Context->preference('autoBarcode') eq 'incremental' ) {
474
    if (C4::Context->preference('autoBarcode') eq 'incremental') {
481
        my ($barcode) =
475
        my ( $barcode ) = C4::Barcodes::ValueBuilder::incremental::get_barcode;
482
          C4::Barcodes::ValueBuilder::incremental::get_barcode;
476
        $current_item->{barcode} = $barcode;
483
        $current_item->{barcode} = $barcode;
477
    }
484
    }
478
    else {
485
    else {
479
        $current_item->{barcode} = undef; # Don't save it!
486
        $current_item->{barcode} = undef;    # Don't save it!
480
    }
487
    }
481
488
482
    $nextop = "additem";
489
    $nextop = "additem";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-2 / +13 lines)
Lines 25-31 Link Here
25
[% INCLUDE 'str/cataloging_additem.inc' %]
25
[% INCLUDE 'str/cataloging_additem.inc' %]
26
[% Asset.js("js/cataloging_additem.js") | $raw %]
26
[% Asset.js("js/cataloging_additem.js") | $raw %]
27
    <script>
27
    <script>
28
      var has_item_groups = "[% item_groups.size | html %]";
28
        var has_item_groups = "[% item_groups.size | html %]";
29
        $(document).ready(function() {
30
            [% IF item_doesnt_exist %]
31
                $("#itemst_wrapper").hide();
32
                $("#menu").hide();
33
                $("#cataloguing_additem_newitem").hide();
34
            [% END %]
35
        });
29
    </script>
36
    </script>
30
</head>
37
</head>
31
38
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/cataloguing/additem.pl?biblionumber=[% biblio.biblionumber %]">Add a new item</a> or <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]#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