5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
27 use C4::Circulation::Circ2;
33 my $bibnum=checkinp($input->param('bibnum'));
34 my $itemnum=checkinp($input->param('itemnumber'));
35 my $copyright=checkinp($input->param('Copyright'));
36 my $seriestitle=checkinp($input->param('Series'));
37 my $serial=checkinp($input->param('Serial'));
38 my $unititle=checkinp($input->param('Unititle'));
39 my $notes=checkinp($input->param('ItemNotes'));
41 #need to do barcode check
42 my $barcode=$input->param('Barcode');
44 my $bibitemnum=checkinp($input->param('bibitemnum'));
45 my $itemtype=checkinp($input->param('Item'));
46 my $isbn=checkinp($input->param('ISBN'));
47 my $publishercode=checkinp($input->param('Publisher'));
48 my $publicationdate=checkinp($input->param('Publication'));
49 my $class=checkinp($input->param('Class'));
50 my $homebranch=checkinp($input->param('Home'));
51 my $lost=$input->param('Lost');
52 my $wthdrawn=$input->param('withdrawn');
56 my $override=$input->param('override');
57 if ($itemtype ne 'NF'){
58 $classification=$class;
60 if ($class =~/[0-9]+/){
62 $dewey=~ s/[a-z]+//gi;
65 @temp=split(/[0-9]+\.[0-9]+/,$class);
67 @temp=split(/[0-9]+/,$class);
69 $classification=$temp[0];
74 my $illus=checkinp($input->param('Illustrations'));
75 my $pages=checkinp($input->param('Pages'));
76 my $volumeddesc=checkinp($input->param('Volume'));
78 if ($wthdrawn == 0 && $override ne 'yes'){
79 moditem( { biblionumber => $bibnum,
82 bibitemnum => $bibitemnum,
85 homebranch => $homebranch,
90 my $dbh = C4::Context->dbh;
91 my $sth=$dbh->prepare("Select * from issues where (itemnumber='$itemnum') and (returndate is null)");
93 my $data=$sth->fetchrow_hashref;
94 if ($data->{'borrowernumber'} ne '') {
95 #item on issue add replacement cost to borrowers record
96 my $accountno=getnextacctno($env,$data->{'borrowernumber'},$dbh);
97 my $item=getiteminformation($env, $itemnum);
98 my $account="Insert into accountlines
99 (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
101 ('$data->{'borrowernumber'}','$accountno',now(),'$item->{'replacementprice'}',
102 'Lost Item $item->{'title'} $item->{'barcode'}','L',
103 '$item->{'replacementprice'}','$itemnum')";
104 my $sth2=$dbh->prepare($account);
105 # print $input->header;
112 print $input->redirect("moredetail.pl?type=intra&bib=$bibnum&bi=$bibitemnum");
115 # print "marking cancelled";
116 #need to check if it is on reserve or issued
117 my $dbh = C4::Context->dbh;
119 my ($resbor,$resrec)=C4::Circulation::Circ2::checkreserve($env,$dbh,$itemnum);
122 print $input->header;
123 print "The biblio or biblioitem this item belongs to has a reserve on it";
126 my $sth=$dbh->prepare("Select * from issues where (itemnumber='$itemnum') and (returndate is null)");
128 my $data=$sth->fetchrow_hashref;
129 if ($data->{'borrowernumber'} ne '') {
130 print $input->header;
131 print "<p>Item is on issue";
136 my $url=$input->self_url;
137 $url.="&override=yes";
138 print "<p> <a href=$url>Cancel Anyway</a> or <a href=\"\">Back</a>";
140 moditem({ biblionumber => $bibnum,
143 bibitemnum => $bibitemnum,
146 homebranch => $homebranch,
148 wthdrawn => $wthdrawn
150 print $input->redirect("moredetail.pl?type=intra&bib=$bibnum&bi=$bibitemnum");