Bug 14778: Remove t/Acquisition/Invoices.t
[koha.git] / svc / virtualshelves / search
blob5e991fc630ca788c4a92ca5986b15c5a6ade3a52
1 #!/usr/bin/perl
3 use Modern::Perl;
4 use CGI;
6 use C4::Auth qw( get_template_and_user );
7 use C4::Output qw( output_with_http_headers );
8 use C4::Utils::DataTables qw( dt_get_params );
9 use C4::Utils::DataTables::VirtualShelves qw( search );
11 my $input = new CGI;
13 exit unless $input->param('template_path');
15 my ($template, $user, $cookie) = get_template_and_user({
16 template_name => $input->param('template_path'),
17 query => $input,
18 type => "intranet",
19 authnotrequired => 0,
20 flagsrequired => { catalogue => 1 }
21 });
23 my $shelfname = $input->param('shelfname');
24 my $count = $input->param('count');
25 my $owner = $input->param('owner');
26 my $type = $input->param('type');
27 my $sortby = $input->param('sortby');
29 # variable information for DataTables (id)
30 my $sEcho = $input->param('sEcho');
32 my %dt_params = dt_get_params($input);
33 foreach (grep {$_ =~ /^mDataProp/} keys %dt_params) {
34 $dt_params{$_} =~ s/^dt_//;
37 my $results = C4::Utils::DataTables::VirtualShelves::search(
39 shelfname => $shelfname,
40 count => $count,
41 owner => $owner,
42 type => $type,
43 sortby => $sortby,
44 dt_params => \%dt_params,
48 $template->param(
49 sEcho => $sEcho,
50 iTotalRecords => $results->{iTotalRecords},
51 iTotalDisplayRecords => $results->{iTotalDisplayRecords},
52 aaData => $results->{shelves}
55 output_with_http_headers $input, $cookie, $template->output, 'json';
57 __END__
59 =head1 NAME
61 search - a search script for finding virtual shelves
63 =head1 SYNOPSIS
65 This script provides a service for template for virtual shelves search using DataTables
67 =cut
69 =back
71 =head1 LICENSE
73 Copyright 2014 BibLibre
75 This file is part of Koha.
77 Koha is free software; you can redistribute it and/or modify it under the
78 terms of the GNU General Public License as published by the Free Software
79 Foundation; either version 2 of the License, or (at your option) any later
80 version.
82 Koha is distributed in the hope that it will be useful, but WITHOUT ANY
83 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
84 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
86 You should have received a copy of the GNU General Public License along
87 with Koha; if not, write to the Free Software Foundation, Inc.,
88 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.