Bug 34732: For Code39, append or prepend asterisk if missing from barcode
[koha.git] / svc / virtualshelves / search
1 #!/usr/bin/perl
2
3 use Modern::Perl;
4 use CGI;
5
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 );
10
11 my $input = CGI->new;
12
13 exit unless $input->param('template_path');
14
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 });
21
22 my $shelfname = $input->param('shelfname');
23 my $count = $input->param('count');
24 my $owner = $input->param('owner');
25 my $public = $input->param('public');
26 my $sortby = $input->param('sortby');
27 my $allow_transfer = $input->param('allow_transfer');
28
29 # variable information for DataTables (id)
30 my $sEcho = $input->param('sEcho');
31
32 my %dt_params = dt_get_params($input);
33 foreach (grep {$_ =~ /^mDataProp/} keys %dt_params) {
34     $dt_params{$_} =~ s/^dt_//;
35 }
36
37 my $results = C4::Utils::DataTables::VirtualShelves::search(
38     {
39         shelfname => $shelfname,
40         count     => $count,
41         owner     => $owner,
42         public    => $public,
43         sortby    => $sortby,
44         dt_params => \%dt_params,
45     }
46 );
47
48 $template->param(
49     sEcho => $sEcho,
50     iTotalRecords => $results->{iTotalRecords},
51     iTotalDisplayRecords => $results->{iTotalDisplayRecords},
52     aaData => $results->{shelves},
53     public => $public,
54     allow_transfer => $allow_transfer,
55 );
56
57 output_with_http_headers $input, $cookie, $template->output, 'json';
58
59 __END__
60
61 =head1 NAME
62
63 search - a search script for finding virtual shelves
64
65 =head1 SYNOPSIS
66
67 This script provides a service for template for virtual shelves search using DataTables
68
69 =head1 LICENSE
70
71 Copyright 2014 BibLibre
72
73 This file is part of Koha.
74
75 Koha is free software; you can redistribute it and/or modify it under the
76 terms of the GNU General Public License as published by the Free Software
77 Foundation; either version 2 of the License, or (at your option) any later
78 version.
79
80 Koha is free software; you can redistribute it and/or modify it
81 under the terms of the GNU General Public License as published by
82 the Free Software Foundation; either version 3 of the License, or
83 (at your option) any later version.
84
85 Koha is distributed in the hope that it will be useful, but
86 WITHOUT ANY WARRANTY; without even the implied warranty of
87 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 GNU General Public License for more details.
89
90 You should have received a copy of the GNU General Public License
91 along with Koha; if not, see <http://www.gnu.org/licenses>.