-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
改正商取引法の施行に伴うECカート「最終確認画面」表示項目の変更[#5304]について #5399
Changes from 25 commits
e8ddcf5
6f4ff62
9bad6bf
1638910
3e7a161
d12377b
c1e97cd
4bbd3f0
d3733a3
6019987
8cc974c
4b57333
ca43aac
043ab0b
15b43cf
ae33f21
c4bbe1d
5bc80f4
fdbc8b3
97239a3
67cf74d
5746cb6
af7cbae
793b7ff
e79a9ee
f1e4ebd
9222fbd
5d105d8
ca10837
097b51a
2964d53
029c71e
bcac815
626ee6b
527ef0a
73b48dd
b612e95
abcbb0f
5b51141
eacdc5d
debe64a
90d7844
3397ec6
fd0a563
da9ff65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,86 @@ | ||||||||||
<?php | ||||||||||
|
||||||||||
namespace Eccube\Controller\Admin\Setting\Shop; | ||||||||||
|
||||||||||
use Eccube\Controller\AbstractController; | ||||||||||
use Eccube\Event\EccubeEvents; | ||||||||||
use Eccube\Event\EventArgs; | ||||||||||
use Eccube\Form\Type\Admin\OrderStatusSettingType; | ||||||||||
use Eccube\Form\Type\Admin\TradeLawType; | ||||||||||
use Eccube\Form\Type\Front\ForgotType; | ||||||||||
use Eccube\Repository\TradeLawRepository; | ||||||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||||||||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType; | ||||||||||
use Symfony\Component\Routing\Annotation\Route; | ||||||||||
use Symfony\Component\HttpFoundation\Request; | ||||||||||
|
||||||||||
class TradeLawController extends AbstractController | ||||||||||
{ | ||||||||||
private TradeLawRepository $tradeLawRepository; | ||||||||||
nanasess marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
/** | ||||||||||
* @param TradeLawRepository $tradeLawRepository | ||||||||||
*/ | ||||||||||
public function __construct( | ||||||||||
TradeLawRepository $tradeLawRepository | ||||||||||
) { | ||||||||||
$this->tradeLawRepository = $tradeLawRepository; | ||||||||||
} | ||||||||||
|
||||||||||
/** | ||||||||||
* 税率設定の初期表示・登録 | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. コメントありがとうございます。こちらのコメントを更新しました。 |
||||||||||
* | ||||||||||
* @Route("/%eccube_admin_route%/setting/shop/tradelaw", name="admin_setting_shop_tradelaw", methods={"GET", "POST"}) | ||||||||||
* @Template("@admin/Setting/Shop/tradelaw.twig") | ||||||||||
* @param Request $request | ||||||||||
*/ | ||||||||||
public function index(Request $request) | ||||||||||
{ | ||||||||||
$tradeLawDetails = $this->tradeLawRepository->findBy([], ['sortNo' => 'ASC']); | ||||||||||
$builder = $this->formFactory->createBuilder(); | ||||||||||
$builder | ||||||||||
->add( | ||||||||||
'TradeLaws', | ||||||||||
CollectionType::class, | ||||||||||
[ | ||||||||||
'entry_type' => TradeLawType::class, | ||||||||||
'data' => $tradeLawDetails, | ||||||||||
] | ||||||||||
); | ||||||||||
$form = $builder->getForm(); | ||||||||||
$form->handleRequest($request); | ||||||||||
|
||||||||||
$event = new EventArgs( | ||||||||||
[ | ||||||||||
'TradeLaw' => $tradeLawDetails, | ||||||||||
], | ||||||||||
$request | ||||||||||
); | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
$form = $builder->getForm(); | ||||||||||
$form->handleRequest($request); | ||||||||||
|
||||||||||
if ($form->isSubmitted() && $form->isValid()) { | ||||||||||
foreach ($form['TradeLaws'] as $child) { | ||||||||||
$OrderStatus = $child->getData(); | ||||||||||
$this->entityManager->persist($OrderStatus); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. コメントありがとうございます。変数名を更新しました。 |
||||||||||
} | ||||||||||
$this->entityManager->flush(); | ||||||||||
|
||||||||||
$this->addSuccess('admin.common.save_complete', 'admin'); | ||||||||||
|
||||||||||
$this->eventDispatcher->dispatch($event, EccubeEvents::ADMIN_SETTING_SHOP_TRADE_LAW_POST_COMPLETE); | ||||||||||
|
||||||||||
return $this->redirectToRoute('admin_setting_shop_tradelaw'); | ||||||||||
} | ||||||||||
|
||||||||||
$this->eventDispatcher->dispatch($event, EccubeEvents::ADMIN_SETTING_SHOP_TRADE_LAW_INDEX_COMPLETE); | ||||||||||
|
||||||||||
return [ | ||||||||||
'form' => $form->createView(), | ||||||||||
'tradeLawDetails' => $tradeLawDetails | ||||||||||
]; | ||||||||||
} | ||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -24,6 +24,7 @@ | |||||||||
use Eccube\Form\Type\Shopping\CustomerAddressType; | ||||||||||
use Eccube\Form\Type\Shopping\OrderType; | ||||||||||
use Eccube\Repository\OrderRepository; | ||||||||||
use Eccube\Repository\TradeLawRepository; | ||||||||||
use Eccube\Service\CartService; | ||||||||||
use Eccube\Service\MailService; | ||||||||||
use Eccube\Service\OrderHelper; | ||||||||||
|
@@ -67,18 +68,25 @@ class ShoppingController extends AbstractShoppingController | |||||||||
*/ | ||||||||||
protected $serviceContainer; | ||||||||||
|
||||||||||
/** | ||||||||||
* @var TradeLawRepository | ||||||||||
*/ | ||||||||||
private TradeLawRepository $tradeLawRepository; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 他の Controller に合わせて protected でお願いします There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 了解いたしました。ShoppingControllerクラスの変数と合わせて変数定義 [例 TradeLawRepository] を削除した方が良いでしょうか? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. コメントありがとうございます。protected に更新しました。 |
||||||||||
|
||||||||||
public function __construct( | ||||||||||
CartService $cartService, | ||||||||||
MailService $mailService, | ||||||||||
OrderRepository $orderRepository, | ||||||||||
OrderHelper $orderHelper, | ||||||||||
ContainerInterface $serviceContainer | ||||||||||
ContainerInterface $serviceContainer, | ||||||||||
TradeLawRepository $tradeLawRepository | ||||||||||
) { | ||||||||||
$this->cartService = $cartService; | ||||||||||
$this->mailService = $mailService; | ||||||||||
$this->orderRepository = $orderRepository; | ||||||||||
$this->orderHelper = $orderHelper; | ||||||||||
$this->serviceContainer = $serviceContainer; | ||||||||||
$this->tradeLawRepository = $tradeLawRepository; | ||||||||||
} | ||||||||||
|
||||||||||
/** | ||||||||||
|
@@ -145,11 +153,14 @@ public function index(PurchaseFlow $cartPurchaseFlow) | |||||||||
$this->entityManager->flush(); | ||||||||||
} | ||||||||||
|
||||||||||
$activeTradeLaws = $this->tradeLawRepository->findBy(['displayOrderScreen' => true], ['sortNo' => 'ASC']); | ||||||||||
|
||||||||||
$form = $this->createForm(OrderType::class, $Order); | ||||||||||
|
||||||||||
return [ | ||||||||||
'form' => $form->createView(), | ||||||||||
'Order' => $Order, | ||||||||||
'activeTradeLaws' => $activeTradeLaws | ||||||||||
]; | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -230,11 +241,14 @@ public function redirectTo(Request $request, RouterInterface $router) | |||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
$activeTradeLaws = $this->tradeLawRepository->findBy(['displayOrderScreen' => true], ['sortNo' => 'ASC']); | ||||||||||
|
||||||||||
log_info('[リダイレクト] フォームエラーのため, 注文手続き画面を表示します.', [$Order->getId()]); | ||||||||||
|
||||||||||
return [ | ||||||||||
'form' => $form->createView(), | ||||||||||
'Order' => $Order, | ||||||||||
'activeTradeLaws' => $activeTradeLaws | ||||||||||
]; | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -266,6 +280,7 @@ public function confirm(Request $request) | |||||||||
return $this->redirectToRoute('shopping_error'); | ||||||||||
} | ||||||||||
|
||||||||||
$activeTradeLaws = $this->tradeLawRepository->findBy(['displayOrderScreen' => true], ['sortNo' => 'ASC']); | ||||||||||
$form = $this->createForm(OrderType::class, $Order); | ||||||||||
$form->handleRequest($request); | ||||||||||
|
||||||||||
|
@@ -311,6 +326,7 @@ public function confirm(Request $request) | |||||||||
return [ | ||||||||||
'form' => $form->createView(), | ||||||||||
'Order' => $Order, | ||||||||||
'activeTradeLaws' => $activeTradeLaws | ||||||||||
]; | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -325,6 +341,7 @@ public function confirm(Request $request) | |||||||||
return [ | ||||||||||
'form' => $form->createView(), | ||||||||||
'Order' => $Order, | ||||||||||
'activeTradeLaws' => $activeTradeLaws | ||||||||||
]; | ||||||||||
} | ||||||||||
|
||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of EC-CUBE | ||
* | ||
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
* | ||
* http://www.ec-cube.co.jp/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Eccube\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
use Symfony\Component\Translation\TranslatableMessage; | ||
use Symfony\Component\Validator\Context\ExecutionContextInterface; | ||
use Symfony\Component\Validator\Mapping\ClassMetadata; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
if (!class_exists('\Eccube\Entity\TradeLaw')) { | ||
/** | ||
* TradeLaw | ||
* | ||
* @ORM\Table(name="dtb_tradelaw") | ||
* @ORM\InheritanceType("SINGLE_TABLE") | ||
* @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255) | ||
* @ORM\HasLifecycleCallbacks() | ||
* @ORM\Entity(repositoryClass="Eccube\Repository\TradeLawRepository") | ||
*/ | ||
class TradeLaw extends AbstractEntity | ||
{ | ||
/** | ||
* @var int | ||
* | ||
* @ORM\Column(name="id", type="integer", options={"unsigned":true}) | ||
* @ORM\Id | ||
* @ORM\GeneratedValue(strategy="IDENTITY") | ||
*/ | ||
private int $id; | ||
|
||
/** | ||
* @var ?string | ||
* | ||
* @ORM\Column(name="name", type="string", length=255, nullable=true) | ||
*/ | ||
private ?string $name; | ||
|
||
/** | ||
* @var ?string | ||
* | ||
* @ORM\Column(name="description", type="string", length=4000, nullable=true) | ||
*/ | ||
private ?string $description; | ||
|
||
/** | ||
* @var int | ||
* | ||
* @ORM\Column(name="sort_no", type="smallint", nullable=false) | ||
*/ | ||
private int $sortNo; | ||
|
||
/** | ||
* @var boolean | ||
* | ||
* @ORM\Column(name="display_order_screen", type="boolean") | ||
*/ | ||
private bool $displayOrderScreen = false; | ||
|
||
public static function loadValidatorMetadata(ClassMetadata $metadata) | ||
{ | ||
$metadata->addConstraint(new Assert\Callback('validateActivation')); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->getName(); | ||
} | ||
|
||
/** | ||
* @param int $id | ||
* @return TradeLaw | ||
*/ | ||
public function setId(int $id): TradeLaw | ||
{ | ||
$this->id = $id; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getId(): int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @return TradeLaw | ||
*/ | ||
public function setName(?string $name): TradeLaw | ||
{ | ||
$this->name = $name ?: ""; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @param string $description | ||
* @return TradeLaw | ||
*/ | ||
public function setDescription(?string $description): TradeLaw | ||
{ | ||
$this->description = $description ?: ""; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription(): ?string | ||
{ | ||
return $this->description; | ||
} | ||
|
||
/** | ||
* @param int $sortNo | ||
* @return TradeLaw | ||
*/ | ||
public function setSortNo(int $sortNo): TradeLaw | ||
{ | ||
$this->sortNo = $sortNo; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getSortNo(): int | ||
{ | ||
return $this->sortNo; | ||
} | ||
|
||
/** | ||
* @param bool $displayOrderScreen | ||
* @return TradeLaw | ||
*/ | ||
public function setDisplayOrderScreen(bool $displayOrderScreen): TradeLaw | ||
{ | ||
$this->displayOrderScreen = $displayOrderScreen; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function isDisplayOrderScreen(): bool | ||
{ | ||
return $this->displayOrderScreen; | ||
} | ||
|
||
public function validateActivation(ExecutionContextInterface $context, $payload) | ||
{ | ||
// check if the name is actually a fake name | ||
if ( | ||
$this->isDisplayOrderScreen() === true && | ||
(empty($this->getName()) || | ||
empty($this->getDescription())) | ||
) { | ||
$context->buildViolation(trans('admin.setting.shop.trade_law.error.activation_error')) | ||
->atPath('displayOrderScreen') | ||
->addViolation(); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
他の Controller に合わせて protected でお願いします