開発メモ

開発用のメモです。

EC CUBE 休日テーブル更新

<?php
$id = 0;
$this-> objQuery-> delete($table);
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "元日(1月1日)",
    'month' => 1,
    'day' => 1,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "成人の日(1月第2月曜日)",
    'month' => 1,
    'day' => date("d", strtotime('second monday of ' . date("Y-01-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "建国記念の日(2月11日)",
    'month' => 2,
    'day' => 11,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "春分の日(3月21日)",
    'month' => 3,
    'day' => 21,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "昭和の日(4月29日)",
    'month' => 4,
    'day' => 29,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "憲法記念日(5月3日)",
    'month' => 5,
    'day' => 3,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "みどりの日(5月4日)",
    'month' => 5,
    'day' => 4,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "こどもの日(5月5日)",
    'month' => 5,
    'day' => 5,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "海の日(7月第3月曜日)",
    'month' => 7,
    'day' => date("d", strtotime('third monday of ' . date("Y-07-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "敬老の日(9月第3月曜日)",
    'month' => 9,
    'day' => date("d", strtotime('third monday of ' . date("Y-09-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
if (date("d", strtotime('third monday of ' . date("Y-09-01")) == 21)) {
    $this-> objQuery-> insert($table, array(
        'holiday_id' => ++$id,
        'title' => "国民の休日(9月22日)",
        'month' => 9,
        'day' => 22,
        'rank' => $id - 1,
        'creator_id' => 0,
        'create_date' => "",
        'update_date' => "",
        'create_date' => "CURRENT_TIMESTAMP",
        'update_date' => "CURRENT_TIMESTAMP",
        'del_flg' => 0
    ));
}
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "秋分の日(9月23日)",
    'month' => 9,
    'day' => 23,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "体育の日(10月第2月曜日)",
    'month' => 10,
    'day' => date("d", strtotime('second monday of ' . date("Y-10-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "文化の日(11月3日)",
    'month' => 11,
    'day' => 3,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "勤労感謝の日(11月23日)",
    'month' => 11,
    'day' => 23,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "天皇誕生日(12月23日)",
    'month' => 21,
    'day' => 23,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
Twitter: @asahina_alice