Removed the useless coupon read function
This commit is contained in:
@@ -512,10 +512,6 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::updateAction</default>
|
||||
<requirement key="couponId">\d+</requirement>
|
||||
</route>
|
||||
<route id="admin.coupon.read" path="/admin/coupon/read/{couponId}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::readAction</default>
|
||||
<requirement key="couponId">\d+</requirement>
|
||||
</route>
|
||||
<route id="admin.coupon.draw.inputs.ajax" path="/admin/coupon/draw/inputs/{couponServiceId}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::getBackOfficeInputsAjaxAction</default>
|
||||
<requirement key="couponServiceId">.*</requirement>
|
||||
@@ -549,7 +545,7 @@
|
||||
|
||||
<!-- Routes to the Config (system variables) controller -->
|
||||
|
||||
<route id="admin.configuration.inedx" path="/admin/configuration">
|
||||
<route id="admin.configuration.index" path="/admin/configuration">
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigurationController::indexAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
@@ -53,58 +53,15 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function browseAction()
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
$args['urlReadCoupon'] = $this->getRoute(
|
||||
'admin.coupon.read',
|
||||
array('couponId' => 0),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['urlEditCoupon'] = $this->getRoute(
|
||||
'admin.coupon.update',
|
||||
array('couponId' => 0),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['urlCreateCoupon'] = $this->getRoute(
|
||||
'admin.coupon.create',
|
||||
array(),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$args['coupon_order'] = $this->getListOrderFromSession('coupon', 'coupon_order', 'code');
|
||||
|
||||
return $this->render('coupon-list', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Coupons read display
|
||||
*
|
||||
* @param int $couponId Coupon Id
|
||||
*
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
$coupon = CouponQuery::create()->findPk($couponId);
|
||||
|
||||
if ($coupon === null) {
|
||||
return $this->pageNotFound();
|
||||
}
|
||||
|
||||
$args['couponId'] = $couponId;
|
||||
$args['urlEditCoupon'] = $this->getRoute(
|
||||
'admin.coupon.update',
|
||||
array('couponId' => $couponId),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
return $this->render('coupon-read', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Coupons creation display
|
||||
*
|
||||
@@ -112,9 +69,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::CREATE);
|
||||
if ($response !== null) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::CREATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -165,9 +120,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function updateAction($couponId)
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::UPDATE);
|
||||
if ($response !== null) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -342,7 +295,9 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getConditionToUpdateInputAjaxAction($couponId, $conditionIndex)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -396,7 +351,9 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function saveConditionsAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -443,7 +400,9 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function deleteConditionsAction($couponId, $conditionIndex)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -681,7 +640,10 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getBackOfficeInputsAjaxAction($couponServiceId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
/** @var CouponInterface $coupon */
|
||||
@@ -706,7 +668,10 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getBackOfficeConditionSummariesAjaxAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
/** @var Coupon $coupon */
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="check-resource"}admin.coupon{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Coupon'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="coupons">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop type="coupon" name="read_coupon" id={$couponId} backend_context="true"}
|
||||
<nav>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
|
||||
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
|
||||
<li>{$CODE}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
|
||||
{if !$IS_ENABLED}
|
||||
<div class="alert alert-info">
|
||||
<span class="glyphicon glyphicon-question-sign"></span>
|
||||
{intl l='This coupon is disabled, you can enable at the bottom of this form.'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{intl l='Title'}</td>
|
||||
<td>{$TITLE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_ENABLED}
|
||||
<span class="label label-success">
|
||||
{intl l="Is enabled"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
{intl l="Is disabled"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{$SUMMARY}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Amount'}</td>
|
||||
<td>{$AMOUNT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Expiration date'}</td>
|
||||
<td>{$EXPIRATION_DATE} ({$DAY_LEFT_BEFORE_EXPIRATION} {intl l="days left"})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Usage left'}</td>
|
||||
<td>
|
||||
{if $USAGE_LEFT == -1}
|
||||
<span class="label label-success">
|
||||
{intl l="Unlimited"}
|
||||
</span>
|
||||
{elseif $USAGE_LEFT}
|
||||
<span class="label label-success">
|
||||
{$USAGE_LEFT}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
0
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_CUMULATIVE}
|
||||
<span class="label label-success">
|
||||
{intl l="May be cumulative"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
{intl l="Can't be cumulative"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_REMOVING_POSTAGE}
|
||||
<span class="label label-warning">
|
||||
{intl l="Will remove postage"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't remove postage"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_AVAILABLE_ON_SPECIAL_OFFERS}
|
||||
<span class="label label-warning">
|
||||
{intl l="Will be available on special offers"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't be available on special offers"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Application field'}</td>
|
||||
<td>
|
||||
<ul class="list-unstyled">
|
||||
{foreach from=$APPLICATION_CONDITIONS item=condition name=conditionsForeach}
|
||||
{if !$smarty.foreach.conditionsForeach.first}
|
||||
<li><span class="label label-info">{intl l='And'}</span></li>
|
||||
{/if}
|
||||
<li>{$condition nofilter}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$SHORT_DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<a href="{$urlEditCoupon}" class="btn btn-default btn-primary btn-medium pull-right">
|
||||
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/loop}
|
||||
</div> <!-- #wrapper -->
|
||||
</div>
|
||||
|
||||
{include file='includes/confirmation-modal.html' id="enable" message="{intl l='Do you really want to enable this element ?'}"}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{module_include location='coupon-read-js'}
|
||||
{/block}
|
||||
Reference in New Issue
Block a user