$newEntity->setCreatedAt(new \DateTime()); | $newEntity->setCreatedAt(new \DateTime()); | ||||
} | } | ||||
$this->entityManager->create($newEntity); | |||||
$this->eventDispatcher->dispatch(new EntityComponentEvent($newEntity), EntityComponentEvent::DUPLICATE_EVENT); | $this->eventDispatcher->dispatch(new EntityComponentEvent($newEntity), EntityComponentEvent::DUPLICATE_EVENT); | ||||
//Ne pas utiliser create ici! Sinon pour certaine entité comme ProductFamily on réajoute un orginProduct | |||||
$this->entityManager->persist($newEntity); | |||||
return $newEntity; | return $newEntity; | ||||
} | } |
use ControllerTrait; | use ControllerTrait; | ||||
/** | |||||
* @Route("/admin", name="app_admin_dashboard") | |||||
*/ | |||||
public function index(): Response | public function index(): Response | ||||
{ | { | ||||
return $this->render('@LcSov/adminlte/dashboard.html.twig'); | return $this->render('@LcSov/adminlte/dashboard.html.twig'); |
namespace Lc\SovBundle\Controller; | namespace Lc\SovBundle\Controller; | ||||
use Symfony\Component\HttpFoundation\Request; | |||||
use Symfony\Component\Mailer\MailerInterface; | |||||
use Throwable; | use Throwable; | ||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; | use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; | ||||
use Symfony\Component\Mime\Email; | |||||
class ErrorController extends AbstractController | class ErrorController extends AbstractController | ||||
{ | { | ||||
public function show(Throwable $exception, DebugLoggerInterface $logger = null) | |||||
public function show($exception, DebugLoggerInterface $logger = null, MailerInterface $mailer) | |||||
{ | { | ||||
if ($this->getRequestStack()->getCurrentRequest()->getPathInfo() == "/admin") { | |||||
//Si != de 404 on envoit un mail de debug | |||||
if ($exception->getStatusCode() != 404) { | |||||
$mailDebug = $this->getParameter('app.mail_debug'); | |||||
if ($mailDebug) { | |||||
$message = "Code : " . $exception->getStatusCode() . "<br>"; | |||||
$message .= "Message : " . $exception->getMessage() . "<br>"; | |||||
$message .= "File : " . $exception->getFile() . "<br>"; | |||||
$message .= "Line : " . $exception->getLine() . "<br><br>"; | |||||
$message .= "Trace : <br>" . str_replace("\n", "<br>", $exception->getTraceAsString()); | |||||
$siteName = $this->getParameter('app.site_name'); | |||||
$email = (new Email()) | |||||
->from('nepasrepondre@laclic.fr') | |||||
->to($mailDebug) | |||||
->subject( | |||||
'[' . $siteName . '] [ERREUR ' . $exception->getStatusCode() . '] ' . $exception->getMessage( | |||||
) . '' | |||||
) | |||||
->text(strip_tags($message)) | |||||
->html($message); | |||||
$mailer->send($email); | |||||
} | |||||
} | |||||
if (str_contains($this->getRequestStack()->getCurrentRequest(), "/admin")) { | |||||
return $this->render('@LcSov/exception/error.html.twig', [ | return $this->render('@LcSov/exception/error.html.twig', [ | ||||
"code" => $exception->getCode(), | |||||
"code" => $exception->getStatusCode(), | |||||
"message" => $exception->getMessage() | "message" => $exception->getMessage() | ||||
]); | ]); | ||||
} else { | } else { | ||||
return $this->render('bundles/TwigBundle/Exception/error.html.twig', [ | return $this->render('bundles/TwigBundle/Exception/error.html.twig', [ | ||||
"code" => $exception->getCode(), | |||||
"code" => $exception->getStatusCode(), | |||||
"message" => $exception->getMessage() | "message" => $exception->getMessage() | ||||
]); | ]); | ||||
} | } |
.card-body table th.sorted, table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);} | .card-body table th.sorted, table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);} | ||||
.card-body table th.sorted.filtered{border-top:0px; position: relative;} | .card-body table th.sorted.filtered{border-top:0px; position: relative;} | ||||
.card-body table th.sorted.filtered:after{ content: ''; height: 2px; position: absolute; left: 0; width: 100%; right: 0; top: -1px; background: linear-gradient(to right, var(--success) 0%, var(--success) 50%, var(--primary) 50%, var(--primary) 100%);} | .card-body table th.sorted.filtered:after{ content: ''; height: 2px; position: absolute; left: 0; width: 100%; right: 0; top: -1px; background: linear-gradient(to right, var(--success) 0%, var(--success) 50%, var(--primary) 50%, var(--primary) 100%);} | ||||
.link-as-text{color: #212529; } |
window.addEventListener('load', (event) => { | window.addEventListener('load', (event) => { | ||||
$(document).on('select2:open', () => { | |||||
document.querySelector('.select2-search__field').focus(); | |||||
}); | |||||
SovNotification.init(); | SovNotification.init(); | ||||
#page-error { | |||||
text-align: center; | |||||
img { | |||||
margin-top: 100px; | |||||
} | |||||
} | |||||
nav.main-header { | nav.main-header { | ||||
ul.navbar-nav { | ul.navbar-nav { | ||||
li.nav-item-user-menu { | li.nav-item-user-menu { |
}); | }); | ||||
SovTools.log(myselect); | SovTools.log(myselect); | ||||
myselect.off('select2:open') | |||||
return myselect; | return myselect; | ||||
} | } | ||||
} | } |
- { name: kernel.event_listener, event: kernel.exception } | - { name: kernel.event_listener, event: kernel.exception } | ||||
parameters: | parameters: | ||||
app.admin.logo: 'laclic.png' | |||||
app.admin.logo: 'laclic.png' | |||||
app.site_name: 'laclic-sov' | |||||
app.mail_debug: '' |
{% for field in entity.fields %} | {% for field in entity.fields %} | ||||
<td class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}" | <td class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}" | ||||
dir="{{ ea.i18n.textDirection }}"> | dir="{{ ea.i18n.textDirection }}"> | ||||
{{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }} | |||||
{# {% if (field.property == 'id' or field.property == 'title') %}#} | |||||
{# #}{# {% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") and _entity_config.name != 'ProductFamilyAdvancedEditing' %} #} | |||||
{# <a class="link-as-text"#} | |||||
{# href="{{ ea_url_short(null, 'edit', entity.instance.id) }}">#} | |||||
{# {{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}#} | |||||
{# </a>#} | |||||
{# {% else %}#} | |||||
{{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }} | |||||
{# {% endif %}#} | |||||
</td> | </td> | ||||
{% endfor %} | {% endfor %} | ||||
{% extends '@LcSov/adminlte/layout.html.twig' %} | |||||
{% block wrapper %} | |||||
{% block navbar_header %}{% endblock %} | |||||
{% block sidebar %}{% endblock %} | |||||
{% block content %} | |||||
<div id="page-error"> | |||||
<html> | |||||
<div id="page-error"> | |||||
<a href="{{ path('app_admin_dashboard') }}" title="Retourner sur l'admin">Retourner sur l'admin</a> | |||||
<div> | |||||
<a href="{{ path('app_admin_dashboard') }}" title="Retourner sur l'admin"> | |||||
<img src="{{ asset('bundles/lcsov/img/erreur-500.png') }}" alt="ERROR"> | <img src="{{ asset('bundles/lcsov/img/erreur-500.png') }}" alt="ERROR"> | ||||
</div> | |||||
{% endblock %} | |||||
{% endblock %} | |||||
{# {% extends 'layout.html' %} #} | |||||
{# {% set title = 'Erreur' %} #} | |||||
{# {% block page_title %}{% endblock %} #} | |||||
{# {% block title %}{{ title }}{% endblock %} #} | |||||
</a> | |||||
</div> | |||||
</div> | |||||
<style> | |||||
#page-error { | |||||
text-align: center; | |||||
} | |||||
{# {% block content %} #} | |||||
{# {% embed 'bundles/TwigBundle/Exception/_content.html.twig' %} #} | |||||
{# {% block content_error %} #} | |||||
{# <p>Une erreur est survenue.TEST</p> #} | |||||
{# {% endblock %} #} | |||||
{# {% endembed %} #} | |||||
{# {% endblock %} #} | |||||
img { | |||||
margin-top: 100px; | |||||
} | |||||
</style> | |||||
</html> |