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.3 2006/07/21 10:12:00 toins
24 # subs renamed according to coding guidelines.
26 # Revision 1.2 2006/07/12 17:17:12 toins
27 # getitemtypes renamed to GetItemTypes
29 # Revision 1.1 2006/01/17 16:40:54 tipaul
30 # moving acqui.simple directory to cataloguing, as acqui.simple contains cataloguing scripts...
32 # Revision 1.8 2005/10/26 09:11:34 tipaul
33 # big commit, still breaking things...
35 # * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
36 # * code cleaning (cleaning warnings from perl -w) continued
38 # Revision 1.4.2.1 2005/03/25 12:52:44 tipaul
39 # needs "editcatalogue" flag, not "catalogue"
41 # Revision 1.4 2004/11/19 16:41:49 tipaul
42 # improving behaviour when MARC=OFF
44 # Revision 1.3 2004/08/13 16:37:25 tipaul
45 # adding frameworkcode to API in some subs
47 # Revision 1.2 2003/05/11 06:59:11 rangi
49 # Still needs some work
59 use C4::Interface::CGI::Output;
62 my $biblionumber = $input->param('biblionumber');
63 my $error = $input->param('error');
75 if ( !$biblionumber ) {
76 print $input->redirect('addbooks.pl');
80 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
82 template_name => "acqui.simple/additem-nomarc.tmpl",
86 flagsrequired => { editcatalogue => 1 },
90 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
92 if ( !$bibliocount ) {
93 print $input->redirect('addbooks.pl');
96 ( $biblioitemcount, @biblioitems ) = &getbiblioitembybiblionumber($biblionumber);
97 my $branches = GetBranches;
99 foreach my $thisbranch (sort keys %$branches) {
100 my %row =(value => $thisbranch,
101 branchname => $branches->{$thisbranch}->{'branchname'},
103 push @branchloop, \%row;
105 my $itemtypes = &GetItemTypes;
107 foreach my $thisitemtype (sort keys %$itemtypes) {
108 my %row =(value => $thisitemtype,
109 description => $itemtypes->{$thisitemtype}->{'description'},
111 push @itemtypeloop, \%row;
113 if ( $error eq "nobarcode" ) {
114 $template->param( NOBARCODE => 1 );
116 elsif ( $error eq "nobiblioitem" ) {
117 $template->param( NOBIBLIOITEM => 1 );
119 elsif ( $error eq "barcodeinuse" ) {
120 $template->param( BARCODEINUSE => 1 );
123 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
124 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
125 $biblioitems[$i]->{'WEB'} = 1;
127 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
128 $biblioitems[$i]->{'dewey'} = $1;
129 ( $itemcount, @items ) = &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
130 $biblioitems[$i]->{'items'} = \@items;
133 BIBNUM => $biblionumber,
134 AUTHOR => $biblios[0]->{'author'},
135 TITLE => $biblios[0]->{'title'},
136 COPYRIGHT => $biblios[0]->{'copyrightdate'},
137 SERIES => $biblios[0]->{'seriestitle'},
138 NOTES => $biblios[0]->{'notes'},
139 BIBITEMS => \@biblioitems,
140 branchloop => \@branchloop,
141 itemtypeloop => \@itemtypeloop,
143 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
145 if ( !$bibliocount ) {
146 print $input->redirect('addbooks.pl');
150 ( $biblioitemcount, @biblioitems ) =
151 &getbiblioitembybiblionumber($biblionumber);
152 @branches = &GetBranches;
153 ( $itemtypecount, @itemtypes ) = &GetItemTypes;
155 for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) {
156 $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } =
157 $itemtypes[$i]->{'description'};
160 for ( my $i = 0 ; $i < $#branches ; $i++ ) {
161 $branchnames{ $branches[$i]->{'branchcode'} } =
162 $branches[$i]->{'branchname'};
165 # print $input->header;
167 # print startmenu('acquisitions');
169 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
171 template_name => "acqui.simple/additem-nomarc.tmpl",
174 authnotrequired => 0,
175 flagsrequired => { editcatalogue => 1 },
180 if ( $error eq "nobarcode" ) {
181 $template->param( NOBARCODE => 1 );
183 elsif ( $error eq "nobiblioitem" ) {
184 $template->param( NOBIBLIOITEM => 1 );
186 elsif ( $error eq "barcodeinuse" ) {
187 $template->param( BARCODEINUSE => 1 );
190 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
191 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
192 $biblioitems[$i]->{'WEB'} = 1;
195 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
196 $biblioitems[$i]->{'dewey'} = $1;
197 ( $itemcount, @items ) =
198 &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
199 $biblioitems[$i]->{'items'} = \@items;
202 BIBNUM => $biblionumber,
203 AUTHOR => $biblios[0]->{'author'},
204 TITLE => $biblios[0]->{'title'},
205 COPYRIGHT => $biblios[0]->{'copyrightdate'},
206 SERIES => $biblios[0]->{'seriestitle'},
207 NOTES => $biblios[0]->{'notes'},
208 BIBITEMS => \@biblioitems,
209 BRANCHES => \@branches,
210 ITEMTYPES => \@itemtypes,
214 output_html_with_http_headers $input, $cookie, $template->output;