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
47 my $success = $input->param('biblioitem');
48 my $query = $input->param('q');
49 my @value = $input->param('value');
51 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
53 template_name => "cataloguing/addbooks.tmpl",
57 flagsrequired => { editcatalogue => 1 },
63 my $frameworks = getframeworks;
64 my @frameworkcodeloop;
65 foreach my $thisframeworkcode (keys %$frameworks) {
66 my %row =(value => $thisframeworkcode,
67 frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
69 push @frameworkcodeloop, \%row;
72 # Searching the catalog.
74 my ($error, $marcresults) = SimpleSearch($query);
77 $template->param(error => $error);
78 warn "error: ".$error;
79 output_html_with_http_headers $input, $cookie, $template->output;
83 my $total = scalar @$marcresults;
86 for(my $i=0;$i<$total;$i++) {
88 my $marcrecord = MARC::File::USMARC::decode($marcresults->[$i]);
89 my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,'');
92 $biblio->{'title'} =~ s/$query/<span class=term>$&<\/span>/gi;
93 $biblio->{'subtitle'} =~ s/$query/<span class=term>$&<\/span>/gi;
94 $biblio->{'biblionumber'} =~ s/$query/<span class=term>$&<\/span>/gi;
95 $biblio->{'author'} =~ s/$query/<span class=term>$&<\/span>/gi;
96 $biblio->{'publishercode'} =~ s/$query/<span class=term>$&<\/span>/gi;
97 $biblio->{'publicationyear'} =~ s/$query/<span class=term>$&<\/span>/gi;
99 #build the hash for the template.
100 $resultsloop{highlight} = ($i % 2)?(1):(0);
101 $resultsloop{title} = $biblio->{'title'};
102 $resultsloop{subtitle} = $biblio->{'subtitle'};
103 $resultsloop{biblionumber} = $biblio->{'biblionumber'};
104 $resultsloop{author} = $biblio->{'author'};
105 $resultsloop{publishercode} = $biblio->{'publishercode'};
106 $resultsloop{publicationyear} = $biblio->{'publicationyear'};
108 push @results, \%resultsloop;
113 resultsloop => \@results,
117 # fill with books in breeding farm
120 # fill isbn or title, depending on what has been entered
121 $isbn=$query if $query =~ /\d/;
122 $title=$query unless $isbn;
123 my ( $countbr, @resultsbr ) = BreedingSearch( $title, $isbn ) if $query;
124 my @breeding_loop = ();
125 for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
133 $row_data{toggle} = $toggle;
134 $row_data{id} = $resultsbr[$i]->{'id'};
135 $row_data{isbn} = $resultsbr[$i]->{'isbn'};
136 $row_data{file} = $resultsbr[$i]->{'file'};
137 $row_data{title} = $resultsbr[$i]->{'title'};
138 $row_data{author} = $resultsbr[$i]->{'author'};
139 push ( @breeding_loop, \%row_data );
142 $template->param( frameworkcodeloop => \@frameworkcodeloop,
143 breeding_loop => \@breeding_loop,
146 output_html_with_http_headers $input, $cookie, $template->output;