Koha-Contrib-Sudoc

 view release on metacpan or  search on metacpan

lib/Koha/Contrib/Sudoc/Koha.pm  view on Meta::CPAN

package Koha::Contrib::Sudoc::Koha;
# ABSTRACT: Lien à Koha
$Koha::Contrib::Sudoc::Koha::VERSION = '2.49';
use Moose;
use Modern::Perl;
use Carp;
use XML::Simple;
use DBI;
use ZOOM;
use MARC::Moose::Record;
use C4::Biblio qw/ GetFrameworkCode /;;
use Search::Elasticsearch;
use Koha::SearchEngine::Elasticsearch;
use YAML;
use MIME::Base64;
use Try::Tiny;


has conf_file => ( is => 'rw', isa => 'Str' );

has dbh => ( is => 'rw' );

has conf => ( is => 'rw' );

has _zconn => ( is => 'rw', isa => 'HashRef' );

has es => ( is => 'rw' );

has es_index => ( is=> 'rw' );

has sth_biblio => (is => 'rw' );

has biblionumber_where => (
    is => 'rw',
    isa => 'Str',
    lazy => 1,
    default => sub {
        my $self = shift;
        my $dbh = $self->dbh;
        my $where = $self->dbh->selectall_arrayref("
            SELECT tagfield, tagsubfield
              FROM marc_subfield_structure
             WHERE kohafield ='biblio.biblionumber'
               AND frameworkcode=''",
            {}
        );
        $where = join('', @{$where->[0]});
        my $tag = substr($where, 0, 3);
        $where = substr($where, 0, 3) if $tag lt '010';
        return $where;
    },
);


sub BUILD {
    my $self = shift;

    # Use KOHA_CONF environment variable by default
    $self->conf_file( $ENV{KOHA_CONF} )  unless $self->conf_file;

    $self->conf( XMLin( $self->conf_file,
        keyattr => ['id'], forcearray => ['listen', 'server', 'serverinfo'],
        suppressempty => '     ') );

    # Database Handler



( run in 1.102 second using v1.01-cache-2.11-cpan-e93a5daba3e )