EC-CUBE / EC-CUBE/ec-cube

dtb_cart に該当会員のカート情報が存在すると管理画面から会員情報の削除ができない

Open
#4,402 0 comments 0 reactions 0 assignees View on GitHub
Status: discussion Status: needs-review
Dominant language
PHP
Stars
788
Forks
719
Avg merge
4d 4h
Merged PRs (30d)
39

Description

## 概要(Overview)
管理画面から会員を削除しようとすると、dtb_cartにその会員のレコードが存在すると
外部キー制約により削除できない。 管理画面から dtb_cartを消す方法が存在しないため
削除対象の会員のアカウントで一度ログインしてカートを空にする必要がある。

## 期待する内容(Expect) or 要望 (Requirement)
会員削除する場合は、dtb_cart, dtb_cart_itmeの該当の会員データを削除してから
会員データの削除をおこなう。

## 再現手順(Procedure)
カートに商品が入っている会員情報を管理画面から削除してみる。

```
admin.ERROR [vm9jrramgli2kj6u4f16o29b1c] [f54a260] [2] [Eccube\Log\Logger:log:64] - 会員削除失敗 ["[object] (
Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException(code: 0): An exception occurred while executing 'DELETE FROM dtb_customer WHERE id = ?' with params [2]:\n\n
SQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table \"dtb_customer\" violates foreign key constraint \"fk_fc3c24f09395c3f3\" on table \"dtb_cart\"\n
DETAIL: Key (id)=(2) is still referenced from table \"dtb_cart\". at /path/to/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php:48, Doctrine\\DBAL\\Driver\\PDOException(code: 23503): SQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table \"dtb_customer\" violates foreign key constraint \"fk_fc3c24f09395c3f3\" on table \"dtb_cart\"\n
DETAIL: Key (id)=(2) is still referenced from table \"dtb_cart\". at /path/to/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119, PDOException(code: 23503): SQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table \"dtb_customer\" violates foreign key constraint \"fk_fc3c24f09395c3f3\" on table \"dtb_cart\"\n
DETAIL: Key (id)=(2) is still referenced from table \"dtb_cart\". at /path/to/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)"] [POST, /admin/customer/2/delete, 192.168.1.1, https://www.example.com/admin/customer, Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36]
```

### 環境 (environment)
+ EC-CUBE: 4.0.3
+ PHP: 7.3.11
+ DB:
- PostgreSQL 12.0.0
- MySQL x.x.x (未検証)

## 関連情報 (Ref)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.