Lines 28-45
use C4::Auth;
Link Here
|
28 |
use C4::Output; |
28 |
use C4::Output; |
29 |
|
29 |
|
30 |
sub StringSearch { |
30 |
sub StringSearch { |
31 |
my $sth = C4::Context->dbh->prepare("SELECT * FROM auth_types WHERE (authtypecode like ?) ORDER BY authtypecode"); |
31 |
my $string = shift || ''; |
32 |
$sth->execute((shift || '') . "%"); |
32 |
my $dbh = C4::Context->dbh; |
33 |
return $sth->fetchall_arrayref({}); |
33 |
return $dbh->selectall_arrayref(q| |
|
|
34 |
SELECT authtypecode, authtypetext, auth_tag_to_report, summary |
35 |
FROM auth_types |
36 |
WHERE (authtypecode like ?) ORDER BY authtypecode |
37 |
|, { Slice => {} }, $string . "%" ); |
34 |
} |
38 |
} |
35 |
|
39 |
|
36 |
my $input = new CGI; |
40 |
my $input = new CGI; |
37 |
my $script_name = "/cgi-bin/koha/admin/authtypes.pl"; |
41 |
my $script_name = "/cgi-bin/koha/admin/authtypes.pl"; |
38 |
my $searchfield = $input->param('authtypecode'); # FIXME: Auth Type search not really implemented |
42 |
my $searchfield = $input->param('authtypecode'); # FIXME: Auth Type search not really implemented |
39 |
my $authtypecode = $input->param('authtypecode'); |
43 |
my $authtypecode = $input->param('authtypecode'); |
40 |
my $offset = $input->param('offset') || 0; |
|
|
41 |
my $op = $input->param('op') || ''; |
44 |
my $op = $input->param('op') || ''; |
42 |
my $pagesize = 20; |
|
|
43 |
my ($template, $borrowernumber, $cookie) |
45 |
my ($template, $borrowernumber, $cookie) |
44 |
= get_template_and_user({template_name => "admin/authtypes.tt", |
46 |
= get_template_and_user({template_name => "admin/authtypes.tt", |
45 |
query => $input, |
47 |
query => $input, |
Lines 110-133
if ($op eq 'add_form') {
Link Here
|
110 |
################## DEFAULT ################################## |
112 |
################## DEFAULT ################################## |
111 |
} else { # DEFAULT |
113 |
} else { # DEFAULT |
112 |
my $results = StringSearch($searchfield); |
114 |
my $results = StringSearch($searchfield); |
113 |
my $count = scalar @$results; |
115 |
$template->param( loop => $results ); |
114 |
my @loop_data; |
|
|
115 |
for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){ |
116 |
push @loop_data, { |
117 |
authtypecode => $results->[$i]{'authtypecode'}, |
118 |
authtypetext => $results->[$i]{'authtypetext'}, |
119 |
auth_tag_to_report => $results->[$i]{'auth_tag_to_report'}, |
120 |
summary => $results->[$i]{'summary'}, |
121 |
}; |
122 |
} |
123 |
$template->param(loop => \@loop_data); |
124 |
if ($offset>0) { |
125 |
my $prevpage = $offset-$pagesize; |
126 |
$template->param(previous => "$script_name?offset=".$prevpage); |
127 |
} |
128 |
if ($offset+$pagesize<$count) { |
129 |
my $nextpage = $offset+$pagesize; |
130 |
$template->param(next => "$script_name?offset=".$nextpage); |
131 |
} |
132 |
} #---- END $OP eq DEFAULT |
116 |
} #---- END $OP eq DEFAULT |
133 |
output_html_with_http_headers $input, $cookie, $template->output; |
117 |
output_html_with_http_headers $input, $cookie, $template->output; |