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 2006/07/12 17:17:12 toins
24 # getitemtypes renamed to GetItemTypes
26 # Revision 1.1 2006/01/17 16:40:54 tipaul
27 # moving acqui.simple directory to cataloguing, as acqui.simple contains cataloguing scripts...
29 # Revision 1.8 2005/10/26 09:11:34 tipaul
30 # big commit, still breaking things...
32 # * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
33 # * code cleaning (cleaning warnings from perl -w) continued
35 # Revision 1.4.2.1 2005/03/25 12:52:44 tipaul
36 # needs "editcatalogue" flag, not "catalogue"
38 # Revision 1.4 2004/11/19 16:41:49 tipaul
39 # improving behaviour when MARC=OFF
41 # Revision 1.3 2004/08/13 16:37:25 tipaul
42 # adding frameworkcode to API in some subs
44 # Revision 1.2 2003/05/11 06:59:11 rangi
46 # Still needs some work
56 use C4::Interface::CGI::Output;
59 my $biblionumber = $input->param('biblionumber');
60 my $error = $input->param('error');
73 if ( !$biblionumber ) {
74 print $input->redirect('addbooks.pl');
78 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
80 template_name => "acqui.simple/additem-nomarc.tmpl",
84 flagsrequired => { editcatalogue => 1 },
88 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
90 if ( !$bibliocount ) {
91 print $input->redirect('addbooks.pl');
94 ( $biblioitemcount, @biblioitems ) = &getbiblioitembybiblionumber($biblionumber);
95 my $branches = getbranches;
97 foreach my $thisbranch (sort keys %$branches) {
98 my %row =(value => $thisbranch,
99 branchname => $branches->{$thisbranch}->{'branchname'},
101 push @branchloop, \%row;
103 my $itemtypes = &GetItemTypes;
105 foreach my $thisitemtype (sort keys %$itemtypes) {
106 my %row =(value => $thisitemtype,
107 description => $itemtypes->{$thisitemtype}->{'description'},
109 push @itemtypeloop, \%row;
111 if ( $error eq "nobarcode" ) {
112 $template->param( NOBARCODE => 1 );
114 elsif ( $error eq "nobiblioitem" ) {
115 $template->param( NOBIBLIOITEM => 1 );
117 elsif ( $error eq "barcodeinuse" ) {
118 $template->param( BARCODEINUSE => 1 );
121 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
122 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
123 $biblioitems[$i]->{'WEB'} = 1;
125 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
126 $biblioitems[$i]->{'dewey'} = $1;
127 ( $itemcount, @items ) = &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 branchloop => \@branchloop,
139 itemtypeloop => \@itemtypeloop,
141 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
143 if ( !$bibliocount ) {
144 print $input->redirect('addbooks.pl');
148 ( $biblioitemcount, @biblioitems ) =
149 &getbiblioitembybiblionumber($biblionumber);
150 ( $branchcount, @branches ) = &branches;
151 ( $itemtypecount, @itemtypes ) = &GetItemTypes;
153 for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) {
154 $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } =
155 $itemtypes[$i]->{'description'};
158 for ( my $i = 0 ; $i < $branchcount ; $i++ ) {
159 $branchnames{ $branches[$i]->{'branchcode'} } =
160 $branches[$i]->{'branchname'};
163 # print $input->header;
165 # print startmenu('acquisitions');
167 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
169 template_name => "acqui.simple/additem-nomarc.tmpl",
172 authnotrequired => 0,
173 flagsrequired => { editcatalogue => 1 },
178 if ( $error eq "nobarcode" ) {
179 $template->param( NOBARCODE => 1 );
181 elsif ( $error eq "nobiblioitem" ) {
182 $template->param( NOBIBLIOITEM => 1 );
184 elsif ( $error eq "barcodeinuse" ) {
185 $template->param( BARCODEINUSE => 1 );
188 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
189 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
190 $biblioitems[$i]->{'WEB'} = 1;
193 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
194 $biblioitems[$i]->{'dewey'} = $1;
195 ( $itemcount, @items ) =
196 &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
197 $biblioitems[$i]->{'items'} = \@items;
200 BIBNUM => $biblionumber,
201 AUTHOR => $biblios[0]->{'author'},
202 TITLE => $biblios[0]->{'title'},
203 COPYRIGHT => $biblios[0]->{'copyrightdate'},
204 SERIES => $biblios[0]->{'seriestitle'},
205 NOTES => $biblios[0]->{'notes'},
206 BIBITEMS => \@biblioitems,
207 BRANCHES => \@branches,
208 ITEMTYPES => \@itemtypes,
212 output_html_with_http_headers $input, $cookie, $template->output;