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.4 2004/11/19 16:41:49 tipaul
24 # improving behaviour when MARC=OFF
26 # Revision 1.3 2004/08/13 16:37:25 tipaul
27 # adding frameworkcode to API in some subs
29 # Revision 1.2 2003/05/11 06:59:11 rangi
31 # Still needs some work
41 use C4::Interface::CGI::Output;
44 my $biblionumber = $input->param('biblionumber');
45 my $error = $input->param('error');
59 my %itemtypedescriptions;
61 if ( !$biblionumber ) {
62 print $input->redirect('addbooks.pl');
66 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
68 if ( !$bibliocount ) {
69 print $input->redirect('addbooks.pl');
73 ( $biblioitemcount, @biblioitems ) =
74 &getbiblioitembybiblionumber($biblionumber);
75 ( $branchcount, @branches ) = &branches;
76 ( $itemtypecount, @itemtypes ) = &getitemtypes;
78 for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) {
79 $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } =
80 $itemtypes[$i]->{'description'};
83 for ( my $i = 0 ; $i < $branchcount ; $i++ ) {
84 $branchnames{ $branches[$i]->{'branchcode'} } =
85 $branches[$i]->{'branchname'};
88 # print $input->header;
90 # print startmenu('acquisitions');
92 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
94 template_name => "acqui.simple/additem-nomarc.tmpl",
98 flagsrequired => { catalogue => 1 },
103 if ( $error eq "nobarcode" ) {
104 $template->param( NOBARCODE => 1 );
106 elsif ( $error eq "nobiblioitem" ) {
107 $template->param( NOBIBLIOITEM => 1 );
109 elsif ( $error eq "barcodeinuse" ) {
110 $template->param( BARCODEINUSE => 1 );
113 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
114 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
115 $biblioitems[$i]->{'WEB'} = 1;
118 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
119 $biblioitems[$i]->{'dewey'} = $1;
120 ( $itemcount, @items ) =
121 &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
122 $biblioitems[$i]->{'items'} = \@items;
125 BIBNUM => $biblionumber,
126 AUTHOR => $biblios[0]->{'author'},
127 TITLE => $biblios[0]->{'title'},
128 COPYRIGHT => $biblios[0]->{'copyrightdate'},
129 SERIES => $biblios[0]->{'seriestitle'},
130 NOTES => $biblios[0]->{'notes'},
131 BIBITEMS => \@biblioitems,
132 BRANCHES => \@branches,
133 ITEMTYPES => \@itemtypes,
137 output_html_with_http_headers $input, $cookie, $template->output;