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

(-)a/admin/authtypes.pl (-24 / +8 lines)
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;
(-)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