Skip to content

Commit

Permalink
Merge d9c4253 into 8c1b1af
Browse files Browse the repository at this point in the history
  • Loading branch information
Chihiro Adachi committed Jun 28, 2018
2 parents 8c1b1af + d9c4253 commit e9cda5a
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/Eccube/Controller/ShoppingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Eccube\Form\Type\Shopping\CustomerAddressType;
use Eccube\Form\Type\Shopping\OrderType;
use Eccube\Repository\CustomerAddressRepository;
use Eccube\Repository\OrderRepository;
use Eccube\Service\CartService;
use Eccube\Service\OrderHelper;
use Eccube\Service\Payment\PaymentDispatcher;
Expand Down Expand Up @@ -92,13 +93,15 @@ public function __construct(
CartService $cartService,
ShoppingService $shoppingService,
CustomerAddressRepository $customerAddressRepository,
OrderRepository $orderRepository,
ParameterBag $parameterBag
) {
$this->BaseInfo = $BaseInfo;
$this->orderHelper = $orderHelper;
$this->cartService = $cartService;
$this->shoppingService = $shoppingService;
$this->customerAddressRepository = $customerAddressRepository;
$this->orderRepository = $orderRepository;
$this->parameterBag = $parameterBag;
}

Expand Down Expand Up @@ -333,9 +336,15 @@ public function complete(Request $request)
// 受注IDを取得
$orderId = $this->session->get($this->sessionOrderKey);

if (empty($orderId)) {
return $this->redirectToRoute('homepage');
}

$Order = $this->orderRepository->find($orderId);

$event = new EventArgs(
[
'orderId' => $orderId,
'Order' => $Order,
],
$request
);
Expand All @@ -350,12 +359,12 @@ public function complete(Request $request)
$this->session->remove($this->sessionKey);
$this->session->remove($this->sessionCustomerAddressKey);

log_info('購入処理完了', [$orderId]);
log_info('購入処理完了', [$Order->getId()]);

$hasNextCart = !empty($this->cartService->getCarts());

return [
'orderId' => $orderId,
'Order' => $Order,
'hasNextCart' => $hasNextCart,
];
}
Expand Down
78 changes: 78 additions & 0 deletions src/Eccube/Entity/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ public function getTotalPrice()
*/
private $currency_code;

/**
* @var string|null
*
* @ORM\Column(name="complete_message", type="text", nullable=true)
*/
private $complete_message;

/**
* @var string|null
*
* @ORM\Column(name="complete_mail_message", type="text", nullable=true)
*/
private $complete_mail_message;

/**
* @var \Doctrine\Common\Collections\Collection
*
Expand Down Expand Up @@ -1136,6 +1150,70 @@ public function setCurrencyCode($currencyCode = null)
return $this;
}

/**
* @return null|string
*/
public function getCompleteMessage()
{
return $this->complete_message;
}

/**
* @param null|string $complete_message
*
* @return $this
*/
public function setCompleteMessage($complete_message = null)
{
$this->complete_message = $complete_message;

return $this;
}

/**
* @param null|string $complete_message
*
* @return $this
*/
public function appendCompleteMessage($complete_message = null)
{
$this->complete_message .= $complete_message;

return $this;
}

/**
* @return null|string
*/
public function getCompleteMailMessage()
{
return $this->complete_mail_message;
}

/**
* @param null|string $complete_mail_message
*
* @return
*/
public function setCompleteMailMessage($complete_mail_message = null)
{
$this->complete_mail_message = $complete_mail_message;

return $this;
}

/**
* @param null|string $complete_mail_message
*
* @return
*/
public function appendCompleteMailMessage($complete_mail_message = null)
{
$this->complete_mail_message .= $complete_mail_message;

return $this;
}

/**
* 商品の受注明細を取得
*
Expand Down
4 changes: 4 additions & 0 deletions src/Eccube/Resource/template/admin/Mail/order.twig
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,8 @@ file that was distributed with this source code.
{% endfor %}
{% endfor %}

{% if Order.complete_mail_message is not empty %}
{{ Order.complete_mail_message }}
{% endif %}

{{ footer }}
4 changes: 4 additions & 0 deletions src/Eccube/Resource/template/default/Mail/order.twig
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,8 @@ file that was distributed with this source code.
{% endfor %}
{% endfor %}

{% if Order.complete_mail_message is not empty %}
{{ Order.complete_mail_message }}
{% endif %}

{{ footer }}
3 changes: 3 additions & 0 deletions src/Eccube/Resource/template/default/Shopping/complete.twig
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ file that was distributed with this source code.
<h2>{{'shopping.text.message.thank_you_order'|trans}}</h2>
</div>
<p class="ec-reportDescription">{{'shopping.text.message.sent_email'|trans}}<br>{{'shopping.text.message.in_case'|trans}}<br>{{'shopping.text.message.thank_you_with_us'|trans}}</p>
{% if Order is not null and Order.complete_message is not empty %}
{{ Order.complete_message|raw }}
{% endif %}
<div class="ec-off4Grid">
{% if hasNextCart %}
<div class="ec-off4Grid__cell"><a class="ec-blockBtn--primary" href="{{ url('cart') }}">購入を続ける</a></div> {# TODO 未翻訳 #}
Expand Down
4 changes: 3 additions & 1 deletion tests/Eccube/Tests/Web/ShoppingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public function testRoutingShoppingLogin()

public function testComplete()
{
$this->container->get('session')->set('eccube.front.shopping.order.id', 111);
$Customer = $this->createCustomer();
$Order = $this->createOrder($Customer);
$this->container->get('session')->set('eccube.front.shopping.order.id', $Order->getId());
$this->client->request('GET', $this->generateUrl('shopping_complete'));

$this->assertTrue($this->client->getResponse()->isSuccessful());
Expand Down

0 comments on commit e9cda5a

Please sign in to comment.