Bug 17600: Standardize our EXPORT_OK
[srvgit] / misc / cronjobs / build_browser_and_cloud.pl
index e1873c8..46551ca 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
@@ -9,16 +10,19 @@ BEGIN {
     eval { require "$FindBin::Bin/../kohalib.pl" };
 }
 
+use Koha::Script -cron;
 use C4::Koha;
 use C4::Context;
-use C4::Biblio;
+use C4::Biblio qw( GetMarcBiblio );
 use Date::Calc;
 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);
+my ($version, $confirm,$field,$batch,$max_digits,$cloud_tag);
 GetOptions(
        'c' => \$confirm,
        'h' => \$version,
@@ -59,6 +63,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 +92,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.' : '.$@;
@@ -129,7 +135,7 @@ if ($browser_tag) {
     print "inserting datas in browser table\n" unless $batch;
     # read existing classification table is possible
     my $classification;
-    if (C4::Context->preference('opaclanguages') =~ m/^fr/i && $browser_tag eq '676' & $browser_subfield eq 'a') {
+    if (C4::Context->preference('OPACLanguages') =~ m/^fr/i && $browser_tag eq '676' & $browser_subfield eq 'a') {
         $classification = dewey_french();
     }