Skip to content

Commit

Permalink
Merge da75054 into 49de0c2
Browse files Browse the repository at this point in the history
  • Loading branch information
kengo-kamon committed Jul 24, 2018
2 parents 49de0c2 + da75054 commit 7feaa1a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Eccube/Controller/Admin/Customer/CustomerEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
use Eccube\Controller\AbstractController;
use Eccube\Event\EccubeEvents;
use Eccube\Event\EventArgs;
use Eccube\Entity\Master\CustomerStatus;
use Eccube\Form\Type\Admin\CustomerType;
use Eccube\Repository\CustomerRepository;
use Eccube\Util\StringUtil;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -60,6 +62,8 @@ public function index(Request $request, $id = null)
if (is_null($Customer)) {
throw new NotFoundHttpException();
}

$oldStatusId = $Customer->getStatus()->getId();
// 編集用にデフォルトパスワードをセット
$previous_password = $Customer->getPassword();
$Customer->setPassword($this->eccubeConfig['eccube_default_password']);
Expand All @@ -68,6 +72,7 @@ public function index(Request $request, $id = null)
$Customer = $this->customerRepository->newCustomer();
$Customer->setBuyTimes(0);
$Customer->setBuyTotal(0);
$oldStatusId = null;
}

// 会員登録フォーム
Expand Down Expand Up @@ -103,6 +108,12 @@ public function index(Request $request, $id = null)
$Customer->setPassword($encoder->encodePassword($Customer->getPassword(), $Customer->getSalt()));
}

// 退会ステータスに更新の場合、ダミーのアドレスに更新
$newStatusId = $Customer->getStatus()->getId();
if ($oldStatusId != $newStatusId && $newStatusId == CustomerStatus::WITHDRAWING) {
$Customer->setEmail(StringUtil::random(60).'@dummy.dummy');
}

$this->entityManager->persist($Customer);
$this->entityManager->flush();

Expand Down
2 changes: 2 additions & 0 deletions src/Eccube/Controller/Mypage/WithdrawController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Eccube\Event\EventArgs;
use Eccube\Repository\Master\CustomerStatusRepository;
use Eccube\Service\MailService;
use Eccube\Util\StringUtil;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -96,6 +97,7 @@ public function index(Request $request)
// 退会ステータスに変更
$CustomerStatus = $this->customerStatusRepository->find(CustomerStatus::WITHDRAWING);
$Customer->setStatus($CustomerStatus);
$Customer->setEmail(StringUtil::random(60).'@dummy.dummy');

$this->entityManager->flush();

Expand Down

0 comments on commit 7feaa1a

Please sign in to comment.