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

(-)a/cataloguing/additem.pl (-11 / +22 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
    }
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";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-2 / +14 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 70-75 Link Here
70
[% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]&amp;analyze=1">analytics.</a>.</div>[% END %]
77
[% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]&amp;analyze=1">analytics.</a>.</div>[% END %]
71
[% IF last_item_for_hold %]<div class="dialog alert"><strong>Cannot delete</strong>: Last item for bibliographic record with biblio-level hold on it.</div>[% END %]
78
[% IF last_item_for_hold %]<div class="dialog alert"><strong>Cannot delete</strong>: Last item for bibliographic record with biblio-level hold on it.</div>[% END %]
72
[% IF item_not_found %]<div class="dialog alert"><strong>Cannot delete</strong>: Item not found.</div>[% END %]
79
[% IF item_not_found %]<div class="dialog alert"><strong>Cannot delete</strong>: Item not found.</div>[% END %]
80
[% IF item_doesnt_exist %]
81
<div class="dialog alert">
82
The item you are trying to access doesn't exist.<br>
83
<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>.
84
</div>
85
[% END %]
73
86
74
<div id="cataloguing_additem_itemlist">
87
<div id="cataloguing_additem_itemlist">
75
    [% IF items %]
88
    [% IF items %]
76
- 

Return to bug 32418