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