Le module MondialRelay n'était pas commité

This commit is contained in:
2020-12-05 09:32:52 +01:00
parent 9572b71f14
commit ef16a65ce8
143 changed files with 16232 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Hook;
use MondialRelay\MondialRelay;
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Tools\URL;
class AdminHookManager extends BaseHook
{
public function onModuleConfigure(HookRenderEvent $event)
{
$vars = [
'code_enseigne' => MondialRelay::getConfigValue(MondialRelay::CODE_ENSEIGNE),
'private_key' => MondialRelay::getConfigValue(MondialRelay::PRIVATE_KEY),
'allow_relay_delivery' => MondialRelay::getConfigValue(MondialRelay::ALLOW_RELAY_DELIVERY),
'allow_home_delivery' => MondialRelay::getConfigValue(MondialRelay::ALLOW_HOME_DELIVERY),
'allow_insurance' => MondialRelay::getConfigValue(MondialRelay::ALLOW_INSURANCE),
'module_id' => MondialRelay::getModuleId()
];
$event->add(
$this->render('mondialrelay/module-configuration.html', $vars)
);
}
public function onMainTopMenuTools(HookRenderBlockEvent $event)
{
$event->add(
[
'id' => 'tools_mondial_relay',
'class' => '',
'url' => URL::getInstance()->absoluteUrl('/admin/module/MondialRelay'),
'title' => $this->trans('Mondial Relay', [], MondialRelay::DOMAIN_NAME)
]
);
}
public function onModuleConfigureJs(HookRenderEvent $event)
{
$event
->add($this->render("mondialrelay/assets/js/mondialrelay.js.html"))
->add($this->addJS("mondialrelay/assets/js/bootstrap-notify.min.js"))
;
}
}

View File

@@ -0,0 +1,65 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Hook;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
class EmailHookManager extends BaseHook
{
protected function renderAddressTemplate(HookRenderEvent $event, $htmlMode = false)
{
$event->add(
$this->render(
'mondialrelay/order-delivery-address.html',
[
'module_id' => $event->getArgument('module'),
'order_id' => $event->getArgument('order'),
'html_mode' => $htmlMode ? '1' : '0'
]
)
);
}
public function onDeliveryAddressText(HookRenderEvent $event)
{
$this->renderAddressTemplate($event, false);
}
public function onDeliveryAddressHtml(HookRenderEvent $event)
{
$this->renderAddressTemplate($event, true);
}
public function onAfterProductsText(HookRenderEvent $event)
{
$event->add(
$this->render(
'mondialrelay/opening-hours-text.html',
[
'order_id' => $event->getArgument('order'),
]
)
);
}
public function onAfterProductsHtml(HookRenderEvent $event)
{
$event->add(
$this->render(
'mondialrelay/opening-hours-html.html',
[
'order_id' => $event->getArgument('order'),
]
)
);
}
}

View File

@@ -0,0 +1,53 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Hook;
use MondialRelay\MondialRelay;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
class FrontHookManager extends BaseHook
{
public function onOrderDeliveryExtra(HookRenderEvent $event)
{
// Clear the session context
$this->getSession()->remove(MondialRelay::SESSION_SELECTED_DELIVERY_TYPE);
$this->getSession()->remove(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID);
// Get the address id from the request, as the hook don(t give it to us.
$addressId = $this->getRequest()->get('address_id', 0);
$event->add(
$this->render(
'mondialrelay/order-delivery-extra.html',
[
'module_id' => MondialRelay::getModuleId(),
'address_id' => $addressId
]
)
);
}
public function onAccountOrderDeliveryAddress(HookRenderEvent $event)
{
$event->add(
$this->render(
'mondialrelay/order-delivery-address.html',
[
'order_id' => $event->getArgument('order'),
'module_id' => $event->getArgument('module')
]
)
);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Hook;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
class PdfHookManager extends BaseHook
{
public function onDeliveryAddress(HookRenderEvent $event)
{
$event->add(
$this->render(
'mondialrelay/order-delivery-address.html',
[
'module_id' => $event->getArgument('module'),
'order_id' => $event->getArgument('order'),
]
)
);
}
public function onAfterDeliveryModule(HookRenderEvent $event)
{
$event->add(
$this->render(
'mondialrelay/opening-hours.html',
[
'module_id' => $event->getArgument('module'),
'order_id' => $event->getArgument('order'),
]
)
);
}
}