X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=catalogue%2Fupdateitem.pl;h=7924b2b85e4429a9e93dcb0cc56968a56d9166a8;hb=refs%2Fheads%2Fkoha_ffzg;hp=e8ce20d5d082c9e27a926a7cc73f8d28a9cae419;hpb=63541e4223224831e4eb2bb51d108cc4a2155388;p=koha.git diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index e8ce20d5d0..7924b2b85e 100755 --- a/catalogue/updateitem.pl +++ b/catalogue/updateitem.pl @@ -5,50 +5,49 @@ # # This file is part of Koha. # -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. # -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along -# with Koha; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -use strict; -use warnings; -use CGI; +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . +use Modern::Perl; +use CGI qw ( -utf8 ); use C4::Auth; use C4::Context; use C4::Biblio; use C4::Items; use C4::Output; use C4::Circulation; -use C4::Accounts; use C4::Reserves; my $cgi= new CGI; -my ($loggedinuser, $cookie, $sessionID) = checkauth($cgi, 0, {circulate => 'circulate_remaining_permissions'}, 'intranet'); +checkauth($cgi, 0, {circulate => 'circulate_remaining_permissions'}, 'intranet'); my $biblionumber=$cgi->param('biblionumber'); my $itemnumber=$cgi->param('itemnumber'); my $biblioitemnumber=$cgi->param('biblioitemnumber'); my $itemlost=$cgi->param('itemlost'); my $itemnotes=$cgi->param('itemnotes'); -my $wthdrawn=$cgi->param('wthdrawn'); +my $itemnotes_nonpublic=$cgi->param('itemnotes_nonpublic'); +my $withdrawn=$cgi->param('withdrawn'); my $damaged=$cgi->param('damaged'); my $confirm=$cgi->param('confirm'); my $dbh = C4::Context->dbh; # get the rest of this item's information -my $item_data_hashref = GetItem($itemnumber, undef); +my $item_data_hashref = Koha::Items->find($itemnumber)->unblessed; # make sure item statuses are set to 0 if empty or NULL -for ($damaged,$itemlost,$wthdrawn) { +for ($damaged,$itemlost,$withdrawn) { if (!$_ or $_ eq "") { $_ = 0; } @@ -56,15 +55,21 @@ for ($damaged,$itemlost,$wthdrawn) { # modify MARC item if input differs from items table. my $item_changes = {}; -if (defined $itemnotes) { # i.e., itemnotes parameter passed from form - my ($loggedinuser, $cookie, $sessionID) = checkauth($cgi, 0, {editcatalogue => 'edit_items'}, 'intranet'); +if (defined $itemnotes_nonpublic) { # i.e., itemnotes_nonpublic parameter passed from form + checkauth($cgi, 0, {editcatalogue => 'edit_items'}, 'intranet'); + if ((not defined $item_data_hashref->{'itemnotes_nonpublic'}) or $itemnotes_nonpublic ne $item_data_hashref->{'itemnotes_nonpublic'}) { + $item_changes->{'itemnotes_nonpublic'} = $itemnotes_nonpublic; + } +} +elsif (defined $itemnotes) { # i.e., itemnotes parameter passed from form + checkauth($cgi, 0, {editcatalogue => 'edit_items'}, 'intranet'); if ((not defined $item_data_hashref->{'itemnotes'}) or $itemnotes ne $item_data_hashref->{'itemnotes'}) { $item_changes->{'itemnotes'} = $itemnotes; } } elsif ($itemlost ne $item_data_hashref->{'itemlost'}) { $item_changes->{'itemlost'} = $itemlost; -} elsif ($wthdrawn ne $item_data_hashref->{'wthdrawn'}) { - $item_changes->{'wthdrawn'} = $wthdrawn; +} elsif ($withdrawn ne $item_data_hashref->{'withdrawn'}) { + $item_changes->{'withdrawn'} = $withdrawn; } elsif ($damaged ne $item_data_hashref->{'damaged'}) { $item_changes->{'damaged'} = $damaged; } else { @@ -75,6 +80,6 @@ if (defined $itemnotes) { # i.e., itemnotes parameter passed from form ModItem($item_changes, $biblionumber, $itemnumber); -C4::Accounts::chargelostitem($itemnumber) if ($itemlost==1) ; +LostItem($itemnumber, 'moredetail') if $itemlost; print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");