3 # $Id: updateitem.pl,v 1.9.2.1.2.4 2006/10/05 18:36:50 kados Exp $
4 # Copyright 2006 LibLime
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 my ($loggedinuser, $cookie, $sessionID) = checkauth
($cgi, 0, {circulate
=> 'circulate_remaining_permissions'}, 'intranet');
36 my $biblionumber=$cgi->param('biblionumber');
37 my $itemnumber=$cgi->param('itemnumber');
38 my $biblioitemnumber=$cgi->param('biblioitemnumber');
39 my $itemlost=$cgi->param('itemlost');
40 my $itemnotes=$cgi->param('itemnotes');
41 my $wthdrawn=$cgi->param('wthdrawn');
42 my $damaged=$cgi->param('damaged');
44 my $confirm=$cgi->param('confirm');
45 my $dbh = C4
::Context
->dbh;
47 # get the rest of this item's information
48 my $item_data_hashref = GetItem
($itemnumber, undef);
50 # make sure item statuses are set to 0 if empty or NULL
51 for ($damaged,$itemlost,$wthdrawn) {
52 if (!$_ or $_ eq "") {
57 # modify MARC item if input differs from items table.
58 my $item_changes = {};
59 if (defined $itemnotes) { # i.e., itemnotes parameter passed from form
60 my ($loggedinuser, $cookie, $sessionID) = checkauth
($cgi, 0, {editcatalogue
=> 'edit_items'}, 'intranet');
61 if ((not defined $item_data_hashref->{'itemnotes'}) or $itemnotes ne $item_data_hashref->{'itemnotes'}) {
62 $item_changes->{'itemnotes'} = $itemnotes;
64 } elsif ($itemlost ne $item_data_hashref->{'itemlost'}) {
65 $item_changes->{'itemlost'} = $itemlost;
66 } elsif ($wthdrawn ne $item_data_hashref->{'wthdrawn'}) {
67 $item_changes->{'wthdrawn'} = $wthdrawn;
68 } elsif ($damaged ne $item_data_hashref->{'damaged'}) {
69 $item_changes->{'damaged'} = $damaged;
71 #nothings changed, so do nothing.
72 print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");
76 ModItem
($item_changes, $biblionumber, $itemnumber);
78 C4
::Accounts
::chargelostitem
($itemnumber) if ($itemlost==1) ;
80 print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");