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

(-)a/C4/AuthoritiesMarc.pm (+1 lines)
Lines 27-32 use C4::AuthoritiesMarc::UNIMARC; Link Here
27
use C4::Charset;
27
use C4::Charset;
28
use C4::Log;
28
use C4::Log;
29
use Koha::MetadataRecord::Authority;
29
use Koha::MetadataRecord::Authority;
30
use Koha::Authority::Types;
30
31
31
use vars qw($VERSION @ISA @EXPORT);
32
use vars qw($VERSION @ISA @EXPORT);
32
33
(-)a/C4/Koha.pm (-63 lines)
Lines 47-53 BEGIN { Link Here
47
		&get_itemtypeinfos_of
47
		&get_itemtypeinfos_of
48
		&getframeworks &getframeworkinfo
48
		&getframeworks &getframeworkinfo
49
        &GetFrameworksLoop
49
        &GetFrameworksLoop
50
		&getauthtypes &getauthtype
51
		&getallthemes
50
		&getallthemes
52
		&getFacets
51
		&getFacets
53
		&displayServers
52
		&displayServers
Lines 355-422 END_SQL Link Here
355
    return get_infos_of( $query, 'itemtype', undef, \@itemtypes );
354
    return get_infos_of( $query, 'itemtype', undef, \@itemtypes );
356
}
355
}
357
356
358
=head2 getauthtypes
359
360
  $authtypes = &getauthtypes();
361
362
Returns information about existing authtypes.
363
364
build a HTML select with the following code :
365
366
=head3 in PERL SCRIPT
367
368
   my $authtypes = getauthtypes;
369
   my @authtypesloop;
370
   foreach my $thisauthtype (keys %$authtypes) {
371
       my $selected = 1 if $thisauthtype eq $authtype;
372
       my %row =(value => $thisauthtype,
373
                selected => $selected,
374
                authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
375
            );
376
        push @authtypesloop, \%row;
377
    }
378
    $template->param(itemtypeloop => \@itemtypesloop);
379
380
=head3 in TEMPLATE
381
382
  <form action='<!-- TMPL_VAR name="script_name" -->' method=post>
383
    <select name="authtype">
384
    <!-- TMPL_LOOP name="authtypeloop" -->
385
        <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="authtypetext" --></option>
386
    <!-- /TMPL_LOOP -->
387
    </select>
388
    <input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
389
    <input type="submit" value="OK" class="button">
390
  </form>
391
392
393
=cut
394
395
sub getauthtypes {
396
397
    # returns a reference to a hash of references to authtypes...
398
    my %authtypes;
399
    my $dbh = C4::Context->dbh;
400
    my $sth = $dbh->prepare("select * from auth_types order by authtypetext");
401
    $sth->execute;
402
    while ( my $IT = $sth->fetchrow_hashref ) {
403
        $authtypes{ $IT->{'authtypecode'} } = $IT;
404
    }
405
    return ( \%authtypes );
406
}
407
408
sub getauthtype {
409
    my ($authtypecode) = @_;
410
411
    # returns a reference to a hash of references to authtypes...
412
    my %authtypes;
413
    my $dbh = C4::Context->dbh;
414
    my $sth = $dbh->prepare("select * from auth_types where authtypecode=?");
415
    $sth->execute($authtypecode);
416
    my $res = $sth->fetchrow_hashref;
417
    return $res;
418
}
419
420
=head2 getframework
357
=head2 getframework
421
358
422
  $frameworks = &getframework();
359
  $frameworks = &getframework();
