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
23 # Revision 1.2 2003/05/11 06:59:11 rangi
25 # Still needs some work
35 use C4::Interface::CGI::Output;
38 my $biblionumber = $input->param('biblionumber');
39 my $error = $input->param('error');
53 my %itemtypedescriptions;
55 if ( !$biblionumber ) {
56 print $input->redirect('addbooks.pl');
60 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
62 if ( !$bibliocount ) {
63 print $input->redirect('addbooks.pl');
67 ( $biblioitemcount, @biblioitems ) =
68 &getbiblioitembybiblionumber($biblionumber);
69 ( $branchcount, @branches ) = &branches;
70 ( $itemtypecount, @itemtypes ) = &getitemtypes;
72 for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) {
73 $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } =
74 $itemtypes[$i]->{'description'};
77 for ( my $i = 0 ; $i < $branchcount ; $i++ ) {
78 $branchnames{ $branches[$i]->{'branchcode'} } =
79 $branches[$i]->{'branchname'};
82 # print $input->header;
84 # print startmenu('acquisitions');
86 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
88 template_name => "acqui.simple/additem-nomarc.tmpl",
92 flagsrequired => { catalogue => 1 },
97 if ( $error eq "nobarcode" ) {
98 $template->param( NOBARCODE => 1 );
100 elsif ( $error eq "nobiblioitem" ) {
101 $template->param( NOBIBLIOITEM => 1 );
103 elsif ( $error eq "barcodeinuse" ) {
104 $template->param( BARCODEINUSE => 1 );
107 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
108 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
109 $biblioitems[$i]->{'WEB'} = 1;
112 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
113 $biblioitems[$i]->{'dewey'} = $1;
114 ( $itemcount, @items ) =
115 &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
116 $biblioitems[$i]->{'items'} = \@items;
119 BIBNUM => $biblionumber,
120 AUTHOR => $biblios[0]->{'author'},
121 TITLE => $biblios[0]->{'title'},
122 COPYRIGHT => $biblios[0]->{'copyrightdate'},
123 SERIES => $biblios[0]->{'seriestitle'},
124 NOTES => $biblios[0]->{'notes'},
125 BIBITEMS => \@biblioitems,
126 BRANCHES => \@branches,
127 ITEMTYPES => \@itemtypes,
131 output_html_with_http_headers $input, $cookie, $template->output;