View | Details | Raw Unified | Return to bug 15235
Collapse All | Expand All

(-)a/C4/Utils/DataTables.pm (-15 / +29 lines)
Lines 20-25 package C4::Utils::DataTables; Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
require Exporter;
21
require Exporter;
22
22
23
use Koha::DateUtils;
24
23
use vars qw(@ISA @EXPORT);
25
use vars qw(@ISA @EXPORT);
24
26
25
BEGIN {
27
BEGIN {
Lines 138-151 sub dt_build_having { Link Here
138
                my $mDataProp = $param->{'mDataProp_'.$i};
140
                my $mDataProp = $param->{'mDataProp_'.$i};
139
                my @filter_fields = $param->{$mDataProp.'_filteron'}
141
                my @filter_fields = $param->{$mDataProp.'_filteron'}
140
                    ? split(' ', $param->{$mDataProp.'_filteron'})
142
                    ? split(' ', $param->{$mDataProp.'_filteron'})
141
                    : ();
143
                    : ($mDataProp);
142
                if(@filter_fields > 0) {
144
143
                    foreach my $field (@filter_fields) {
145
                foreach my $field (@filter_fields) {
144
                        push @gFilters, " $field LIKE ? ";
146
                    push @gFilters, " $field LIKE ? ";
145
                        push @gParams, "%$sSearch%";
146
                    }
147
                } else {
148
                    push @gFilters, " $mDataProp LIKE ? ";
149
                    push @gParams, "%$sSearch%";
147
                    push @gParams, "%$sSearch%";
150
                }
148
                }
151
            }
149
            }
Lines 163-179 sub dt_build_having { Link Here
163
            my $mDataProp = $param->{'mDataProp_'.$i};
161
            my $mDataProp = $param->{'mDataProp_'.$i};
164
            my @filter_fields = $param->{$mDataProp.'_filteron'}
162
            my @filter_fields = $param->{$mDataProp.'_filteron'}
165
                ? split(' ', $param->{$mDataProp.'_filteron'})
163
                ? split(' ', $param->{$mDataProp.'_filteron'})
166
                : ();
164
                : ($mDataProp);
167
            if(@filter_fields > 0) {
165
168
                my @localfilters;
166
            my @localfilters;
169
                foreach my $field (@filter_fields) {
167
            foreach my $field (@filter_fields) {
168
                if ($sSearch =~ /^(.*)\~(.*)$/) {
169
                    my ($from, $to) = ($1, $2);
170
                    my @datefilters;
171
                    if ($from) {
172
                        my $date = dt_from_string($from);
173
                        push @datefilters, " $field >= ? ";
174
                        push @params, $date->ymd;
175
                    }
176
                    if ($to) {
177
                        my $date = dt_from_string($to);
178
                        push @datefilters, " $field <= ? ";
179
                        push @params, $date->ymd;
180
                    }
181
                    if (@datefilters) {
182
                        push @localfilters, ' (' . join(' AND ', @datefilters) . ') ';
183
                    }
184
                } else {
170
                    push @localfilters, " $field LIKE ? ";
185
                    push @localfilters, " $field LIKE ? ";
171
                    push @params, "%$sSearch%";
186
                    push @params, "%$sSearch%";
172
                }
187
                }
188
            }
189
            if (@localfilters) {
173
                push @filters, " ( ". join(" OR ", @localfilters) ." ) ";
190
                push @filters, " ( ". join(" OR ", @localfilters) ." ) ";
174
            } else {
175
                push @filters, " $mDataProp LIKE ? ";
176
                push @params, "%$sSearch%";
177
            }
191
            }
178
        }
192
        }
179
        $i++;
193
        $i++;
(-)a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.dataTables.columnFilter.js (-1 / +1 lines)
Lines 250-256 Link Here
250
            //th.html(_fnRangeLabelPart(0));
250
            //th.html(_fnRangeLabelPart(0));
251
            var sFromId = oTable.attr("id") + '_range_from_' + i;
251
            var sFromId = oTable.attr("id") + '_range_from_' + i;
252
            var from = $('<input type="text" class="date_range_filter" id="' + sFromId + '" rel="' + i + '"/>');
252
            var from = $('<input type="text" class="date_range_filter" id="' + sFromId + '" rel="' + i + '"/>');
253
            from.datepicker();
254
            //th.append(from);
253
            //th.append(from);
255
            //th.append(_fnRangeLabelPart(1));
254
            //th.append(_fnRangeLabelPart(1));
256
            var sToId = oTable.attr("id") + '_range_to_' + i;
255
            var sToId = oTable.attr("id") + '_range_to_' + i;
Lines 275-280 Link Here
275
274
276
275
277
            th.wrapInner('<span class="filter_column filter_date_range" />');
