Bug 20478: Refactor to remove code duplication.
[koha.git] / misc / cronjobs / build_browser_and_cloud.pl
index e1873c8..d5e0d1a 100755 (executable)
@@ -2,6 +2,7 @@
 # small script that builds the tag cloud
 
 use strict;
+#use warnings; FIXME - Bug 2505
 BEGIN {
     # find Koha's Perl modules
     # test carefully before changing this
@@ -17,6 +18,8 @@ use Time::HiRes qw(gettimeofday);
 use ZOOM;
 use MARC::File::USMARC;
 use Getopt::Long;
+use C4::Log;
+
 my ( $input_marc_file, $number) = ('',0);
 my ($version, $confirm,$test_parameter,$field,$batch,$max_digits,$cloud_tag);
 GetOptions(
@@ -59,6 +62,8 @@ my $browser_subfield = $2;
 warn "browser : $browser_tag / $browser_subfield" unless $batch;
 die "no cloud or browser field/subfield defined : nothing to do !" unless $browser_tag or $cloud_tag;
 
+cronlogaction();
+
 my $dbh = C4::Context->dbh;
 
 my $i=0;
@@ -86,7 +91,7 @@ while ((my ($biblionumber)= $sth->fetchrow)) {
     #now, parse the record, extract the item fields, and store them in somewhere else.
     my $Koharecord;
     eval{
-           $Koharecord = GetMarcBiblio($biblionumber);
+        $Koharecord = GetMarcBiblio({ biblionumber => $biblionumber });
     };
     if($@){
            warn 'pb when getting biblio '.$i.' : '.$@;