Inital commit
This commit is contained in:
25
local/modules/TakeCustomerAccount/CHANGELOG.md
Normal file
25
local/modules/TakeCustomerAccount/CHANGELOG.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# 1.2.1
|
||||
|
||||
- #4 Fix bug with cart without currency
|
||||
|
||||
# 1.2.0
|
||||
|
||||
- #3 Add success and error url option
|
||||
|
||||
# 1.1.0
|
||||
|
||||
- Add event `TakeCustomerAccountEvents::TAKE_CUSTOMER_ACCOUNT`
|
||||
- Add hook `take-customer-account.form`
|
||||
- Add the ability to change the redirection from event listener. For this, to throw an exception of type `RedirectException`
|
||||
- Add screenshot and logo
|
||||
- Fix error message in form
|
||||
- Fix checkAuth in template
|
||||
|
||||
# 1.0.2
|
||||
|
||||
- #2 Fix checkAuth in controller
|
||||
|
||||
# 1.0.1
|
||||
|
||||
- Remove old cart in the session
|
||||
|
||||
26
local/modules/TakeCustomerAccount/Config/config.xml
Normal file
26
local/modules/TakeCustomerAccount/Config/config.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<forms>
|
||||
<form name="take_customer_account" class="TakeCustomerAccount\Form\TakeCustomerAccountForm" />
|
||||
</forms>
|
||||
|
||||
<hooks>
|
||||
<hook id="take.customer.account" class="TakeCustomerAccount\Hook\AdminCustomerHook" scope="request">
|
||||
<tag name="hook.event_listener" event="customer.edit" type="back" method="onCustomerEdit"/>
|
||||
<tag name="hook.event_listener" event="customer.edit-js" type="back" method="onCustomerEditJs"/>
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
<services>
|
||||
<service id="take.customer.account.listener" class="TakeCustomerAccount\EventListener\TakeCustomerAccountListener" scope="request">
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
<argument type="service" id="thelia.securityContext"/>
|
||||
<argument type="service" id="request"/>
|
||||
</service>
|
||||
</services>
|
||||
</config>
|
||||
24
local/modules/TakeCustomerAccount/Config/module.xml
Normal file
24
local/modules/TakeCustomerAccount/Config/module.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
|
||||
<fullnamespace>TakeCustomerAccount\TakeCustomerAccount</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Lets take control of a customer account</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Permet de prendre le contrôle d'un compte client</title>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.2.1</version>
|
||||
<author>
|
||||
<name>Gilles Bourgeat</name>
|
||||
<email>gbourgeat@openstudio.fr</email>
|
||||
</author>
|
||||
<type>classic</type>
|
||||
<thelia>2.1.0</thelia>
|
||||
<stability>prod</stability>
|
||||
</module>
|
||||
11
local/modules/TakeCustomerAccount/Config/routing.xml
Normal file
11
local/modules/TakeCustomerAccount/Config/routing.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="take_customer_account" path="/admin/take-customer-account/{customer_id}" methods="POST">
|
||||
<default key="_controller">TakeCustomerAccount\Controller\TakeCustomerAccountController::takeAction</default>
|
||||
<requirement key="customer_id">\d+</requirement>
|
||||
</route>
|
||||
</routes>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module TakeCustomerAccount */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace TakeCustomerAccount\Controller;
|
||||
|
||||
use TakeCustomerAccount\Event\TakeCustomerAccountEvent;
|
||||
use TakeCustomerAccount\Event\TakeCustomerAccountEvents;
|
||||
use TakeCustomerAccount\TakeCustomerAccount;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\HttpKernel\Exception\RedirectException;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
|
||||
/**
|
||||
* Class TakeCustomerAccountController
|
||||
* @package TakeCustomerAccount\Controller
|
||||
* @author Gilles Bourgeat <gbourgeat@openstudio.fr>
|
||||
*/
|
||||
class TakeCustomerAccountController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* @param int $customer_id
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function takeAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(array(), 'TakeCustomerAccount', AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm('take_customer_account');
|
||||
|
||||
try {
|
||||
if (null !== $customer = CustomerQuery::create()->findPk($customer_id)) {
|
||||
$this->validateForm($form);
|
||||
|
||||
$this->dispatch(
|
||||
TakeCustomerAccountEvents::TAKE_CUSTOMER_ACCOUNT,
|
||||
new TakeCustomerAccountEvent($customer)
|
||||
);
|
||||
} else {
|
||||
throw new \Exception($this->getTranslator()->trans(
|
||||
"Customer not found",
|
||||
[],
|
||||
TakeCustomerAccount::MODULE_DOMAIN
|
||||
));
|
||||
}
|
||||
|
||||
// since version 1.2.0, use method_exists for retro compatibility
|
||||
if (method_exists($form, 'hasSuccessUrl') && $form->hasSuccessUrl()) {
|
||||
return $this->generateRedirectFromRoute($form->getSuccessUrl());
|
||||
}
|
||||
|
||||
$this->setCurrentRouter('router.front');
|
||||
return $this->generateRedirectFromRoute('customer.home', [], [], 'router.front');
|
||||
} catch (RedirectException $e) {
|
||||
return $this->generateRedirect($e->getUrl(), $e->getCode());
|
||||
} catch (\Exception $e) {
|
||||
// since version 1.2.0, use method_exists for retro compatibility
|
||||
if (method_exists($form, 'hasErrorUrl') && $form->hasErrorUrl()) {
|
||||
return $this->generateRedirect($form->getErrorUrl());
|
||||
}
|
||||
|
||||
$form->setErrorMessage($e->getMessage());
|
||||
|
||||
$this->getParserContext()->addForm($form);
|
||||
|
||||
$this->setCurrentRouter('router.admin');
|
||||
return $this->generateRedirectFromRoute(
|
||||
'admin.customer.update.view',
|
||||
['customer_id' => $customer_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module TakeCustomerAccount */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace TakeCustomerAccount\Event;
|
||||
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
/**
|
||||
* Class TakeCustomerAccountEvent
|
||||
* @package TakeCustomerAccount\Event
|
||||
* @author Gilles Bourgeat <gbourgeat@openstudio.fr>
|
||||
*/
|
||||
class TakeCustomerAccountEvent extends ActionEvent
|
||||
{
|
||||
/** @var Customer */
|
||||
protected $customer;
|
||||
|
||||
/**
|
||||
* @param Customer $customer
|
||||
*/
|
||||
public function __construct(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Customer
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Customer $customer
|
||||
* @return TakeCustomerAccountEvent
|
||||
*/
|
||||
public function setCustomer($customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module TakeCustomerAccount */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace TakeCustomerAccount\Event;
|
||||
|
||||
/**
|
||||
* Class TakeCustomerAccountEvents
|
||||
* @package TakeCustomerAccount\Event
|
||||
* @author Gilles Bourgeat <gbourgeat@openstudio.fr>
|
||||
*/
|
||||
class TakeCustomerAccountEvents
|
||||
{
|
||||
const TAKE_CUSTOMER_ACCOUNT = "take.customer.account";
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module FeatureType */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace TakeCustomerAccount\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use TakeCustomerAccount\Event\TakeCustomerAccountEvent;
|
||||
use TakeCustomerAccount\Event\TakeCustomerAccountEvents;
|
||||
use TakeCustomerAccount\TakeCustomerAccount;
|
||||
use Thelia\Core\Event\Cart\CartCreateEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerLoginEvent;
|
||||
use Thelia\Core\Event\DefaultActionEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Model\AdminLog;
|
||||
|
||||
/**
|
||||
* Class TakeCustomerAccountListener
|
||||
* @package TakeCustomerAccount\EventListener
|
||||
* @author Gilles Bourgeat <gbourgeat@openstudio.fr>
|
||||
*/
|
||||
class TakeCustomerAccountListener implements EventSubscriberInterface
|
||||
{
|
||||
/** @var EventDispatcherInterface */
|
||||
protected $eventDispatcher;
|
||||
|
||||
/** @var SecurityContext */
|
||||
protected $securityContext;
|
||||
|
||||
/** @var Request */
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param SecurityContext $securityContext
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
SecurityContext $securityContext,
|
||||
Request $request
|
||||
) {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
|
||||
$this->securityContext = $securityContext;
|
||||
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TakeCustomerAccountEvent $event
|
||||
*/
|
||||
public function take(TakeCustomerAccountEvent $event)
|
||||
{
|
||||
$this->eventDispatcher->dispatch(TheliaEvents::CUSTOMER_LOGOUT, new DefaultActionEvent());
|
||||
|
||||
$this->eventDispatcher->dispatch(
|
||||
TheliaEvents::CUSTOMER_LOGIN,
|
||||
new CustomerLoginEvent($event->getCustomer())
|
||||
);
|
||||
|
||||
$newCartEvent = new CartCreateEvent();
|
||||
$this->eventDispatcher->dispatch(TheliaEvents::CART_CREATE_NEW, $newCartEvent);
|
||||
|
||||
AdminLog::append(
|
||||
TakeCustomerAccount::MODULE_DOMAIN,
|
||||
AccessManager::VIEW,
|
||||
'Took control of the customer account "' . $event->getCustomer()->getId() . '"',
|
||||
$this->request,
|
||||
$this->securityContext->getAdminUser()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TakeCustomerAccountEvents::TAKE_CUSTOMER_ACCOUNT => ['take', 128]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module TakeCustomerAccount */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace TakeCustomerAccount\Form;
|
||||
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* Class TakeCustomerAccountForm
|
||||
* @package TakeCustomerAccount\Form
|
||||
* @author Gilles Bourgeat <gbourgeat@openstudio.fr>
|
||||
*/
|
||||
class TakeCustomerAccountForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'take_customer_account';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* in this function you add all the fields you need for your Form.
|
||||
* Form this you have to call add method on $this->formBuilder attribute :
|
||||
*
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
}
|
||||
}
|
||||
50
local/modules/TakeCustomerAccount/Hook/AdminCustomerHook.php
Normal file
50
local/modules/TakeCustomerAccount/Hook/AdminCustomerHook.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module TakeCustomerAccount */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace TakeCustomerAccount\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
/**
|
||||
* Class AdminCustomerHook
|
||||
* @package TakeCustomerAccount\Hook
|
||||
* @author Gilles Bourgeat <gbourgeat@openstudio.fr>
|
||||
*/
|
||||
class AdminCustomerHook extends BaseHook
|
||||
{
|
||||
/**
|
||||
* @param HookRenderEvent $event
|
||||
*/
|
||||
public function onCustomerEdit(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'take-customer-account/hook/customer-edit.html',
|
||||
array(
|
||||
'customer_id' => $event->getArgument('customer_id')
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param HookRenderEvent $event
|
||||
*/
|
||||
public function onCustomerEditJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render(
|
||||
'take-customer-account/hook/customer-edit-js.html',
|
||||
array(
|
||||
'customer_id' => $event->getArgument('customer_id')
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Help !!!' => 'Help !!!',
|
||||
'If you are logged in with another customer he will be offline' => 'If you are logged in with another customer he will be offline',
|
||||
'Take customer account' => 'Take customer account',
|
||||
'To ask for help' => 'To ask for help',
|
||||
'To connect to the customer\'s account' => 'To connect to the customer\'s account',
|
||||
'You have not need the customer password' => 'You have not need the customer password',
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Help !!!' => 'Aide !!!',
|
||||
'If you are logged in with another customer he will be offline' => 'Si vous êtes connecté avec un autre client, il sera déconnecté',
|
||||
'Take customer account' => 'Se connecter au compte client',
|
||||
'To ask for help' => 'Pour de l\'aide',
|
||||
'To connect to the customer\'s account' => 'Pour vous connecter au compte client',
|
||||
'You have not need the customer password' => 'Vous n\'avez pas besoin du mot de passe du client',
|
||||
);
|
||||
5
local/modules/TakeCustomerAccount/I18n/en_US.php
Normal file
5
local/modules/TakeCustomerAccount/I18n/en_US.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Customer not found' => ' Customer not found',
|
||||
);
|
||||
5
local/modules/TakeCustomerAccount/I18n/fr_FR.php
Normal file
5
local/modules/TakeCustomerAccount/I18n/fr_FR.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Customer not found' => 'Impossible de trouver le client',
|
||||
);
|
||||
165
local/modules/TakeCustomerAccount/LICENSE.txt
Normal file
165
local/modules/TakeCustomerAccount/LICENSE.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
37
local/modules/TakeCustomerAccount/Readme.md
Normal file
37
local/modules/TakeCustomerAccount/Readme.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Take Customer Account
|
||||
|
||||
Authors: Thelia <info@thelia.net>, Gilles Bourgeat <gbourgeat@openstudio.fr>
|
||||
|
||||
* This module is used to connect to a client account from admin.
|
||||
* You have not need the customer password
|
||||
|
||||
[](https://scrutinizer-ci.com/g/thelia-modules/TakeCustomerAccount/?branch=master)
|
||||
[](https://packagist.org/packages/thelia/take-customer-account-module)
|
||||
[](https://packagist.org/packages/thelia/take-customer-account-module)
|
||||
|
||||
## Screenshot
|
||||
|
||||

|
||||
|
||||
## Compatibility
|
||||
|
||||
Thelia > 2.1
|
||||
|
||||
## Installation
|
||||
|
||||
### Manually
|
||||
|
||||
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is ```TakeCustomerAccount```.
|
||||
* Activate it in your thelia administration panel
|
||||
|
||||
### Composer
|
||||
|
||||
Add it in your main thelia composer.json file
|
||||
|
||||
```
|
||||
composer require thelia/take-customer-account-module:~1.2.0
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
* See you in a customer account in the admin, then go to the area "Take customer account"
|
||||
43
local/modules/TakeCustomerAccount/TakeCustomerAccount.php
Normal file
43
local/modules/TakeCustomerAccount/TakeCustomerAccount.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the module TakeCustomerAccount */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace TakeCustomerAccount;
|
||||
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
use Thelia\Module\BaseModule;
|
||||
|
||||
class TakeCustomerAccount extends BaseModule
|
||||
{
|
||||
const MODULE_DOMAIN = "takecustomeraccount";
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHooks()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"type" => TemplateDefinition::BACK_OFFICE,
|
||||
"code" => "take-customer-account.form",
|
||||
"title" => array(
|
||||
"fr_FR" => "Module Take Customer Account, form",
|
||||
"en_US" => "Module Take Customer Account, form",
|
||||
),
|
||||
"description" => array(
|
||||
"fr_FR" => "En haut du formulaire",
|
||||
"en_US" => "Top of form",
|
||||
),
|
||||
"active" => true
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
11
local/modules/TakeCustomerAccount/composer.json
Normal file
11
local/modules/TakeCustomerAccount/composer.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "thelia/take-customer-account-module",
|
||||
"license": "LGPL-3.0+",
|
||||
"type": "thelia-module",
|
||||
"require": {
|
||||
"thelia/installer": "~1.1"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "TakeCustomerAccount"
|
||||
}
|
||||
}
|
||||
BIN
local/modules/TakeCustomerAccount/logo.jpg
Normal file
BIN
local/modules/TakeCustomerAccount/logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
local/modules/TakeCustomerAccount/screenshot/screenshot-1.jpeg
Normal file
BIN
local/modules/TakeCustomerAccount/screenshot/screenshot-1.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,5 @@
|
||||
<script>
|
||||
(function($, $module){
|
||||
$module.find('.js-popover').popover();
|
||||
}(jQuery, jQuery('#module-take-customer-account')));
|
||||
</script>
|
||||
@@ -0,0 +1,49 @@
|
||||
{loop type="auth" name="auth" role="ADMIN" module="TakeCustomerAccount" access="VIEW"}
|
||||
{form name="take_customer_account"}
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator" id="module-take-customer-account">
|
||||
<button class="btn btn-default pull-right js-popover"
|
||||
title="{intl l="Help !!!" d="takecustomeraccount.bo.default"}"
|
||||
data-placement="left"
|
||||
data-html="true"
|
||||
data-content="{intl l="To ask for help" d="takecustomeraccount.bo.default"}
|
||||
</br> <a target='_blank' href='https://github.com/thelia-modules/TakeCustomerAccount/issues'>GitHub</a>
|
||||
, <a target='_blank' href='http://thelia.net/forum/'>Thelia forum</a>
|
||||
"
|
||||
>
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
</button>
|
||||
<div class="title title-without-tabs">
|
||||
{intl l="Take customer account" d="takecustomeraccount.bo.default"}
|
||||
</div>
|
||||
<form action="{url path="/admin/take-customer-account/$customer_id"}" method="POST" target="_blank">
|
||||
{form_hidden_fields form=$form}
|
||||
<div class="form-container">
|
||||
<div class="row">
|
||||
{if $form_error}
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{hook name="take-customer-account.form"}
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="alert alert-info">
|
||||
- {intl l="To connect to the customer's account" d="takecustomeraccount.bo.default"}<br />
|
||||
- {intl l="If you are logged in with another customer he will be offline" d="takecustomeraccount.bo.default"}<br />
|
||||
- {intl l="You have not need the customer password" d="takecustomeraccount.bo.default"}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<br />
|
||||
<br />
|
||||
<button type="submit" class="btn btn-primary">{intl l="Take customer account" d="takecustomeraccount.bo.default"}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{/form}
|
||||
{/loop}
|
||||
Reference in New Issue
Block a user