-sub get_from_authid {
- my $class = shift;
- my $authid = shift;
- my $marcflavour = C4::Context->preference("marcflavour");
-
- my $dbh=C4::Context->dbh;
- my $sth=$dbh->prepare("select authtypecode, marcxml from auth_header where authid=?");
- $sth->execute($authid);
- my ($authtypecode, $marcxml) = $sth->fetchrow;
- my $record=eval {MARC::Record->new_from_xml(StripNonXmlChars($marcxml),'UTF-8',
- (C4::Context->preference("marcflavour") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("marcflavour")))};
- return if ($@);
- $record->encoding('UTF-8');
-
- my $self = $class->SUPER::new( { authid => $authid,
- marcflavour => $marcflavour,
- authtype => $authtypecode,
- record => $record });
-
- bless $self, $class;
- return $self;