Koha/misc/maintenance/UNIMARC_fix_collectiontitle.pl
Martin Renvoize d2e189ca1c Bug 22600: Set 'commandline' interface appropriately
This patch change Koha::Cron to be a more generic Koha::Script class and
update all commanline driven scripts to use it.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-10 19:43:11 +00:00

33 lines
838 B
Perl
Executable file

#!/usr/bin/perl
#
# This script should be used only with UNIMARC flavour
# It is designed to report some missing information from biblio
# table into marc data
#
use strict;
use warnings;
BEGIN {
use FindBin;
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use C4::Biblio;
sub process {
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(qq{UPDATE marc_subfield_structure SET kohafield='biblioitems.collectiontitle' where kohafield='biblio.seriestitle' and not tagfield like "4__"});
return $sth->execute();
}
if (lc(C4::Context->preference('marcflavour')) eq "unimarc"){
print "count subfields changed :".process()." kohafields biblio.seriestitle changed into biblioitems.collectiontitle";
}
else {
print "this script is UNIMARC only and should be used only on unimarc databases\n";
}