Rajout du module de gestion des avoirs
This commit is contained in:
46
local/modules/CreditNote/Hook/Back/CustomerEditHook.php
Normal file
46
local/modules/CreditNote/Hook/Back/CustomerEditHook.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module CreditNote */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace CreditNote\Hook\Back;
|
||||
|
||||
use CreditNote\CreditNote;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Core\Thelia;
|
||||
|
||||
/**
|
||||
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
|
||||
*/
|
||||
class CustomerEditHook extends BaseHook
|
||||
{
|
||||
public function onCustomerEdit(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'hook/customer.edit.html',
|
||||
array_merge($event->getArguments(), [
|
||||
|
||||
])
|
||||
));
|
||||
}
|
||||
|
||||
public function onCustomerEditBottom(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'includes/credit-note-modal.html',
|
||||
array_merge($event->getArguments(), [])
|
||||
));
|
||||
}
|
||||
|
||||
public function onCustomerEditJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'includes/credit-note-js.html',
|
||||
array_merge($event->getArguments(), [])
|
||||
));
|
||||
}
|
||||
}
|
||||
29
local/modules/CreditNote/Hook/Back/MainHook.php
Normal file
29
local/modules/CreditNote/Hook/Back/MainHook.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module CreditNote */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace CreditNote\Hook\Back;
|
||||
|
||||
use CreditNote\CreditNote;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
/**
|
||||
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
|
||||
*/
|
||||
class MainHook extends BaseHook
|
||||
{
|
||||
public function onMainFooterJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'hook/main.footer-js.html',
|
||||
$event->getArguments() + [
|
||||
'admin_current_location' => ($this->getRequest()->get('_route') == 'creditnote.list' ? 'credit-note' : '')
|
||||
]
|
||||
));
|
||||
}
|
||||
}
|
||||
73
local/modules/CreditNote/Hook/Back/OrderEditHook.php
Normal file
73
local/modules/CreditNote/Hook/Back/OrderEditHook.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module CreditNote */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace CreditNote\Hook\Back;
|
||||
|
||||
use CreditNote\CreditNote;
|
||||
use CreditNote\Model\CreditNoteDetailQuery;
|
||||
use CreditNote\Model\CreditNoteQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Core\Thelia;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
|
||||
*/
|
||||
class OrderEditHook extends BaseHook
|
||||
{
|
||||
public function onOrderEditProductList(HookRenderEvent $event)
|
||||
{
|
||||
$creditNoteDetails = CreditNoteDetailQuery::create()
|
||||
->filterByQuantity(0, Criteria::GREATER_THAN)
|
||||
->filterByOrderProductId($event->getArgument('order_product_id'))
|
||||
->find();
|
||||
|
||||
$event->add($this->render(
|
||||
'hook/order-edit.product-list.html',
|
||||
$event->getArguments() + ['creditNoteDetails' => $creditNoteDetails]
|
||||
));
|
||||
}
|
||||
|
||||
public function onOrderTab(HookRenderBlockEvent $event)
|
||||
{
|
||||
$count = CreditNoteQuery::create()
|
||||
->filterByOrderId($event->getArgument('id'))
|
||||
->count();
|
||||
|
||||
$event->add(
|
||||
[
|
||||
"id" => "credit-note",
|
||||
"title" => Translator::getInstance()->trans("Credit Note", [], CreditNote::DOMAIN_MESSAGE) . ($count ? ' (' . $count . ')' : ''),
|
||||
"content" => $this->render('hook/order.tab.html', array_merge($event->getArguments(), [
|
||||
|
||||
]))
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function onOrderEditBottom(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'includes/credit-note-modal.html',
|
||||
array_merge($event->getArguments(), [
|
||||
|
||||
])
|
||||
));
|
||||
}
|
||||
|
||||
public function onOrderEditJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'hook/order.edit-js.html',
|
||||
array_merge($event->getArguments(), [])
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user