6 # Modified saas@users.sf.net 12:00 01 April 2001
7 # The biblioitemnumber was not correctly initialised
8 # The max(barcode) value was broken - koha 'barcode' is a string value!
9 # - If left blank, barcode value now defaults to max(biblionumber)
14 # Add info on biblioitems and items already entered as you enter new ones
16 # Add info on biblioitems and items already entered as you enter new ones
18 # Copyright 2000-2002 Katipo Communications
20 # This file is part of Koha.
22 # Koha is free software; you can redistribute it and/or modify it under the
23 # terms of the GNU General Public License as published by the Free Software
24 # Foundation; either version 2 of the License, or (at your option) any later
27 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
28 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
29 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
31 # You should have received a copy of the GNU General Public License along with
32 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
33 # Suite 330, Boston, MA 02111-1307 USA
41 use C4::Interface::CGI::Output;
48 my $success = $input->param('biblioitem');
49 my $query = $input->param('q');
50 my @value = $input->param('value');
52 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
54 template_name => "cataloguing/addbooks.tmpl",
58 flagsrequired => { editcatalogue => 1 },
64 my $frameworks = getframeworks;
65 my @frameworkcodeloop;
66 foreach my $thisframeworkcode (keys %$frameworks) {
67 my %row =(value => $thisframeworkcode,
68 frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
70 push @frameworkcodeloop, \%row;
73 # Searching the catalog.
75 my ($error, $marcresults) = SimpleSearch($query);
78 $template->param(error => $error);
79 warn "error: ".$error;
80 output_html_with_http_headers $input, $cookie, $template->output;
84 my $total = scalar @$marcresults;
87 for(my $i=0;$i<$total;$i++) {
89 my $marcrecord = MARC::File::USMARC::decode($marcresults->[$i]);
90 my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,'');
93 $biblio->{'title'} =~ s/$query/<span class=term>$&<\/span>/gi;
94 $biblio->{'subtitle'} =~ s/$query/<span class=term>$&<\/span>/gi;
95 $biblio->{'biblionumber'} =~ s/$query/<span class=term>$&<\/span>/gi;
96 $biblio->{'author'} =~ s/$query/<span class=term>$&<\/span>/gi;
97 $biblio->{'publishercode'} =~ s/$query/<span class=term>$&<\/span>/gi;
98 $biblio->{'publicationyear'} =~ s/$query/<span class=term>$&<\/span>/gi;
100 #build the hash for the template.
101 $resultsloop{highlight} = ($i % 2)?(1):(0);
102 $resultsloop{title} = $biblio->{'title'};
103 $resultsloop{subtitle} = $biblio->{'subtitle'};
104 $resultsloop{biblionumber} = $biblio->{'biblionumber'};
105 $resultsloop{author} = $biblio->{'author'};
106 $resultsloop{publishercode} = $biblio->{'publishercode'};
107 $resultsloop{publicationyear} = $biblio->{'publicationyear'};
109 push @results, \%resultsloop;
114 resultsloop => \@results,
118 # fill with books in breeding farm
121 # fill isbn or title, depending on what has been entered
122 $isbn=$query if $query =~ /\d/;
123 $title=$query unless $isbn;
124 my ( $countbr, @resultsbr ) = BreedingSearch( $title, $isbn ) if $query;
125 my @breeding_loop = ();
126 for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
134 $row_data{toggle} = $toggle;
135 $row_data{id} = $resultsbr[$i]->{'id'};
136 $row_data{isbn} = $resultsbr[$i]->{'isbn'};
137 $row_data{file} = $resultsbr[$i]->{'file'};
138 $row_data{title} = $resultsbr[$i]->{'title'};
139 $row_data{author} = $resultsbr[$i]->{'author'};
140 push ( @breeding_loop, \%row_data );
143 $template->param( frameworkcodeloop => \@frameworkcodeloop,
144 breeding_loop => \@breeding_loop,
147 output_html_with_http_headers $input, $cookie, $template->output;