X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=cataloguing%2Faddbooks.pl;h=5e89ef87f3d549b736c429decd7b50f1df2b4039;hb=ad37f3e5e7175cb3a2a5785d552f6e06affaea97;hp=00ccd7ad65933387ed9215177cf408e7794c5397;hpb=d633bd1ba1169855de71fc9256d571554408e738;p=koha_fer diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl index 00ccd7ad65..5e89ef87f3 100755 --- a/cataloguing/addbooks.pl +++ b/cataloguing/addbooks.pl @@ -14,9 +14,9 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. =head1 cataloguing:addbooks.pl @@ -49,7 +49,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { editcatalogue => 1 }, + flagsrequired => { editcatalogue => 'edit_catalogue' }, debug => 1, } ); @@ -57,7 +57,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( # get framework list my $frameworks = getframeworks; my @frameworkcodeloop; -foreach my $thisframeworkcode ( keys %{$frameworks} ) { +foreach my $thisframeworkcode ( sort {$frameworks->{$a} cmp $frameworks->{$b}}keys %{$frameworks} ) { push @frameworkcodeloop, { value => $thisframeworkcode, frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'}, @@ -68,8 +68,13 @@ foreach my $thisframeworkcode ( keys %{$frameworks} ) { # Searching the catalog. if ($query) { + # build query + my @operands = $query; + my (@operators, @indexes, @sort_by, @limits) = (); + my ( $builterror,$builtquery,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,@limits,\@sort_by,undef,undef); + # find results - my ( $error, $marcresults, $total_hits ) = SimpleSearch($query, $results_per_page * ($page - 1), $results_per_page); + my ( $error, $marcresults, $total_hits ) = SimpleSearch($builtquery, $results_per_page * ($page - 1), $results_per_page); if ( defined $error ) { $template->param( error => $error ); @@ -79,8 +84,9 @@ if ($query) { } # format output - my $total = scalar @$marcresults; - my @newresults = searchResults( $query, $total, $results_per_page, $page-1, 0, @$marcresults ); + # SimpleSearch() give the results per page we want, so 0 offet here + my $total = @{$marcresults}; + my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, @{$marcresults} ); $template->param( total => $total_hits, query => $query, @@ -110,14 +116,13 @@ if ($query) { ( $countbr, @resultsbr ) = BreedingSearch( $title, $isbn ); } my $breeding_loop = []; -my $id = 0; for my $resultsbr (@resultsbr) { push @{$breeding_loop}, { - id => $id++, + id => $resultsbr->{import_record_id}, isbn => $resultsbr->{isbn}, copyrightdate => $resultsbr->{copyrightdate}, editionstatement => $resultsbr->{editionstatement}, - file => $resultsbr->{file}, + file => $resultsbr->{file_name}, title => $resultsbr->{title}, author => $resultsbr->{author}, };