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.8 2005/10/26 09:11:34 tipaul
24 # big commit, still breaking things...
26 # * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
27 # * code cleaning (cleaning warnings from perl -w) continued
29 # Revision 1.4.2.1 2005/03/25 12:52:44 tipaul
30 # needs "editcatalogue" flag, not "catalogue"
32 # Revision 1.4 2004/11/19 16:41:49 tipaul
33 # improving behaviour when MARC=OFF
35 # Revision 1.3 2004/08/13 16:37:25 tipaul
36 # adding frameworkcode to API in some subs
38 # Revision 1.2 2003/05/11 06:59:11 rangi
40 # Still needs some work
50 use C4::Interface::CGI::Output;
53 my $biblionumber = $input->param('biblionumber');
54 my $error = $input->param('error');
67 if ( !$biblionumber ) {
68 print $input->redirect('addbooks.pl');
72 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
74 template_name => "acqui.simple/additem-nomarc.tmpl",
78 flagsrequired => { editcatalogue => 1 },
82 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
84 if ( !$bibliocount ) {
85 print $input->redirect('addbooks.pl');
88 ( $biblioitemcount, @biblioitems ) = &getbiblioitembybiblionumber($biblionumber);
89 my $branches = getbranches;
91 foreach my $thisbranch (sort keys %$branches) {
92 my %row =(value => $thisbranch,
93 branchname => $branches->{$thisbranch}->{'branchname'},
95 push @branchloop, \%row;
97 my $itemtypes = &getitemtypes;
99 foreach my $thisitemtype (sort keys %$itemtypes) {
100 my %row =(value => $thisitemtype,
101 description => $itemtypes->{$thisitemtype}->{'description'},
103 push @itemtypeloop, \%row;
105 if ( $error eq "nobarcode" ) {
106 $template->param( NOBARCODE => 1 );
108 elsif ( $error eq "nobiblioitem" ) {
109 $template->param( NOBIBLIOITEM => 1 );
111 elsif ( $error eq "barcodeinuse" ) {
112 $template->param( BARCODEINUSE => 1 );
115 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
116 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
117 $biblioitems[$i]->{'WEB'} = 1;
119 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
120 $biblioitems[$i]->{'dewey'} = $1;
121 ( $itemcount, @items ) = &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 branchloop => \@branchloop,
133 itemtypeloop => \@itemtypeloop,
135 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
137 if ( !$bibliocount ) {
138 print $input->redirect('addbooks.pl');
142 ( $biblioitemcount, @biblioitems ) =
143 &getbiblioitembybiblionumber($biblionumber);
144 ( $branchcount, @branches ) = &branches;
145 ( $itemtypecount, @itemtypes ) = &getitemtypes;
147 for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) {
148 $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } =
149 $itemtypes[$i]->{'description'};
152 for ( my $i = 0 ; $i < $branchcount ; $i++ ) {
153 $branchnames{ $branches[$i]->{'branchcode'} } =
154 $branches[$i]->{'branchname'};
157 # print $input->header;
159 # print startmenu('acquisitions');
161 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
163 template_name => "acqui.simple/additem-nomarc.tmpl",
166 authnotrequired => 0,
167 flagsrequired => { editcatalogue => 1 },
172 if ( $error eq "nobarcode" ) {
173 $template->param( NOBARCODE => 1 );
175 elsif ( $error eq "nobiblioitem" ) {
176 $template->param( NOBIBLIOITEM => 1 );
178 elsif ( $error eq "barcodeinuse" ) {
179 $template->param( BARCODEINUSE => 1 );
182 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
183 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
184 $biblioitems[$i]->{'WEB'} = 1;
187 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
188 $biblioitems[$i]->{'dewey'} = $1;
189 ( $itemcount, @items ) =
190 &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
191 $biblioitems[$i]->{'items'} = \@items;
194 BIBNUM => $biblionumber,
195 AUTHOR => $biblios[0]->{'author'},
196 TITLE => $biblios[0]->{'title'},
197 COPYRIGHT => $biblios[0]->{'copyrightdate'},
198 SERIES => $biblios[0]->{'seriestitle'},
199 NOTES => $biblios[0]->{'notes'},
200 BIBITEMS => \@biblioitems,
201 BRANCHES => \@branches,
202 ITEMTYPES => \@itemtypes,
206 output_html_with_http_headers $input, $cookie, $template->output;