View | Details | Raw Unified | Return to bug 17015
Collapse All | Expand All

(-)a/misc/cronjobs/add_days_discrete_calendar.pl (-3 / +10 lines)
Lines 91-97 for ($newDay->add(days => 1); $newDay <= $latestedDate; $newDay->add(days => 1)) Link Here
91
    my $yearAgo = $newDay->clone();
91
    my $yearAgo = $newDay->clone();
92
    $yearAgo = $yearAgo->add(years => -1);
92
    $yearAgo = $yearAgo->add(years => -1);
93
    my $last_year = 'SELECT is_opened, holiday_type, note FROM discrete_calendar WHERE date=? AND branchcode=?';
93
    my $last_year = 'SELECT is_opened, holiday_type, note FROM discrete_calendar WHERE date=? AND branchcode=?';
94
    my $day_last_week = "SELECT open_hour, close_hour FROM discrete_calendar WHERE DAYOFWEEK(date)=DAYOFWEEK(?) and date < ? order by date desc limit 1";
94
    my $day_last_week = "SELECT open_hour, close_hour, holiday_type, note FROM discrete_calendar WHERE DAYOFWEEK(date)=DAYOFWEEK(?) and date < ? order by date desc limit 1";
95
    my $add_Day = 'INSERT INTO discrete_calendar (date,branchcode,is_opened,open_hour,close_hour) VALUES (?,?,?,?,?)';
95
    my $add_Day = 'INSERT INTO discrete_calendar (date,branchcode,is_opened,open_hour,close_hour) VALUES (?,?,?,?,?)';
96
    my $note ='';
96
    my $note ='';
97
    #insert into discrete_calendar for each branch
97
    #insert into discrete_calendar for each branch
Lines 112-118 for ($newDay->add(days => 1); $newDay <= $latestedDate; $newDay->add(days => 1)) Link Here
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, $weekly_holiday_type, $weekly_note ) = $statement->fetchrow_array;
116
117
        # weekly repeatable holidays
118
        if ( $weekly_holiday_type eq 'W' ) {
119
            $is_opened = 0;
120
            $holiday_type = $weekly_holiday_type unless $holiday_type;
121
            $note = $weekly_note unless $note;
122
        }
123
116
        my $add_Day = 'INSERT INTO discrete_calendar (date,branchcode,is_opened,holiday_type, note,open_hour,close_hour) VALUES (?,?,?,?,?,?,?)';
124
        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);
125
        $statement = $dbh->prepare($add_Day);
118
        $statement->execute($newDay,$branchCode,$is_opened,$holiday_type,$note, $open_hour,$close_hour);
126
        $statement->execute($newDay,$branchCode,$is_opened,$holiday_type,$note, $open_hour,$close_hour);
119
- 

Return to bug 17015