Bug 7144 followup DBrev number
[koha_gimpoz] / misc / cronjobs / gather_print_notices.pl
index 03b65b4..165b16e 100755 (executable)
@@ -28,22 +28,20 @@ BEGIN {
     eval { require "$FindBin::Bin/../kohalib.pl" };
 }
 
-use CGI; # NOT a CGI script, this is just to keep C4::Output::gettemplate happy
+use CGI; # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy
 use C4::Context;
 use C4::Dates;
 use C4::Debug;
 use C4::Letters;
-use C4::Output;
+use C4::Templates;
 use File::Spec;
 use Getopt::Long;
 
 sub usage {
     print STDERR <<USAGE;
-Usage: $0 [ -s STYLESHEET ] OUTPUT_DIRECTORY
+Usage: $0 OUTPUT_DIRECTORY
   Will print all waiting print notices to
   OUTPUT_DIRECTORY/notices-CURRENT_DATE.html .
-  If the filename of a CSS stylesheet is specified with -s, the contents of that
-  file will be included in the HTML.
 USAGE
     exit $_[0];
 }
@@ -51,7 +49,6 @@ USAGE
 my ( $stylesheet, $help );
 
 GetOptions(
-    's:s' => \$stylesheet,
     'h|help' => \$help,
 ) || usage( 1 );
 
@@ -70,17 +67,10 @@ exit unless( @messages );
 
 open OUTPUT, '>', File::Spec->catdir( $output_directory, "holdnotices-" . $today->output( 'iso' ) . ".html" );
 
-my $template = C4::Output::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI );
-my $stylesheet_contents = '';
-
-if ($stylesheet) {
-  open STYLESHEET, '<', $stylesheet;
-  while ( <STYLESHEET> ) { $stylesheet_contents .= $_ }
-  close STYLESHEET;
-}
+my $template = C4::Templates::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI );
 
 $template->param(
-    stylesheet => $stylesheet_contents,
+    stylesheet => C4::Context->preference("NoticeCSS"),
     today => $today->output(),
     messages => \@messages,
 );