use C4::AuthoritiesMarc;
use C4::ImportBatch; #GetImportRecordMarc
use C4::Context;
-use C4::Koha; # XXX subfield_is_koha_internal_p
+use C4::Koha;
use Date::Calc qw(Today);
use MARC::File::USMARC;
use MARC::File::XML;
use C4::Biblio;
+use Koha::Authority::Types;
use vars qw( $tagslib);
use vars qw( $authorised_values_sth);
use vars qw( $is_a_modif );
push @authorised_values, $branchcode;
$authorised_lib{$branchcode} = $branchname;
}
-
- #----- itemtypes
}
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
- my $sth =
- $dbh->prepare(
- "select itemtype,description from itemtypes order by description");
- $sth->execute;
push @authorised_values, ""
unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
&& ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
-
+
my $itemtype;
-
- while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
- push @authorised_values, $itemtype;
- $authorised_lib{$itemtype} = $description;
+ my $itemtypes = GetItemTypes( style => 'array' );
+ for my $itemtype ( @$itemtypes ) {
+ push @authorised_values, $itemtype->{itemtype};
+ $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
}
$value = $itemtype unless ($value);
my $dbh = C4::Context->dbh;
if(!$authtypecode) {
- $authtypecode = $authid? &GetAuthTypeCode($authid): '';
+ $authtypecode = $authid ? Koha::Authorities->find($authid)->authtypecode : '';
}
my ($template, $loggedinuser, $cookie)
# build indicator hash.
my @ind_tag = $input->param('ind_tag');
my @indicator = $input->param('indicator');
- my $record = TransformHtmlToMarc($input);
+ my $record = TransformHtmlToMarc($input, 0);
my ($duplicateauthid,$duplicateauthvalue);
($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
authid => $authid , authtypecode=>$authtypecode, );
}
-$template->param(authid => $authid,
- authtypecode => $authtypecode,
- linkid=>$linkid,
-);
+my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
-my $authtypes = getauthtypes;
-my @authtypesloop;
-foreach my $thisauthtype (keys %$authtypes) {
- my %row =(value => $thisauthtype,
- selected => $thisauthtype eq $authtypecode,
- authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
- );
- push @authtypesloop, \%row;
-}
-
-$template->param(authtypesloop => \@authtypesloop,
- authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
- hide_marc => C4::Context->preference('hide_marc'),
- );
+$template->param(
+ authority_types => $authority_types,
+ authtypecode => $authtypecode,
+ authid => $authid,
+ linkid => $linkid,
+ authtypetext => $authority_types->find($authtypecode)->authtypetext,
+ hide_marc => C4::Context->preference('hide_marc'),
+);
output_html_with_http_headers $input, $cookie, $template->output;