(-)a/admin/auth_tag_structure.pl (-12 / +3 lines)
Lines 27-39 use C4::Context; Link Here
27
use C4::Output;
27
use C4::Output;
28
use C4::Context;
28
use C4::Context;
29
29
30
use Koha::Authority::Types;
30
31
31
# retrieve parameters
32
# retrieve parameters
32
my $input = new CGI;
33
my $input = new CGI;
33
my $authtypecode         = $input->param('authtypecode')         || '';    # set to select framework
34
my $authtypecode         = $input->param('authtypecode')         || '';    # set to select framework
34
my $existingauthtypecode = $input->param('existingauthtypecode') || '';    # set when we have to create a new framework (in authtype) by copying an old one (in existingauthtype)
35
my $existingauthtypecode = $input->param('existingauthtypecode') || '';    # set when we have to create a new framework (in authtype) by copying an old one (in existingauthtype)
35
36
36
# my $authtypeinfo = getauthtypeinfo($authtype);
37
my $searchfield = $input->param('searchfield') || 0;
37
my $searchfield = $input->param('searchfield') || 0;
38
my $offset      = $input->param('offset') || 0;
38
my $offset      = $input->param('offset') || 0;
39
my $op          = $input->param('op')     || '';
39
my $op          = $input->param('op')     || '';
Lines 54-69 my ($template, $loggedinuser, $cookie) Link Here
54
                 debug => 1,
54
                 debug => 1,
55
                 });
55
                 });
56
56
57
# get authtype list
57
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
58
my $authtypes     = getauthtypes;
59
my @authtypesloop = ();
60
foreach my $thisauthtype ( sort keys %{$authtypes} ) {
61
    push @authtypesloop,
62
      { value        => $thisauthtype,
63
        selected     => $thisauthtype eq $authtypecode,
64
        authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
65
      };
66
}
67
58
68
my $sth;
59
my $sth;
69
# check that authtype framework is defined in auth_tag_structure if we are on a default action
60
# check that authtype framework is defined in auth_tag_structure if we are on a default action
Lines 83-89 if (!$op or $op eq 'authtype_create_confirm') { Link Here
83
    }
74
    }
84
}
75
}
85
$template->param(script_name  => $script_name);
76
$template->param(script_name  => $script_name);
86
$template->param(authtypeloop => \@authtypesloop);
77
$template->param(authority_types => $authority_types );
87
if ($op && $op ne 'authtype_create_confirm') {
78
if ($op && $op ne 'authtype_create_confirm') {
88
    $template->param($op  => 1);
79
    $template->param($op  => 1);
89
} else {
80
} else {
(-)a/authorities/auth_finder.pl (-13 / +4 lines)
Lines 29-34 use C4::AuthoritiesMarc; Link Here
29
use C4::Acquisition;
29
use C4::Acquisition;
30
use C4::Koha;
30
use C4::Koha;
31
31
32
use Koha::Authority::Types;
33
32
my $query        = new CGI;
34
my $query        = new CGI;
33
my $op           = $query->param('op') || '';
35
my $op           = $query->param('op') || '';
34
my $authtypecode = $query->param('authtypecode') || '';
36
my $authtypecode = $query->param('authtypecode') || '';
Lines 49-66 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
49
    }
51
    }
