From 6b46d36e7c87e0f29c73ebc5bcb1839af5ad9e27 Mon Sep 17 00:00:00 2001
From: David Bourgault <dav.bour@gmail.com>
Date: Tue, 24 Jul 2018 17:15:51 -0400
Subject: [PATCH] Bug 17015: Fixes to cronjob

Fixes a typo in the add_days cronjob.
---
 misc/cronjobs/add_days_discrete_calendar.pl | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/misc/cronjobs/add_days_discrete_calendar.pl b/misc/cronjobs/add_days_discrete_calendar.pl
index 5d3849a..2e4f3a9 100755
--- a/misc/cronjobs/add_days_discrete_calendar.pl
+++ b/misc/cronjobs/add_days_discrete_calendar.pl
@@ -66,7 +66,7 @@ for my $branchcode ($statement->fetchrow_array ) {
 $query = "SELECT MAX(date) FROM discrete_calendar";
 $statement = $dbh->prepare($query);
 $statement->execute();
-my $latestedDate = $$statement->fetchrow_array;
+my $latestedDate = $statement->fetchrow_array;
 my $parser = DateTime::Format::Strptime->new(
     pattern => '%Y-%m-%d %H:%M:%S',
     on_error => 'croak',
@@ -96,9 +96,9 @@ for ($newDay->add(days => 1); $newDay <= $latestedDate; $newDay->add(days => 1))
     my $note ='';
     #insert into discrete_calendar for each branch
     foreach my $branchCode(@branches){
-        $$statement = $dbh->prepare($last_year);
-        $$statement->execute($yearAgo,$branchCode);
-        my ($is_opened, $holiday_type, $note) = $$statement->fetchrow_array;
+        $statement = $dbh->prepare($last_year);
+        $statement->execute($yearAgo,$branchCode);
+        my ($is_opened, $holiday_type, $note) = $statement->fetchrow_array;
         #weekly and unique holidays are not replicated in the future
         if ($holiday_type && $holiday_type ne "R"){
             $is_opened = 1;
@@ -110,12 +110,12 @@ for ($newDay->add(days => 1); $newDay <= $latestedDate; $newDay->add(days => 1))
             }
         }
         $holiday_type = '' if $is_opened;
-        $$statement = $dbh->prepare($day_last_week);
-        $$statement->execute($newDay, $newDay);
-        my ($open_hour,$close_hour ) = $$statement->fetchrow_array;
+        $statement = $dbh->prepare($day_last_week);
+        $statement->execute($newDay, $newDay);
+        my ($open_hour,$close_hour ) = $statement->fetchrow_array;
         my $add_Day = 'INSERT INTO discrete_calendar (date,branchcode,is_opened,holiday_type, note,open_hour,close_hour) VALUES (?,?,?,?,?,?,?)';
-        $$statement = $dbh->prepare($add_Day);
-        $$statement->execute($newDay,$branchCode,$is_opened,$holiday_type,$note, $open_hour,$close_hour);
+        $statement = $dbh->prepare($add_Day);
+        $statement->execute($newDay,$branchCode,$is_opened,$holiday_type,$note, $open_hour,$close_hour);
 
         if($debug && !$@){
             warn "Added day $newDay to $branchCode is opened : $is_opened, holiday_type : $holiday_type, note: $note, open_hour : $open_hour, close_hour : $close_hour \n";
-- 
2.7.4