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 : ""); |