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
28 use C4::Circulation::Circ2;
34 my $bibnum=checkinp($input->param('bibnum'));
35 my $itemnum=checkinp($input->param('itemnumber'));
36 my $copyright=checkinp($input->param('Copyright'));
37 my $seriestitle=checkinp($input->param('Series'));
38 my $serial=checkinp($input->param('Serial'));
39 my $unititle=checkinp($input->param('Unititle'));
40 my $notes=checkinp($input->param('ItemNotes'));
42 #need to do barcode check
43 my $barcode=$input->param('Barcode');
45 my $bibitemnum=checkinp($input->param('bibitemnum'));
46 my $itemtype=checkinp($input->param('Item'));
47 my $isbn=checkinp($input->param('ISBN'));
48 my $publishercode=checkinp($input->param('Publisher'));
49 my $publicationdate=checkinp($input->param('Publication'));
50 my $class=checkinp($input->param('Class'));
51 my $homebranch=checkinp($input->param('Home'));
52 my $lost=$input->param('Lost');
53 my $wthdrawn=$input->param('withdrawn');
57 my $override=$input->param('override');
58 if ($itemtype ne 'NF'){
59 $classification=$class;
61 if ($class =~/[0-9]+/){
63 $dewey=~ s/[a-z]+//gi;
66 @temp=split(/[0-9]+\.[0-9]+/,$class);
68 @temp=split(/[0-9]+/,$class);
70 $classification=$temp[0];
75 my $illus=checkinp($input->param('Illustrations'));
76 my $pages=checkinp($input->param('Pages'));
77 my $volumeddesc=checkinp($input->param('Volume'));
79 if ($wthdrawn == 0 && $override ne 'yes'){
80 moditem( { biblionumber => $bibnum,
83 bibitemnum => $bibitemnum,
86 homebranch => $homebranch,
91 my $dbh = C4::Context->dbh;
92 my $sth=$dbh->prepare("Select * from issues where (itemnumber='$itemnum') and (returndate is null)");
94 my $data=$sth->fetchrow_hashref;
95 if ($data->{'borrowernumber'} ne '') {
96 #item on issue add replacement cost to borrowers record
97 my $accountno=getnextacctno($env,$data->{'borrowernumber'},$dbh);
98 my $item=getiteminformation($env, $itemnum);
99 my $account="Insert into accountlines
100 (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
102 ('$data->{'borrowernumber'}','$accountno',now(),'$item->{'replacementprice'}',
103 'Lost Item $item->{'title'} $item->{'barcode'}','L',
104 '$item->{'replacementprice'}','$itemnum')";
105 my $sth2=$dbh->prepare($account);
106 # print $input->header;
113 print $input->redirect("moredetail.pl?type=intra&bib=$bibnum&bi=$bibitemnum");
116 # print "marking cancelled";
117 #need to check if it is on reserve or issued
118 my $dbh = C4::Context->dbh;
120 my ($resbor,$resrec)=C4::Circulation::Circ2::checkreserve($env,$dbh,$itemnum);
123 print $input->header;
124 print "The biblio or biblioitem this item belongs to has a reserve on it";
127 my $sth=$dbh->prepare("Select * from issues where (itemnumber='$itemnum') and (returndate is null)");
129 my $data=$sth->fetchrow_hashref;
130 if ($data->{'borrowernumber'} ne '') {
131 print $input->header;
132 print "<p>Item is on issue";
137 my $url=$input->self_url;
138 $url.="&override=yes";
139 print "<p> <a href=$url>Cancel Anyway</a> or <a href=\"\">Back</a>";
141 moditem({ biblionumber => $bibnum,
144 bibitemnum => $bibitemnum,
147 homebranch => $homebranch,
149 wthdrawn => $wthdrawn
151 print $input->redirect("moredetail.pl?type=intra&bib=$bibnum&bi=$bibitemnum");