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

(-)a/C4/Utils/DataTables/VirtualShelves.pm (-15 / +8 lines)
Lines 61-84 sub search { Link Here
61
61
62
    if ( defined $shelfname and $shelfname ne '' ) {
62
    if ( defined $shelfname and $shelfname ne '' ) {
63
        push @where_strs, 'shelfname LIKE ?';
63
        push @where_strs, 'shelfname LIKE ?';
64
        push @args, 'shelfname%';
64
        push @args, "%$shelfname%";
65
    }
66
    if ( defined $count and $count ne '' ) {
67
        push @where_strs, 'count = ?';
68
        push @args, $count;
69
    }
65
    }
70
    if ( defined $owner and $owner ne '' ) {
66
    if ( defined $owner and $owner ne '' ) {
71
        push @where_strs, 'owner LIKE ?';
67
        #push @where_strs, 'owner LIKE ?';
72
        push @args, 'owner%';
68
        #push @args, "$owner%";
73
        # FIXME search borronumber by name??
74
        # WHERE category=1 AND (vs.owner=? OR sh.borrowernumber=?);
69
        # WHERE category=1 AND (vs.owner=? OR sh.borrowernumber=?);
70
        push @where_strs, '( bo.firstname LIKE ? OR bo.surname LIKE ? )';
71
        push @args, "%$owner%", "%$owner%";
75
    }
72
    }
76
    if ( defined $sortby and $sortby ne '' ) {
73
    if ( defined $sortby and $sortby ne '' ) {
77
        push @where_strs, 'sortfield = ?';
74
        push @where_strs, 'sortfield = ?';
78
        push @args, 'sortfield';
75
        push @args, $sortby;
79
    }
76
    }
80
77
81
82
    push @where_strs, 'category = ?';
78
    push @where_strs, 'category = ?';
83
    push @args, $type;
79
    push @args, $type;
84
80
Lines 90-96 sub search { Link Here
90
    my $where;
86
    my $where;
91
    $where = " WHERE " . join (" AND ", @where_strs) if @where_strs;
87
    $where = " WHERE " . join (" AND ", @where_strs) if @where_strs;
92
    my $orderby = dt_build_orderby($dt_params);
88
    my $orderby = dt_build_orderby($dt_params);
93
    $orderby =~ s|shelfnumber|vs.shelfnumber|;
89
    $orderby =~ s|shelfnumber|vs.shelfnumber| if $orderby;
94
90
95
    my $limit;
91
    my $limit;
96
    # If iDisplayLength == -1, we want to display all shelves
92
    # If iDisplayLength == -1, we want to display all shelves
Lines 114-123 sub search { Link Here
114
        ($orderby ? $orderby : ""),
110
        ($orderby ? $orderby : ""),
115
        ($limit ? $limit : "")
111
        ($limit ? $limit : "")
116
    );
112
    );
117
    my $sth = $dbh->prepare($query);
113
    my $shelves = $dbh->selectall_arrayref( $query, { Slice => {} }, @args );
118
    $sth->execute(@args);
119
120
    my $shelves = $sth->fetchall_arrayref({});
121
114
122
    # Get the iTotalDisplayRecords DataTable variable
115
    # Get the iTotalDisplayRecords DataTable variable
123
    $query = "SELECT COUNT(vs.shelfnumber) " . $from_total . ($where ? $where : "");
116
    $query = "SELECT COUNT(vs.shelfnumber) " . $from_total . ($where ? $where : "");
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js (+3 lines)
Lines 130-135 jQuery.fn.dataTableExt.oApi.fnAddFilters = function ( oSettings, sClass, iDelay Link Here
130
        }, iDelay);
130
        }, iDelay);
131
      }
131
      }
132
    });
132
    });
133
    $(table).find("select."+sClass).on('change', function() {
134
        table.fnFilter($(this).val(), $(this).attr('data-column_num'));
135
    });
133
}
136
}
134
137
135
// Useful if you want to filter on dates with 2 inputs (start date and end date)
138
// Useful if you want to filter on dates with 2 inputs (start date and end date)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-3 / +29 lines)
Lines 3-8 Link Here
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'datatables.inc' %]
5
[% INCLUDE 'datatables.inc' %]
6
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
6
[% IF ( viewshelf ) %]
7
[% IF ( viewshelf ) %]
7
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
9
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
Lines 24-31 $(document).ready(function(){ Link Here
24
            aoData.push({
25
            aoData.push({
25
                'name': 'type',
26
                'name': 'type',
26
                'value': type,
27
                'value': type,
27
            },
28
            },{
28
            {
29
                'name': 'shelfname',
30
                'value': $("#searchshelfname_filter").val(),
31
            },{
32
                'name': 'owner',
33
                'value': $("#searchowner_filter").val(),
34
            },{
35
                'name': 'sortby',
36
                'value': $("#searchsortby_filter").val(),
37
            },{
29
                'name': 'template_path',
38
                'name': 'template_path',
30
                'value': 'virtualshelves/tables/shelves_results.tt',
39
                'value': 'virtualshelves/tables/shelves_results.tt',
31
            });
40
            });
Lines 52-59 $(document).ready(function(){ Link Here
52
        ],
61
        ],
53
        'bAutoWidth': false,
62
        'bAutoWidth': false,
54
        'sPaginationType': 'full_numbers',
63
        'sPaginationType': 'full_numbers',
64
        'bFilter': false,
55
        "bProcessing": true,
65
        "bProcessing": true,
56
        'bFilter': false
66
        "bSortCellsTop": true
57
    }));
67
    }));
58
68
59
    dtListResults.fnAddFilters("filter", 750);
69
    dtListResults.fnAddFilters("filter", 750);
Lines 595-600 function placeHold () { Link Here
595
                        <th>Sort by</th>
605
                        <th>Sort by</th>
596
                        <th>Actions</th>
606
                        <th>Actions</th>
597
                    </tr>
607
                    </tr>
608
                    <tr class="filters_row">
609
                        <th></th>
610
                        <th><input class="filter text_filter" id="searchshelfname_filter" placeholder="List name"></th>
611
                        <th></th>
612
                        <th><input class="filter text_filter" id="searchowner_filter" placeholder="Owner"></th>
613
                        <th>
614
                            <select class="filter text_filter" id="searchsortby_filter">
615
                                <option value=""></option>
616
                                <option value="title">Title</option>
617
                                <option value="author">Author</option>
618
                                <option value="copyrightdate">Copyrightdate</option>
619
                                <option value="itemcallnumber">Call number</option>
620
                            </select>
621
                        </th>
622
                        <th></th>
623
                    </tr>
598
                </thead>
624
                </thead>
599
                <tbody></tbody>
625
                <tbody></tbody>
600
            </table>
626
            </table>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt (-2 / +1 lines)
Lines 8-14 Link Here
8
                "dt_type":
8
                "dt_type":
9
                    "[% data.type %]",
9
                    "[% data.type %]",
10
                "dt_shelfname":
10
                "dt_shelfname":
11
                    "<a href='cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% data.shelfnumber %]'>[% data.shelfname %]</a>",
11
                    "<a href='/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% data.shelfnumber %]'>[% data.shelfname %]</a>",
12
                "dt_count":
12
                "dt_count":
13
                    "[% data.count %] item(s)",
13
                    "[% data.count %] item(s)",
14
                "dt_owner":
14
                "dt_owner":
15
- 

Return to bug 13419