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

(-)a/Koha/Item.pm (+18 lines)
Lines 188-193 sub store { Link Here
188
            }
188
            }
189
        }
189
        }
190
190
191
        my $prevent_withdrawing_of = C4::Context->preference('PreventWithDrawingItemsStatus');
192
        my @statuses_to_prevent    = defined $prevent_withdrawing_of ? split( ',', $prevent_withdrawing_of ) : ();
193
        my $prevent_onloan         = grep { $_ eq 'checkedout' } @statuses_to_prevent;
194
        my $prevent_intransit      = grep { $_ eq 'intransit' } @statuses_to_prevent;
195
196
        if ( exists $updated_columns{withdrawn} && $updated_columns{withdrawn} ) {
197
            my $transfer = $pre_mod_item->get_transfer;
198
            if ( $pre_mod_item->onloan && $prevent_onloan ) {
199
                Koha::Exceptions::Item::Transfer::OnLoan->throw( error => "onloan_cannot_withdraw" );
200
                return $self->SUPER::store;
201
            }
202
203
            if ( defined $transfer && $transfer->in_transit && $prevent_intransit ) {
204
                Koha::Exceptions::Item::Transfer::InTransit->throw( error => "intransit_cannot_withdraw" );
205
                return $self->SUPER::store;
206
            }
207
        }
208
191
        if (   exists $updated_columns{itemcallnumber}
209
        if (   exists $updated_columns{itemcallnumber}
192
            or exists $updated_columns{cn_source} )
210
            or exists $updated_columns{cn_source} )
193
        {
211
        {
(-)a/cataloguing/additem.pl (-1 / +8 lines)
Lines 50-55 use MARC::File::XML; Link Here
50
use MIME::Base64 qw( decode_base64url encode_base64url );
50
use MIME::Base64 qw( decode_base64url encode_base64url );
51
use Storable     qw( freeze thaw );
51
use Storable     qw( freeze thaw );
52
use URI::Escape  qw( uri_escape_utf8 );
52
use URI::Escape  qw( uri_escape_utf8 );
53
use Try::Tiny    qw( catch try );
53
54
54
our $dbh = C4::Context->dbh;
55
our $dbh = C4::Context->dbh;
55
56
Lines 641-647 if ( $op eq "cud-additem" ) { Link Here
641
        if ( $newitemlost && $newitemlost ge '1' && !$olditemlost ) {
642
        if ( $newitemlost && $newitemlost ge '1' && !$olditemlost ) {
642
            LostItem( $item->itemnumber, 'additem' );
643
            LostItem( $item->itemnumber, 'additem' );
643
        }
644
        }
644
        $item->store;
645
        try {
646
            $item->store;
647
        } catch {
648
            if ( ref $_ && $_->can('error') ) {
649
                push @errors, $_->error;
650
            }
651
        }
645
    }
652
    }
646
653
647
    $nextop = "cud-additem";
654
    $nextop = "cud-additem";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +2 lines)
Lines 89-94 Link Here
89
    <h1>Items for [% biblio.title | html %] [% IF ( biblio.author ) %]by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</h1>
89
    <h1>Items for [% biblio.title | html %] [% IF ( biblio.author ) %]by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</h1>
90
    <a id="newitem_jump" href="#f"><i class="fa fa-arrow-down"></i> Jump to form</a>
90
    <a id="newitem_jump" href="#f"><i class="fa fa-arrow-down"></i> Jump to form</a>
91
91
92
    [% IF ( onloan_cannot_withdraw ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: Onloan item cannot be withdrawn.</div>[% END %]
93
    [% IF ( intransit_cannot_withdraw ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: In transit item cannot be withdrawn.</div>[% END %]
92
    [% IF ( barcode_not_unique ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
94
    [% IF ( barcode_not_unique ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
93
    [% IF ( no_next_barcode ) %]<div class="alert alert-warning"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div>[% END %]
95
    [% IF ( no_next_barcode ) %]<div class="alert alert-warning"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div>[% END %]
94
    [% IF ( book_on_loan ) %]<div class="alert alert-warning"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
96
    [% IF ( book_on_loan ) %]<div class="alert alert-warning"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
95
- 

Return to bug 23010