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.6 2005/08/04 12:12:13 tipaul
24 # synch'ing 2.2 and head
26 # Revision 1.4.2.1 2005/03/25 12:52:44 tipaul
27 # needs "editcatalogue" flag, not "catalogue"
29 # Revision 1.4 2004/11/19 16:41:49 tipaul
30 # improving behaviour when MARC=OFF
32 # Revision 1.3 2004/08/13 16:37:25 tipaul
33 # adding frameworkcode to API in some subs
35 # Revision 1.2 2003/05/11 06:59:11 rangi
37 # Still needs some work
47 use C4::Interface::CGI::Output;
50 my $biblionumber = $input->param('biblionumber');
51 my $error = $input->param('error');
65 my %itemtypedescriptions;
67 if ( !$biblionumber ) {
68 print $input->redirect('addbooks.pl');
72 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
74 if ( !$bibliocount ) {
75 print $input->redirect('addbooks.pl');
79 ( $biblioitemcount, @biblioitems ) =
80 &getbiblioitembybiblionumber($biblionumber);
81 ( $branchcount, @branches ) = &branches;
82 ( $itemtypecount, @itemtypes ) = &getitemtypes;
84 for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) {
85 $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } =
86 $itemtypes[$i]->{'description'};
89 for ( my $i = 0 ; $i < $branchcount ; $i++ ) {
90 $branchnames{ $branches[$i]->{'branchcode'} } =
91 $branches[$i]->{'branchname'};
94 # print $input->header;
96 # print startmenu('acquisitions');
98 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
100 template_name => "acqui.simple/additem-nomarc.tmpl",
103 authnotrequired => 0,
104 flagsrequired => { editcatalogue => 1 },
109 if ( $error eq "nobarcode" ) {
110 $template->param( NOBARCODE => 1 );
112 elsif ( $error eq "nobiblioitem" ) {
113 $template->param( NOBIBLIOITEM => 1 );
115 elsif ( $error eq "barcodeinuse" ) {
116 $template->param( BARCODEINUSE => 1 );
119 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
120 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
121 $biblioitems[$i]->{'WEB'} = 1;
124 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
125 $biblioitems[$i]->{'dewey'} = $1;
126 ( $itemcount, @items ) =
127 &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
128 $biblioitems[$i]->{'items'} = \@items;
131 BIBNUM => $biblionumber,
132 AUTHOR => $biblios[0]->{'author'},
133 TITLE => $biblios[0]->{'title'},
134 COPYRIGHT => $biblios[0]->{'copyrightdate'},
135 SERIES => $biblios[0]->{'seriestitle'},
136 NOTES => $biblios[0]->{'notes'},
137 BIBITEMS => \@biblioitems,
138 BRANCHES => \@branches,
139 ITEMTYPES => \@itemtypes,
143 output_html_with_http_headers $input, $cookie, $template->output;