|
Lines 20-26
sub search {
Link Here
|
| 20 |
$searchmember = $dt_params->{sSearch} // ''; |
20 |
$searchmember = $dt_params->{sSearch} // ''; |
| 21 |
} |
21 |
} |
| 22 |
|
22 |
|
| 23 |
my ($iTotalRecords, $iTotalDisplayRecords); |
23 |
my ($sth, $query, $iTotalRecords, $iTotalDisplayRecords); |
|
|
24 |
my $dbh = C4::Context->dbh; |
| 25 |
# Get the iTotalRecords DataTable variable |
| 26 |
$query = "SELECT COUNT(borrowers.borrowernumber) FROM borrowers"; |
| 27 |
$sth = $dbh->prepare($query); |
| 28 |
$sth->execute; |
| 29 |
($iTotalRecords) = $sth->fetchrow_array; |
| 30 |
|
| 31 |
if ( $searchfieldstype eq 'dateofbirth' ) { |
| 32 |
# Return an empty list if the date of birth is not correctly formatted |
| 33 |
$searchmember = eval { output_pref( { str => $searchmember, dateformat => 'iso', dateonly => 1 } ); }; |
| 34 |
if ( $@ or not $searchmember ) { |
| 35 |
return { |
| 36 |
iTotalRecords => 0, |
| 37 |
iTotalDisplayRecords => 0, |
| 38 |
patrons => [], |
| 39 |
}; |
| 40 |
} |
| 41 |
} |
| 24 |
|
42 |
|
| 25 |
# If branches are independent and user is not superlibrarian |
43 |
# If branches are independent and user is not superlibrarian |
| 26 |
# The search has to be only on the user branch |
44 |
# The search has to be only on the user branch |
|
Lines 30-36
sub search {
Link Here
|
| 30 |
|
48 |
|
| 31 |
} |
49 |
} |
| 32 |
|
50 |
|
| 33 |
my $dbh = C4::Context->dbh; |
|
|
| 34 |
my $select = "SELECT |
51 |
my $select = "SELECT |
| 35 |
borrowers.borrowernumber, borrowers.surname, borrowers.firstname, |
52 |
borrowers.borrowernumber, borrowers.surname, borrowers.firstname, |
| 36 |
borrowers.streetnumber, borrowers.streettype, borrowers.address, |
53 |
borrowers.streetnumber, borrowers.streettype, borrowers.address, |
|
Lines 126-132
sub search {
Link Here
|
| 126 |
$limit = "LIMIT $dt_params->{iDisplayStart},$dt_params->{iDisplayLength}"; |
143 |
$limit = "LIMIT $dt_params->{iDisplayStart},$dt_params->{iDisplayLength}"; |
| 127 |
} |
144 |
} |
| 128 |
|
145 |
|
| 129 |
my $query = join( |
146 |
$query = join( |
| 130 |
" ", |
147 |
" ", |
| 131 |
($select ? $select : ""), |
148 |
($select ? $select : ""), |
| 132 |
($from ? $from : ""), |
149 |
($from ? $from : ""), |
|
Lines 134-140
sub search {
Link Here
|
| 134 |
($orderby ? $orderby : ""), |
151 |
($orderby ? $orderby : ""), |
| 135 |
($limit ? $limit : "") |
152 |
($limit ? $limit : "") |
| 136 |
); |
153 |
); |
| 137 |
my $sth = $dbh->prepare($query); |
154 |
$sth = $dbh->prepare($query); |
| 138 |
$sth->execute(@where_args); |
155 |
$sth->execute(@where_args); |
| 139 |
my $patrons = $sth->fetchall_arrayref({}); |
156 |
my $patrons = $sth->fetchall_arrayref({}); |
| 140 |
|
157 |
|
|
Lines 144-155
sub search {
Link Here
|
| 144 |
$sth->execute(@where_args); |
161 |
$sth->execute(@where_args); |
| 145 |
($iTotalDisplayRecords) = $sth->fetchrow_array; |
162 |
($iTotalDisplayRecords) = $sth->fetchrow_array; |
| 146 |
|
163 |
|
| 147 |
# Get the iTotalRecords DataTable variable |
|
|
| 148 |
$query = "SELECT COUNT(borrowers.borrowernumber) FROM borrowers"; |
| 149 |
$sth = $dbh->prepare($query); |
| 150 |
$sth->execute; |
| 151 |
($iTotalRecords) = $sth->fetchrow_array; |
| 152 |
|
| 153 |
# Get some information on patrons |
164 |
# Get some information on patrons |
| 154 |
foreach my $patron (@$patrons) { |
165 |
foreach my $patron (@$patrons) { |
| 155 |
($patron->{overdues}, $patron->{issues}, $patron->{fines}) = |
166 |
($patron->{overdues}, $patron->{issues}, $patron->{fines}) = |