search and export from invoice archive (#2408)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace App\EventSubscriber\Actions;
|
||||
|
||||
use App\Constants;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
@@ -33,4 +34,9 @@ abstract class AbstractActionsSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
return $this->urlGenerator->generate($route, $parameters);
|
||||
}
|
||||
|
||||
protected function documentationLink(string $url): string
|
||||
{
|
||||
return Constants::HOMEPAGE . '/documentation/' . $url;
|
||||
}
|
||||
}
|
||||
|
||||
37
src/EventSubscriber/Actions/InvoiceArchiveSubscriber.php
Normal file
37
src/EventSubscriber/Actions/InvoiceArchiveSubscriber.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\EventSubscriber\Actions;
|
||||
|
||||
use App\Event\PageActionsEvent;
|
||||
|
||||
class InvoiceArchiveSubscriber extends AbstractActionsSubscriber
|
||||
{
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'actions.invoice_details' => ['onActions', 1000],
|
||||
];
|
||||
}
|
||||
|
||||
public function onActions(PageActionsEvent $event)
|
||||
{
|
||||
$actions = $event->getActions();
|
||||
|
||||
if ($this->isGranted('view_invoice')) {
|
||||
$actions['back'] = ['url' => $this->path('invoice'), 'translation_domain' => 'actions'];
|
||||
}
|
||||
|
||||
$actions['visibility'] = '#modal_invoices';
|
||||
$actions['download'] = ['url' => $this->path('invoice_export'), 'class' => 'toolbar-action'];
|
||||
$actions['help'] = ['url' => $this->documentationLink('invoices.html'), 'target' => '_blank'];
|
||||
|
||||
$event->setActions($actions);
|
||||
}
|
||||
}
|
||||
@@ -88,8 +88,6 @@ class UserSubscriber extends AbstractActionsSubscriber
|
||||
$actions['trash'] = ['url' => $this->path('admin_user_delete', ['id' => $user->getId()]), 'class' => 'modal-ajax-form'];
|
||||
}
|
||||
|
||||
$payload['actions'] = array_merge($payload['actions'], $actions);
|
||||
|
||||
$event->setPayload($payload);
|
||||
$event->setActions($actions);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user