From 646e9aab6f0c0e6eac91083318e4726736c892e1 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 23 Jan 2017 12:14:17 +0100 Subject: [PATCH] Add logs + add working days validation --- main/cron/import_csv.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main/cron/import_csv.php b/main/cron/import_csv.php index 9024a765f0..193b048566 100755 --- a/main/cron/import_csv.php +++ b/main/cron/import_csv.php @@ -981,11 +981,12 @@ class ImportCsv } $start = $event['start']; - // Tolerance days see BT#12156#note-16 + // Working days (Mon-Fri)see BT#12156#note-16 $days = 5; + $startDatePlusDays = api_strtotime($start ." +$days weekdays"); // Send - if (api_strtotime($start) + $days * 24*60*60 > time() && + if ($startDatePlusDays > time() && api_strtotime($start) < time() ) { $sendMail = true; @@ -1001,10 +1002,6 @@ class ImportCsv $alreadyAdded = true; } - $this->logger->addInfo( - "Send Mail already added? : ".(int) ($alreadyAdded) - ); - // Send announcement to users if ($sendMail && $alreadyAdded == false) { $start = api_get_local_time( @@ -1062,6 +1059,10 @@ class ImportCsv ); if ($announcementId) { + $this->logger->addInfo( + "<<--SEND MAIL-->>" + ); + $this->logger->addInfo( "Announcement added: ".(int) ($announcementId) );