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 67-76
my $results = C4::Utils::DataTables::Members::search(
Link Here
|
67 |
searchtype => $searchtype, |
68 |
searchtype => $searchtype, |
68 |
searchfieldstype => $searchfieldstype, |
69 |
searchfieldstype => $searchfieldstype, |
69 |
dt_params => \%dt_params, |
70 |
dt_params => \%dt_params, |
70 |
|
|
|
71 |
} |
71 |
} |
72 |
); |
72 |
); |
73 |
|
73 |
|
|
|
74 |
# It is not recommanded to use the has_permission param if you use the pagination |
75 |
# The filter is done AFTER requested the data |
76 |
if ($has_permission) { |
77 |
my ( $permission, $subpermission ) = split /\./, $has_permission; |
78 |
my @patrons_with_permission; |
79 |
for my $patron ( @{ $results->{patrons} } ) { |
80 |
my $perms = haspermission( $patron->{userid} ); |
81 |
if ( $perms->{superlibrarian} == 1 |
82 |
or $perms->{$permission} == 1 ) |
83 |
{ |
84 |
push @patrons_with_permission, $patron; |
85 |
next; |
86 |
} |
87 |
|
88 |
if ($subpermission) { |
89 |
my $subperms = get_user_subpermissions( $patron->{userid} ); |
90 |
push @patrons_with_permission, $patron |
91 |
if $subperms->{$permission}->{$subpermission}; |
92 |
} |
93 |
} |
94 |
$results->{patrons} = \@patrons_with_permission; |
95 |
$results->{iTotalDisplayRecords} = scalar( @patrons_with_permission ); |
96 |
} |
97 |
|
74 |
$template->param( |
98 |
$template->param( |
75 |
sEcho => $sEcho, |
99 |
sEcho => $sEcho, |
76 |
iTotalRecords => $results->{iTotalRecords}, |
100 |
iTotalRecords => $results->{iTotalRecords}, |
77 |
- |
|
|