50
);
52
);
51
53
52
# Authority types loop
54
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
53
my $authtypes = C4::Koha::getauthtypes();
54
my @authtypesloop;
55
foreach my $thisauthtype ( keys %$authtypes ) {
56
    my %row = (
57
        value        => $thisauthtype,
58
        selected     => ( $thisauthtype eq $authtypecode ),
59
        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
60
        index        => $index,
61
    );
62
    push @authtypesloop, \%row;
63
}
64
55
65
# If search form posted
56
# If search form posted
66
if ( $op eq "do_search" ) {
57
if ( $op eq "do_search" ) {
Lines 173-179 $template->param( Link Here
173
    value_match   => $query->param('value_match') || '',
164
    value_match   => $query->param('value_match') || '',
174
    tagid         => $tagid,
165
    tagid         => $tagid,
175
    index         => $index,
166
    index         => $index,
176
    authtypesloop => \@authtypesloop,
167
    authority_types  => $authority_types,
177
    authtypecode  => $authtypecode,
168
    authtypecode  => $authtypecode,
178
    source        => $source,
169
    source        => $source,
179
    relationship  => $relationship,
170
    relationship  => $relationship,
(-)a/authorities/authorities-home.pl (-17 / +4 lines)
Lines 33-38 use C4::Koha; # XXX subfield_is_koha_internal_p Link Here
33
use C4::Biblio;
33
use C4::Biblio;
34
use C4::Search::History;
34
use C4::Search::History;
35
35
36
use Koha::Authority::Types;
37
36
my $query = new CGI;
38
my $query = new CGI;
37
my $dbh   = C4::Context->dbh;
39
my $dbh   = C4::Context->dbh;
38
my $op           = $query->param('op')           || '';
40
my $op           = $query->param('op')           || '';
Lines 41-62 my $authid = $query->param('authid') || ''; Link Here
41
43
42
my ( $template, $loggedinuser, $cookie );
44
my ( $template, $loggedinuser, $cookie );
43
45
44
my $authtypes = getauthtypes;
46
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
45
my @authtypesloop;
46
foreach my $thisauthtype (
47
    sort {
48
        $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'}
49
    }
50
    keys %$authtypes
51
  )
52
{
53
    my %row = (
54
        value        => $thisauthtype,
55
        selected     => $thisauthtype eq $authtypecode,
56
        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
57
    );
58
    push @authtypesloop, \%row;
59
}
60
47
61
if ( $op eq "delete" ) {
48
if ( $op eq "delete" ) {
62
    ( $template, $loggedinuser, $cookie ) = get_template_and_user(
49
    ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 201-207 if ( $op eq '' ) { Link Here
201
}
188
}
202
189
203
$template->param(
190
$template->param(
204
    authtypesloop => \@authtypesloop,
191
    authority_types => $authority_types,
205
    op            => $op,
192
    op            => $op,
206
);
193
);
207
194
(-)a/authorities/authorities.pl (-18 / +10 lines)
Lines 31-36 use Date::Calc qw(Today); Link Here
31
use MARC::File::USMARC;
31
use MARC::File::USMARC;
32
use MARC::File::XML;
32
use MARC::File::XML;
33
use C4::Biblio;
33
use C4::Biblio;
34
use Koha::Authority::Types;
34
use vars qw( $tagslib);
35
use vars qw( $tagslib);
35
use vars qw( $authorised_values_sth);
36
use vars qw( $authorised_values_sth);
36
use vars qw( $is_a_modif );
37
use vars qw( $is_a_modif );
Lines 659-681 if ($op eq "duplicate") Link Here
659
                        authid                      => $authid , authtypecode=>$authtypecode,	);
660
                        authid                      => $authid , authtypecode=>$authtypecode,	);
660
}
661
}
661
662
662
$template->param(authid                       => $authid,
663
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
663
                 authtypecode => $authtypecode,
664
                 linkid=>$linkid,
665
);
666
667
my $authtypes = getauthtypes;
668
my @authtypesloop;
669
foreach my $thisauthtype (keys %$authtypes) {
670
    my %row =(value => $thisauthtype,
671
                selected => $thisauthtype eq $authtypecode,
672
                authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
673
            );
674
    push @authtypesloop, \%row;
675
}
676
664
677
$template->param(authtypesloop => \@authtypesloop,
665
$template->param(
678
                authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
666
    authority_types => $authority_types,
679
                hide_marc => C4::Context->preference('hide_marc'),
667
    authtypecode    => $authtypecode,
680
                );
668
    authid          => $authid,
669
    linkid          => $linkid,
670
    authtypetext    => $authority_types->find($authtypecode)->authtypetext,
671
    hide_marc       => C4::Context->preference('hide_marc'),
672
);
681
output_html_with_http_headers $input, $cookie, $template->output;
673
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/authorities/detail-biblio-search.pl (-13 / +8 lines)
Lines 50-55 use C4::Koha; Link Here
50
# use C4::Biblio;
50
# use C4::Biblio;
51
# use C4::Catalogue;
51
# use C4::Catalogue;
52
52
53
use Koha::Authority::Types;
53
54
54
my $query=new CGI;
55
my $query=new CGI;
55
56
Lines 119-136 my @fields = $record->fields(); Link Here
119
	}
