Lines 66-72
for my $branchcode ($statement->fetchrow_array ) {
Link Here
|
66 |
$query = "SELECT MAX(date) FROM discrete_calendar"; |
66 |
$query = "SELECT MAX(date) FROM discrete_calendar"; |
67 |
$statement = $dbh->prepare($query); |
67 |
$statement = $dbh->prepare($query); |
68 |
$statement->execute(); |
68 |
$statement->execute(); |
69 |
my $latestedDate = $$statement->fetchrow_array; |
69 |
my $latestedDate = $statement->fetchrow_array; |
70 |
my $parser = DateTime::Format::Strptime->new( |
70 |
my $parser = DateTime::Format::Strptime->new( |
71 |
pattern => '%Y-%m-%d %H:%M:%S', |
71 |
pattern => '%Y-%m-%d %H:%M:%S', |
72 |
on_error => 'croak', |
72 |
on_error => 'croak', |
Lines 96-104
for ($newDay->add(days => 1); $newDay <= $latestedDate; $newDay->add(days => 1))
Link Here
|
96 |
my $note =''; |
96 |
my $note =''; |
97 |
#insert into discrete_calendar for each branch |
97 |
#insert into discrete_calendar for each branch |
98 |
foreach my $branchCode(@branches){ |
98 |
foreach my $branchCode(@branches){ |
99 |
$$statement = $dbh->prepare($last_year); |
99 |
$statement = $dbh->prepare($last_year); |
100 |
$$statement->execute($yearAgo,$branchCode); |
100 |
$statement->execute($yearAgo,$branchCode); |
101 |
my ($is_opened, $holiday_type, $note) = $$statement->fetchrow_array; |
101 |
my ($is_opened, $holiday_type, $note) = $statement->fetchrow_array; |
102 |
#weekly and unique holidays are not replicated in the future |
102 |
#weekly and unique holidays are not replicated in the future |
103 |
if ($holiday_type && $holiday_type ne "R"){ |
103 |
if ($holiday_type && $holiday_type ne "R"){ |
104 |
$is_opened = 1; |
104 |
$is_opened = 1; |
Lines 110-121
for ($newDay->add(days => 1); $newDay <= $latestedDate; $newDay->add(days => 1))
Link Here
|
110 |
} |
110 |
} |
111 |
} |
111 |
} |
112 |
$holiday_type = '' if $is_opened; |
112 |
$holiday_type = '' if $is_opened; |
113 |
$$statement = $dbh->prepare($day_last_week); |
113 |
$statement = $dbh->prepare($day_last_week); |
114 |
$$statement->execute($newDay, $newDay); |
114 |
$statement->execute($newDay, $newDay); |
115 |
my ($open_hour,$close_hour ) = $$statement->fetchrow_array; |
115 |
my ($open_hour,$close_hour ) = $statement->fetchrow_array; |
116 |
my $add_Day = 'INSERT INTO discrete_calendar (date,branchcode,is_opened,holiday_type, note,open_hour,close_hour) VALUES (?,?,?,?,?,?,?)'; |
116 |
my $add_Day = 'INSERT INTO discrete_calendar (date,branchcode,is_opened,holiday_type, note,open_hour,close_hour) VALUES (?,?,?,?,?,?,?)'; |
117 |
$$statement = $dbh->prepare($add_Day); |
117 |
$statement = $dbh->prepare($add_Day); |
118 |
$$statement->execute($newDay,$branchCode,$is_opened,$holiday_type,$note, $open_hour,$close_hour); |
118 |
$statement->execute($newDay,$branchCode,$is_opened,$holiday_type,$note, $open_hour,$close_hour); |
119 |
|
119 |
|
120 |
if($debug && !$@){ |
120 |
if($debug && !$@){ |
121 |
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"; |
121 |
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"; |
122 |
- |
|
|