Bug 26784: Silence warns about comparing undefined values for MARC modification templates
[koha.git] / svc / virtualshelves / search
blob403da12c21655e35eb50c3a7eab304abdd50dd8d
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 = CGI->new;
13 exit unless $input->param('template_path');
15 my ($template, $user, $cookie) = get_template_and_user({
16 template_name => scalar $input->param('template_path'),
17 query => $input,
18 type => "intranet",
19 flagsrequired => { catalogue => 1 }
20 });
22 my $shelfname = $input->param('shelfname');
23 my $count = $input->param('count');
24 my $owner = $input->param('owner');
25 my $type = $input->param('type');
26 my $sortby = $input->param('sortby');
28 # variable information for DataTables (id)
29 my $sEcho = $input->param('sEcho');
31 my %dt_params = dt_get_params($input);
32 foreach (grep {$_ =~ /^mDataProp/} keys %dt_params) {
33 $dt_params{$_} =~ s/^dt_//;
36 my $results = C4::Utils::DataTables::VirtualShelves::search(
38 shelfname => $shelfname,
39 count => $count,
40 owner => $owner,
41 type => $type,
42 sortby => $sortby,
43 dt_params => \%dt_params,
47 $template->param(
48 sEcho => $sEcho,
49 iTotalRecords => $results->{iTotalRecords},
50 iTotalDisplayRecords => $results->{iTotalDisplayRecords},
51 aaData => $results->{shelves}
54 output_with_http_headers $input, $cookie, $template->output, 'json';
56 __END__
58 =head1 NAME
60 search - a search script for finding virtual shelves
62 =head1 SYNOPSIS
64 This script provides a service for template for virtual shelves search using DataTables
66 =cut
68 =back
70 =head1 LICENSE
72 Copyright 2014 BibLibre
74 This file is part of Koha.
76 Koha is free software; you can redistribute it and/or modify it under the
77 terms of the GNU General Public License as published by the Free Software
78 Foundation; either version 2 of the License, or (at your option) any later
79 version.
81 Koha is free software; you can redistribute it and/or modify it
82 under the terms of the GNU General Public License as published by
83 the Free Software Foundation; either version 3 of the License, or
84 (at your option) any later version.
86 Koha is distributed in the hope that it will be useful, but
87 WITHOUT ANY WARRANTY; without even the implied warranty of
88 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89 GNU General Public License for more details.
91 You should have received a copy of the GNU General Public License
92 along with Koha; if not, see <http://www.gnu.org/licenses>.