Lines 1-14
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
|
|
2 |
|
2 |
use Modern::Perl; |
3 |
use Modern::Perl; |
|
|
4 |
|
3 |
use Getopt::Long; |
5 |
use Getopt::Long; |
|
|
6 |
use MARC::Field; |
7 |
use MARC::Record; |
8 |
use Pod::Usage; |
9 |
use Time::HiRes qw(gettimeofday); |
10 |
|
4 |
use C4::Context; |
11 |
use C4::Context; |
5 |
use C4::Biblio; |
12 |
use C4::Biblio; |
6 |
use C4::Items; |
13 |
use C4::Items; |
7 |
use MARC::Record; |
|
|
8 |
use MARC::Field; |
9 |
use Data::Dumper; |
10 |
use Time::HiRes qw(gettimeofday); |
11 |
use Pod::Usage; |
12 |
|
14 |
|
13 |
=head1 NAME |
15 |
=head1 NAME |
14 |
|
16 |
|
Lines 41-47
GetOptions(
Link Here
|
41 |
'where:s' => \$where, |
43 |
'where:s' => \$where, |
42 |
) or pod2usage(2); |
44 |
) or pod2usage(2); |
43 |
|
45 |
|
44 |
pod2usage(1) if ( $help || ( !$confirm ) ); |
46 |
pod2usage(1) if $help || ( !$confirm && !$test_parameter ); |
45 |
print "### Database will not be modified ###\n" if $test_parameter; |
47 |
print "### Database will not be modified ###\n" if $test_parameter; |
46 |
|
48 |
|
47 |
#dbh |
49 |
#dbh |
Lines 68-79
$sth->execute();
Link Here
|
68 |
while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow ) { |
70 |
while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow ) { |
69 |
$count++; |
71 |
$count++; |
70 |
warn $count unless $count % 1000; |
72 |
warn $count unless $count % 1000; |
71 |
my $extkey; |
|
|
72 |
my $record = GetMarcBiblio( $biblionumber, 1 ); |
73 |
my $record = GetMarcBiblio( $biblionumber, 1 ); |
73 |
unless ($record) { push @errors, "bad record biblionumber $biblionumber"; next; } |
74 |
unless ($record) { push @errors, "bad record biblionumber $biblionumber"; next; } |
74 |
my ( $tmptestfields, $tmptestdirectory, $reclen, $tmptestbaseaddress ) = MARC::File::USMARC::_build_tag_directory($record); |
|
|
75 |
|
75 |
|
76 |
#print "\n################################ record before ##################################\n".$record->as_formatted;#!test |
|
|
77 |
unless ($test_parameter) { |
76 |
unless ($test_parameter) { |
78 |
my $rqitemnumber = $dbh->prepare("SELECT itemnumber, biblionumber from items where itemnumber = ? and biblionumber = ?"); |
77 |
my $rqitemnumber = $dbh->prepare("SELECT itemnumber, biblionumber from items where itemnumber = ? and biblionumber = ?"); |
79 |
foreach my $itemfield ( $record->field($itemfield) ) { |
78 |
foreach my $itemfield ( $record->field($itemfield) ) { |
Lines 109-113
if ( scalar(@errors) > 0 ) {
Link Here
|
109 |
print "Some biblionumber could not be processed though: ", join( " ", @errors ); |
108 |
print "Some biblionumber could not be processed though: ", join( " ", @errors ); |
110 |
} |
109 |
} |
111 |
|
110 |
|
112 |
sub defnonull { my $var = shift; defined $var and $var ne "" } |
111 |
sub defnonull { |
113 |
__END__ |
112 |
my $var = shift; |
|
|
113 |
defined $var and $var ne ""; |
114 |
} |
114 |
- |
|
|