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