Bug 12031: [QA Follow-up] Undefined routine and change to koha-conf.xml
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 4 Aug 2014 08:56:34 +0000 (10:56 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 27 Oct 2014 13:38:11 +0000 (10:38 -0300)
[1] Routine add_cron_job was added in 2007 but has not been defined.
    Parameter Recurring is not used.
[2] Made some changes to koha-conf.xml. Instead of an example to edit,
    I replaced it by the SCRIPT_NONDEV_DIR install variable.
[3] SCRIPT_NONDEV_DIR had to be included in rewrite-config.pl and the
    path had to be corrected for dev installs in Makefile.PL

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested single and dev install for supportdir change.
Compared installations with and without the patches for this report.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Makefile.PL
etc/koha-conf.xml
rewrite-config.PL
tools/scheduler.pl

index c7600b0..499172c 100644 (file)
@@ -1259,7 +1259,9 @@ sub get_target_directories {
         $dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'pazpar2');
         $dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
         $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
-        $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
+        #For dev install, point NONDEV_DIR to misc in current dir (not base)
+        #Used by supportdir in koha-conf.xml (BZ 12031)
+        $dirmap{'SCRIPT_NONDEV_DIR'} = File::Spec->catdir($curdir, 'misc');
         $skipdirs{'SCRIPT_NONDEV_DIR'} = 1;
         $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
         $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
index c886050..6f2f8a8 100644 (file)
@@ -106,11 +106,9 @@ __PAZPAR2_TOGGLE_XML_POST__
       tool -->
  <backup_db_via_tools>0</backup_db_via_tools>
  <backup_conf_via_tools>0</backup_conf_via_tools>
- <!-- Uncomment the following line if you are not using packages and need to schedule reports through the web interface
- Example:
- My runreports.pl is in /home/user/koha-src/koha/misc/cronjobs
- my <supportdir> would be as follows:
- <supportdir>/home/user/koha-src/koha/misc</supportdir>
+ <!-- Uncomment the following line if you are not using packages and need to schedule reports through the web interface. supportdir should contain cronjobs/runreport.pl -->
+ <!--
+ <supportdir>__SCRIPT_NONDEV_DIR__</supportdir>
  -->
  <pazpar2url>http://__PAZPAR2_HOST__:__PAZPAR2_PORT__/search.pz2</pazpar2url>
  <install_log>__MISC_DIR__/koha-install-log</install_log>
index 87e2587..8e6813d 100644 (file)
@@ -115,6 +115,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
   '__PAZPAR2_CONF_DIR__' => "$prefix/etc/koha/pazpar2",
   '__MISC_DIR__' => "$prefix/misc",
   '__SCRIPT_DIR__' => "$prefix/bin",
+  '__SCRIPT_NONDEV_DIR__' => "$prefix/bin",
   '__MAN_DIR__' => "$prefix/man",
   '__DOC_DIR__' => "$prefix/doc",
   '__ZEBRA_LOCK_DIR__' => "$prefix/var/lock/zebradb",
index c6715b8..c909971 100755 (executable)
@@ -40,7 +40,7 @@ if ( C4::Context->config('supportdir') ) {
      $base = C4::Context->config('supportdir');
 }
 else {
-     $base        = "/usr/share/koha/bin";
+     $base = "/usr/share/koha/bin";
 }
 
 my $CONFIG_NAME = $ENV{'KOHA_CONF'};
@@ -68,24 +68,27 @@ if ( $mode eq 'job_add' ) {
     my $startdate = join('', (split /-/, $c4date->output("iso")));
 
     my $starttime = $input->param('starttime');
-    my $recurring = $input->param('recurring');
     $starttime =~ s/\://g;
     my $start  = $startdate . $starttime;
     my $report = $input->param('report');
     my $format = $input->param('format');
     my $email  = $input->param('email');
     my $command =
-        "export KOHA_CONF=\"$CONFIG_NAME\"; " . $base
-      . "/cronjobs/runreport.pl $report --format=$format --to=$email";
-
-    if ($recurring) {
-        my $frequency = $input->param('frequency');
-        add_cron_job( $start, $command );
-    }
-    else {
-        unless ( add_at_job( $start, $command ) ) {
-            $template->param( job_add_failed => 1 );
-        }
+        "export KOHA_CONF=\"$CONFIG_NAME\"; " .
+        "$base/cronjobs/runreport.pl $report --format=$format --to=$email";
+
+#FIXME commit ea899bc55933cd74e4665d70b1c48cab82cd1257 added recurring parameter (it is not in template) and call to add_cron_job (undefined)
+#    my $recurring = $input->param('recurring');
+#    if ($recurring) {
+#        my $frequency = $input->param('frequency');
+#        add_cron_job( $start, $command );
+#    }
+#    else {
+#        #here was the the unless ( add_at_job
+#    }
+
+    unless ( add_at_job( $start, $command ) ) {
+        $template->param( job_add_failed => 1 );
     }
 }