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

(-)a/Koha/Item.pm (+18 lines)
Lines 187-192 sub store { Link Here
187
            }
187
            }
188
        }
188
        }
189
189
190
        my $prevent_withdrawing_of = C4::Context->preference('PreventWithDrawingItemsStatus');
191
        my @statuses_to_prevent    = defined $prevent_withdrawing_of ? split( ',', $prevent_withdrawing_of ) : ();
192
        my $prevent_onloan         = grep { $_ eq 'checkedout' } @statuses_to_prevent;
193
        my $prevent_intransit      = grep { $_ eq 'intransit' } @statuses_to_prevent;
194
195
        if ( exists $updated_columns{withdrawn} && $updated_columns{withdrawn} ) {
196
            my $transfer = $pre_mod_item->get_transfer;
197
            if ( $pre_mod_item->onloan && $prevent_onloan ) {
198
                Koha::Exceptions::Item::Transfer::OnLoan->throw( error => "onloan_cannot_withdraw" );
199
                return $self->SUPER::store;
200
            }
201
202
            if ( defined $transfer && $transfer->in_transit && $prevent_intransit ) {
203
                Koha::Exceptions::Item::Transfer::InTransit->throw( error => "intransit_cannot_withdraw" );
204
                return $self->SUPER::store;
205
            }
206
        }
207
190
        if (   exists $updated_columns{itemcallnumber}
208
        if (   exists $updated_columns{itemcallnumber}
191
            or exists $updated_columns{cn_source} )
209
            or exists $updated_columns{cn_source} )
192
        {
210
        {
(-)a/cataloguing/additem.pl (-1 / +9 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 644-650 if ( $op eq "cud-additem" ) { Link Here
644
        if ( $newitemlost && $newitemlost ge '1' && !$olditemlost ) {
645
        if ( $newitemlost && $newitemlost ge '1' && !$olditemlost ) {
645
            LostItem( $item->itemnumber, 'additem' );
646
            LostItem( $item->itemnumber, 'additem' );
646
        }
647
        }
647
        $item->store;
648
        try {
649
            $item->store;
650
        }
651
        catch {
652
            if ( ref $_ && $_->can('error') ) {
653
                push @errors, $_->error;
654
            }
655
        }
648
    }
656
    }
649
657
650
    $nextop = "cud-additem";
658
    $nextop = "cud-additem";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-2 / +2 lines)
Lines 74-80 Link Here
74
        [% END %]
74
        [% END %]
75
    [% END #/ WRAPPER breadcrumbs %]
75
    [% END #/ WRAPPER breadcrumbs %]
76
[% END #/ WRAPPER sub-header.inc %]
76
[% END #/ WRAPPER sub-header.inc %]
77
78
<div class="main container-fluid">
77
<div class="main container-fluid">
79
    <div class="row">
78
    <div class="row">
80
        <div class="col-sm-12">
79
        <div class="col-sm-12">
Lines 88-93 Link Here
88
<h1>Items for [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</h1>
87
<h1>Items for [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</h1>
89
<a id="newitem_jump" href="#additema"><i class="fa fa-arrow-down"></i> Jump to add item form</a>
88
<a id="newitem_jump" href="#additema"><i class="fa fa-arrow-down"></i> Jump to add item form</a>
90
89
90
[% IF ( onloan_cannot_withdraw ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: Onloan item cannot be withdrawn.</div>[% END %]
91
[% IF ( intransit_cannot_withdraw ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: In transit item cannot be withdrawn.</div>[% END %]
91
[% IF ( barcode_not_unique ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
92
[% IF ( barcode_not_unique ) %]<div class="alert alert-warning"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
92
[% 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 %]
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 %]
93
[% IF ( book_on_loan ) %]<div class="alert alert-warning"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
94
[% IF ( book_on_loan ) %]<div class="alert alert-warning"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
94
- 

Return to bug 23010