Koha-Contrib-Sudoc

 view release on metacpan or  search on metacpan

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

package Koha::Contrib::Sudoc::Localisation;
# ABSTRACT: Localisation auto de notices biblio
$Koha::Contrib::Sudoc::Localisation::VERSION = '2.49';
use Moose;

extends 'AnyEvent::Processor';

use Modern::Perl;
use utf8;
use Koha::Contrib::Sudoc;
use Koha::Contrib::Sudoc::BiblioReader;
use C4::Items;
use C4::Context;
use YAML;
use Encode;
use Business::ISBN;
use List::Util qw/first/;


# Moulinette SUDOC
has sudoc => (
    is => 'rw',
    isa => 'Koha::Contrib::Sudoc',
    default => sub { Koha::Contrib::Sudoc->new; },
);


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

has reader => ( is => 'rw', isa => 'Koha::Contrib::Sudoc::BiblioReader' );

# Type de sortie : isbn, ppn ou dat
has type => (
    is => 'rw',
    isa => 'Str',
    default => 'isbn',
    trigger => sub {
        my ($self, $type) = @_;
        if ( $type !~ /isbn|dat|ppn/i ) {
            say "Type inconnu: $type";
            exit;
        }
        return $type;
    },
);

# Champ contenant le PPN
has ppn => (
    is => 'rw',
    isa => 'Str',
    default => '001',
    trigger => sub {
        my ($self, $ppn) = @_;
        if ( $ppn !~ /^[0-9]{3}$/ && $ppn !~ /^[0-9]{3}[a-z]$/ ) {
            say "Champ PPN invalide: $ppn";
            exit;
        }
        return $ppn;
    },
);


# Où placer la cote Koha dans la notice ABES, par défaut 930 $a
has coteabes => (
    is => 'rw',
    isa => 'Str',
    default => '930 $a'
);



( run in 2.230 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )