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

(-)a/C4/Utils/DataTables/VirtualShelves.pm (-15 / +8 lines)
Lines 62-85 sub search { Link Here
62
62
63
    if ( defined $shelfname and $shelfname ne '' ) {
63
    if ( defined $shelfname and $shelfname ne '' ) {
64
        push @where_strs, 'shelfname LIKE ?';
64
        push @where_strs, 'shelfname LIKE ?';
65
        push @args, 'shelfname%';
65
        push @args, "%$shelfname%";
66
    }
67
    if ( defined $count and $count ne '' ) {
68
        push @where_strs, 'count = ?';
69
        push @args, $count;
70
    }
66
    }
71
    if ( defined $owner and $owner ne '' ) {
67
    if ( defined $owner and $owner ne '' ) {
72
        push @where_strs, 'owner LIKE ?';
68
        #push @where_strs, 'owner LIKE ?';
73
        push @args, 'owner%';
69
        #push @args, "$owner%";
74
        # FIXME search borronumber by name??
75
        # WHERE category=1 AND (vs.owner=? OR sh.borrowernumber=?);
70
        # WHERE category=1 AND (vs.owner=? OR sh.borrowernumber=?);
71
        push @where_strs, '( bo.firstname LIKE ? OR bo.surname LIKE ? )';
72
        push @args, "%$owner%", "%$owner%";
76
    }
73
    }
77
    if ( defined $sortby and $sortby ne '' ) {
74
    if ( defined $sortby and $sortby ne '' ) {
78
        push @where_strs, 'sortfield = ?';
75
        push @where_strs, 'sortfield = ?';
79
        push @args, 'sortfield';
76
        push @args, $sortby;
80
    }
77
    }
81
78
82
83
    push @where_strs, 'category = ?';
79
    push @where_strs, 'category = ?';
84
    push @args, $type;
80
    push @args, $type;
85
81
Lines 91-97 sub search { Link Here
91
    my $where;
87
    my $where;
92
    $where = " WHERE " . join (" AND ", @where_strs) if @where_strs;
88
    $where = " WHERE " . join (" AND ", @where_strs) if @where_strs;
93
    my $orderby = dt_build_orderby($dt_params);
89
    my $orderby = dt_build_orderby($dt_params);
94
    $orderby =~ s|shelfnumber|vs.shelfnumber|;
90
    $orderby =~ s|shelfnumber|vs.shelfnumber| if $orderby;
95
91
96
    my $limit;
92
    my $limit;
97
    # If iDisplayLength == -1, we want to display all shelves
93
    # If iDisplayLength == -1, we want to display all shelves
Lines 115-124 sub search { Link Here
115
        ($orderby ? $orderby : ""),
111
        ($orderby ? $orderby : ""),
116
        ($limit ? $limit : "")
112
        ($limit ? $limit : "")
117
    );
113
    );
118
    my $sth = $dbh->prepare($query);
114
    my $shelves = $dbh->selectall_arrayref( $query, { Slice => {} }, @args );
119
    $sth->execute(@args);
120
121
    my $shelves = $sth->fetchall_arrayref({});
122
115
123
    # Get the iTotalDisplayRecords DataTable variable
116
    # Get the iTotalDisplayRecords DataTable variable
124
    $query = "SELECT COUNT(vs.shelfnumber) " . $from_total . ($where ? $where : "");
117
    $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