276
            th.wrapInner('<span class="filter_column filter_date_range" />');
277
            from.datepicker();
278
            to.datepicker();
278
            to.datepicker();
279
            var index = i;
279
            var index = i;
280
            aiCustomSearch_Indexes.push(i);
280
            aiCustomSearch_Indexes.push(i);
(-)a/koha-tmpl/intranet-tmpl/prog/css/datatables.css (+10 lines)
Lines 257-262 span.filter_column > input[type="text"] { Link Here
257
    box-sizing: border-box;
257
    box-sizing: border-box;
258
}
258
}
259
259
260
span.filter_column.filter_date_range {
261
    white-space: nowrap;
262
}
263
264
span.filter_column > input.date_range_filter {
265
    font-size: 80%;
266
    width: 6em;
267
    padding: 0;
268
}
269
260
/* Row grouping */
270
/* Row grouping */
261
td.group,
271
td.group,
262
table.group td.group {
272
table.group td.group {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc (+18 lines)
Lines 9-14 Link Here
9
        <form name="issues" action="/cgi-bin/koha/tools/export.pl" method="post" class="checkboxed">
9
        <form name="issues" action="/cgi-bin/koha/tools/export.pl" method="post" class="checkboxed">
10
            <table id="issues-table" style="width: 100% !Important;">
10
            <table id="issues-table" style="width: 100% !Important;">
11
                <thead>
11
                <thead>
12
                    <tr class="filters_row" style="display: none">
13
                        <th>&nbsp;</th>
14
                        <th>&nbsp;</th>
15
                        <th>Due date</th>
16
                        <th>Title</th>
17
                        <th>Item type</th>
18
                        <th>Location</th>
19
                        <th>Home library</th>
20
                        <th>Checked out on</th>
21
                        <th>Checked out from</th>
22
                        <th>Call no</th>
23
                        <th>&nbsp;</th>
24
                        <th>&nbsp;</th>
25
                        <th>&nbsp;</th>
26
                        <th>&nbsp;</th>
27
                        <th>&nbsp;</th>
28
                        <th>&nbsp;</th>
29
                    </tr>
12
                    <tr>
30
                    <tr>
13
                        <th scope="col">&nbsp;</th>
31
                        <th scope="col">&nbsp;</th>
14
                        <th scope="col">&nbsp;</th>
32
                        <th scope="col">&nbsp;</th>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc (+1 lines)
Lines 44-48 Link Here
44
    var RESUME_HOLD_ERROR_NOT_FOUND = _("Unable to resume, hold not found");
44
    var RESUME_HOLD_ERROR_NOT_FOUND = _("Unable to resume, hold not found");
45
    var CURRENT = _(" (current) ");
45
    var CURRENT = _(" (current) ");
46
    var GROUP_TODAYS_CHECKOUTS = _("Group today's checkouts");
46
    var GROUP_TODAYS_CHECKOUTS = _("Group today's checkouts");
47
    var SHOW_COLUMN_FILTERS = _("Show column filters");
47
//]]>
48
//]]>
48
</script>
49
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 979-984 No patron matched <span class="ex">[% message | html %]</span> Link Here
979
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min_[% KOHA_VERSION %].js"></script>
979
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min_[% KOHA_VERSION %].js"></script>
980
    [% INCLUDE 'timepicker.inc' %]
980
    [% INCLUDE 'timepicker.inc' %]
981
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.rowGrouping_[% KOHA_VERSION %].js"></script>
981
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.rowGrouping_[% KOHA_VERSION %].js"></script>
982
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter_[% KOHA_VERSION %].js"></script>
982
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation_[% KOHA_VERSION %].js"></script>
983
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation_[% KOHA_VERSION %].js"></script>
983
    [% INCLUDE 'checkouts.js.inc' %]
984
    [% INCLUDE 'checkouts.js.inc' %]
984
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/holds_[% KOHA_VERSION %].js"></script>
985
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/holds_[% KOHA_VERSION %].js"></script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 549-554 Link Here
549
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min_[% KOHA_VERSION %].js"></script>
549
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min_[% KOHA_VERSION %].js"></script>
550
    [% INCLUDE 'timepicker.inc' %]
550
    [% INCLUDE 'timepicker.inc' %]
551
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.rowGrouping_[% KOHA_VERSION %].js"></script>
551
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.rowGrouping_[% KOHA_VERSION %].js"></script>
552
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter_[% KOHA_VERSION %].js"></script>
552
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation_[% KOHA_VERSION %].js"></script>
553
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation_[% KOHA_VERSION %].js"></script>
553
    [% INCLUDE 'checkouts.js.inc' %]
554
    [% INCLUDE 'checkouts.js.inc' %]
554
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/holds_[% KOHA_VERSION %].js"></script>
555
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/holds_[% KOHA_VERSION %].js"></script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (+62 lines)
Lines 22-27 function disableGrouping(datatable) { Link Here
22
    }
22
    }
23
}
23
}
24
24
25
function enableFiltering(datatable) {
26
    var oSettings = datatable.fnSettings();
27
    var filters_row = $(oSettings.nTable).find('thead tr.filters_row');
28
    if (!filters_row.hasClass('columnFilter')) {
29
        datatable.columnFilter({
30
            sPlaceHolder: "head:after",
31
            bUseColVis: true,
32
            sRangeFormat: "From {from}<br>to {to}",
33
            aoColumns: [
34
                null,
35
                null,
36
                { type: "date-range" },
37
                { type: "text" },
38
                { type: "text" },
39
                { type: "text" },
40
                { type: "text" },
41
                { type: "date-range" },
42
                { type: "text" },
43
                { type: "text" },
44
                null,
45
                null,
46
                null,
47
                null,
48
                null,
49
                null,
50
                null
51
            ]
52
        });
53
        filters_row.addClass('columnFilter');
54
    }
55
    filters_row.show();
56
}
57
58
function disableFiltering(datatable) {
59
    var oSettings = datatable.fnSettings();
60
    var filters_row = $(oSettings.nTable).find('thead tr.filters_row');
61
    filters_row.find('input[type="text"]')
62
        .val('')            // Empty filter text boxes
63
        .trigger('keyup')   // Filter (display all rows)
64
        .trigger('blur');   // Reset value to the column name
65
    filters_row.hide();
66
}
67
25
var renderers = {
68
var renderers = {
26
    groupOrder: function (data, type, row) {
69
    groupOrder: function (data, type, row) {
27
        if ( row.issued_today ) {
70
        if ( row.issued_today ) {
Lines 589-594 $(document).ready(function() { Link Here
589
          .append('<label for="issues-table-row-grouping-switch">' + GROUP_TODAYS_CHECKOUTS + '</label>')
632
          .append('<label for="issues-table-row-grouping-switch">' + GROUP_TODAYS_CHECKOUTS + '</label>')
590
          .appendTo('#issues-table_wrapper .top.pager');
633
          .appendTo('#issues-table_wrapper .top.pager');
591
634
635
        var filteringSwitch = $('<input type="checkbox">')
636
          .attr('id', 'issues-table-filtering-switch')
637
          .css('vertical-align', 'middle')
638
          .change(function() {
639
              if ($(this).is(':checked')) {
640
                  enableFiltering(issuesTable);
641
              } else {
642
                  disableFiltering(issuesTable);
643
              }
644
          });
645
        $('<div></div>')
646
          .css('float', 'left')
647
          .css('padding', '0.3em 0.5em')
648
          .css('line-height', '1.9em')
649
          .append(filteringSwitch)
650
          .append('&nbsp;')
651
          .append('<label for="issues-table-filtering-switch">' + SHOW_COLUMN_FILTERS + '</label>')
652
          .appendTo('#issues-table_wrapper .top.pager');
653
592
        if ( $("#issues-table").length ) {
654
        if ( $("#issues-table").length ) {
593
            $("#issues-table_processing").position({
655
            $("#issues-table_processing").position({
594
                of: $( "#issues-table" ),
656
                of: $( "#issues-table" ),
(-)a/svc/checkouts (-1 / +6 lines)
Lines 52-57 my $count = $input->param('iDisplayLength'); Link Here
52
52
53
my %params = dt_get_params($input);
53
my %params = dt_get_params($input);
54
my $orderby = dt_build_orderby(\%params);
54
my $orderby = dt_build_orderby(\%params);
55
my ($having, $having_params) = dt_build_having(\%params);
55
56
56
my $todaysIssuesDefaultSortOrder =
57
my $todaysIssuesDefaultSortOrder =
57
  C4::Context->preference('todaysIssuesDefaultSortOrder');
58
  C4::Context->preference('todaysIssuesDefaultSortOrder');
Lines 128-133 if ( @borrowernumber == 1 ) { Link Here
128
$sql .= $borrowernumber_sql;
129
$sql .= $borrowernumber_sql;
129
push( @parameters, @borrowernumber );
130
push( @parameters, @borrowernumber );
130
131
132
if (@$having) {
133
    $sql .= ' HAVING ' . join (' AND ', @$having);
134
    push @parameters, @$having_params;
135
}
136
131
$sql .= " $orderby";
137
$sql .= " $orderby";
132
138
133
if ($count && $count > 0) {
139
if ($count && $count > 0) {
134
- 

Return to bug 15235