#!/usr/bin/perl
+# $Id$
+
+
#script to modify/delete biblios
#written 8/11/99
# modified 11/11/99 by chris@katipo.co.nz
+# modified 12/16/02 by hdl@ifrance.com : Templating
+
+# Copyright 2000-2002 Katipo Communications
+#
+# 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 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., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
use strict;
+require Exporter;
use C4::Search;
use CGI;
use C4::Output;
-use C4::Acquisitions;
+#use C4::Acquisitions;
+use C4::Biblio;
+use HTML::Template;
+use C4::Koha;
+use C4::Catalogue;
+use C4::Auth;
+use C4::Interface::CGI::Output;
my $input = new CGI;
my $submit=$input->param('delete.x');
print $input->redirect("/cgi-bin/koha/delitem.pl?itemnum=$itemnum&bibitemnum=$bibitemnum");
}
-print $input->header;
-#print $input->dump;
-
my $data=bibitemdata($bibitemnum);
my $item=itemnodata('blah','',$itemnum);
#my ($analytictitle)=analytic($biblionumber,'t');
#my ($analyticauthor)=analytic($biblionumber,'a');
-print startpage();
-print startmenu();
+
+
+my ($template, $loggedinuser, $cookie) = get_template_and_user({
+ template_name => 'moditem.tmpl',
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {catalogue => 1},
+ });
+
my %inputs;
#the value is a tab separated list, the first item being the input type
#$inputs{'Author'}="text\t$data->{'author'}\t0";
#$inputs{'Title'}="text\t$data->{'title'}\t1";
-my $dewey = $data->{'dewey'};
-$dewey =~ s/0+$//;
-if ($dewey eq "000.") { $dewey = "";};
-if ($dewey < 10){$dewey='00'.$dewey;}
-if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
-if ($dewey <= 0){
- $dewey='';
-}
+# FIXME - The Dewey code is a string, not a number. And "000" is a
+# perfectly acceptable value.
+my $dewey = $data->{'dewey'};
+$dewey =~ s/0+$//;
+if ($dewey eq "000.") { $dewey = "";};
+if ($dewey < 10){$dewey='00'.$dewey;}
+if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
+if ($dewey <= 0){
+ $dewey='';
+}
$dewey=~ s/\.$//;
+
+# 12/16/2002 hdl@ifrance.com : all these inputs seem unused !!!
+
$inputs{'Barcode'}="text\t$item->{'barcode'}\t0";
$inputs{'Class'}="hidden\t$data->{'classification'}$dewey$data->{'subclass'}\t2";
#$inputs{'Item Type'}="text\t$data->{'itemtype'}\t3";
$inputs{'Lost'}="radio\t$item->{'itemlost'}\t19";
#$inputs{'Analytic author'}="text\t\t18";
#$inputs{'Analytic title'}="text\t\t19";
-
$inputs{'bibnum'}="hidden\t$data->{'biblionumber'}\t20";
$inputs{'bibitemnum'}="hidden\t$data->{'biblioitemnumber'}\t21";
$inputs{'itemnumber'}="hidden\t$itemnum\t22";
-
-
-print <<printend
-<FONT SIZE=6><em>$data->{'title'} ($data->{'author'})</em></FONT><br>
-<table border=0 cellspacing=0 cellpadding=5>
-<tr valign=top bgcolor=white><td><form action=updateitem.pl method=post>
-<table border=0 cellspacing=0 cellpadding=5>
-<tr valign=top bgcolor=white><td>Barcode</td><td><input type=text name=Barcode value="$item->{'barcode'}" size=40></td></tr>
-<input type=hidden name=Class value="$data->{'classification'}$dewey$data->{'subclass'}">
-<input type=hidden name=Publisher value="$data->{'publisher'}">
-<input type=hidden name=ISBN value="$data->{'isbn'}">
-<input type=hidden name=Publication Year value="$data->{'publicationyear'}">
-<input type=hidden name=Pages value="$data->{'pages'}">
-<input type=hidden name=Illustrations value="$data->{'illustration'}">
-<tr valign=top bgcolor=white><td>ItemNotes</td><td><textarea name=ItemNotes cols=40 rows=4>$item->{'itemnotes'}</textarea></td></tr>
-<input type=hidden name=Volume value="$data->{'volumeddesc'}">
-<tr valign=top bgcolor=white><td>Home Branch</td><td><input type=text name=Home Branch value="$item->{'homebranch'}" size=40></td></tr>
-<tr valign=top bgcolor=white><td>Lost</td><td><input type=radio name=Lost value=1
-printend
-;
-if ($item->{'itemlost'} ==1){
- print " checked ";
-}
-print <<printend
->Yes
-<input type=radio name=Lost value=0
-printend
-;
-if ($item->{'itemlost'} ==0){
- print " checked ";
-}
-print <<printend
->No</td></tr>
-<tr valign=top bgcolor=white><td>Cancelled</td><td><input type=radio name=withdrawn value=1
-printend
-;
-if ($item->{'wthdrawn'} ==1){
- print " checked ";
-}
-print <<printend
->Yes
-<input type=radio name=withdrawn value=0
-printend
-;
-if ($item->{'wthdrawn'} ==0){
- print " checked ";
-}
-print <<printend
->No</td></tr>
-<input type=hidden name=bibnum value="$data->{'biblionumber'}">
-<input type=hidden name=bibitemnum value="$data->{'biblioitemnumber'}">
-<input type=hidden name=itemnumber value="$itemnum">
-<tr valign=top bgcolor=white><td></td><td>
-
-<input type=image name=submit src=/images/save-changes.gif border=0 width=187
-height=42></td></tr>
-</table>
-</form></td></tr>
-</table>
-
-printend
-;
-
-
-
-
-
-print endmenu();
-print endpage();
+#12/16/2002 hdl@ifrance.com : end of comment
+
+
+
+#12/16/2002 hdl@ifrance.com : templating
+$template->param( title => $data->{'title'},
+ author => $data->{'author'},
+ barcode => $item->{'barcode'},
+ classification => "$data->{'classification'}$dewey$data->{'subclass'}",
+ publisher => $data->{'publisher'},
+ publicationyear => $data->{'publicationyear'},
+ pages => $data->{'pages'},
+ illustration => $data->{'illustration'},
+ itemnotes => $item->{'itemnotes'},
+ volumedesc => $data->{'volumedesc'},
+ homebranch => $data->{'homebranch'},
+ itemlost => ($item->{'itemlost'} ==1),
+ itemwithdrawn => ($item->{'wthdrawn'} ==1),
+ biblionumber => $data->{'biblionumber'},
+ biblioitemnumber => $data->{'biblioitemnumber'},
+ itemnumber => $itemnum);
+
+print "Content-Type: text/html\n\n", $template->output;
+#12/16/2002 hdl@ifrance.com : templating