From cfef01d110dd26a41dd0a2a09a32a47ab332802a Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Fri, 5 Jul 2013 15:35:27 +0000
Subject: fixed note adder for zf and fe


diff --git a/rhimport-zffe b/rhimport-zffe
index ac55f46..fc34fc0 100755
--- a/rhimport-zffe
+++ b/rhimport-zffe
@@ -27,6 +27,7 @@ use Date::Calc;
 use Time::localtime;
 use IO::Handle;
 use IPC::Open3;
+use File::Slurp;
 
 use lib '/usr/local/share/rhimport/';
 use rhimport;
@@ -46,7 +47,20 @@ if($#ARGV >= 0 && $ARGV[0] eq 'last') {
   print "!!!This is the last attempt, there won't be a retry on error!!!\n"
 }
 
-my @import_day = Date::Calc::Today();
+my @today = Date::Calc::Today();
+my $dow = Date::Calc::Day_of_Week(@today);
+my @tomorrow = Date::Calc::Add_Delta_Days($today[0], $today[1], $today[2], 1);
+
+my @tmp = Date::Calc::Standard_to_Business(@today);
+$tmp[2] = 1;
+my @this_mon = Date::Calc::Business_to_Standard(@tmp);
+my @next_mon = Date::Calc::Add_Delta_Days($this_mon[0], $this_mon[1], $this_mon[2], 7);
+
+my @import_day = @tomorrow;
+if ($dow == 5) {
+  @import_day = @next_mon;
+}
+
 my $import_date = sprintf("%04d-%02d-%02d", @import_day);
 my $current_date = `cat $STAT_FILE`;
 if($current_date eq $import_date) {
@@ -86,7 +100,7 @@ sub get_note {
 
 my $sum_title = "focus europa, zip-fm (WH)";
 my $sum_text = get_note($FE_NOTE_FILE) . "<br/>\n";
-$sum_text = $sum_text . get_note($ZF_NOTE_FILE) . "<br/>\n";
+$sum_text = $sum_text . "<br/>\n" . get_note($ZF_NOTE_FILE) . "<br/>\n";
 $sum_text = $sum_text . "<br/><br/>\n";
 
 print "\nsummary:\n" . $sum_title . "\n\n" . $sum_text . "\n";
-- 
cgit v0.10.2