Lines 20-26
Link Here
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use CGI; |
21 |
use CGI; |
22 |
|
22 |
|
23 |
use C4::Auth qw( get_template_and_user ); |
23 |
use C4::Auth qw( get_template_and_user haspermission get_user_subpermissions ); |
24 |
use C4::Output qw( output_with_http_headers ); |
24 |
use C4::Output qw( output_with_http_headers ); |
25 |
use C4::Utils::DataTables qw( dt_get_params ); |
25 |
use C4::Utils::DataTables qw( dt_get_params ); |
26 |
use C4::Utils::DataTables::Members qw( search ); |
26 |
use C4::Utils::DataTables::Members qw( search ); |
Lines 44-49
my $categorycode = $input->param('categorycode');
Link Here
|
44 |
my $branchcode = $input->param('branchcode'); |
44 |
my $branchcode = $input->param('branchcode'); |
45 |
my $searchtype = $input->param('searchtype'); |
45 |
my $searchtype = $input->param('searchtype'); |
46 |
my $searchfieldstype = $input->param('searchfieldstype') || 'standard'; |
46 |
my $searchfieldstype = $input->param('searchfieldstype') || 'standard'; |
|
|
47 |
my $has_permission = $input->param('has_permission'); |
47 |
|
48 |
|
48 |
if ( $searchfieldstype eq "dateofbirth" ) { |
49 |
if ( $searchfieldstype eq "dateofbirth" ) { |
49 |
$searchmember = output_pref({dt => dt_from_string($searchmember), dateformat => 'iso', dateonly => 1}); |
50 |
$searchmember = output_pref({dt => dt_from_string($searchmember), dateformat => 'iso', dateonly => 1}); |
Lines 82-91
$results = C4::Utils::DataTables::Members::search(
Link Here
|
82 |
searchtype => $searchtype, |
83 |
searchtype => $searchtype, |
83 |
searchfieldstype => $searchfieldstype, |
84 |
searchfieldstype => $searchfieldstype, |
84 |
dt_params => \%dt_params, |
85 |
dt_params => \%dt_params, |
85 |
|
|
|
86 |
} |
86 |
} |
87 |
) unless $results; |
87 |
) unless $results; |
88 |
|
88 |
|
|
|
89 |
# It is not recommanded to use the has_permission param if you use the pagination |
90 |
# The filter is done AFTER requested the data |
91 |
if ($has_permission) { |
92 |
my ( $permission, $subpermission ) = split /\./, $has_permission; |
93 |
my @patrons_with_permission; |
94 |
for my $patron ( @{ $results->{patrons} } ) { |
95 |
my $perms = haspermission( $patron->{userid} ); |
96 |
if ( $perms->{superlibrarian} == 1 |
97 |
or $perms->{$permission} == 1 ) |
98 |
{ |
99 |
push @patrons_with_permission, $patron; |
100 |
next; |
101 |
} |
102 |
|
103 |
if ($subpermission) { |
104 |
my $subperms = get_user_subpermissions( $patron->{userid} ); |
105 |
push @patrons_with_permission, $patron |
106 |
if $subperms->{$permission}->{$subpermission}; |
107 |
} |
108 |
} |
109 |
$results->{patrons} = \@patrons_with_permission; |
110 |
$results->{iTotalDisplayRecords} = scalar( @patrons_with_permission ); |
111 |
} |
112 |
|
89 |
$template->param( |
113 |
$template->param( |
90 |
sEcho => $sEcho, |
114 |
sEcho => $sEcho, |
91 |
iTotalRecords => $results->{iTotalRecords}, |
115 |
iTotalRecords => $results->{iTotalRecords}, |
92 |
- |
|
|