120
	}
120
	$template->param("0XX" =>\@loop_data);
121
	$template->param("0XX" =>\@loop_data);
121
122
122
my $authtypes = getauthtypes;
123
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
123
my @authtypesloop;
124
124
foreach my $thisauthtype (keys %$authtypes) {
125
$template->param(
125
	my %row =(value => $thisauthtype,
126
    authid          => $authid,
126
				selected => $thisauthtype eq $authtypecode,
127
    authority_types => $authority_types,
127
				authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
128
    index           => $index,
128
			);
129
);
129
	push @authtypesloop, \%row;
130
}
131
132
$template->param(authid => $authid,
133
		authtypesloop => \@authtypesloop, index => $index,
134
		);
135
output_html_with_http_headers $query, $cookie, $template->output;
130
output_html_with_http_headers $query, $cookie, $template->output;
136
131
(-)a/authorities/detail.pl (-17 / +12 lines)
Lines 48-53 use CGI qw ( -utf8 ); Link Here
48
use MARC::Record;
48
use MARC::Record;
49
use C4::Koha;
49
use C4::Koha;
50
50
51
use Koha::Authority::Types;
52
51
our ($tagslib);
53
our ($tagslib);
52
54
53
sub build_tabs {
55
sub build_tabs {
Lines 178-193 my $authtypecode = GetAuthTypeCode($authid); Link Here
178
$tagslib = &GetTagsLabels(1,$authtypecode);
180
$tagslib = &GetTagsLabels(1,$authtypecode);
179
181
180
# Build list of authtypes for showing them
182
# Build list of authtypes for showing them
181
my $authtypes = getauthtypes;
183
my $authority_types = Koha::Authority::Types->search({}, { order_by => ['authtypecode']});
182
my @authtypesloop;
183
184
foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$authtypes) {
185
    my %row =(value => $thisauthtype,
186
                selected => $thisauthtype eq $authtypecode,
187
                authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
188
            );
189
    push @authtypesloop, \%row;
190
}
191
184
192
my $record=GetAuthority($authid);
185
my $record=GetAuthority($authid);
193
186
Lines 195-201 if (not defined $record) { Link Here
195
    # authid invalid
188
    # authid invalid
196
    $template->param ( errauthid => $authid,
189
    $template->param ( errauthid => $authid,
197
                       unknownauthid => 1,
190
                       unknownauthid => 1,
198
                       authtypesloop => \@authtypesloop );
191
                       authority_types => $authority_types, );
199
    output_html_with_http_headers $query, $cookie, $template->output;
192
    output_html_with_http_headers $query, $cookie, $template->output;
200
    exit;
193
    exit;
201
}
194
}
Lines 218-229 chop $biblio_fields; Link Here
218
211
219
build_tabs ($template, $record, $dbh,"",$query);
212
build_tabs ($template, $record, $dbh,"",$query);
220
213
221
$template->param(authid => $authid,
214
$template->param(
222
		count => $count,
215
    authid          => $authid,
223
		biblio_fields => $biblio_fields,
216
    count           => $count,
224
		authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
217
    biblio_fields   => $biblio_fields,
225
		authtypesloop => \@authtypesloop,
218
    authtypetext    => $authority_types->find($authtypecode)->authtypetext,
226
		);
219
    authtypecode    => $authtypecode,
220
    authority_types => $authority_types,
221
);
227
222
228
$template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour");
223
$template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour");
229
output_html_with_http_headers $query, $cookie, $template->output;
224
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/authorities/merge.pl (-24 / +6 lines)
Lines 156-172 else { Link Here
156
                title2          => $recordObj2->authorized_heading,
156
                title2          => $recordObj2->authorized_heading,
157
            );
157
            );
