Koha-Contrib-Tamil

 view release on metacpan or  search on metacpan

lib/Koha/Contrib/Tamil/Unimarc4xx/Fix.pm  view on Meta::CPAN

package Koha::Contrib::Tamil::Unimarc4xx::Fix;
# ABSTRACT: Class checking mother/child biblios inconsistencies
$Koha::Contrib::Tamil::Unimarc4xx::Fix::VERSION = '0.074';
use Moose;

extends 'AnyEvent::Processor';

use Modern::Perl;
use utf8;
use MARC::Moose::Record;
use C4::Biblio qw/ ModBiblio /;
use YAML;


binmode(STDOUT, ':encoding(utf8)');

has tags => (is => 'rw', isa => 'ArrayRef', default => sub { [] });

has doit => ( is => 'rw', isa => 'Bool', default => 0 );

has sansid => ( is => 'rw', isa => 'HashRef', default => sub { {} } );

has invalide => ( is => 'rw', isa => 'HashRef', default => sub { { } } );

has title => ( is => 'rw', isa => 'HashRef', default => sub { { } } );


has verbose => ( is => 'rw', isa => 'Bool', default => 1 );

has sth => (
    is => 'rw',
    lazy => 1,
    default => sub {
        my $self = shift;
		my $dbh  = C4::Context->dbh;
        my $where = join(' OR ', map {
            "ExtractValue(metadata, '//datafield[\@tag=$_]') <> ''"
            } @{$self->tags});
        my $query = "
            SELECT biblionumber
              FROM biblio_metadata
         LEFT JOIN biblio USING(biblionumber)
             WHERE $where
          ORDER BY biblionumber ASC
        ";
        my $sth = $dbh->prepare($query);
        $sth->execute;
        $self->sth($sth);
	},
);


has fh => (
    is => 'rw',
    lazy => 1,
    default => sub {
        my $self = shift;
        my $fh_per_type = {};
        my @types = qw/
            ok
            9-invalide
            fixed
            orpheline
            orpheline-title
            sansid-mere
            sansid-fille
        /;
        for my $type (@types) {



( run in 1.181 second using v1.01-cache-2.11-cpan-b16cb0d3907 )