Lines 36-48
sub search {
Link Here
|
36 |
|, undef, $has_permission->{permission}); |
36 |
|, undef, $has_permission->{permission}); |
37 |
} |
37 |
} |
38 |
|
38 |
|
|
|
39 |
my (@where, @conditions); |
39 |
# Get the iTotalRecords DataTable variable |
40 |
# Get the iTotalRecords DataTable variable |
40 |
$iTotalQuery = "SELECT COUNT(borrowers.borrowernumber) FROM borrowers"; |
41 |
$iTotalQuery = "SELECT COUNT(borrowers.borrowernumber) FROM borrowers"; |
41 |
if ( $has_permission ) { |
42 |
if ( $has_permission ) { |
42 |
$iTotalQuery .= ' LEFT JOIN user_permissions on borrowers.borrowernumber=user_permissions.borrowernumber'; |
43 |
$iTotalQuery .= ' LEFT JOIN user_permissions ON borrowers.borrowernumber=user_permissions.borrowernumber'; |
|
|
44 |
$iTotalQuery .= ' AND module_bit=? AND code=?'; |
45 |
push @conditions, $has_permission->{module_bit}, $has_permission->{subpermission}; |
43 |
} |
46 |
} |
44 |
|
47 |
|
45 |
my (@where, @conditions); |
|
|
46 |
if ( @restricted_branchcodes ) { |
48 |
if ( @restricted_branchcodes ) { |
47 |
push @where, "borrowers.branchcode IN (" . join( ',', ('?') x @restricted_branchcodes ) . ")"; |
49 |
push @where, "borrowers.branchcode IN (" . join( ',', ('?') x @restricted_branchcodes ) . ")"; |
48 |
push @conditions, @restricted_branchcodes; |
50 |
push @conditions, @restricted_branchcodes; |
Lines 89-99
sub search {
Link Here
|
89 |
my $from = "FROM borrowers |
91 |
my $from = "FROM borrowers |
90 |
LEFT JOIN branches ON borrowers.branchcode = branches.branchcode |
92 |
LEFT JOIN branches ON borrowers.branchcode = branches.branchcode |
91 |
LEFT JOIN categories ON borrowers.categorycode = categories.categorycode"; |
93 |
LEFT JOIN categories ON borrowers.categorycode = categories.categorycode"; |
|
|
94 |
my @where_args; |
92 |
if ( $has_permission ) { |
95 |
if ( $has_permission ) { |
93 |
$from .= ' |
96 |
$from .= ' |
94 |
LEFT JOIN user_permissions on borrowers.borrowernumber=user_permissions.borrowernumber'; |
97 |
LEFT JOIN user_permissions ON borrowers.borrowernumber=user_permissions.borrowernumber |
|
|
98 |
AND module_bit=? AND code=?'; |
99 |
push @where_args, $has_permission->{module_bit}, $has_permission->{subpermission}; |
95 |
} |
100 |
} |
96 |
my @where_args; |
|
|
97 |
my @where_strs; |
101 |
my @where_strs; |
98 |
if(defined $firstletter and $firstletter ne '') { |
102 |
if(defined $firstletter and $firstletter ne '') { |
99 |
push @where_strs, "borrowers.surname LIKE ?"; |
103 |
push @where_strs, "borrowers.surname LIKE ?"; |
100 |
- |
|
|