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.1 2006/01/17 16:40:54 tipaul
24 # moving acqui.simple directory to cataloguing, as acqui.simple contains cataloguing scripts...
26 # Revision 1.8 2005/10/26 09:11:34 tipaul
27 # big commit, still breaking things...
29 # * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
30 # * code cleaning (cleaning warnings from perl -w) continued
32 # Revision 1.4.2.1 2005/03/25 12:52:44 tipaul
33 # needs "editcatalogue" flag, not "catalogue"
35 # Revision 1.4 2004/11/19 16:41:49 tipaul
36 # improving behaviour when MARC=OFF
38 # Revision 1.3 2004/08/13 16:37:25 tipaul
39 # adding frameworkcode to API in some subs
41 # Revision 1.2 2003/05/11 06:59:11 rangi
43 # Still needs some work
53 use C4::Interface::CGI::Output;
56 my $biblionumber = $input->param('biblionumber');
57 my $error = $input->param('error');
70 if ( !$biblionumber ) {
71 print $input->redirect('addbooks.pl');
75 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
77 template_name => "acqui.simple/additem-nomarc.tmpl",
81 flagsrequired => { editcatalogue => 1 },
85 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
87 if ( !$bibliocount ) {
88 print $input->redirect('addbooks.pl');
91 ( $biblioitemcount, @biblioitems ) = &getbiblioitembybiblionumber($biblionumber);
92 my $branches = getbranches;
94 foreach my $thisbranch (sort keys %$branches) {
95 my %row =(value => $thisbranch,
96 branchname => $branches->{$thisbranch}->{'branchname'},
98 push @branchloop, \%row;
100 my $itemtypes = &getitemtypes;
102 foreach my $thisitemtype (sort keys %$itemtypes) {
103 my %row =(value => $thisitemtype,
104 description => $itemtypes->{$thisitemtype}->{'description'},
106 push @itemtypeloop, \%row;
108 if ( $error eq "nobarcode" ) {
109 $template->param( NOBARCODE => 1 );
111 elsif ( $error eq "nobiblioitem" ) {
112 $template->param( NOBIBLIOITEM => 1 );
114 elsif ( $error eq "barcodeinuse" ) {
115 $template->param( BARCODEINUSE => 1 );
118 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
119 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
120 $biblioitems[$i]->{'WEB'} = 1;
122 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
123 $biblioitems[$i]->{'dewey'} = $1;
124 ( $itemcount, @items ) = &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
125 $biblioitems[$i]->{'items'} = \@items;
128 BIBNUM => $biblionumber,
129 AUTHOR => $biblios[0]->{'author'},
130 TITLE => $biblios[0]->{'title'},
131 COPYRIGHT => $biblios[0]->{'copyrightdate'},
132 SERIES => $biblios[0]->{'seriestitle'},
133 NOTES => $biblios[0]->{'notes'},
134 BIBITEMS => \@biblioitems,
135 branchloop => \@branchloop,
136 itemtypeloop => \@itemtypeloop,
138 ( $bibliocount, @biblios ) = &getbiblio($biblionumber);
140 if ( !$bibliocount ) {
141 print $input->redirect('addbooks.pl');
145 ( $biblioitemcount, @biblioitems ) =
146 &getbiblioitembybiblionumber($biblionumber);
147 ( $branchcount, @branches ) = &branches;
148 ( $itemtypecount, @itemtypes ) = &getitemtypes;
150 for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) {
151 $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } =
152 $itemtypes[$i]->{'description'};
155 for ( my $i = 0 ; $i < $branchcount ; $i++ ) {
156 $branchnames{ $branches[$i]->{'branchcode'} } =
157 $branches[$i]->{'branchname'};
160 # print $input->header;
162 # print startmenu('acquisitions');
164 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
166 template_name => "acqui.simple/additem-nomarc.tmpl",
169 authnotrequired => 0,
170 flagsrequired => { editcatalogue => 1 },
175 if ( $error eq "nobarcode" ) {
176 $template->param( NOBARCODE => 1 );
178 elsif ( $error eq "nobiblioitem" ) {
179 $template->param( NOBIBLIOITEM => 1 );
181 elsif ( $error eq "barcodeinuse" ) {
182 $template->param( BARCODEINUSE => 1 );
185 for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
186 if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
187 $biblioitems[$i]->{'WEB'} = 1;
190 $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
191 $biblioitems[$i]->{'dewey'} = $1;
192 ( $itemcount, @items ) =
193 &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
194 $biblioitems[$i]->{'items'} = \@items;
197 BIBNUM => $biblionumber,
198 AUTHOR => $biblios[0]->{'author'},
199 TITLE => $biblios[0]->{'title'},
200 COPYRIGHT => $biblios[0]->{'copyrightdate'},
201 SERIES => $biblios[0]->{'seriestitle'},
202 NOTES => $biblios[0]->{'notes'},
203 BIBITEMS => \@biblioitems,
204 BRANCHES => \@branches,
205 ITEMTYPES => \@itemtypes,
209 output_html_with_http_headers $input, $cookie, $template->output;