View | Details | Raw Unified | Return to bug 14042
Collapse All | Expand All

(-)a/admin/authtypes.pl (-24 / +8 lines)
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;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt (-6 / +19 lines)
Lines 7-12 Link Here
7
[% END %]
7
[% END %]
8
</title>
8
</title>
9
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
10
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
11
[% INCLUDE 'datatables.inc' %]
12
<script type="text/javascript">
13
//<![CDATA[
14
    $(document).ready(function() {
15
        $("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, {
16
            "aoColumnDefs": [
17
                { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
18
            ],
19
            "sPaginationType": "four_button"
20
        }));
21
    });
22
//]]>
23
</script>
10
</head>
24
</head>
11
25
12
<body id="admin_authtypes" class="admin">
26
<body id="admin_authtypes" class="admin">
Lines 96-102 Link Here
96
110
97
<h1>Authority types</h1>
111
<h1>Authority types</h1>
98
<p>Define authority types, then authority MARC structure in the same way you define itemtypes and biblio MARC tag structure. Authority values are managed through plugins</p>
112
<p>Define authority types, then authority MARC structure in the same way you define itemtypes and biblio MARC tag structure. Authority values are managed through plugins</p>
99
<table>
113
<table id="authtypes">
114
    <thead>
100
	<tr>
115
	<tr>
101
		<th>Code</th>
116
		<th>Code</th>
102
		<th>Description</th>
117
		<th>Description</th>
Lines 106-112 Link Here
106
		<th>Edit</th>
121
		<th>Edit</th>
107
		<th>Delete</th>
122
		<th>Delete</th>
108
	</tr>
123
	</tr>
109
	
124
    </thead>
125
    <tbody>
110
	[% FOREACH loo IN loop %]
126
	[% FOREACH loo IN loop %]
111
		<tr>
127
		<tr>
112
			<td>[% loo.authtypecode %]</td>
128
			<td>[% loo.authtypecode %]</td>
Lines 118-128 Link Here
118
			<td><a href="[% loo.script_name %]?op=delete_confirm&amp;authtypecode=[% loo.authtypecode |html %]">Delete</a></td>
134
			<td><a href="[% loo.script_name %]?op=delete_confirm&amp;authtypecode=[% loo.authtypecode |html %]">Delete</a></td>
119
		</tr>
135
		</tr>
120
	[% END %]
136
	[% END %]
137
    <tbody>
121
</table>
138
</table>
122
139
123
	[% IF ( previous ) %]<p><a href="[% previous %]">&lt;&lt; Previous</a></p>[% END %]
124
	[% IF ( next ) %]<p><a href="[% next %]">Next &gt;&gt;</a></p>[% END %]
125
126
[% END %]
140
[% END %]
127
</div>
141
</div>
128
</div>
142
</div>
129
- 

Return to bug 14042