158
            if ( $recordObj1->authtype ne $recordObj2->authtype ) {
158
            if ( $recordObj1->authtype ne $recordObj2->authtype ) {
159
                my $frameworks = getauthtypes;
159
                my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
160
                my @frameworkselect;
160
                my @frameworkselect;
161
                foreach my $thisframeworkcode ( keys %$frameworks ) {
161
                while ( my $authority_type = $authority_types->next ) {
162
                    my %row = (
162
                    my %row = (
163
                        value => $thisframeworkcode,
163
                        value => $authority_type->authtypecode,
164
                        frameworktext =>
164
                        frameworktext => $authority_type->authtypetext,
165
                          $frameworks->{$thisframeworkcode}->{'authtypetext'},
166
                    );
165
                    );
167
                    if ( $recordObj1->authtype eq $thisframeworkcode ) {
168
                        $row{'selected'} = 1;
169
                    }
170
                    push @frameworkselect, \%row;
166
                    push @frameworkselect, \%row;
171
                }
167
                }
172
                $template->param(
168
                $template->param(
Lines 181-202 else { Link Here
181
    }
177
    }
182
}
178
}
183
179
184
my $authtypes = getauthtypes;
180
my $authority_types = Koha::Authority::Types->search({}, { order_by => ['authtypetext']});
185
my @authtypesloop;
181
$template->param( authority_types => $authority_types );
186
foreach my $thisauthtype (
187
    sort {
188
        $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'}
189
    }
190
    keys %$authtypes
191
  )
192
{
193
    my %row = (
194
        value        => $thisauthtype,
195
        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
196
    );
197
    push @authtypesloop, \%row;
198
}
199
$template->{VARS}->{authtypesloop} = \@authtypesloop;
200
182
201
if (@errors) {
183
if (@errors) {
202
184
(-)a/cataloguing/value_builder/unimarc_field_210c.pl (-16 lines)
Lines 69-89 my ($input) = @_; Link Here
69
    my ($template, $loggedinuser, $cookie);
69
    my ($template, $loggedinuser, $cookie);
70
    my $resultsperpage;
70
    my $resultsperpage;
71
71
72
    my $authtypes = getauthtypes;
73
    my @authtypesloop;
74
    foreach my $thisauthtype (keys %$authtypes) {
75
        my $selected;
76
        if ($thisauthtype eq $authtypecode) {
77
            $selected=1;
78
        }
79
        my %row =(value => $thisauthtype,
80
                    selected => $selected,
81
                    authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
82
                index => $index,
83
                );
84
        push @authtypesloop, \%row;
85
    }
86
87
    if ($op eq "do_search") {
72
    if ($op eq "do_search") {
88
        my @marclist = $query->param('marclist');
73
        my @marclist = $query->param('marclist');
89
        my @and_or = $query->param('and_or');
74
        my @and_or = $query->param('and_or');
Lines 186-192 my ($input) = @_; Link Here
186
                        );
171
                        );
187
    }
172
    }
188
173
189
    $template->param(authtypesloop => \@authtypesloop);
190
    $template->param(category => $category);
174
    $template->param(category => $category);
191
175
192
    # Print the page
176
    # Print the page
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc (-13 / +13 lines)
Lines 25-35 Link Here
25
        <input type="hidden" name="type" value="intranet" />
25
        <input type="hidden" name="type" value="intranet" />
26
        <select name="authtypecode">
26
        <select name="authtypecode">
27
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
27
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
28
        [% FOREACH authtypesloo IN authtypesloop %]
28
        [% FOREACH authority_type IN authority_types %]
29
            [% IF ( authtypesloo.selected ) %]
29
            [% IF authority_type.authtypecode == authtypecode %]
30
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
30
            <option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
31
            [% ELSE %]
31
            [% ELSE %]
32
            <option value="[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</option>
32
            <option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
33
            [% END %]
33
            [% END %]
34
        [% END %]
34
        [% END %]
35
        </select>
35
        </select>
Lines 79-91 Link Here
79
    <form action="/cgi-bin/koha/authorities/authorities-home.pl" method="get">
79
    <form action="/cgi-bin/koha/authorities/authorities-home.pl" method="get">
80
        <input type="hidden" name="op" value="do_search" />
80
        <input type="hidden" name="op" value="do_search" />
81
        <input type="hidden" name="type" value="intranet" />
81
        <input type="hidden" name="type" value="intranet" />
82
        <select  name="authtypecode">
82
        <select name="authtypecode">
83
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
83
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
84
        [% FOREACH authtypesloo IN authtypesloop %]
84
        [% FOREACH authority_type IN authority_types %]
85
            [% IF ( authtypesloo.selected ) %]
85
            [% IF authority_type.authtypecode == authtypecode %]
86
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
86
            <option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
87
            [% ELSE %]
87
            [% ELSE %]
88
            <option value="[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</option>
88
            <option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
89
            [% END %]
89
            [% END %]
90
        [% END %]
90
        [% END %]
91
        </select>
91
        </select>
Lines 135-145 Link Here
135
        <input type="hidden" name="type" value="intranet" />
135
        <input type="hidden" name="type" value="intranet" />
136
        <select name="authtypecode">
136
        <select name="authtypecode">
137
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
137
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
138
        [% FOREACH authtypesloo IN authtypesloop %]
138
        [% FOREACH authority_type IN authority_types %]
139
            [% IF ( authtypesloo.selected ) %]
139
            [% IF authority_type.authtypecode == authtypecode %]
140
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
140
            <option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
141
            [% ELSE %]
141
            [% ELSE %]
142
            <option value="[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</option>
142
            <option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
143
            [% END %]
143
            [% END %]
144
        [% END %]
144
        [% END %]
145
        </select>
145
        </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc (-2 / +2 lines)
Lines 54-61 Link Here
54
        <span class="caret"></span>
54
        <span class="caret"></span>
55
        </a>
55
        </a>
56
        <ul class="dropdown-menu">
56
        <ul class="dropdown-menu">
57
            [% FOREACH authtypesloo IN authtypesloop %]
57
            [% FOREACH authority_type IN authority_types %]
58
            <li><a href="/cgi-bin/koha/authorities/authorities.pl?authtypecode=[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</a></li>
58
                <li><a href="/cgi-bin/koha/authorities/authorities.pl?authtypecode=[% authority_type.authtypecode %]">[% authority_type.authtypetext %]</a></li>
59
            [% END %]
59
            [% END %]
60
        </ul>
60
        </ul>
61
    </div>
61
    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt (-5 / +4 lines)
Lines 187-199 Link Here
187
<h2>Select an authority framework</h2>
187
<h2>Select an authority framework</h2>
188
<form action="[% script_name %]" method="post">
188
<form action="[% script_name %]" method="post">
189
    <select name="authtypecode">
189
    <select name="authtypecode">
190
    [% FOREACH authtypeloo IN authtypeloop %]
190
    [% FOREACH authority_type IN authority_types%]
191
        [% IF ( authtypeloo.selected ) %]
191
        [% IF authority_type.authtypecode == authtypecode%]
192
        <option value="[% authtypeloo.value %]" selected="selected">[% authtypeloo.authtypetext %]</option>
192
        <option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
193
        [% ELSE %]
193
        [% ELSE %]
194
        <option value="[% authtypeloo.value %]">[% authtypeloo.authtypetext %]</option>
194
        <option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
195
        [% END %]
195
        [% END %]
196
            
197
    [% END %]
196
    [% END %]
198
    </select>
197
    </select>
199
    <input type="text" name="searchfield" value="[% searchfield %]" />
198
    <input type="text" name="searchfield" value="[% searchfield %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt (-1 / +1 lines)
Lines 93-99 function changeFramework(fw) { Link Here
93
                      <select name="frameworkcode" id="frameworkcode">
93
                      <select name="frameworkcode" id="frameworkcode">
94
                                      <option value="Default">Default</option>
94
                                      <option value="Default">Default</option>
95
                                      [% FOREACH frameworkcodeloo IN frameworkselect %]
95
                                      [% FOREACH frameworkcodeloo IN frameworkselect %]
96
                                          [% IF ( frameworkcodeloo.selected ) %]
96
                                          [% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
97
                                              <option value="[% frameworkcodeloo.value %]" selected="selected">
97
                                              <option value="[% frameworkcodeloo.value %]" selected="selected">
98
                                          [% ELSE %]
98
                                          [% ELSE %]
99
                                              <option value="[% frameworkcodeloo.value %]">
99
                                              <option value="[% frameworkcodeloo.value %]">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt (-6 / +2 lines)
Lines 172-183 $(document).ready(function() { Link Here
172
            <label for="authtype">Authority type: </label>
172
            <label for="authtype">Authority type: </label>
173
            <select name="authtype" id="authtype">
173
            <select name="authtype" id="authtype">
174
                <option value="">-- All --</option>
174
                <option value="">-- All --</option>
175
                [% FOREACH authtypeloo IN authtypeloop %]
175
                [% FOREACH authority_type IN authority_types %]
176
                [% IF ( authtypeloo.selected ) %]
176
                    <option value="[% authtypeloo.value %]">[% authtypeloo.description %]</option>
177
                <option value="[% authtypeloo.value %]" selected="selected">[% authtypeloo.description %]</option>
178
[% ELSE %]
179
                <option value="[% authtypeloo.value %]">[% authtypeloo.description %]</option>
180
[% END %]
181
                [% END %]
177
                [% END %]
182
            </select>
178
            </select>
183
        </li>
179
        </li>
(-)a/opac/opac-authorities-home.pl (-17 / +8 lines)
Lines 31-36 use C4::AuthoritiesMarc; Link Here
31
use C4::Koha;    # XXX subfield_is_koha_internal_p
31
use C4::Koha;    # XXX subfield_is_koha_internal_p
32
use C4::Search::History;
32
use C4::Search::History;
33
33
34
use Koha::Authority::Types;
35
34
my $query        = new CGI;
36
my $query        = new CGI;
35
my $op           = $query->param('op') || '';
37
my $op           = $query->param('op') || '';
36
my $authtypecode = $query->param('authtypecode') || '';
38
my $authtypecode = $query->param('authtypecode') || '';
Lines 42-62 $startfrom = 0 if ( !defined $startfrom ); Link Here
42
my ( $template, $loggedinuser, $cookie );
44
my ( $template, $loggedinuser, $cookie );
43
my $resultsperpage;
45
my $resultsperpage;
44
46
45
my $authtypes     = getauthtypes();
47
my $authority_types = Koha::Authority::Types->search({}, { order_by => ['authtypetext']});
46
my @authtypesloop = ();
47
foreach my $thisauthtype (
48
    sort {
49
        $authtypes->{$a}->{'authtypetext'}
50
          cmp $authtypes->{$b}->{'authtypetext'}
51
    }
52
    keys %{$authtypes}
53
  ) {
54
    push @authtypesloop,
55
      { value        => $thisauthtype,
56
        selected     => $thisauthtype eq $authtypecode,
57
        authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
58
      };
59
}
60
48
61
if ( $op eq "do_search" ) {
49
if ( $op eq "do_search" ) {
62
    my @marclist = ($query->param('marclist'));
50
    my @marclist = ($query->param('marclist'));
Lines 179-185 if ( $op eq "do_search" ) { Link Here
179
        resultcount    => scalar @$results,
167
        resultcount    => scalar @$results,
180
        numbers        => \@numbers,
168
        numbers        => \@numbers,
181
        authtypecode   => $authtypecode,
169
        authtypecode   => $authtypecode,
182
        authtypetext   => $authtypes->{$authtypecode}{'authtypetext'},
170
        authtypetext   => $authority_types->find($authtypecode)->authtypetext,
183
        isEDITORS      => $authtypecode eq 'EDITORS',
171
        isEDITORS      => $authtypecode eq 'EDITORS',
184
    );
172
    );
185
173
Lines 197-203 else { Link Here
197
185
198
}
186
}
199
187
200
$template->param( authtypesloop => \@authtypesloop );
188
$template->param(
189
    authority_types => $authority_types,
190
    authtypecode    => $authtypecode,
191
);
201
192
202
# Print the page
193
# Print the page
203
output_html_with_http_headers $query, $cookie, $template->output;
194
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-authoritiesdetail.pl (-14 / +8 lines)
Lines 47-52 use CGI qw ( -utf8 ); Link Here
47
use MARC::Record;
47
use MARC::Record;
48
use C4::Koha;
48
use C4::Koha;
49
49
50
use Koha::Authority::Types;
50
51
51
my $query = new CGI;
52
my $query = new CGI;
52
53
Lines 83-102 if ($display_hierarchy){ Link Here
83
84
84
my $count = CountUsage($authid);
85
my $count = CountUsage($authid);
85
86
86
87
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
87
my $authtypes     = getauthtypes();
88
$template->param(
88
my @authtypesloop = ();
89
    authority_types => $authority_types,
89
foreach my $thisauthtype ( keys %{$authtypes} ) {
90
    authtypetext    => $authority_types->find($authtypecode)->authtypetext,
90
    push @authtypesloop,
91
    authid          => $authid,
91
         { value        => $thisauthtype,
92
    count           => $count,
92
           selected     => $thisauthtype eq $authtypecode,
93
);
93
           authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
94
         };
95
}
96
$template->{VARS}->{'authtypesloop'} = \@authtypesloop;
97
$template->{VARS}->{'authtypetext'}  = $authtypes->{$authtypecode}{'authtypetext'};
98
$template->{VARS}->{'authid'}        = $authid;
99
$template->{VARS}->{'count'}         = $count;
100
94
101
# find the marc field/subfield used in biblio by this authority
95
# find the marc field/subfield used in biblio by this authority
102
if ($show_marc) {
96
if ($show_marc) {
(-)a/tools/export.pl (-12 / +3 lines)
Lines 26-31 use C4::Csv; Link Here
26
use C4::Koha;               # GetItemTypes
26
use C4::Koha;               # GetItemTypes
27
use C4::Output;
27
use C4::Output;
28
28
29
use Koha::Authority::Types;
29
use Koha::Biblioitems;
30
use Koha::Biblioitems;
30
use Koha::Database;
31
use Koha::Database;
31
use Koha::DateUtils qw( dt_from_string output_pref );
32
use Koha::DateUtils qw( dt_from_string output_pref );
Lines 279-294 else { Link Here
279
          };
280
          };
280
    }
281
    }
281
282
282
    my $authtypes = getauthtypes;
283
    my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
283
    my @authtypesloop;
284
    foreach my $thisauthtype ( sort keys %$authtypes ) {
285
        next unless $thisauthtype;
286
        my %row = (
287
            value       => $thisauthtype,
288
            description => $authtypes->{$thisauthtype}->{'authtypetext'},
289
        );
290
        push @authtypesloop, \%row;
291
    }
292
284
293
    if (   $flags->{superlibrarian}
285
    if (   $flags->{superlibrarian}
294
        && C4::Context->config('backup_db_via_tools')
286
        && C4::Context->config('backup_db_via_tools')
Lines 313-319 else { Link Here
313
    $template->param(
305
    $template->param(
314
        branchloop               => \@branchloop,
306
        branchloop               => \@branchloop,
315
        itemtypeloop             => \@itemtypesloop,
307
        itemtypeloop             => \@itemtypesloop,
316
        authtypeloop             => \@authtypesloop,
308
        authority_types          => $authority_types,
317
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
309
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
318
        csv_profiles             => C4::Csv::GetCsvProfiles('marc'),
310
        csv_profiles             => C4::Csv::GetCsvProfiles('marc'),
319
    );
311
    );
320
- 

Return to bug 15381