Skip to content

Commit cd0f958

Browse files
authored
Merge pull request #16 from nobuhiko/fix-csv-import-order
4.1からの移行の不具合修正
2 parents a77d97e + 56447fd commit cd0f958

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

Controller/Admin/ConfigController.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,27 @@ public function index(Request $request, Connection $em)
113113
}
114114

115115
if ($this->dataMigrationService->isVersion('4.0/4.1')) {
116+
// 権限/メンバーを先に処理(外部キー制約のため)
117+
$this->upsertAuthorityAndMember($em, $csvDir);
118+
$this->collectMissingCreatorIds($csvDir, [
119+
'dtb_delivery',
120+
'dtb_delivery_time',
121+
'dtb_delivery_fee',
122+
'dtb_payment',
123+
'dtb_order',
124+
'dtb_shipping',
125+
'dtb_mail_history'
126+
]);
116127

117128
// $csvDir 内のファイルをすべて読み込む
118129
$files = scandir($csvDir);
119130
foreach ($files as $file) {
120131
// csvファイルのみ処理
121132
if (is_file($csvDir . $file) && pathinfo($file, PATHINFO_EXTENSION) === 'csv') {
122-
$this->fix4x($em, $csvDir, $file);
133+
// dtb_member, dtb_plugin はスキップ(別途処理済み or 処理不要)
134+
if ($file !== 'dtb_member.csv' && $file !== 'dtb_plugin.csv') {
135+
$this->fix4x($em, $csvDir, $file);
136+
}
123137
}
124138
}
125139
} else {
@@ -2120,11 +2134,6 @@ private function getTaxRule($order_date)
21202134

21212135
private function fix4x($em, $tmpDir, $csvName)
21222136
{
2123-
if ($csvName == "dtb_member.csv") {
2124-
// 変更するとログアウトしちゃうので
2125-
return;
2126-
}
2127-
21282137
// csvNameからテーブル名を取得
21292138

21302139
if (filesize($tmpDir . $csvName) == 0) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ec-cube/datamigration43",
3-
"version": "4.3.4",
3+
"version": "4.3.5",
44
"description": "データ移行プラグイン",
55
"type": "eccube-plugin",
66
"require": {

0 commit comments

Comments
 (0)