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=?) and (returndate is null)");
92 $sth->execute($itemnum);
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 $sth2=$dbh->prepare("Insert into accountlines
99 (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
101 (?,?,now(),?,?,'L',?,?)");
102 $sth2->execute($data->{'borrowernumber'},$accountno,$item->{'replacementprice'},
103 "Lost Item $item->{'title'} $item->{'barcode'}",
104 $item->{'replacementprice'},$itemnum);
109 print $input->redirect("moredetail.pl?type=intra&bib=$bibnum&bi=$bibitemnum");
112 # print "marking cancelled";
113 #need to check if it is on reserve or issued
114 my $dbh = C4::Context->dbh;
116 my ($resbor,$resrec)=C4::Reserves2::CheckReserves($env,$dbh,$itemnum);
119 print $input->header;
120 print "The biblio or biblioitem this item belongs to has a reserve on it";
123 my $sth=$dbh->prepare("Select * from issues where (itemnumber=?) and (returndate is null)");
124 $sth->execute($itemnum);
125 my $data=$sth->fetchrow_hashref;
126 if ($data->{'borrowernumber'} ne '') {
127 print $input->header;
128 print "<p>Item is on issue";
133 my $url=$input->self_url;
134 $url.="&override=yes";
135 print "<p> <a href=$url>Cancel Anyway</a> or <a href=\"\">Back</a>";
137 moditem({ biblionumber => $bibnum,
140 bibitemnum => $bibitemnum,
143 homebranch => $homebranch,
145 wthdrawn => $wthdrawn
147 print $input->redirect("moredetail.pl?type=intra&bib=$bibnum&bi=$bibitemnum");