Lines 46-54
GetOptions(
Link Here
|
46 |
pod2usage(1) if $help || ( !$confirm && !$test_parameter ); |
46 |
pod2usage(1) if $help || ( !$confirm && !$test_parameter ); |
47 |
print "### Database will not be modified ###\n" if $test_parameter; |
47 |
print "### Database will not be modified ###\n" if $test_parameter; |
48 |
|
48 |
|
49 |
#dbh |
|
|
50 |
my $dbh = C4::Context->dbh; |
49 |
my $dbh = C4::Context->dbh; |
51 |
$dbh->{AutoCommit} = 0; |
50 |
my $schema = Koha::Database->schema; |
|
|
51 |
$schema->txn_begin; |
52 |
|
52 |
|
53 |
#sysprefs |
53 |
#sysprefs |
54 |
C4::Context->disable_syspref_cache() if ( defined( C4::Context->disable_syspref_cache() ) ); |
54 |
C4::Context->disable_syspref_cache() if ( defined( C4::Context->disable_syspref_cache() ) ); |
Lines 56-62
my $CataloguingLog = C4::Context->preference('CataloguingLog');
Link Here
|
56 |
my $mergelimit = C4::Context->preference('AuthorityMergeLimit'); |
56 |
my $mergelimit = C4::Context->preference('AuthorityMergeLimit'); |
57 |
$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); |
57 |
$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); |
58 |
$dbh->do("UPDATE systempreferences SET value=0 where variable='AuthorityMergeLimit'"); |
58 |
$dbh->do("UPDATE systempreferences SET value=0 where variable='AuthorityMergeLimit'"); |
59 |
$dbh->commit() unless $test_parameter; |
59 |
unless ($test_parameter){ |
|
|
60 |
$schema->txn_commit; |
61 |
$schema->txn_begin; |
62 |
} |
60 |
my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber" ); |
63 |
my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber" ); |
61 |
|
64 |
|
62 |
#dbh query init |
65 |
#dbh query init |
Lines 93-100
while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow
Link Here
|
93 |
if ($@) { warn "Problem with : $biblionumber : $@"; warn $record->as_formatted; } |
96 |
if ($@) { warn "Problem with : $biblionumber : $@"; warn $record->as_formatted; } |
94 |
} |
97 |
} |
95 |
} |
98 |
} |
96 |
unless ($test_parameter) { |
99 |
|
97 |
$dbh->commit() unless $count % 1000; |
100 |
unless ($test_parameter || $count % 1000) { |
|
|
101 |
$schema->txn_commit; |
102 |
$schema->txn_begin; |
98 |
} |
103 |
} |
99 |
} |
104 |
} |
100 |
|
105 |
|
Lines 102-108
my $sthCataloguingLog = $dbh->prepare("UPDATE systempreferences SET value=? WHER
Link Here
|
102 |
$sthCataloguingLog->execute($CataloguingLog); |
107 |
$sthCataloguingLog->execute($CataloguingLog); |
103 |
my $sthmergelimit = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='AuthorityMergeLimit'"); |
108 |
my $sthmergelimit = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='AuthorityMergeLimit'"); |
104 |
$sthmergelimit->execute($mergelimit); |
109 |
$sthmergelimit->execute($mergelimit); |
105 |
$dbh->commit() unless $test_parameter; |
110 |
$schema->txn_commit unless $test_parameter; |
106 |
my $timeneeded = time() - $starttime; |
111 |
my $timeneeded = time() - $starttime; |
107 |
print "$count MARC record done in $timeneeded seconds\n"; |
112 |
print "$count MARC record done in $timeneeded seconds\n"; |
108 |
if ( scalar(@errors) > 0 ) { |
113 |
if ( scalar(@errors) > 0 ) { |
109 |
- |
|
|