mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 03:38:47 +02:00
Merge branch 'time_machine'
This commit is contained in:
commit
eb03d14b37
87 changed files with 7336 additions and 1265 deletions
14
.env
14
.env
|
@ -59,3 +59,17 @@ EMAIL_SENDER_EMAIL=noreply@partdb.changeme
|
|||
# Set this to 1 to allow reset of a password per email
|
||||
ALLOW_EMAIL_PW_RESET=0
|
||||
|
||||
|
||||
######################################################################################
|
||||
# History/Eventlog related settings
|
||||
######################################################################################
|
||||
|
||||
# If you want to use full timetrave functionality
|
||||
|
||||
# Save which fields were changed in a ElementEdited log entry
|
||||
HISTORY_SAVE_CHANGED_FIELDS=1
|
||||
# Save the old data in the ElementEdited log entry (warning this could increase the database size in short time)
|
||||
HISTORY_SAVE_CHANGED_DATA=0
|
||||
# Save the data of an element that gets removed into log entry. This allows to undelete an element
|
||||
HISTORY_SAVE_REMOVED_DATA=0
|
||||
|
||||
|
|
|
@ -242,6 +242,16 @@ showing the sidebar (on devices with md or higher)
|
|||
* Bootstrap extensions
|
||||
*****************************************/
|
||||
|
||||
.bg-primary-striped {
|
||||
background: repeating-linear-gradient(
|
||||
-45deg,
|
||||
var(--primary),
|
||||
var(--primary) 10px,
|
||||
var(--info) 10px,
|
||||
var(--info) 20px
|
||||
)
|
||||
}
|
||||
|
||||
.form-group-sm {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
@ -310,6 +320,10 @@ showing the sidebar (on devices with md or higher)
|
|||
}
|
||||
}
|
||||
|
||||
.not-allowed {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
|
||||
/**************************************
|
||||
btn-xs
|
||||
btn-xs
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
translation:
|
||||
locales: ["en", "de", "ru"]
|
||||
locales: ["en", "de"]
|
||||
edit_in_place:
|
||||
enabled: false
|
||||
config_name: app
|
||||
|
|
|
@ -67,6 +67,10 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
show_history:
|
||||
label: "perm.part.show_history"
|
||||
bit: 30
|
||||
revert_element:
|
||||
label: "perm.revert_elements"
|
||||
bit: 32
|
||||
alsoSet: ["read", "edit", "create", "delete", "show_history"]
|
||||
|
||||
parts_name: &PART_ATTRIBUTE # We define a template here, that we can use for all part attributes.
|
||||
label: "perm.part.name"
|
||||
|
@ -154,8 +158,31 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
label: "perm.part.lots"
|
||||
|
||||
parts_attachments:
|
||||
<<: *PART_MULTI_ATTRIBUTE
|
||||
group: "structures"
|
||||
label: "perm.part.attachments"
|
||||
operations:
|
||||
read:
|
||||
label: "perm.read"
|
||||
bit: 0
|
||||
edit:
|
||||
label: "perm.edit"
|
||||
bit: 2
|
||||
alsoSet: 'read'
|
||||
create:
|
||||
label: "perm.create"
|
||||
bit: 4
|
||||
alsoSet: ['read', 'edit']
|
||||
delete:
|
||||
label: "perm.delete"
|
||||
bit: 6
|
||||
alsoSet: ['read']
|
||||
show_history:
|
||||
label: "perm.show_history"
|
||||
bit: 8
|
||||
revert_element:
|
||||
label: "perm.revert_elements"
|
||||
bit: 10
|
||||
alsoSet: ["read", "edit", "create", "delete", "show_history"]
|
||||
|
||||
parts_order:
|
||||
<<: *PART_ATTRIBUTE
|
||||
|
@ -189,6 +216,13 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
show_users:
|
||||
label: "perm.show_users"
|
||||
bit: 12
|
||||
show_history:
|
||||
label: "perm.show_history"
|
||||
bit: 14
|
||||
revert_element:
|
||||
label: "perm.revert_elements"
|
||||
bit: 16
|
||||
alsoSet: ["read", "edit", "create", "delete", "show_history"]
|
||||
|
||||
footprints:
|
||||
<<: *PART_CONTAINING
|
||||
|
@ -243,6 +277,12 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
statistics:
|
||||
label: "perm.tools.statistics"
|
||||
bit: 10
|
||||
lastActivity:
|
||||
label: "perm.tools.lastActivity"
|
||||
bit: 12
|
||||
timetravel:
|
||||
label: "perm.tools.timeTravel"
|
||||
bit: 14
|
||||
|
||||
groups:
|
||||
label: "perm.groups"
|
||||
|
@ -270,6 +310,13 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
label: "perm.edit_permissions"
|
||||
alsoSet: ['read', 'edit']
|
||||
bit: 10
|
||||
show_history:
|
||||
label: "perm.show_history"
|
||||
bit: 12
|
||||
revert_element:
|
||||
label: "perm.revert_elements"
|
||||
bit: 14
|
||||
alsoSet: ["read", "edit", "create", "delete", "move", "edit_permissions", "show_history"]
|
||||
|
||||
users:
|
||||
label: "perm.users"
|
||||
|
@ -309,6 +356,13 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
change_user_settings:
|
||||
label: "perm.users.change_user_settings"
|
||||
bit: 16
|
||||
show_history:
|
||||
label: "perm.show_history"
|
||||
bit: 18
|
||||
revert_element:
|
||||
label: "perm.revert_elements"
|
||||
bit: 20
|
||||
alsoSet: ["read", "edit", "create", "delete", "move", "edit_permissions", "show_history", "edit_infos", "change_group", "edit_username"]
|
||||
|
||||
database:
|
||||
label: "perm.database"
|
||||
|
|
|
@ -74,6 +74,10 @@ services:
|
|||
- { name: "doctrine.orm.entity_listener" }
|
||||
|
||||
App\EventSubscriber\EventLoggerSubscriber:
|
||||
arguments:
|
||||
$save_changed_fields: '%env(bool:HISTORY_SAVE_CHANGED_FIELDS)%'
|
||||
$save_changed_data: '%env(bool:HISTORY_SAVE_CHANGED_DATA)%'
|
||||
$save_removed_data: '%env(bool:HISTORY_SAVE_REMOVED_DATA)%'
|
||||
tags:
|
||||
- { name: 'doctrine.event_subscriber' }
|
||||
|
||||
|
@ -92,6 +96,11 @@ services:
|
|||
tags:
|
||||
- name: doctrine.orm.entity_listener
|
||||
|
||||
# Dont use JSONSerializable Interface,
|
||||
serializer.normalizer.json_serializable:
|
||||
class: Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer
|
||||
tags:
|
||||
- {name: serializer.normalizer, priority: -9000}
|
||||
|
||||
App\Controller\RedirectController:
|
||||
arguments:
|
||||
|
|
|
@ -137,6 +137,7 @@ class ShowEventLogCommand extends Command
|
|||
$headers = ['ID', 'Timestamp', 'Type', 'User', 'Target Type', 'Target'];
|
||||
if ($showExtra) {
|
||||
$headers[] = 'Extra data';
|
||||
$table->setColumnMaxWidth(6, 50);
|
||||
}
|
||||
$table->setHeaders($headers);
|
||||
|
||||
|
@ -144,6 +145,9 @@ class ShowEventLogCommand extends Command
|
|||
$this->addTableRow($table, $entry, $showExtra);
|
||||
}
|
||||
|
||||
$table->setColumnMaxWidth(3, 20);
|
||||
$table->setColumnMaxWidth(5, 30);
|
||||
|
||||
$table->render();
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class AttachmentTypeController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="attachment_type_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="attachment_type_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
*
|
||||
* @param AttachmentType $entity
|
||||
|
@ -87,9 +87,9 @@ class AttachmentTypeController extends BaseAdminController
|
|||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em): Response
|
||||
public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,6 +42,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
use App\DataTables\LogDataTable;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
@ -52,9 +53,13 @@ use App\Services\Attachments\AttachmentManager;
|
|||
use App\Services\Attachments\AttachmentSubmitHandler;
|
||||
use App\Services\EntityExporter;
|
||||
use App\Services\EntityImporter;
|
||||
use App\Services\LogSystem\EventCommentHelper;
|
||||
use App\Services\LogSystem\HistoryHelper;
|
||||
use App\Services\LogSystem\TimeTravel;
|
||||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
use Omines\DataTablesBundle\DataTableFactory;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
@ -77,9 +82,16 @@ abstract class BaseAdminController extends AbstractController
|
|||
protected $translator;
|
||||
protected $attachmentHelper;
|
||||
protected $attachmentSubmitHandler;
|
||||
protected $commentHelper;
|
||||
|
||||
protected $historyHelper;
|
||||
protected $timeTravel;
|
||||
protected $dataTableFactory;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, UserPasswordEncoderInterface $passwordEncoder,
|
||||
AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler)
|
||||
AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler,
|
||||
EventCommentHelper $commentHelper, HistoryHelper $historyHelper, TimeTravel $timeTravel,
|
||||
DataTableFactory $dataTableFactory)
|
||||
{
|
||||
if ('' === $this->entity_class || '' === $this->form_class || '' === $this->twig_template || '' === $this->route_base) {
|
||||
throw new InvalidArgumentException('You have to override the $entity_class, $form_class, $route_base and $twig_template value in your subclasss!');
|
||||
|
@ -93,14 +105,54 @@ abstract class BaseAdminController extends AbstractController
|
|||
$this->passwordEncoder = $passwordEncoder;
|
||||
$this->attachmentHelper = $attachmentHelper;
|
||||
$this->attachmentSubmitHandler = $attachmentSubmitHandler;
|
||||
$this->commentHelper = $commentHelper;
|
||||
$this->historyHelper = $historyHelper;
|
||||
$this->timeTravel = $timeTravel;
|
||||
$this->dataTableFactory = $dataTableFactory;
|
||||
}
|
||||
|
||||
|
||||
protected function _edit(AbstractNamedDBElement $entity, Request $request, EntityManagerInterface $em) : Response
|
||||
protected function _edit(AbstractNamedDBElement $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null) : Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('read', $entity);
|
||||
|
||||
$form = $this->createForm($this->form_class, $entity, ['attachment_class' => $this->attachment_class]);
|
||||
|
||||
$timeTravel_timestamp = null;
|
||||
if ($timestamp !== null) {
|
||||
$this->denyAccessUnlessGranted('@tools.timeTravel');
|
||||
$this->denyAccessUnlessGranted('show_history', $entity);
|
||||
//If the timestamp only contains numbers interpret it as unix timestamp
|
||||
if (ctype_digit($timestamp)) {
|
||||
$timeTravel_timestamp = new \DateTime();
|
||||
$timeTravel_timestamp->setTimestamp((int) $timestamp);
|
||||
} else { //Try to parse it via DateTime
|
||||
$timeTravel_timestamp = new \DateTime($timestamp);
|
||||
}
|
||||
$this->timeTravel->revertEntityToTimestamp($entity, $timeTravel_timestamp);
|
||||
}
|
||||
|
||||
if ($this->isGranted('show_history', $entity) ) {
|
||||
$table = $this->dataTableFactory->createFromType(
|
||||
LogDataTable::class,
|
||||
[
|
||||
'filter_elements' => $this->historyHelper->getAssociatedElements($entity),
|
||||
'mode' => 'element_history'
|
||||
],
|
||||
['pageLength' => 10]
|
||||
)
|
||||
->handleRequest($request);
|
||||
|
||||
if ($table->isCallback()) {
|
||||
return $table->getResponse();
|
||||
}
|
||||
} else {
|
||||
$table = null;
|
||||
}
|
||||
|
||||
$form = $this->createForm($this->form_class, $entity, [
|
||||
'attachment_class' => $this->attachment_class,
|
||||
'disabled' => $timeTravel_timestamp !== null ? true : null
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
@ -131,6 +183,8 @@ abstract class BaseAdminController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
$this->commentHelper->setMessage($form['log_comment']->getData());
|
||||
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
$this->addFlash('success', 'entity.edit_flash');
|
||||
|
@ -146,6 +200,9 @@ abstract class BaseAdminController extends AbstractController
|
|||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
'attachment_helper' => $this->attachmentHelper,
|
||||
'route_base' => $this->route_base,
|
||||
'datatable' => $table,
|
||||
'timeTravel' => $timeTravel_timestamp
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -188,6 +245,8 @@ abstract class BaseAdminController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
$this->commentHelper->setMessage($form['log_comment']->getData());
|
||||
|
||||
$em->persist($new_entity);
|
||||
$em->flush();
|
||||
$this->addFlash('success', 'entity.created_flash');
|
||||
|
@ -215,6 +274,10 @@ abstract class BaseAdminController extends AbstractController
|
|||
'csv_separator' => $data['csv_separator'],
|
||||
];
|
||||
|
||||
$this->commentHelper->setMessage('Import ' . $file->getClientOriginalName());
|
||||
|
||||
|
||||
|
||||
$errors = $importer->fileToDBEntities($file, $this->entity_class, $options);
|
||||
|
||||
foreach ($errors as $name => $error) {
|
||||
|
@ -252,6 +315,7 @@ abstract class BaseAdminController extends AbstractController
|
|||
'import_form' => $import_form->createView(),
|
||||
'mass_creation_form' => $mass_creation_form->createView(),
|
||||
'attachment_helper' => $this->attachmentHelper,
|
||||
'route_base' => $this->route_base,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -280,6 +344,8 @@ abstract class BaseAdminController extends AbstractController
|
|||
$entityManager->remove($entity);
|
||||
}
|
||||
|
||||
$this->commentHelper->setMessage($request->request->get('log_comment', null));
|
||||
|
||||
//Flush changes
|
||||
$entityManager->flush();
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class CategoryController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="category_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="category_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
*
|
||||
* @param Category $entity
|
||||
|
@ -87,9 +87,9 @@ class CategoryController extends BaseAdminController
|
|||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Category $entity, Request $request, EntityManagerInterface $em): Response
|
||||
public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ class CurrencyController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="currency_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="currency_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
*
|
||||
* @param Currency $entity
|
||||
|
@ -89,9 +89,9 @@ class CurrencyController extends BaseAdminController
|
|||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Currency $entity, Request $request, EntityManagerInterface $em): Response
|
||||
public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,7 +79,7 @@ class DeviceController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="device_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
*
|
||||
* @param Device $entity
|
||||
|
@ -87,9 +87,9 @@ class DeviceController extends BaseAdminController
|
|||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Device $entity, Request $request, EntityManagerInterface $em): Response
|
||||
public function edit(Device $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,16 +78,16 @@ class FootprintController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="footprint_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="footprint_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
* @param Footprint $entity
|
||||
* @param Request $request
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em)
|
||||
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,16 +77,16 @@ class ManufacturerController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="manufacturer_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="manufacturer_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
* @param Manufacturer $entity
|
||||
* @param Request $request
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em)
|
||||
public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,16 +78,16 @@ class MeasurementUnitController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="measurement_unit_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="measurement_unit_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
* @param MeasurementUnit $entity
|
||||
* @param Request $request
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(MeasurementUnit $entity, Request $request, EntityManagerInterface $em)
|
||||
public function edit(MeasurementUnit $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -76,16 +76,16 @@ class StorelocationController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="store_location_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="store_location_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
* @param Storelocation $entity
|
||||
* @param Request $request
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em)
|
||||
public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,16 +77,16 @@ class SupplierController extends BaseAdminController
|
|||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="supplier_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="supplier_edit")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
* @param Supplier $entity
|
||||
* @param Request $request
|
||||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Supplier $entity, Request $request, EntityManagerInterface $em)
|
||||
public function edit(Supplier $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null)
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,7 @@ class GroupController extends BaseAdminController
|
|||
protected $attachment_class = GroupAttachment::class;
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="group_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="group_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
*
|
||||
* @param Group $entity
|
||||
|
@ -75,9 +75,9 @@ class GroupController extends BaseAdminController
|
|||
* @param EntityManagerInterface $em
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Group $entity, Request $request, EntityManagerInterface $em): Response
|
||||
public function edit(Group $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||
{
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\DataTables\LogDataTable;
|
||||
use App\Services\GitVersionInfo;
|
||||
use Omines\DataTablesBundle\DataTableFactory;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
@ -53,11 +57,13 @@ class HomepageController extends AbstractController
|
|||
{
|
||||
protected $cache;
|
||||
protected $kernel;
|
||||
protected $dataTable;
|
||||
|
||||
public function __construct(CacheInterface $cache, KernelInterface $kernel)
|
||||
public function __construct(CacheInterface $cache, KernelInterface $kernel, DataTableFactory $dataTable)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->kernel = $kernel;
|
||||
$this->dataTable = $dataTable;
|
||||
}
|
||||
|
||||
public function getBanner(): string
|
||||
|
@ -78,12 +84,30 @@ class HomepageController extends AbstractController
|
|||
* @param GitVersionInfo $versionInfo
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function homepage(GitVersionInfo $versionInfo): \Symfony\Component\HttpFoundation\Response
|
||||
public function homepage(Request $request, GitVersionInfo $versionInfo): Response
|
||||
{
|
||||
if ($this->isGranted("@tools.lastActivity")) {
|
||||
$table = $this->dataTable->createFromType(
|
||||
LogDataTable::class,
|
||||
[
|
||||
'mode' => 'last_activity'
|
||||
],
|
||||
['pageLength' => 10]
|
||||
)
|
||||
->handleRequest($request);
|
||||
|
||||
if ($table->isCallback()) {
|
||||
return $table->getResponse();
|
||||
}
|
||||
} else {
|
||||
$table = null;
|
||||
}
|
||||
|
||||
return $this->render('homepage.html.twig', [
|
||||
'banner' => $this->getBanner(),
|
||||
'git_branch' => $versionInfo->getGitBranchName(),
|
||||
'git_commit' => $versionInfo->getGitCommitHash(),
|
||||
'datatable' => $table
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,20 @@ declare(strict_types=1);
|
|||
namespace App\Controller;
|
||||
|
||||
use App\DataTables\LogDataTable;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
use App\Entity\LogSystem\ElementCreatedLogEntry;
|
||||
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||
use App\Services\LogSystem\EventUndoHelper;
|
||||
use App\Services\LogSystem\TimeTravel;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Omines\DataTablesBundle\DataTableFactory;
|
||||
use phpDocumentor\Reflection\Element;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
@ -55,6 +66,18 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||
*/
|
||||
class LogController extends AbstractController
|
||||
{
|
||||
protected $entityManager;
|
||||
protected $timeTravel;
|
||||
protected $dbRepository;
|
||||
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager, TimeTravel $timeTravel)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->timeTravel = $timeTravel;
|
||||
$this->dbRepository = $entityManager->getRepository(AbstractDBElement::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/", name="log_view")
|
||||
*
|
||||
|
@ -77,4 +100,107 @@ class LogController extends AbstractController
|
|||
'datatable' => $table,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/undo", name="log_undo", methods={"POST"})
|
||||
* @param Request $request
|
||||
*/
|
||||
public function undoRevertLog(Request $request, EventUndoHelper $eventUndoHelper)
|
||||
{
|
||||
$mode = EventUndoHelper::MODE_UNDO;
|
||||
$id = $request->request->get('undo');
|
||||
|
||||
//If no undo value was set check if a revert was set
|
||||
if ($id === null) {
|
||||
$id = $request->get('revert');
|
||||
$mode = EventUndoHelper::MODE_REVERT;
|
||||
}
|
||||
|
||||
$log_element = $this->entityManager->find(AbstractLogEntry::class, $id);
|
||||
if ($log_element === null) {
|
||||
throw new \InvalidArgumentException('No log entry with the given ID is existing!');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted('revert_element', $log_element->getTargetClass());
|
||||
|
||||
$eventUndoHelper->setMode($mode);
|
||||
$eventUndoHelper->setUndoneEvent($log_element);
|
||||
|
||||
if ($mode === EventUndoHelper::MODE_UNDO) {
|
||||
$this->undoLog($log_element);
|
||||
} elseif ($mode === EventUndoHelper::MODE_REVERT) {
|
||||
$this->revertLog($log_element);
|
||||
}
|
||||
|
||||
$eventUndoHelper->clearUndoneEvent();
|
||||
|
||||
$redirect = $request->request->get('redirect_back');
|
||||
return $this->redirect($redirect);
|
||||
}
|
||||
|
||||
protected function revertLog(AbstractLogEntry $logEntry): void
|
||||
{
|
||||
$timestamp = $logEntry->getTimestamp();
|
||||
$element = $this->entityManager->find($logEntry->getTargetClass(), $logEntry->getTargetID());
|
||||
//If the element is not available in DB try to undelete it
|
||||
if ($element === null) {
|
||||
$element = $this->timeTravel->undeleteEntity($logEntry->getTargetClass(), $logEntry->getTargetID());
|
||||
$this->entityManager->persist($element);
|
||||
$this->entityManager->flush();
|
||||
$this->dbRepository->changeID($element, $logEntry->getTargetID());
|
||||
}
|
||||
|
||||
if (!$element instanceof AbstractDBElement) {
|
||||
$this->addFlash('error', 'log.undo.target_not_found');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->timeTravel->revertEntityToTimestamp($element, $timestamp);
|
||||
$this->entityManager->flush();
|
||||
$this->addFlash('success', 'log.undo.revert_success');
|
||||
}
|
||||
|
||||
protected function undoLog(AbstractLogEntry $log_element): void
|
||||
{
|
||||
if ($log_element instanceof ElementDeletedLogEntry || $log_element instanceof CollectionElementDeleted) {
|
||||
if ($log_element instanceof ElementDeletedLogEntry) {
|
||||
$element_class = $log_element->getTargetClass();
|
||||
$element_id = $log_element->getTargetID();
|
||||
} else {
|
||||
$element_class = $log_element->getDeletedElementClass();
|
||||
$element_id = $log_element->getDeletedElementID();
|
||||
}
|
||||
|
||||
//Check if the element we want to undelete already exits
|
||||
if ($this->entityManager->find($element_class, $element_id) == null) {
|
||||
$undeleted_element = $this->timeTravel->undeleteEntity($element_class, $element_id);
|
||||
$this->entityManager->persist($undeleted_element);
|
||||
$this->entityManager->flush();
|
||||
$this->dbRepository->changeID($undeleted_element, $element_id);
|
||||
$this->addFlash('success', 'log.undo.element_undelete_success');
|
||||
} else {
|
||||
$this->addFlash('warning', 'log.undo.element_element_already_undeleted');
|
||||
}
|
||||
} elseif ($log_element instanceof ElementCreatedLogEntry) {
|
||||
$element = $this->entityManager->find($log_element->getTargetClass(), $log_element->getTargetID());
|
||||
if ($element !== null) {
|
||||
$this->entityManager->remove($element);
|
||||
$this->entityManager->flush();
|
||||
$this->addFlash('success', 'log.undo.element_delete_success');
|
||||
} else {
|
||||
$this->addFlash('warning', 'log.undo.element.element_already_delted');
|
||||
}
|
||||
} elseif ($log_element instanceof ElementEditedLogEntry) {
|
||||
$element = $this->entityManager->find($log_element->getTargetClass(), $log_element->getTargetID());
|
||||
if ($element instanceof AbstractDBElement) {
|
||||
$this->timeTravel->applyEntry($element, $log_element);
|
||||
$this->entityManager->flush();
|
||||
$this->addFlash('success', 'log.undo.element_change_undone');
|
||||
} else {
|
||||
$this->addFlash('error', 'log.undo.do_undelete_before');
|
||||
}
|
||||
} else {
|
||||
$this->addFlash('error', 'log.undo.log_type_invalid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\DataTables\LogDataTable;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Exceptions\AttachmentDownloadException;
|
||||
|
@ -49,8 +50,12 @@ use App\Form\Part\PartBaseType;
|
|||
use App\Services\Attachments\AttachmentManager;
|
||||
use App\Services\Attachments\AttachmentSubmitHandler;
|
||||
use App\Services\Attachments\PartPreviewGenerator;
|
||||
use App\Services\LogSystem\EventCommentHelper;
|
||||
use App\Services\LogSystem\HistoryHelper;
|
||||
use App\Services\LogSystem\TimeTravel;
|
||||
use App\Services\PricedetailHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Omines\DataTablesBundle\DataTableFactory;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
@ -64,27 +69,70 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
*/
|
||||
class PartController extends AbstractController
|
||||
{
|
||||
protected $attachmentManager;
|
||||
protected $pricedetailHelper;
|
||||
protected $partPreviewGenerator;
|
||||
protected $commentHelper;
|
||||
|
||||
public function __construct(AttachmentManager $attachmentManager, PricedetailHelper $pricedetailHelper,
|
||||
PartPreviewGenerator $partPreviewGenerator, EventCommentHelper $commentHelper)
|
||||
{
|
||||
$this->attachmentManager = $attachmentManager;
|
||||
$this->pricedetailHelper = $pricedetailHelper;
|
||||
$this->partPreviewGenerator = $partPreviewGenerator;
|
||||
$this->commentHelper = $commentHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/info", name="part_info")
|
||||
* @Route("/{id}/info/{timestamp}", name="part_info")
|
||||
* @Route("/{id}", requirements={"id"="\d+"})
|
||||
*
|
||||
* @param Part $part
|
||||
* @param AttachmentManager $attachmentHelper
|
||||
* @param PricedetailHelper $pricedetailHelper
|
||||
* @param PartPreviewGenerator $previewGenerator
|
||||
* @return Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function show(Part $part, AttachmentManager $attachmentHelper, PricedetailHelper $pricedetailHelper, PartPreviewGenerator $previewGenerator): Response
|
||||
public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper,
|
||||
DataTableFactory $dataTable, ?string $timestamp = null): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('read', $part);
|
||||
|
||||
$timeTravel_timestamp = null;
|
||||
if ($timestamp !== null) {
|
||||
$this->denyAccessUnlessGranted('@tools.timeTravel');
|
||||
$this->denyAccessUnlessGranted('show_history', $part);
|
||||
//If the timestamp only contains numbers interpret it as unix timestamp
|
||||
if (ctype_digit($timestamp)) {
|
||||
$timeTravel_timestamp = new \DateTime();
|
||||
$timeTravel_timestamp->setTimestamp((int) $timestamp);
|
||||
} else { //Try to parse it via DateTime
|
||||
$timeTravel_timestamp = new \DateTime($timestamp);
|
||||
}
|
||||
$timeTravel->revertEntityToTimestamp($part, $timeTravel_timestamp);
|
||||
}
|
||||
|
||||
if ($this->isGranted('show_history', $part) ) {
|
||||
$table = $dataTable->createFromType(LogDataTable::class, [
|
||||
'filter_elements' => $historyHelper->getAssociatedElements($part),
|
||||
'mode' => 'element_history'
|
||||
], ['pageLength' => 10])
|
||||
->handleRequest($request);
|
||||
|
||||
if ($table->isCallback()) {
|
||||
return $table->getResponse();
|
||||
}
|
||||
} else {
|
||||
$table = null;
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'Parts/info/show_part_info.html.twig',
|
||||
[
|
||||
'part' => $part,
|
||||
'attachment_helper' => $attachmentHelper,
|
||||
'pricedetail_helper' => $pricedetailHelper,
|
||||
'pictures' => $previewGenerator->getPreviewAttachments($part),
|
||||
'datatable' => $table,
|
||||
'attachment_helper' => $this->attachmentManager,
|
||||
'pricedetail_helper' => $this->pricedetailHelper,
|
||||
'pictures' => $this->partPreviewGenerator->getPreviewAttachments($part),
|
||||
'timeTravel' => $timeTravel_timestamp
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -96,12 +144,11 @@ class PartController extends AbstractController
|
|||
* @param Request $request
|
||||
* @param EntityManagerInterface $em
|
||||
* @param TranslatorInterface $translator
|
||||
* @param AttachmentManager $attachmentHelper
|
||||
* @param AttachmentSubmitHandler $attachmentSubmitHandler
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
|
||||
AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler): Response
|
||||
AttachmentSubmitHandler $attachmentSubmitHandler): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('edit', $part);
|
||||
|
||||
|
@ -128,6 +175,8 @@ class PartController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
$this->commentHelper->setMessage($form['log_comment']->getData());
|
||||
|
||||
$em->persist($part);
|
||||
$em->flush();
|
||||
$this->addFlash('info', 'part.edited_flash');
|
||||
|
@ -138,11 +187,11 @@ class PartController extends AbstractController
|
|||
}
|
||||
|
||||
return $this->render('Parts/edit/edit_part_info.html.twig',
|
||||
[
|
||||
'part' => $part,
|
||||
'form' => $form->createView(),
|
||||
'attachment_helper' => $attachmentHelper,
|
||||
]);
|
||||
[
|
||||
'part' => $part,
|
||||
'form' => $form->createView(),
|
||||
'attachment_helper' => $this->attachmentManager,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,6 +208,8 @@ class PartController extends AbstractController
|
|||
if ($this->isCsrfTokenValid('delete'.$part->getId(), $request->request->get('_token'))) {
|
||||
$entityManager = $this->getDoctrine()->getManager();
|
||||
|
||||
$this->commentHelper->setMessage($request->request->get('log_comment', null));
|
||||
|
||||
//Remove part
|
||||
$entityManager->remove($part);
|
||||
|
||||
|
@ -182,7 +233,7 @@ class PartController extends AbstractController
|
|||
* @return Response
|
||||
*/
|
||||
public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
|
||||
AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler): Response
|
||||
AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler): Response
|
||||
{
|
||||
$new_part = new Part();
|
||||
|
||||
|
@ -219,6 +270,8 @@ class PartController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
$this->commentHelper->setMessage($form['log_comment']->getData());
|
||||
|
||||
$em->persist($new_part);
|
||||
$em->flush();
|
||||
$this->addFlash('success', 'part.created_flash');
|
||||
|
@ -231,11 +284,11 @@ class PartController extends AbstractController
|
|||
}
|
||||
|
||||
return $this->render('Parts/edit/new_part.html.twig',
|
||||
[
|
||||
'part' => $new_part,
|
||||
'form' => $form->createView(),
|
||||
'attachment_helper' => $attachmentHelper,
|
||||
]);
|
||||
[
|
||||
'part' => $new_part,
|
||||
'form' => $form->createView(),
|
||||
'attachment_helper' => $attachmentHelper,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,9 +320,9 @@ class PartController extends AbstractController
|
|||
}
|
||||
|
||||
return $this->render('Parts/edit/new_part.html.twig',
|
||||
[
|
||||
'part' => $new_part,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
[
|
||||
'part' => $new_part,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class UserController extends AdminPages\BaseAdminController
|
|||
protected $attachment_class = UserAttachment::class;
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", requirements={"id"="\d+"}, name="user_edit")
|
||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="user_edit")
|
||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||
* @param User $entity
|
||||
* @param Request $request
|
||||
|
@ -77,7 +77,7 @@ class UserController extends AdminPages\BaseAdminController
|
|||
* @return Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(User $entity, Request $request, EntityManagerInterface $em)
|
||||
public function edit(User $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null)
|
||||
{
|
||||
//Handle 2FA disabling
|
||||
|
||||
|
@ -102,7 +102,7 @@ class UserController extends AdminPages\BaseAdminController
|
|||
}
|
||||
}
|
||||
|
||||
return $this->_edit($entity, $request, $em);
|
||||
return $this->_edit($entity, $request, $em, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
126
src/DataTables/Column/IconLinkColumn.php
Normal file
126
src/DataTables/Column/IconLinkColumn.php
Normal file
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\DataTables\Column;
|
||||
|
||||
|
||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class IconLinkColumn extends AbstractColumn
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function normalize($value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
$resolver->setDefaults([
|
||||
'icon' => 'fas fa-fw fa-edit',
|
||||
'title' => null,
|
||||
'href' => null,
|
||||
'disabled' => false,
|
||||
]);
|
||||
|
||||
$resolver->setAllowedTypes('title', ['null', 'string', 'callable']);
|
||||
$resolver->setAllowedTypes('icon', ['null', 'string', 'callable']);
|
||||
$resolver->setAllowedTypes('href', ['null', 'string', 'callable']);
|
||||
$resolver->setAllowedTypes('disabled', ['bool', 'callable']);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render($value, $context)
|
||||
{
|
||||
$href = $this->getHref($value, $context);
|
||||
$icon = $this->getIcon($value, $context);
|
||||
$title = $this->getTitle($value, $context);
|
||||
$disabled = $this->getDisabled($value, $context);
|
||||
|
||||
if ($href !== null) {
|
||||
return sprintf(
|
||||
'<a class="btn btn-primary btn-sm %s" href="%s" title="%s"><i class="%s"></i></a>',
|
||||
$disabled ? 'disabled' : '',
|
||||
$href,
|
||||
$title,
|
||||
$icon
|
||||
);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
protected function getDisabled($value, $context): bool
|
||||
{
|
||||
$provider = $this->options['disabled'];
|
||||
if (is_bool($provider)) {
|
||||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getHref($value, $context): ?string
|
||||
{
|
||||
$provider = $this->options['href'];
|
||||
if (is_string($provider)) {
|
||||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function getIcon($value, $context): ?string
|
||||
{
|
||||
$provider = $this->options['icon'];
|
||||
if (is_string($provider)) {
|
||||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function getTitle($value, $context): ?string
|
||||
{
|
||||
$provider = $this->options['title'];
|
||||
if (is_string($provider)) {
|
||||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
93
src/DataTables/Column/RevertLogColumn.php
Normal file
93
src/DataTables/Column/RevertLogColumn.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\DataTables\Column;
|
||||
|
||||
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
use App\Entity\LogSystem\ElementCreatedLogEntry;
|
||||
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class RevertLogColumn extends AbstractColumn
|
||||
{
|
||||
protected $translator;
|
||||
protected $security;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, Security $security)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function normalize($value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function render($value, $context)
|
||||
{
|
||||
$revertable = true;
|
||||
if (
|
||||
$context instanceof CollectionElementDeleted
|
||||
|| ($context instanceof ElementDeletedLogEntry && $context->hasOldDataInformations())
|
||||
) {
|
||||
$icon = 'fa-trash-restore';
|
||||
$title = $this->translator->trans('log.undo.undelete');
|
||||
} elseif (
|
||||
$context instanceof ElementCreatedLogEntry
|
||||
|| ($context instanceof ElementEditedLogEntry && $context->hasOldDataInformations())
|
||||
) {
|
||||
$icon = 'fa-undo';
|
||||
$title = $this->translator->trans('log.undo.undo');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
$disabled = !$this->security->isGranted('revert_element', $context->getTargetClass());
|
||||
|
||||
$tmp = '<div class="btn-group btn-group-sm">';
|
||||
$tmp .= sprintf(
|
||||
'<button type="submit" class="btn btn-outline-secondary" name="undo" value="%d" %s><i class="fas fa-fw %s" title="%s"></i></button>',
|
||||
$context->getID(),
|
||||
$disabled ? 'disabled' : '',
|
||||
$icon,
|
||||
$title
|
||||
);
|
||||
|
||||
$tmp .= sprintf(
|
||||
'<button type="submit" class="btn btn-outline-secondary" name="revert" value="%d" %s><i class="fas fa-fw fa-backward" title="%s"></i></button>',
|
||||
$context->getID(),
|
||||
$disabled ? 'disabled' : '',
|
||||
$this->translator->trans('log.undo.revert')
|
||||
);
|
||||
|
||||
$tmp .= '</div>';
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
}
|
|
@ -42,36 +42,73 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\DataTables;
|
||||
|
||||
use App\DataTables\Column\IconLinkColumn;
|
||||
use App\DataTables\Column\LocaleDateTimeColumn;
|
||||
use App\DataTables\Column\LogEntryExtraColumn;
|
||||
use App\DataTables\Column\LogEntryTargetColumn;
|
||||
use App\DataTables\Column\RevertLogColumn;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Contracts\TimeTravelInterface;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
use App\Entity\LogSystem\ElementCreatedLogEntry;
|
||||
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Exceptions\EntityNotSupportedException;
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter;
|
||||
use Omines\DataTablesBundle\Column\TextColumn;
|
||||
use Omines\DataTablesBundle\DataTable;
|
||||
use Omines\DataTablesBundle\DataTableTypeInterface;
|
||||
use Psr\Log\LogLevel;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Symfony\Flex\Options;
|
||||
|
||||
class LogDataTable implements DataTableTypeInterface
|
||||
{
|
||||
protected $elementTypeNameGenerator;
|
||||
protected $translator;
|
||||
protected $urlGenerator;
|
||||
protected $entityURLGenerator;
|
||||
protected $logRepo;
|
||||
protected $security;
|
||||
|
||||
public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator,
|
||||
UrlGeneratorInterface $urlGenerator)
|
||||
UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, Security $security)
|
||||
{
|
||||
$this->elementTypeNameGenerator = $elementTypeNameGenerator;
|
||||
$this->translator = $translator;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->entityURLGenerator = $entityURLGenerator;
|
||||
$this->logRepo = $entityManager->getRepository(AbstractLogEntry::class);
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $optionsResolver)
|
||||
{
|
||||
$optionsResolver->setDefaults([
|
||||
'mode' => 'system_log',
|
||||
'filter_elements' => [],
|
||||
]);
|
||||
|
||||
$optionsResolver->setAllowedValues('mode', ['system_log', 'element_history', 'last_activity']);
|
||||
}
|
||||
|
||||
public function configure(DataTable $dataTable, array $options): void
|
||||
{
|
||||
$resolver = new OptionsResolver();
|
||||
$this->configureOptions($resolver);
|
||||
$options = $resolver->resolve($options);
|
||||
|
||||
|
||||
$dataTable->add('symbol', TextColumn::class, [
|
||||
'label' => '',
|
||||
'render' => function ($value, AbstractLogEntry $context) {
|
||||
|
@ -114,7 +151,11 @@ class LogDataTable implements DataTableTypeInterface
|
|||
break;
|
||||
}
|
||||
|
||||
return sprintf('<i class="fas fa-fw %s"></i>', $symbol);
|
||||
return sprintf(
|
||||
'<i class="fas fa-fw %s" title="%s"></i>',
|
||||
$symbol,
|
||||
$context->getLevelString()
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -138,6 +179,7 @@ class LogDataTable implements DataTableTypeInterface
|
|||
|
||||
$dataTable->add('level', TextColumn::class, [
|
||||
'label' => $this->translator->trans('log.level'),
|
||||
'visible' => $options['mode'] === 'system_log',
|
||||
'propertyPath' => 'levelString',
|
||||
'render' => function (string $value, AbstractLogEntry $context) {
|
||||
return $value;
|
||||
|
@ -178,21 +220,77 @@ class LogDataTable implements DataTableTypeInterface
|
|||
'label' => $this->translator->trans('log.extra'),
|
||||
]);
|
||||
|
||||
$dataTable->add('timeTravel', IconLinkColumn::class,[
|
||||
'label' => '',
|
||||
'icon' => 'fas fa-fw fa-eye',
|
||||
'href' => function ($value, AbstractLogEntry $context) {
|
||||
if (
|
||||
($context instanceof TimeTravelInterface
|
||||
&& $context->hasOldDataInformations())
|
||||
|| $context instanceof CollectionElementDeleted
|
||||
) {
|
||||
try {
|
||||
$target = $this->logRepo->getTargetElement($context);
|
||||
if($target !== null) {
|
||||
$str = $this->entityURLGenerator->timeTravelURL($target, $context->getTimestamp());
|
||||
return $str;
|
||||
}
|
||||
} catch (EntityNotSupportedException $exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
'disabled' => function ($value, AbstractLogEntry $context) {
|
||||
return
|
||||
!$this->security->isGranted('@tools.timetravel')
|
||||
|| !$this->security->isGranted('show_history', $context->getTargetClass());
|
||||
}
|
||||
|
||||
]);
|
||||
|
||||
$dataTable->add('actionRevert', RevertLogColumn::class, [
|
||||
'label' => ''
|
||||
]);
|
||||
|
||||
$dataTable->addOrderBy('timestamp', DataTable::SORT_DESCENDING);
|
||||
|
||||
$dataTable->createAdapter(ORMAdapter::class, [
|
||||
'entity' => AbstractLogEntry::class,
|
||||
'query' => function (QueryBuilder $builder): void {
|
||||
$this->getQuery($builder);
|
||||
'query' => function (QueryBuilder $builder) use ($options): void {
|
||||
$this->getQuery($builder, $options);
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getQuery(QueryBuilder $builder): void
|
||||
protected function getQuery(QueryBuilder $builder, array $options): void
|
||||
{
|
||||
$builder->distinct()->select('log')
|
||||
->addSelect('user')
|
||||
->from(AbstractLogEntry::class, 'log')
|
||||
->leftJoin('log.user', 'user');
|
||||
|
||||
if ($options['mode'] === 'last_activity') {
|
||||
$builder->where('log INSTANCE OF ' . ElementCreatedLogEntry::class)
|
||||
->orWhere('log INSTANCE OF ' . ElementDeletedLogEntry::class)
|
||||
->orWhere('log INSTANCE OF ' . ElementEditedLogEntry::class)
|
||||
->orWhere('log INSTANCE OF ' . CollectionElementDeleted::class)
|
||||
->andWhere('log.target_type NOT IN (:disallowed)');;
|
||||
|
||||
$builder->setParameter('disallowed', [
|
||||
AbstractLogEntry::targetTypeClassToID(User::class),
|
||||
AbstractLogEntry::targetTypeClassToID(Group::class),
|
||||
]);
|
||||
}
|
||||
|
||||
if (!empty($options['filter_elements'])) {
|
||||
foreach ($options['filter_elements'] as $element) {
|
||||
/** @var AbstractDBElement $element */
|
||||
|
||||
$target_type = AbstractLogEntry::targetTypeClassToID(get_class($element));
|
||||
$target_id = $element->getID();
|
||||
$builder->orWhere("log.target_type = $target_type AND log.target_id = $target_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* Every database table which are managed with this class (or a subclass of it)
|
||||
* must have the table row "id"!! The ID is the unique key to identify the elements.
|
||||
*
|
||||
* @ORM\MappedSuperclass()
|
||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\DBElementRepository")
|
||||
*
|
||||
* @ORM\EntityListeners({"App\Security\EntityListeners\ElementPermissionListener"})
|
||||
*
|
||||
|
@ -55,7 +55,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* "user" = "App\Entity\User"
|
||||
* })
|
||||
*/
|
||||
abstract class AbstractDBElement
|
||||
abstract class AbstractDBElement implements \JsonSerializable
|
||||
{
|
||||
/** @var int|null The Identification number for this part. This value is unique for the element in this table.
|
||||
* Null if the element is not saved to DB yet.
|
||||
|
@ -92,4 +92,9 @@ abstract class AbstractDBElement
|
|||
* @return string The ID as a string;
|
||||
*/
|
||||
abstract public function getIDString(): string;
|
||||
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ['@id' => $this->getID()];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Base;
|
||||
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use App\Entity\Contracts\TimeStampableInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
@ -30,10 +31,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* All subclasses of this class have an attribute "name".
|
||||
*
|
||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\UserRepository")
|
||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\NamedDBElement")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
abstract class AbstractNamedDBElement extends AbstractDBElement implements NamedElementInterface
|
||||
abstract class AbstractNamedDBElement extends AbstractDBElement implements NamedElementInterface, TimeStampableInterface
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
|
45
src/Entity/Contracts/LogWithCommentInterface.php
Normal file
45
src/Entity/Contracts/LogWithCommentInterface.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Entity\Contracts;
|
||||
|
||||
|
||||
interface LogWithCommentInterface
|
||||
{
|
||||
/**
|
||||
* Checks if this log entry has a user provided comment.
|
||||
* @return bool
|
||||
*/
|
||||
public function hasComment(): bool;
|
||||
|
||||
/**
|
||||
* Gets the user provided comment associated with this log entry.
|
||||
* Returns null if not comment was set.
|
||||
* @return string|null
|
||||
*/
|
||||
public function getComment(): ?string;
|
||||
|
||||
/**
|
||||
* Sets the user provided comment associated with this log entry.
|
||||
* @param string|null $new_comment
|
||||
* @return $this
|
||||
*/
|
||||
public function setComment(?string $new_comment): self;
|
||||
}
|
55
src/Entity/Contracts/LogWithEventUndoInterface.php
Normal file
55
src/Entity/Contracts/LogWithEventUndoInterface.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Entity\Contracts;
|
||||
|
||||
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
|
||||
interface LogWithEventUndoInterface
|
||||
{
|
||||
/**
|
||||
* Checks if this element undoes another event.
|
||||
* @return bool
|
||||
*/
|
||||
public function isUndoEvent(): bool;
|
||||
|
||||
/**
|
||||
* Returns the ID of the undone event or null if no event is undone.
|
||||
* @return int|null
|
||||
*/
|
||||
public function getUndoEventID(): ?int;
|
||||
|
||||
/**
|
||||
* Sets the event that is undone, and the undo mode.
|
||||
* @param AbstractLogEntry $event
|
||||
* @param string $mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setUndoneEvent(AbstractLogEntry $event, string $mode = 'undo'): self;
|
||||
|
||||
/**
|
||||
* Returns the mode how the event was undone:
|
||||
* "undo" = Only a single event was applied to element
|
||||
* "revert" = Element was reverted to the state it was to the timestamp of the log.
|
||||
* @return string
|
||||
*/
|
||||
public function getUndoMode(): string;
|
||||
}
|
44
src/Entity/Contracts/TimeStampableInterface.php
Normal file
44
src/Entity/Contracts/TimeStampableInterface.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Contracts;
|
||||
|
||||
|
||||
use DateTime;
|
||||
|
||||
interface TimeStampableInterface
|
||||
{
|
||||
/**
|
||||
* Returns the last time when the element was modified.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return DateTime|null the time of the last edit
|
||||
*/
|
||||
public function getLastModified(): ?DateTime;
|
||||
|
||||
/**
|
||||
* Returns the date/time when the element was created.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return DateTime|null the creation time of the part
|
||||
*/
|
||||
public function getAddedDate(): ?DateTime;
|
||||
}
|
41
src/Entity/Contracts/TimeTravelInterface.php
Normal file
41
src/Entity/Contracts/TimeTravelInterface.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Contracts;
|
||||
|
||||
|
||||
interface TimeTravelInterface
|
||||
{
|
||||
/**
|
||||
* Checks if this entry has informations which data has changed.
|
||||
* @return bool True if this entry has informations about the changed data.
|
||||
*/
|
||||
public function hasOldDataInformations(): bool;
|
||||
|
||||
/** Returns the data the entity had before this log entry. */
|
||||
public function getOldData(): array;
|
||||
|
||||
/**
|
||||
* Returns the the timestamp associated with this change.
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getTimestamp(): \DateTime;
|
||||
}
|
|
@ -81,7 +81,8 @@ use Psr\Log\LogLevel;
|
|||
* 7 = "ElementEditedLogEntry",
|
||||
* 8 = "ConfigChangedLogEntry",
|
||||
* 9 = "InstockChangedLogEntry",
|
||||
* 10 = "DatabaseUpdatedLogEntry"
|
||||
* 10 = "DatabaseUpdatedLogEntry",
|
||||
* 11 = "CollectionElementDeleted"
|
||||
* })
|
||||
*/
|
||||
abstract class AbstractLogEntry extends AbstractDBElement
|
||||
|
@ -367,6 +368,17 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target ID of the element associated with this element.
|
||||
* @param int $target_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setTargetElementID(int $target_id): self
|
||||
{
|
||||
$this->target_id = $target_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getExtraData(): array
|
||||
{
|
||||
return $this->extra;
|
||||
|
|
136
src/Entity/LogSystem/CollectionElementDeleted.php
Normal file
136
src/Entity/LogSystem/CollectionElementDeleted.php
Normal file
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Entity\LogSystem;
|
||||
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Contracts\LogWithEventUndoInterface;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
* This log entry is created when an element is deleted, that is used in a collection of an other entity.
|
||||
* This is needed to signal time travel, that it has to undelete the deleted entity.
|
||||
*/
|
||||
class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventUndoInterface
|
||||
{
|
||||
protected $typeString = 'collection_element_deleted';
|
||||
protected $level = self::LEVEL_INFO;
|
||||
|
||||
public function __construct(AbstractDBElement $changed_element, string $collection_name, AbstractDBElement $deletedElement)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->level = self::LEVEL_INFO;
|
||||
$this->setTargetElement($changed_element);
|
||||
$this->extra['n'] = $collection_name;
|
||||
$this->extra['c'] = self::targetTypeClassToID(get_class($deletedElement));
|
||||
$this->extra['i'] = $deletedElement->getID();
|
||||
if ($deletedElement instanceof NamedElementInterface) {
|
||||
$this->extra['o'] = $deletedElement->getName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the collection (on target element) that was changed.
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionName(): string
|
||||
{
|
||||
return $this->extra['n'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the element that was deleted.
|
||||
* Return null, if the element did not have a name.
|
||||
* @return string|null
|
||||
*/
|
||||
public function getOldName(): ?string
|
||||
{
|
||||
return $this->extra['o'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class of the deleted element.
|
||||
* @return string
|
||||
*/
|
||||
public function getDeletedElementClass(): string
|
||||
{
|
||||
return self::targetTypeIdToClass($this->extra['c']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the deleted element.
|
||||
* @return int
|
||||
*/
|
||||
public function getDeletedElementID(): int
|
||||
{
|
||||
return $this->extra['i'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isUndoEvent(): bool
|
||||
{
|
||||
return isset($this->extra['u']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoEventID(): ?int
|
||||
{
|
||||
return $this->extra['u'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setUndoneEvent(AbstractLogEntry $event, string $mode = 'undo'): LogWithEventUndoInterface
|
||||
{
|
||||
$this->extra['u'] = $event->getID();
|
||||
|
||||
if ($mode === 'undo') {
|
||||
$this->extra['um'] = 1;
|
||||
} elseif ($mode === 'revert') {
|
||||
$this->extra['um'] = 2;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Passed invalid $mode!');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoMode(): string
|
||||
{
|
||||
$mode_int = $this->extra['um'] ?? 1;
|
||||
if ($mode_int === 1) {
|
||||
return 'undo';
|
||||
} else {
|
||||
return 'revert';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,12 +43,16 @@ declare(strict_types=1);
|
|||
namespace App\Entity\LogSystem;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Contracts\LogWithCommentInterface;
|
||||
use App\Entity\Contracts\LogWithEventUndoInterface;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class ElementCreatedLogEntry extends AbstractLogEntry
|
||||
class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentInterface, LogWithEventUndoInterface
|
||||
{
|
||||
protected $typeString = 'element_created';
|
||||
|
||||
|
@ -57,6 +61,11 @@ class ElementCreatedLogEntry extends AbstractLogEntry
|
|||
parent::__construct();
|
||||
$this->level = self::LEVEL_INFO;
|
||||
$this->setTargetElement($new_element);
|
||||
|
||||
//Creation of new users is maybe more interesting...
|
||||
if ($new_element instanceof User || $new_element instanceof Group) {
|
||||
$this->level = self::LEVEL_NOTICE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,4 +87,76 @@ class ElementCreatedLogEntry extends AbstractLogEntry
|
|||
{
|
||||
return null !== $this->getCreationInstockValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function hasComment(): bool
|
||||
{
|
||||
return isset($this->extra['m']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->extra['m'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setComment(?string $new_comment): LogWithCommentInterface
|
||||
{
|
||||
$this->extra['m'] = $new_comment;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isUndoEvent(): bool
|
||||
{
|
||||
return isset($this->extra['u']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoEventID(): ?int
|
||||
{
|
||||
return $this->extra['u'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setUndoneEvent(AbstractLogEntry $event, string $mode = 'undo'): LogWithEventUndoInterface
|
||||
{
|
||||
$this->extra['u'] = $event->getID();
|
||||
|
||||
if ($mode === 'undo') {
|
||||
$this->extra['um'] = 1;
|
||||
} elseif ($mode === 'revert') {
|
||||
$this->extra['um'] = 2;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Passed invalid $mode!');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoMode(): string
|
||||
{
|
||||
$mode_int = $this->extra['um'] ?? 1;
|
||||
if ($mode_int === 1) {
|
||||
return 'undo';
|
||||
} else {
|
||||
return 'revert';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,18 @@ declare(strict_types=1);
|
|||
namespace App\Entity\LogSystem;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Contracts\LogWithCommentInterface;
|
||||
use App\Entity\Contracts\LogWithEventUndoInterface;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use App\Entity\Contracts\TimeTravelInterface;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class ElementDeletedLogEntry extends AbstractLogEntry
|
||||
class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInterface, LogWithCommentInterface, LogWithEventUndoInterface
|
||||
{
|
||||
protected $typeString = 'element_deleted';
|
||||
|
||||
|
@ -58,6 +63,11 @@ class ElementDeletedLogEntry extends AbstractLogEntry
|
|||
parent::__construct();
|
||||
$this->level = self::LEVEL_INFO;
|
||||
$this->setTargetElement($deleted_element);
|
||||
|
||||
//Deletion of a user is maybe more interesting...
|
||||
if ($deleted_element instanceof User || $deleted_element instanceof Group) {
|
||||
$this->level = self::LEVEL_NOTICE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,4 +93,102 @@ class ElementDeletedLogEntry extends AbstractLogEntry
|
|||
{
|
||||
return $this->extra['n'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the old data for this entry.
|
||||
* @param array $old_data
|
||||
* @return $this
|
||||
*/
|
||||
public function setOldData(array $old_data): self
|
||||
{
|
||||
$this->extra['o'] = $old_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function hasOldDataInformations(): bool
|
||||
{
|
||||
return !empty($this->extra['o']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getOldData(): array
|
||||
{
|
||||
return $this->extra['o'] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function hasComment(): bool
|
||||
{
|
||||
return isset($this->extra['m']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->extra['m'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setComment(?string $new_comment): LogWithCommentInterface
|
||||
{
|
||||
$this->extra['m'] = $new_comment;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isUndoEvent(): bool
|
||||
{
|
||||
return isset($this->extra['u']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoEventID(): ?int
|
||||
{
|
||||
return $this->extra['u'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setUndoneEvent(AbstractLogEntry $event, string $mode = 'undo'): LogWithEventUndoInterface
|
||||
{
|
||||
$this->extra['u'] = $event->getID();
|
||||
|
||||
if ($mode === 'undo') {
|
||||
$this->extra['um'] = 1;
|
||||
} elseif ($mode === 'revert') {
|
||||
$this->extra['um'] = 2;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Passed invalid $mode!');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoMode(): string
|
||||
{
|
||||
$mode_int = $this->extra['um'] ?? 1;
|
||||
if ($mode_int === 1) {
|
||||
return 'undo';
|
||||
}
|
||||
return 'revert';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,12 +43,15 @@ declare(strict_types=1);
|
|||
namespace App\Entity\LogSystem;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Contracts\LogWithCommentInterface;
|
||||
use App\Entity\Contracts\LogWithEventUndoInterface;
|
||||
use App\Entity\Contracts\TimeTravelInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class ElementEditedLogEntry extends AbstractLogEntry
|
||||
class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterface, LogWithCommentInterface, LogWithEventUndoInterface
|
||||
{
|
||||
protected $typeString = 'element_edited';
|
||||
|
||||
|
@ -61,12 +64,138 @@ class ElementEditedLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the message associated with this edit change.
|
||||
*
|
||||
* @return string
|
||||
* Checks if this log contains infos about which fields has changed.
|
||||
* @return bool
|
||||
*/
|
||||
public function getMessage(): string
|
||||
public function hasChangedFieldsInfo(): bool
|
||||
{
|
||||
return $this->extra['m'] ?? '';
|
||||
return isset($this->extra['f']) || $this->hasOldDataInformations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the names of all fields that were changed during the change.
|
||||
* @return string[]
|
||||
*/
|
||||
public function getChangedFields(): array
|
||||
{
|
||||
if ($this->hasOldDataInformations()) {
|
||||
return array_keys($this->getOldData());
|
||||
}
|
||||
|
||||
if (isset($this->extra['f'])) {
|
||||
return $this->extra['f'];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fields that were changed during this element change.
|
||||
* @param string[] $changed_fields The names of the fields that were changed during the elements
|
||||
* @return $this
|
||||
*/
|
||||
public function setChangedFields(array $changed_fields): self
|
||||
{
|
||||
$this->extra['f'] = $changed_fields;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the old data for this entry.
|
||||
* @param array $old_data
|
||||
* @return $this
|
||||
*/
|
||||
public function setOldData(array $old_data): self
|
||||
{
|
||||
$this->extra['d'] = $old_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function hasOldDataInformations(): bool
|
||||
{
|
||||
return !empty($this->extra['d']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getOldData(): array
|
||||
{
|
||||
return $this->extra['d'] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function hasComment(): bool
|
||||
{
|
||||
return isset($this->extra['m']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->extra['m'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setComment(?string $new_comment): LogWithCommentInterface
|
||||
{
|
||||
$this->extra['m'] = $new_comment;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isUndoEvent(): bool
|
||||
{
|
||||
return isset($this->extra['u']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoEventID(): ?int
|
||||
{
|
||||
return $this->extra['u'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setUndoneEvent(AbstractLogEntry $event, string $mode = 'undo'): LogWithEventUndoInterface
|
||||
{
|
||||
$this->extra['u'] = $event->getID();
|
||||
|
||||
if ($mode === 'undo') {
|
||||
$this->extra['um'] = 1;
|
||||
} elseif ($mode === 'revert') {
|
||||
$this->extra['um'] = 2;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Passed invalid $mode!');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUndoMode(): string
|
||||
{
|
||||
$mode_int = $this->extra['um'] ?? 1;
|
||||
if ($mode_int === 1) {
|
||||
return 'undo';
|
||||
} else {
|
||||
return 'revert';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class Part extends AttachmentContainingDBElement
|
|||
/**
|
||||
* TODO.
|
||||
*/
|
||||
protected $devices;
|
||||
protected $devices = [];
|
||||
|
||||
/**
|
||||
* @ColumnSecurity(type="datetime")
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Contracts\TimeStampableInterface;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use App\Validator\Constraints\ValidPartLot;
|
||||
use DateTime;
|
||||
|
@ -60,7 +61,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\HasLifecycleCallbacks()
|
||||
* @ValidPartLot()
|
||||
*/
|
||||
class PartLot extends AbstractDBElement
|
||||
class PartLot extends AbstractDBElement implements TimeStampableInterface
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace App\Entity\PriceInformations;
|
|||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Contracts\TimeStampableInterface;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
@ -66,7 +67,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Entity()
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class Orderdetail extends AbstractDBElement
|
||||
class Orderdetail extends AbstractDBElement implements TimeStampableInterface
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace App\Entity\PriceInformations;
|
|||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Contracts\TimeStampableInterface;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -65,7 +66,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\HasLifecycleCallbacks()
|
||||
* @UniqueEntity(fields={"orderdetail", "min_discount_quantity"})
|
||||
*/
|
||||
class Pricedetail extends AbstractDBElement
|
||||
class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ class PermissionsEmbed
|
|||
*/
|
||||
final protected static function readBitPair($data, int $n): int
|
||||
{
|
||||
Assert::lessThanEq($n, 31, '$n must be smaller than 32, because only a 32bit int is used! Got %s.');
|
||||
//Assert::lessThanEq($n, 31, '$n must be smaller than 32, because only a 32bit int is used! Got %s.');
|
||||
if (0 !== $n % 2) {
|
||||
throw new InvalidArgumentException('$n must be dividable by 2, because we address bit pairs here!');
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ class PermissionsEmbed
|
|||
*/
|
||||
final protected static function writeBitPair(int $data, int $n, int $new): int
|
||||
{
|
||||
Assert::lessThanEq($n, 31, '$n must be smaller than 32, because only a 32bit int is used! Got %s.');
|
||||
//Assert::lessThanEq($n, 31, '$n must be smaller than 32, because only a 32bit int is used! Got %s.');
|
||||
Assert::lessThanEq($new, 3, '$new must be smaller than 3, because a bit pair is written! Got %s.');
|
||||
Assert::greaterThanEq($new, 0, '$new must not be negative, because a bit pair is written! Got %s.');
|
||||
|
||||
|
|
|
@ -20,25 +20,71 @@
|
|||
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
use App\Entity\LogSystem\ElementCreatedLogEntry;
|
||||
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Entity\PriceInformations\Pricedetail;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Services\LogSystem\EventCommentHelper;
|
||||
use App\Services\LogSystem\EventLogger;
|
||||
use App\Services\LogSystem\EventUndoHelper;
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Event\OnFlushEventArgs;
|
||||
use Doctrine\ORM\Event\PostFlushEventArgs;
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class EventLoggerSubscriber implements EventSubscriber
|
||||
{
|
||||
protected $logger;
|
||||
/** @var array The given fields will not be saved, because they contain sensitive informations */
|
||||
protected const FIELD_BLACKLIST = [
|
||||
User::class => ['password', 'need_pw_change', 'googleAuthenticatorSecret', 'backupCodes', 'trustedDeviceCookieVersion', 'pw_reset_token', 'backupCodesGenerationDate'],
|
||||
];
|
||||
|
||||
public function __construct(EventLogger $logger)
|
||||
/** @var array If elements of the given class are deleted, a log for the given fields will be triggered */
|
||||
protected const TRIGGER_ASSOCIATION_LOG_WHITELIST = [
|
||||
PartLot::class => ['part'],
|
||||
Orderdetail::class => ['part'],
|
||||
Pricedetail::class => ['orderdetail'],
|
||||
Attachment::class => ['element'],
|
||||
];
|
||||
|
||||
protected const MAX_STRING_LENGTH = 2000;
|
||||
|
||||
protected $logger;
|
||||
protected $serializer;
|
||||
protected $eventCommentHelper;
|
||||
protected $eventUndoHelper;
|
||||
protected $save_changed_fields;
|
||||
protected $save_changed_data;
|
||||
protected $save_removed_data;
|
||||
protected $propertyAccessor;
|
||||
|
||||
public function __construct(EventLogger $logger, SerializerInterface $serializer, EventCommentHelper $commentHelper,
|
||||
bool $save_changed_fields, bool $save_changed_data, bool $save_removed_data, PropertyAccessorInterface $propertyAccessor,
|
||||
EventUndoHelper $eventUndoHelper)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->serializer = $serializer;
|
||||
$this->eventCommentHelper = $commentHelper;
|
||||
$this->propertyAccessor = $propertyAccessor;
|
||||
$this->eventUndoHelper = $eventUndoHelper;
|
||||
|
||||
$this->save_changed_fields = $save_changed_fields;
|
||||
$this->save_changed_data = $save_changed_data;
|
||||
$this->save_removed_data = $save_removed_data;
|
||||
}
|
||||
|
||||
public function onFlush(OnFlushEventArgs $eventArgs)
|
||||
|
@ -53,30 +99,43 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
|
||||
foreach ($uow->getScheduledEntityUpdates() as $entity) {
|
||||
if ($this->validEntity($entity)) {
|
||||
$log = new ElementEditedLogEntry($entity);
|
||||
$this->logger->log($log);
|
||||
$this->logElementEdited($entity, $em);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($uow->getScheduledEntityDeletions() as $entity) {
|
||||
if ($this->validEntity($entity)) {
|
||||
$log = new ElementDeletedLogEntry($entity);
|
||||
$this->logger->log($log);
|
||||
$this->logElementDeleted($entity, $em);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$uow->computeChangeSets();
|
||||
}
|
||||
|
||||
public function postPersist(LifecycleEventArgs $args)
|
||||
{
|
||||
//Create an log entry
|
||||
//Create an log entry, we have to do this post persist, cause we have to know the ID
|
||||
|
||||
/** @var AbstractDBElement $entity */
|
||||
$entity = $args->getObject();
|
||||
if ($this->validEntity($entity)) {
|
||||
$log = new ElementCreatedLogEntry($entity);
|
||||
//Add user comment to log entry
|
||||
if ($this->eventCommentHelper->isMessageSet()) {
|
||||
$log->setComment($this->eventCommentHelper->getMessage());
|
||||
}
|
||||
if ($this->eventUndoHelper->isUndo()) {
|
||||
$undoEvent = $this->eventUndoHelper->getUndoneEvent();
|
||||
|
||||
$log->setUndoneEvent($undoEvent, $this->eventUndoHelper->getMode());
|
||||
|
||||
if($undoEvent instanceof ElementDeletedLogEntry && $undoEvent->getTargetClass() === $log->getTargetClass()) {
|
||||
$log->setTargetElementID($undoEvent->getTargetID());
|
||||
}
|
||||
if($undoEvent instanceof CollectionElementDeleted && $undoEvent->getDeletedElementClass() === $log->getTargetClass()) {
|
||||
$log->setTargetElementID($undoEvent->getDeletedElementID());
|
||||
}
|
||||
}
|
||||
$this->logger->log($log);
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +148,158 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
if ($uow->hasPendingInsertions()) {
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
//Clear the message provided by user.
|
||||
$this->eventCommentHelper->clearMessage();
|
||||
$this->eventUndoHelper->clearUndoneEvent();
|
||||
}
|
||||
|
||||
protected function logElementDeleted(AbstractDBElement $entity, EntityManagerInterface $em): void
|
||||
{
|
||||
$log = new ElementDeletedLogEntry($entity);
|
||||
//Add user comment to log entry
|
||||
if ($this->eventCommentHelper->isMessageSet()) {
|
||||
$log->setComment($this->eventCommentHelper->getMessage());
|
||||
}
|
||||
if ($this->eventUndoHelper->isUndo()) {
|
||||
$log->setUndoneEvent($this->eventUndoHelper->getUndoneEvent(), $this->eventUndoHelper->getMode());
|
||||
}
|
||||
if ($this->save_removed_data) {
|
||||
//The 4th param is important here, as we delete the element...
|
||||
$this->saveChangeSet($entity, $log, $em, true);
|
||||
}
|
||||
$this->logger->log($log);
|
||||
|
||||
//Check if we have to log CollectionElementDeleted entries
|
||||
if ($this->save_changed_data) {
|
||||
$metadata = $em->getClassMetadata(get_class($entity));
|
||||
$mappings = $metadata->getAssociationMappings();
|
||||
//Check if class is whitelisted for CollectionElementDeleted entry
|
||||
foreach (static::TRIGGER_ASSOCIATION_LOG_WHITELIST as $class => $whitelist) {
|
||||
if (is_a($entity, $class)) {
|
||||
//Check names
|
||||
foreach ($mappings as $field => $mapping) {
|
||||
if (in_array($field, $whitelist)) {
|
||||
$changed = $this->propertyAccessor->getValue($entity, $field);
|
||||
$log = new CollectionElementDeleted($changed, $mapping['inversedBy'], $entity);
|
||||
if ($this->eventUndoHelper->isUndo()) {
|
||||
$log->setUndoneEvent($this->eventUndoHelper->getUndoneEvent(), $this->eventUndoHelper->getMode());
|
||||
}
|
||||
$this->logger->log($log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function logElementEdited(AbstractDBElement $entity, EntityManagerInterface $em): void
|
||||
{
|
||||
$uow = $em->getUnitOfWork();
|
||||
|
||||
$log = new ElementEditedLogEntry($entity);
|
||||
if ($this->save_changed_data) {
|
||||
$this->saveChangeSet($entity, $log, $em);
|
||||
} elseif ($this->save_changed_fields) {
|
||||
$changed_fields = array_keys($uow->getEntityChangeSet($entity));
|
||||
//Remove lastModified field, as this is always changed (gives us no additional info)
|
||||
$changed_fields = array_diff($changed_fields, ['lastModified']);
|
||||
$log->setChangedFields($changed_fields);
|
||||
}
|
||||
//Add user comment to log entry
|
||||
if ($this->eventCommentHelper->isMessageSet()) {
|
||||
$log->setComment($this->eventCommentHelper->getMessage());
|
||||
}
|
||||
if ($this->eventUndoHelper->isUndo()) {
|
||||
$log->setUndoneEvent($this->eventUndoHelper->getUndoneEvent(), $this->eventUndoHelper->getMode());
|
||||
}
|
||||
$this->logger->log($log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given element class has restrictions to its fields
|
||||
* @param AbstractDBElement $element
|
||||
* @return bool True if there are restrictions, and further checking is needed
|
||||
*/
|
||||
public function hasFieldRestrictions(AbstractDBElement $element): bool
|
||||
{
|
||||
foreach (static::FIELD_BLACKLIST as $class => $blacklist) {
|
||||
if (is_a($element, $class)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out every forbidden field and return the cleaned array.
|
||||
* @param AbstractDBElement $element
|
||||
* @param array $fields
|
||||
* @return array
|
||||
*/
|
||||
protected function filterFieldRestrictions(AbstractDBElement $element, array $fields): array
|
||||
{
|
||||
unset($fields['lastModified']);
|
||||
|
||||
if (!$this->hasFieldRestrictions($element)) {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
return array_filter($fields, function ($value, $key) use ($element) {
|
||||
//Associative array (save changed data) case
|
||||
if (is_string($key)) {
|
||||
return $this->shouldFieldBeSaved($element, $key);
|
||||
}
|
||||
|
||||
return $this->shouldFieldBeSaved($element, $value);
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the field of the given element should be saved (if it is not blacklisted).
|
||||
* @param AbstractDBElement $element
|
||||
* @param string $field_name
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldFieldBeSaved(AbstractDBElement $element, string $field_name): bool
|
||||
{
|
||||
foreach (static::FIELD_BLACKLIST as $class => $blacklist) {
|
||||
if (is_a($element, $class) && in_array($field_name, $blacklist)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//By default allow every field.
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function saveChangeSet(AbstractDBElement $entity, AbstractLogEntry $logEntry, EntityManagerInterface $em, $element_deleted = false): void
|
||||
{
|
||||
$uow = $em->getUnitOfWork();
|
||||
|
||||
if (!$logEntry instanceof ElementEditedLogEntry && !$logEntry instanceof ElementDeletedLogEntry) {
|
||||
throw new \InvalidArgumentException('$logEntry must be ElementEditedLogEntry or ElementDeletedLogEntry!');
|
||||
}
|
||||
|
||||
if ($element_deleted) { //If the element was deleted we can use getOriginalData to save its content
|
||||
$old_data = $uow->getOriginalEntityData($entity);
|
||||
} else { //Otherwise we have to get it from entity changeset
|
||||
$changeSet = $uow->getEntityChangeSet($entity);
|
||||
$old_data = array_combine(array_keys($changeSet), array_column($changeSet, 0));
|
||||
}
|
||||
$old_data = $this->filterFieldRestrictions($entity, $old_data);
|
||||
|
||||
//Restrict length of string fields, to save memory...
|
||||
$old_data = array_map(function ($value) {
|
||||
if (is_string($value)) {
|
||||
return mb_strimwidth($value, 0, self::MAX_STRING_LENGTH, '...');
|
||||
}
|
||||
|
||||
return $value;
|
||||
}, $old_data);
|
||||
|
||||
$logEntry->setOldData($old_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -144,6 +144,13 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'entity' => $entity,
|
||||
]);
|
||||
|
||||
$builder->add('log_comment', TextType::class, [
|
||||
'label' => 'edit.log_comment',
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'empty_data' => null,
|
||||
]);
|
||||
|
||||
//Buttons
|
||||
$builder->add('save', SubmitType::class, [
|
||||
'label' => $is_new ? 'entity.create' : 'entity.edit.save',
|
||||
|
|
|
@ -264,6 +264,13 @@ class PartBaseType extends AbstractType
|
|||
],
|
||||
]);
|
||||
|
||||
$builder->add('log_comment', TextType::class, [
|
||||
'label' => 'edit.log_comment',
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'empty_data' => null,
|
||||
]);
|
||||
|
||||
$builder
|
||||
//Buttons
|
||||
->add('save', SubmitType::class, ['label' => 'part.edit.save'])
|
||||
|
|
|
@ -250,6 +250,13 @@ class UserAdminForm extends AbstractType
|
|||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('log_comment', TextType::class, [
|
||||
'label' => 'edit.log_comment',
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'empty_data' => null,
|
||||
]);
|
||||
|
||||
//Buttons
|
||||
$builder->add('save', SubmitType::class, [
|
||||
'label' => $is_new ? 'user.create' : 'user.edit.save',
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace App\Repository;
|
|||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class AttachmentRepository extends EntityRepository
|
||||
class AttachmentRepository extends DBElementRepository
|
||||
{
|
||||
/**
|
||||
* Gets the count of all private/secure attachments.
|
||||
|
|
56
src/Repository/DBElementRepository.php
Normal file
56
src/Repository/DBElementRepository.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class DBElementRepository extends EntityRepository
|
||||
{
|
||||
/**
|
||||
* Changes the ID of the given element to a new value.
|
||||
* You should only use it to undelete former existing elements, everything else is most likely a bad idea!
|
||||
* @param AbstractDBElement $element The element whose ID should be changed
|
||||
* @param int $new_id The new ID
|
||||
*/
|
||||
public function changeID(AbstractDBElement $element, int $new_id): void
|
||||
{
|
||||
$qb = $this->createQueryBuilder('element');
|
||||
$q = $qb->update(get_class($element), 'element')
|
||||
->set('element.id', $new_id)
|
||||
->where('element.id = ?1')
|
||||
->setParameter(1, $element->getID())
|
||||
->getQuery();
|
||||
|
||||
$p = $q->execute();
|
||||
|
||||
$this->setField($element, 'id', $new_id);
|
||||
}
|
||||
|
||||
protected function setField(AbstractDBElement $element, string $field, $new_value)
|
||||
{
|
||||
$reflection = new \ReflectionClass(get_class($element));
|
||||
$property = $reflection->getProperty($field);
|
||||
$property->setAccessible(true);
|
||||
$property->setValue($element, $new_value);
|
||||
}
|
||||
}
|
|
@ -44,13 +44,15 @@ namespace App\Repository;
|
|||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
use App\Entity\LogSystem\ElementCreatedLogEntry;
|
||||
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||
use App\Entity\UserSystem\User;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
class LogEntryRepository extends EntityRepository
|
||||
class LogEntryRepository extends DBElementRepository
|
||||
{
|
||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
||||
{
|
||||
|
@ -81,6 +83,93 @@ class LogEntryRepository extends EntityRepository
|
|||
return $this->findBy(['element' => $element], ['timestamp' => $order], $limit, $offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get a log entry that contains the information to undete a given element
|
||||
* @param string $class The class of the element that should be undeleted
|
||||
* @param int $id The ID of the element that should be deleted
|
||||
* @return ElementDeletedLogEntry
|
||||
*/
|
||||
public function getUndeleteDataForElement(string $class, int $id): ElementDeletedLogEntry
|
||||
{
|
||||
$qb = $this->createQueryBuilder('log');
|
||||
$qb->select('log')
|
||||
//->where('log INSTANCE OF App\Entity\LogSystem\ElementEditedLogEntry')
|
||||
->where('log INSTANCE OF ' . ElementDeletedLogEntry::class)
|
||||
->andWhere('log.target_type = :target_type')
|
||||
->andWhere('log.target_id = :target_id')
|
||||
->orderBy('log.timestamp', 'DESC')
|
||||
->setMaxResults(1);
|
||||
|
||||
$qb->setParameters([
|
||||
'target_type' => AbstractLogEntry::targetTypeClassToID($class),
|
||||
'target_id' => $id,
|
||||
]);
|
||||
|
||||
$query = $qb->getQuery();
|
||||
|
||||
$results = $query->execute();
|
||||
|
||||
if (empty($results)) {
|
||||
throw new \RuntimeException("No undelete data could be found for this element");
|
||||
}
|
||||
return $results[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all log entries that are related to time travelling
|
||||
* @param AbstractDBElement $element The element for which the time travel data should be retrieved
|
||||
* @param \DateTime $until Back to which timestamp should the data be get (including the timestamp)
|
||||
* @return AbstractLogEntry[]
|
||||
*/
|
||||
public function getTimetravelDataForElement(AbstractDBElement $element, \DateTime $until): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('log');
|
||||
$qb->select('log')
|
||||
//->where('log INSTANCE OF App\Entity\LogSystem\ElementEditedLogEntry')
|
||||
->where('log INSTANCE OF ' . ElementEditedLogEntry::class)
|
||||
->orWhere('log INSTANCE OF ' . CollectionElementDeleted::class)
|
||||
->andWhere('log.target_type = :target_type')
|
||||
->andWhere('log.target_id = :target_id')
|
||||
->andWhere('log.timestamp >= :until')
|
||||
->orderBy('log.timestamp', 'DESC');
|
||||
|
||||
$qb->setParameters([
|
||||
'target_type' => AbstractLogEntry::targetTypeClassToID(get_class($element)),
|
||||
'target_id' => $element->getID(),
|
||||
'until' => $until
|
||||
]);
|
||||
|
||||
$query = $qb->getQuery();
|
||||
return $query->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given element has existed at the given timestamp
|
||||
* @param AbstractDBElement $element
|
||||
* @param \DateTime $timestamp
|
||||
* @return bool True if the element existed at the given timestamp
|
||||
*/
|
||||
public function getElementExistedAtTimestamp(AbstractDBElement $element, \DateTime $timestamp): bool
|
||||
{
|
||||
$qb = $this->createQueryBuilder('log');
|
||||
$qb->select('count(log)')
|
||||
->where('log INSTANCE OF ' . ElementCreatedLogEntry::class)
|
||||
->andWhere('log.target_type = :target_type')
|
||||
->andWhere('log.target_id = :target_id')
|
||||
->andWhere('log.timestamp >= :until')
|
||||
->orderBy('log.timestamp', 'DESC');
|
||||
|
||||
$qb->setParameters([
|
||||
'target_type' => AbstractLogEntry::targetTypeClassToID(get_class($element)),
|
||||
'target_id' => $element->getID(),
|
||||
'until' => $timestamp
|
||||
]);
|
||||
|
||||
$query = $qb->getQuery();
|
||||
$count = $query->getSingleScalarResult();
|
||||
return !($count > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last log entries ordered by timestamp.
|
||||
*
|
||||
|
|
|
@ -46,7 +46,7 @@ use App\Entity\Base\AbstractNamedDBElement;
|
|||
use App\Helpers\Trees\TreeViewNode;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class NamedDBElementRepository extends EntityRepository
|
||||
class NamedDBElementRepository extends DBElementRepository
|
||||
{
|
||||
/**
|
||||
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
|
||||
|
|
|
@ -46,7 +46,7 @@ use App\Entity\Parts\PartLot;
|
|||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
class PartRepository extends EntityRepository
|
||||
class PartRepository extends NamedDBElementRepository
|
||||
{
|
||||
/**
|
||||
* Gets the summed up instock of all parts (only parts without an measurent unit)
|
||||
|
|
|
@ -58,11 +58,7 @@ class AttachmentVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if ($subject instanceof Attachment) {
|
||||
return $this->resolver->inherit($user, 'parts_attachments', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $this->resolver->inherit($user, 'parts_attachments', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,10 +71,11 @@ class AttachmentVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof Attachment) {
|
||||
if (is_a($subject, Attachment::class, true)) {
|
||||
return in_array($attribute, $this->resolver->listOperationsForPermission('parts_attachments'), false);
|
||||
}
|
||||
|
||||
//Allow class name as subject
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,11 +57,7 @@ class GroupVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if ($subject instanceof Group) {
|
||||
return $this->resolver->inherit($user, 'groups', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $this->resolver->inherit($user, 'groups', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +70,7 @@ class GroupVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof Group) {
|
||||
if (is_a($subject, Group::class, true)) {
|
||||
return $this->resolver->isValidOperation('groups', $attribute);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,22 +51,20 @@ class LogEntryVoter extends ExtendedVoter
|
|||
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if ($subject instanceof AbstractLogEntry) {
|
||||
if ('delete' === $attribute) {
|
||||
return $this->resolver->inherit($user, 'system', 'delete_logs') ?? false;
|
||||
if ('delete' === $attribute) {
|
||||
return $this->resolver->inherit($user, 'system', 'delete_logs') ?? false;
|
||||
}
|
||||
|
||||
if ('read' === $attribute) {
|
||||
//Allow read of the users own log entries
|
||||
if (
|
||||
$subject->getUser() === $user
|
||||
&& $this->resolver->inherit($user, 'self', 'show_logs')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('read' === $attribute) {
|
||||
//Allow read of the users own log entries
|
||||
if (
|
||||
$subject->getUser() === $user
|
||||
&& $this->resolver->inherit($user, 'self', 'show_logs')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->resolver->inherit($user, 'system', 'show_logs') ?? false;
|
||||
}
|
||||
return $this->resolver->inherit($user, 'system', 'show_logs') ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
59
src/Security/Voter/OrderdetailVoter.php
Normal file
59
src/Security/Voter/OrderdetailVoter.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Security\Voter;
|
||||
|
||||
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
||||
class OrderdetailVoter extends ExtendedVoter
|
||||
{
|
||||
/** @var string[] When this permsission are encountered, they are checked on part */
|
||||
protected const PART_PERMS = ['show_history', 'revert_element'];
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if (in_array($attribute, self::PART_PERMS, true)) {
|
||||
return $this->resolver->inherit($user, 'parts', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return $this->resolver->inherit($user, 'parts_orderdetails', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (is_a($subject, Orderdetail::class, true)) {
|
||||
return in_array($attribute, array_merge(
|
||||
self::PART_PERMS,
|
||||
$this->resolver->listOperationsForPermission('parts_orderdetails')
|
||||
), true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
58
src/Security/Voter/PartLotVoter.php
Normal file
58
src/Security/Voter/PartLotVoter.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Security\Voter;
|
||||
|
||||
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
||||
class PartLotVoter extends ExtendedVoter
|
||||
{
|
||||
/** @var string[] When this permsission are encountered, they are checked on part */
|
||||
protected const PART_PERMS = ['show_history', 'revert_element'];
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if (in_array($attribute, self::PART_PERMS, true)) {
|
||||
return $this->resolver->inherit($user, 'parts', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return $this->resolver->inherit($user, 'parts_lots', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (is_a($subject, PartLot::class, true)) {
|
||||
return in_array($attribute, array_merge(
|
||||
self::PART_PERMS,
|
||||
$this->resolver->listOperationsForPermission('parts_lots')
|
||||
), true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -57,11 +57,7 @@ class PartVoter extends ExtendedVoter
|
|||
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
// replace with your own logic
|
||||
// https://symfony.com/doc/current/security/voters.html
|
||||
//return ($subject instanceof Part || in_array($subject, ['PERM_parts', 'PERM_parts_name']));
|
||||
|
||||
if ($subject instanceof Part) {
|
||||
if (is_a($subject, Part::class, true)) {
|
||||
//Check if a sub permission should be checked -> $attribute has format name.edit
|
||||
if (false !== strpos($attribute, '.')) {
|
||||
[$perm, $op] = explode('.', $attribute);
|
||||
|
@ -72,24 +68,21 @@ class PartVoter extends ExtendedVoter
|
|||
return $this->resolver->isValidOperation('parts', $attribute);
|
||||
}
|
||||
|
||||
//Allow class name as subject
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if ($subject instanceof Part) {
|
||||
//Check for sub permissions
|
||||
if (false !== strpos($attribute, '.')) {
|
||||
[$perm, $op] = explode('.', $attribute);
|
||||
//Check for sub permissions
|
||||
if (false !== strpos($attribute, '.')) {
|
||||
[$perm, $op] = explode('.', $attribute);
|
||||
|
||||
return $this->resolver->inherit($user, 'parts_'.$perm, $op) ?? false;
|
||||
}
|
||||
|
||||
//Null concealing operator means, that no
|
||||
return $this->resolver->inherit($user, 'parts', $attribute) ?? false;
|
||||
return $this->resolver->inherit($user, 'parts_'.$perm, $op) ?? false;
|
||||
}
|
||||
|
||||
//Deny access by default.
|
||||
return false;
|
||||
//Null concealing operator means, that no
|
||||
return $this->resolver->inherit($user, 'parts', $attribute) ?? false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
59
src/Security/Voter/PricedetailVoter.php
Normal file
59
src/Security/Voter/PricedetailVoter.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Security\Voter;
|
||||
|
||||
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\PriceInformations\Pricedetail;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
||||
class PricedetailVoter extends ExtendedVoter
|
||||
{
|
||||
/** @var string[] When this permsission are encountered, they are checked on part */
|
||||
protected const PART_PERMS = ['show_history', 'revert_element'];
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if (in_array($attribute, self::PART_PERMS, true)) {
|
||||
return $this->resolver->inherit($user, 'parts', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return $this->resolver->inherit($user, 'parts_prices', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (is_a($subject, Pricedetail::class, true)) {
|
||||
return in_array($attribute, array_merge(
|
||||
self::PART_PERMS,
|
||||
$this->resolver->listOperationsForPermission('parts_prices')
|
||||
), true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -43,11 +43,13 @@ declare(strict_types=1);
|
|||
namespace App\Security\Voter;
|
||||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
|
@ -67,24 +69,29 @@ class StructureVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (is_object($subject)) {
|
||||
if (is_object($subject) || is_string($subject)) {
|
||||
$permission_name = $this->instanceToPermissionName($subject);
|
||||
//If permission name is null, then the subject is not supported
|
||||
return (null !== $permission_name) && $this->resolver->isValidOperation($permission_name, $attribute);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a instance type to the permission name.
|
||||
*
|
||||
* @param mixed $subject The subject for which the permission name should be generated
|
||||
* @param object|string $subject The subject for which the permission name should be generated
|
||||
*
|
||||
* @return string|null the name of the permission for the subject's type or null, if the subject is not supported
|
||||
*/
|
||||
protected function instanceToPermissionName($subject): ?string
|
||||
{
|
||||
$class_name = get_class($subject);
|
||||
if (!is_string($subject)) {
|
||||
$class_name = get_class($subject);
|
||||
} else {
|
||||
$class_name = $subject;
|
||||
}
|
||||
switch ($class_name) {
|
||||
case AttachmentType::class:
|
||||
return 'attachment_types';
|
||||
|
|
|
@ -57,11 +57,11 @@ class UserVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof User) {
|
||||
if (is_a($subject, User::class, true)) {
|
||||
return in_array($attribute, array_merge(
|
||||
$this->resolver->listOperationsForPermission('users'),
|
||||
$this->resolver->listOperationsForPermission('self')),
|
||||
false
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -89,10 +89,11 @@ class UserVoter extends ExtendedVoter
|
|||
return $tmp;
|
||||
}
|
||||
}
|
||||
//Else just check users permission:
|
||||
if ($this->resolver->isValidOperation('users', $attribute)) {
|
||||
return $this->resolver->inherit($user, 'users', $attribute) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
//Else just check users permission:
|
||||
if ($this->resolver->isValidOperation('users', $attribute)) {
|
||||
return $this->resolver->inherit($user, 'users', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -43,6 +43,14 @@ declare(strict_types=1);
|
|||
namespace App\Services;
|
||||
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use Symfony\Component\Serializer\Encoder\CsvEncoder;
|
||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||
use Symfony\Component\Serializer\Encoder\XmlEncoder;
|
||||
use Symfony\Component\Serializer\Encoder\YamlEncoder;
|
||||
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use function in_array;
|
||||
use InvalidArgumentException;
|
||||
use function is_array;
|
||||
|
@ -62,6 +70,10 @@ class EntityExporter
|
|||
|
||||
public function __construct(SerializerInterface $serializer)
|
||||
{
|
||||
/*$encoders = [new XmlEncoder(), new JsonEncoder(), new CSVEncoder(), new YamlEncoder()];
|
||||
$normalizers = [new ObjectNormalizer(), new DateTimeNormalizer()];
|
||||
$this->serializer = new Serializer($normalizers, $encoders);
|
||||
$this->serializer-> */
|
||||
$this->serializer = $serializer;
|
||||
}
|
||||
|
||||
|
@ -120,13 +132,15 @@ class EntityExporter
|
|||
$entity_array = [$entity];
|
||||
}
|
||||
|
||||
$response = new Response($this->serializer->serialize($entity_array, $format,
|
||||
[
|
||||
'groups' => $groups,
|
||||
'as_collection' => true,
|
||||
'csv_delimiter' => ';', //Better for Excel
|
||||
'xml_root_node_name' => 'PartDBExport',
|
||||
]));
|
||||
$serialized_data = $this->serializer->serialize($entity_array, $format,
|
||||
[
|
||||
'groups' => $groups,
|
||||
'as_collection' => true,
|
||||
'csv_delimiter' => ';', //Better for Excel
|
||||
'xml_root_node_name' => 'PartDBExport',
|
||||
]);
|
||||
|
||||
$response = new Response($serialized_data);
|
||||
|
||||
$response->headers->set('Content-Type', $content_type);
|
||||
|
||||
|
@ -151,7 +165,8 @@ class EntityExporter
|
|||
// Create the disposition of the file
|
||||
$disposition = $response->headers->makeDisposition(
|
||||
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
|
||||
$filename
|
||||
$filename,
|
||||
$string = preg_replace('![^'.preg_quote('-').'a-z0-_9\s]+!', '', strtolower($filename))
|
||||
);
|
||||
// Set the content disposition
|
||||
$response->headers->set('Content-Disposition', $disposition);
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace App\Services;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parts\Category;
|
||||
|
@ -51,9 +52,12 @@ use App\Entity\Parts\Footprint;
|
|||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Entity\PriceInformations\Pricedetail;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Exceptions\EntityNotSupportedException;
|
||||
|
@ -120,6 +124,70 @@ class EntityURLGenerator
|
|||
throw new InvalidArgumentException('Method is not supported!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL to view the given element at a given timestamp
|
||||
* @param AbstractDBElement $entity
|
||||
* @param \DateTime $dateTime
|
||||
* @return string
|
||||
*/
|
||||
public function timeTravelURL(AbstractDBElement $entity, \DateTime $dateTime): string
|
||||
{
|
||||
$map = [
|
||||
Part::class => 'part_info',
|
||||
|
||||
//As long we does not have own things for it use edit page
|
||||
AttachmentType::class => 'attachment_type_edit',
|
||||
Category::class => 'category_edit',
|
||||
Device::class => 'device_edit',
|
||||
Supplier::class => 'supplier_edit',
|
||||
Manufacturer::class => 'manufacturer_edit',
|
||||
Storelocation::class => 'store_location_edit',
|
||||
Footprint::class => 'footprint_edit',
|
||||
User::class => 'user_edit',
|
||||
Currency::class => 'currency_edit',
|
||||
MeasurementUnit::class => 'measurement_unit_edit',
|
||||
Group::class => 'group_edit',
|
||||
];
|
||||
|
||||
try {
|
||||
return $this->urlGenerator->generate(
|
||||
$this->mapToController($map, $entity),
|
||||
[
|
||||
'id' => $entity->getID(),
|
||||
'timestamp' => $dateTime->getTimestamp()
|
||||
]
|
||||
);
|
||||
} catch (EntityNotSupportedException $exception) {
|
||||
if ($entity instanceof PartLot) {
|
||||
return $this->urlGenerator->generate('part_info', [
|
||||
'id' => $entity->getPart()->getID(),
|
||||
'timestamp' => $dateTime->getTimestamp()
|
||||
]);
|
||||
}
|
||||
if ($entity instanceof PartAttachment) {
|
||||
return $this->urlGenerator->generate('part_info', [
|
||||
'id' => $entity->getElement()->getID(),
|
||||
'timestamp' => $dateTime->getTimestamp()
|
||||
]);
|
||||
}
|
||||
if ($entity instanceof Orderdetail) {
|
||||
return $this->urlGenerator->generate('part_info', [
|
||||
'id' => $entity->getPart()->getID(),
|
||||
'timestamp' => $dateTime->getTimestamp()
|
||||
]);
|
||||
}
|
||||
if ($entity instanceof Pricedetail) {
|
||||
return $this->urlGenerator->generate('part_info', [
|
||||
'id' => $entity->getOrderdetail()->getPart()->getID(),
|
||||
'timestamp' => $dateTime->getTimestamp()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//Otherwise throw an error
|
||||
throw new EntityNotSupportedException('The given entity is not supported yet!');
|
||||
}
|
||||
|
||||
public function viewURL($entity): string
|
||||
{
|
||||
if ($entity instanceof Attachment) {
|
||||
|
|
72
src/Services/LogSystem/EventCommentHelper.php
Normal file
72
src/Services/LogSystem/EventCommentHelper.php
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Services\LogSystem;
|
||||
|
||||
|
||||
class EventCommentHelper
|
||||
{
|
||||
protected const MAX_MESSAGE_LENGTH = 255;
|
||||
|
||||
protected $message;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$message = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message that will be saved for all ElementEdited/Created/Deleted messages during the next flush.
|
||||
* Set to null if no message should be shown.
|
||||
* After the flush this message is cleared.
|
||||
* @param string|null $message
|
||||
*/
|
||||
public function setMessage(?string $message): void
|
||||
{
|
||||
//Restrict the length of the string
|
||||
$this->message = mb_strimwidth($message, 0, self::MAX_MESSAGE_LENGTH, '...');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently set message, or null if no message is set yet.
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the currently set message.
|
||||
*/
|
||||
public function clearMessage(): void
|
||||
{
|
||||
$this->message = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a message is currently set.
|
||||
* @return bool
|
||||
*/
|
||||
public function isMessageSet(): bool
|
||||
{
|
||||
return is_string($this->message);
|
||||
}
|
||||
}
|
90
src/Services/LogSystem/EventUndoHelper.php
Normal file
90
src/Services/LogSystem/EventUndoHelper.php
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Services\LogSystem;
|
||||
|
||||
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
|
||||
class EventUndoHelper
|
||||
{
|
||||
public const MODE_UNDO = 'undo';
|
||||
public const MODE_REVERT = 'revert';
|
||||
|
||||
protected const ALLOWED_MODES = [self::MODE_REVERT, self::MODE_UNDO];
|
||||
|
||||
protected $undone_event;
|
||||
protected $mode;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$undone_event = null;
|
||||
$this->mode = self::MODE_UNDO;
|
||||
}
|
||||
|
||||
public function setMode(string $mode): void
|
||||
{
|
||||
if (!in_array($mode, self::ALLOWED_MODES)) {
|
||||
throw new \InvalidArgumentException('Invalid mode passed!');
|
||||
}
|
||||
$this->mode = $mode;
|
||||
}
|
||||
|
||||
public function getMode(): string
|
||||
{
|
||||
return $this->mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set which event log is currently undone.
|
||||
* After the flush this message is cleared.
|
||||
* @param AbstractLogEntry|null $undone_event
|
||||
*/
|
||||
public function setUndoneEvent(?AbstractLogEntry $undone_event): void
|
||||
{
|
||||
$this->undone_event = $undone_event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns event that is currently undone.
|
||||
* @return AbstractLogEntry|null
|
||||
*/
|
||||
public function getUndoneEvent(): ?AbstractLogEntry
|
||||
{
|
||||
return $this->undone_event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the currently the set undone event.
|
||||
*/
|
||||
public function clearUndoneEvent(): void
|
||||
{
|
||||
$this->undone_event = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a event is undone
|
||||
* @return bool
|
||||
*/
|
||||
public function isUndo(): bool
|
||||
{
|
||||
return ($this->undone_event instanceof AbstractLogEntry);
|
||||
}
|
||||
}
|
61
src/Services/LogSystem/HistoryHelper.php
Normal file
61
src/Services/LogSystem/HistoryHelper.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Services\LogSystem;
|
||||
|
||||
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Part;
|
||||
|
||||
class HistoryHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all elements that are associated with the argument.
|
||||
* The returned array contains the given element.
|
||||
* @param AbstractDBElement $element
|
||||
* @return array
|
||||
*/
|
||||
public function getAssociatedElements(AbstractDBElement $element): array
|
||||
{
|
||||
$array = [$element];
|
||||
if ($element instanceof AttachmentContainingDBElement) {
|
||||
$array = array_merge($array, $element->getAttachments()->toArray());
|
||||
}
|
||||
|
||||
if ($element instanceof Part) {
|
||||
$array = array_merge(
|
||||
$array,
|
||||
$element->getPartLots()->toArray(),
|
||||
$element->getOrderdetails()->toArray()
|
||||
);
|
||||
foreach ($element->getOrderdetails() as $orderdetail) {
|
||||
$array = array_merge($array, $orderdetail->getPricedetails()->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
|
@ -42,7 +42,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\LogSystem;
|
||||
|
||||
use App\Entity\Contracts\LogWithCommentInterface;
|
||||
use App\Entity\Contracts\LogWithEventUndoInterface;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
use App\Entity\LogSystem\DatabaseUpdatedLogEntry;
|
||||
use App\Entity\LogSystem\ElementCreatedLogEntry;
|
||||
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||
|
@ -52,6 +55,8 @@ use App\Entity\LogSystem\InstockChangedLogEntry;
|
|||
use App\Entity\LogSystem\UserLoginLogEntry;
|
||||
use App\Entity\LogSystem\UserLogoutLogEntry;
|
||||
use App\Entity\LogSystem\UserNotAllowedLogEntry;
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
|
@ -60,10 +65,15 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
class LogEntryExtraFormatter
|
||||
{
|
||||
protected $translator;
|
||||
protected $elementTypeNameGenerator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
protected const CONSOLE_SEARCH = ['<i class="fas fa-long-arrow-alt-right"></i>', '<i>', '</i>', '<b>', '</b>', ];
|
||||
protected const CONSOLE_REPLACE = ['→', '<info>', '</info>', '<error>', '</error>'];
|
||||
|
||||
public function __construct(TranslatorInterface $translator, ElementTypeNameGenerator $elementTypeNameGenerator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->elementTypeNameGenerator = $elementTypeNameGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,32 +83,33 @@ class LogEntryExtraFormatter
|
|||
*/
|
||||
public function formatConsole(AbstractLogEntry $logEntry): string
|
||||
{
|
||||
$tmp = $this->format($logEntry);
|
||||
$arr = $this->getInternalFormat($logEntry);
|
||||
$tmp = [];
|
||||
|
||||
//Just a simple tweak to make the console output more pretty.
|
||||
$search = ['<i>', '</i>', '<b>', '</b>', ' <i class="fas fa-long-arrow-alt-right">'];
|
||||
$replace = ['<info>', '</info>', '<error>', '</error>', '→'];
|
||||
//Make an array with entries in the form "<b>Key:</b> Value"
|
||||
foreach ($arr as $key => $value) {
|
||||
$str = '';
|
||||
if (is_string($key)) {
|
||||
$str .= '<error>' . $this->translator->trans($key) . '</error>: ';
|
||||
}
|
||||
$str .= $value;
|
||||
if (!empty($str)) {
|
||||
$tmp[] = $str;
|
||||
}
|
||||
}
|
||||
|
||||
return str_replace($search, $replace, $tmp);
|
||||
return str_replace(static::CONSOLE_SEARCH, static::CONSOLE_REPLACE, implode("; ", $tmp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a HTML formatted string containing a user viewable form of the Extra data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function format(AbstractLogEntry $context): string
|
||||
protected function getInternalFormat(AbstractLogEntry $context): array
|
||||
{
|
||||
$array = [];
|
||||
if ($context instanceof UserLoginLogEntry || $context instanceof UserLogoutLogEntry) {
|
||||
return sprintf(
|
||||
'<i>%s</i>: %s',
|
||||
$this->translator->trans('log.user_login.ip'),
|
||||
htmlspecialchars($context->getIPAddress())
|
||||
);
|
||||
$array['log.user_login.ip'] = htmlspecialchars($context->getIPAddress());
|
||||
}
|
||||
|
||||
if ($context instanceof ExceptionLogEntry) {
|
||||
return sprintf(
|
||||
$array[] = sprintf(
|
||||
'<i>%s</i> %s:%d : %s',
|
||||
htmlspecialchars($context->getExceptionClass()),
|
||||
htmlspecialchars($context->getFile()),
|
||||
|
@ -108,7 +119,7 @@ class LogEntryExtraFormatter
|
|||
}
|
||||
|
||||
if ($context instanceof DatabaseUpdatedLogEntry) {
|
||||
return sprintf(
|
||||
$array[] = sprintf(
|
||||
'<i>%s</i> %s <i class="fas fa-long-arrow-alt-right"></i> %s',
|
||||
$this->translator->trans($context->isSuccessful() ? 'log.database_updated.success' : 'log.database_updated.failure'),
|
||||
$context->getOldVersion(),
|
||||
|
@ -116,42 +127,85 @@ class LogEntryExtraFormatter
|
|||
);
|
||||
}
|
||||
|
||||
if ($context instanceof LogWithEventUndoInterface) {
|
||||
if ($context->isUndoEvent()) {
|
||||
if ($context->getUndoMode() === 'undo') {
|
||||
$array['log.undo_mode.undo'] = (string) $context->getUndoEventID();
|
||||
} elseif ($context->getUndoMode() === 'revert') {
|
||||
$array['log.undo_mode.revert'] = (string) $context->getUndoEventID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($context instanceof LogWithCommentInterface && $context->hasComment()) {
|
||||
$array[] = htmlspecialchars($context->getComment());
|
||||
}
|
||||
|
||||
if ($context instanceof ElementCreatedLogEntry && $context->hasCreationInstockValue()) {
|
||||
return sprintf(
|
||||
'<i>%s</i>: %s',
|
||||
$this->translator->trans('log.element_created.original_instock'),
|
||||
$context->getCreationInstockValue()
|
||||
);
|
||||
$array['log.element_created.original_instock'] = (string) $context->getCreationInstockValue();
|
||||
}
|
||||
|
||||
if ($context instanceof ElementDeletedLogEntry) {
|
||||
return sprintf(
|
||||
'<i>%s</i>: %s',
|
||||
$this->translator->trans('log.element_deleted.old_name'),
|
||||
$context->getOldName() ?? $this->translator->trans('log.element_deleted.old_name.unknown')
|
||||
);
|
||||
if ($context->getOldName() !== null) {
|
||||
$array['log.element_deleted.old_name'] = htmlspecialchars($context->getOldName());
|
||||
} else {
|
||||
$array['log.element_deleted.old_name'] = $this->translator->trans('log.element_deleted.old_name.unknown');
|
||||
}
|
||||
}
|
||||
|
||||
if ($context instanceof ElementEditedLogEntry && ! empty($context->getMessage())) {
|
||||
return htmlspecialchars($context->getMessage());
|
||||
if ($context instanceof ElementEditedLogEntry && $context->hasChangedFieldsInfo()) {
|
||||
$array['log.element_edited.changed_fields'] = htmlspecialchars(implode(', ', $context->getChangedFields()));
|
||||
}
|
||||
|
||||
if ($context instanceof InstockChangedLogEntry) {
|
||||
return sprintf(
|
||||
'<i>%s</i>; %s <i class="fas fa-long-arrow-alt-right"></i> %s (%s); %s: %s',
|
||||
$this->translator->trans($context->isWithdrawal() ? 'log.instock_changed.withdrawal' : 'log.instock_changed.added'),
|
||||
$array[] = $this->translator->trans($context->isWithdrawal() ? 'log.instock_changed.withdrawal' : 'log.instock_changed.added');
|
||||
$array[] = sprintf(
|
||||
'%s <i class="fas fa-long-arrow-alt-right"></i> %s (%s)',
|
||||
$context->getOldInstock(),
|
||||
$context->getNewInstock(),
|
||||
(! $context->isWithdrawal() ? '+' : '-').$context->getDifference(true),
|
||||
$this->translator->trans('log.instock_changed.comment'),
|
||||
htmlspecialchars($context->getComment())
|
||||
(! $context->isWithdrawal() ? '+' : '-').$context->getDifference(true)
|
||||
);
|
||||
$array['log.instock_changed.comment'] = htmlspecialchars($context->getComment());
|
||||
}
|
||||
|
||||
if ($context instanceof CollectionElementDeleted) {
|
||||
$array['log.collection_deleted.deleted'] = sprintf(
|
||||
'%s: %s (%s)',
|
||||
$this->elementTypeNameGenerator->getLocalizedTypeLabel($context->getDeletedElementClass()),
|
||||
$context->getOldName() ?? $context->getDeletedElementID(),
|
||||
$context->getCollectionName()
|
||||
);
|
||||
}
|
||||
|
||||
if ($context instanceof UserNotAllowedLogEntry) {
|
||||
return htmlspecialchars($context->getMessage());
|
||||
$array[] = htmlspecialchars($context->getMessage());
|
||||
}
|
||||
|
||||
return '';
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a HTML formatted string containing a user viewable form of the Extra data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function format(AbstractLogEntry $context): string
|
||||
{
|
||||
$arr = $this->getInternalFormat($context);
|
||||
$tmp = [];
|
||||
|
||||
//Make an array with entries in the form "<b>Key:</b> Value"
|
||||
foreach ($arr as $key => $value) {
|
||||
$str = '';
|
||||
if (is_string($key)) {
|
||||
$str .= '<b>' . $this->translator->trans($key) . '</b>: ';
|
||||
}
|
||||
$str .= $value;
|
||||
if (!empty($str)) {
|
||||
$tmp[] = $str;
|
||||
}
|
||||
}
|
||||
|
||||
return implode("; ", $tmp);
|
||||
}
|
||||
}
|
||||
|
|
217
src/Services/LogSystem/TimeTravel.php
Normal file
217
src/Services/LogSystem/TimeTravel.php
Normal file
|
@ -0,0 +1,217 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Services\LogSystem;
|
||||
|
||||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Contracts\TimeStampableInterface;
|
||||
use App\Entity\Contracts\TimeTravelInterface;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
|
||||
class TimeTravel
|
||||
{
|
||||
protected $em;
|
||||
protected $repo;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->repo = $em->getRepository(AbstractLogEntry::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undeletes the element with the given ID.
|
||||
* @param string $class The class name of the element that should be undeleted
|
||||
* @param int $id The ID of the element that should be undeleted.
|
||||
* @return AbstractDBElement
|
||||
*/
|
||||
public function undeleteEntity(string $class, int $id): AbstractDBElement
|
||||
{
|
||||
$log = $this->repo->getUndeleteDataForElement($class, $id);
|
||||
$element = new $class();
|
||||
$this->applyEntry($element, $log);
|
||||
|
||||
//Set internal ID so the element can be reverted
|
||||
$this->setField($element, 'id', $id);
|
||||
|
||||
//Let database determine when it will be created
|
||||
$this->setField($element,'addedDate', null);
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert the given element to the state it has on the given timestamp
|
||||
* @param AbstractDBElement $element
|
||||
* @param \DateTime $timestamp
|
||||
* @param AbstractLogEntry[] $reverted_elements
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function revertEntityToTimestamp(AbstractDBElement $element, \DateTime $timestamp, array $reverted_elements = [])
|
||||
{
|
||||
if (!$element instanceof TimeStampableInterface) {
|
||||
throw new \InvalidArgumentException('$element must have a Timestamp!');
|
||||
}
|
||||
|
||||
if ($timestamp > new \DateTime('now')) {
|
||||
throw new \InvalidArgumentException('You can not travel to the future (yet)...');
|
||||
}
|
||||
|
||||
//Skip this process if already were reverted...
|
||||
if (in_array($element, $reverted_elements)) {
|
||||
return;
|
||||
}
|
||||
$reverted_elements[] = $element;
|
||||
|
||||
$history = $this->repo->getTimetravelDataForElement($element, $timestamp);
|
||||
|
||||
/*
|
||||
if (!$this->repo->getElementExistedAtTimestamp($element, $timestamp)) {
|
||||
$element = null;
|
||||
return;
|
||||
}*/
|
||||
|
||||
foreach ($history as $logEntry) {
|
||||
if ($logEntry instanceof ElementEditedLogEntry) {
|
||||
$this->applyEntry($element, $logEntry);
|
||||
}
|
||||
if ($logEntry instanceof CollectionElementDeleted) {
|
||||
//Undelete element and add it to collection again
|
||||
$undeleted = $this->undeleteEntity(
|
||||
$logEntry->getDeletedElementClass(),
|
||||
$logEntry->getDeletedElementID()
|
||||
);
|
||||
if ($this->repo->getElementExistedAtTimestamp($undeleted, $timestamp)) {
|
||||
$this->revertEntityToTimestamp($undeleted, $timestamp, $reverted_elements);
|
||||
$collection = $this->getField($element, $logEntry->getCollectionName());
|
||||
if ($collection instanceof Collection) {
|
||||
$collection->add($undeleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Revert any of the associated elements
|
||||
$metadata = $this->em->getClassMetadata(get_class($element));
|
||||
$associations = $metadata->getAssociationMappings();
|
||||
foreach ($associations as $field => $mapping) {
|
||||
if (
|
||||
($element instanceof AbstractStructuralDBElement && ($field === 'parts' || $field === 'children'))
|
||||
|| ($element instanceof AttachmentType && $field === 'attachments')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//Revert many to one association (one element in property)
|
||||
if (
|
||||
$mapping['type'] === ClassMetadata::MANY_TO_ONE
|
||||
|| $mapping['type'] === ClassMetadata::ONE_TO_ONE
|
||||
) {
|
||||
$target_element = $this->getField($element, $field);
|
||||
if ($target_element !== null && $element->getLastModified() > $timestamp) {
|
||||
$this->revertEntityToTimestamp($target_element, $timestamp, $reverted_elements);
|
||||
}
|
||||
} elseif ( //Revert *_TO_MANY associations (collection properties)
|
||||
($mapping['type'] === ClassMetadata::MANY_TO_MANY
|
||||
|| $mapping['type'] === ClassMetadata::ONE_TO_MANY)
|
||||
&& $mapping['isOwningSide'] === false
|
||||
) {
|
||||
$target_elements = $this->getField($element, $field);
|
||||
if ($target_elements === null || count($target_elements) > 10) {
|
||||
continue;
|
||||
}
|
||||
foreach ($target_elements as $target_element) {
|
||||
if ($target_element !== null && $element->getLastModified() >= $timestamp) {
|
||||
//Remove the element from collection, if it did not existed at $timestamp
|
||||
if (!$this->repo->getElementExistedAtTimestamp($target_element, $timestamp)) {
|
||||
if ($target_elements instanceof Collection) {
|
||||
$target_elements->removeElement($target_element);
|
||||
}
|
||||
}
|
||||
$this->revertEntityToTimestamp($target_element, $timestamp, $reverted_elements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the changeset in the given LogEntry to the element
|
||||
* @param AbstractDBElement $element
|
||||
* @param TimeTravelInterface $logEntry
|
||||
* @throws \Doctrine\ORM\Mapping\MappingException
|
||||
*/
|
||||
public function applyEntry(AbstractDBElement $element, TimeTravelInterface $logEntry): void
|
||||
{
|
||||
//Skip if this does not provide any info...
|
||||
if (!$logEntry->hasOldDataInformations()) {
|
||||
return;
|
||||
}
|
||||
if (!$element instanceof TimeStampableInterface) {
|
||||
return;
|
||||
}
|
||||
$metadata = $this->em->getClassMetadata(get_class($element));
|
||||
$old_data = $logEntry->getOldData();
|
||||
|
||||
foreach ($old_data as $field => $data) {
|
||||
if ($metadata->hasField($field)) {
|
||||
$this->setField($element, $field, $data);
|
||||
}
|
||||
if ($metadata->hasAssociation($field)) {
|
||||
$mapping = $metadata->getAssociationMapping($field);
|
||||
$target_class = $mapping['targetEntity'];
|
||||
//Try to extract the old ID:
|
||||
if (is_array($data) && isset($data['@id'])) {
|
||||
$entity = $this->em->getPartialReference($target_class, $data['@id']);
|
||||
$this->setField($element, $field, $entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->setField($element, 'lastModified', $logEntry->getTimestamp());
|
||||
}
|
||||
|
||||
protected function getField(AbstractDBElement $element, string $field)
|
||||
{
|
||||
$reflection = new \ReflectionClass(get_class($element));
|
||||
$property = $reflection->getProperty($field);
|
||||
$property->setAccessible(true);
|
||||
return $property->getValue($element);
|
||||
}
|
||||
|
||||
protected function setField(AbstractDBElement $element, string $field, $new_value)
|
||||
{
|
||||
$reflection = new \ReflectionClass(get_class($element));
|
||||
$property = $reflection->getProperty($field);
|
||||
$property->setAccessible(true);
|
||||
$property->setValue($element, $new_value);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,15 @@
|
|||
{% extends "main_card.html.twig" %}
|
||||
|
||||
{% block card_type %}
|
||||
{% if timeTravel is defined and timeTravel is not null %}
|
||||
bg-primary-striped text-white
|
||||
{% else %}
|
||||
bg-primary text-white
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% form_theme form.log_comment 'bootstrap_4_layout.html.twig' %}
|
||||
|
||||
{% block card_content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
|
@ -33,16 +43,25 @@
|
|||
<legend>
|
||||
{% if entity.ID %}
|
||||
<strong>{% trans with {'%name': entity.name} %}edit.caption{% endtrans %}</strong>
|
||||
{% if timeTravel is defined and timeTravel is not null %}
|
||||
({{ timeTravel|format_datetime('short') }})
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<strong>{% trans %}new.caption{% endtrans %}</strong>
|
||||
{% endif %}
|
||||
</legend>
|
||||
{% if timeTravel is defined and timeTravel is not null %}
|
||||
<b>{% trans with {'%timestamp%': timeTravel|format_datetime('short')} %}part.info.timetravel_hint{% endtrans %}</b>
|
||||
{% endif %}
|
||||
|
||||
{{ form_errors(form) }}
|
||||
|
||||
<ul class="nav nav-tabs mt-2">
|
||||
<li class="nav-item"><a class="link-anchor active nav-link" data-toggle="tab" href="#home">{% trans %}standard.label{% endtrans %}</a></li>
|
||||
<li class="nav-item"><a data-toggle="tab" class="link-anchor nav-link" href="#info">{% trans %}infos.label{% endtrans %}</a></li>
|
||||
{% if datatable is defined %}
|
||||
<li class="nav-item {% if datatable is null %}not-allowed{% endif %}"><a data-toggle="tab" class="link-anchor nav-link {% if datatable is null %}disabled{% endif %}" href="#history">{% trans %}history.label{% endtrans %}</a></li>
|
||||
{% endif %}
|
||||
{% if entity.id %}
|
||||
<li class="nav-item"><a data-toggle="tab" class="link-anchor nav-link" href="#export">{% trans %}export.label{% endtrans %}</a> </li>
|
||||
{% else %}
|
||||
|
@ -73,7 +92,7 @@
|
|||
<div class="tab-pane active" id="common">
|
||||
{{ form_row(form.name) }}
|
||||
{% if form.parent%}
|
||||
{{ form_row(form.parent) }}
|
||||
{{ form_row(form.parent) }}
|
||||
{% endif %}
|
||||
{% if form.not_selectable is defined %}
|
||||
{{ form_row(form.not_selectable) }}
|
||||
|
@ -82,7 +101,7 @@
|
|||
{% block additional_controls %}{% endblock %}
|
||||
|
||||
{% block comment %}
|
||||
{{ form_row(form.comment) }}
|
||||
{{ form_row(form.comment) }}
|
||||
{% endblock %}
|
||||
|
||||
</div>
|
||||
|
@ -96,7 +115,21 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.save) }}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-9 offset-sm-3">
|
||||
<div class="btn-group">
|
||||
{{ form_widget(form.save) }}
|
||||
<button type="button" class="btn {% if entity.id is not null %}btn-primary{% else %}btn-success{% endif %} dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<div class="dropdown-menu p-2">
|
||||
{{ form_row(form.log_comment)}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.reset) }}
|
||||
{{ form_end(form) }}
|
||||
|
||||
|
@ -112,11 +145,15 @@
|
|||
{% include "AdminPages/_info.html.twig" %}
|
||||
</div>
|
||||
|
||||
|
||||
{% if datatable is defined and datatable is not null %}
|
||||
<div id="history" class="tab-pane fade">
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if entity.id %}
|
||||
<div id="export" class="tab-pane fade">
|
||||
{% include 'AdminPages/_export_form.html.twig' with {'path' : path('attachment_type_export', {'id': entity.id})} %}
|
||||
{% include 'AdminPages/_export_form.html.twig' with {'path' : path(route_base ~ '_export', {'id': entity.id})} %}
|
||||
</div>
|
||||
{% else %} {# For new element we have a combined import/export tab #}
|
||||
<div id="import_export" class="tab-pane fade">
|
||||
|
|
|
@ -7,12 +7,22 @@
|
|||
<div class=""></div>
|
||||
<div class="col-sm offset-sm-3 pl-2">
|
||||
{% set delete_disabled = (not is_granted("delete", entity)) or (entity.group is defined and entity.id == 1) %}
|
||||
<button class="btn btn-danger" {% if delete_disabled %}disabled{% endif %}>{% trans %}entity.delete{% endtrans %}</button>
|
||||
{% if entity.parent is defined %}
|
||||
<div class="ml-2 custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="recursive" name="delete_recursive">
|
||||
<label class="custom-control-label" for="recursive">{% trans %}entity.delete.recursive{% endtrans %}</label>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-danger" {% if delete_disabled %}disabled{% endif %}>{% trans %}entity.delete{% endtrans %}</button>
|
||||
<button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<div class="dropdown-menu p-2">
|
||||
<div class="form-group"><label for="delete_log_comment">{% trans %}edit.log_comment{% endtrans %}</label>
|
||||
<input type="text" id="delete_log_comment" name="log_comment" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if entity.parent is defined %}
|
||||
<div class="ml-2 custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="recursive" name="delete_recursive">
|
||||
<label class="custom-control-label" for="recursive">{% trans %}entity.delete.recursive{% endtrans %}</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
14
templates/LogSystem/_log_table.html.twig
Normal file
14
templates/LogSystem/_log_table.html.twig
Normal file
|
@ -0,0 +1,14 @@
|
|||
<form method="post" action="{{ url("log_undo") }}" data-delete-form data-title="{% trans %}log.undo.confirm_title{% endtrans %}"
|
||||
data-message="{% trans %}log.undo.confirm_message{% endtrans %}">
|
||||
<input type="hidden" name="redirect_back" value="{{ app.request.uri }}">
|
||||
<div id="part_list" class="" data-datatable data-settings='{{ datatable_settings(datatable) }}'>
|
||||
<div class="card-body">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4>{% trans %}part_list.loading.caption{% endtrans %}</h4>
|
||||
<h6>{% trans %}part_list.loading.message{% endtrans %}</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -3,14 +3,5 @@
|
|||
{% block title %}{% trans %}log.list.title{% endtrans %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="part_list" class="" data-datatable data-settings='{{ datatable_settings(datatable) }}'>
|
||||
<div class="card-body">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4>{% trans %}part_list.loading.caption{% endtrans %}</h4>
|
||||
<h6>{% trans %}part_list.loading.message{% endtrans %}</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
{% endblock %}
|
|
@ -84,11 +84,23 @@
|
|||
<div class="tab-pane fade p-2" id="comment" role="tabpanel">
|
||||
{{ form_widget(form.comment)}}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{{ form_row(form.save) }}
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-9 offset-sm-3">
|
||||
<div class="btn-group">
|
||||
{{ form_widget(form.save) }}
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<div class="dropdown-menu p-2">
|
||||
{{ form_row(form.log_comment)}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.reset) }}
|
||||
{{ form_errors(form) }}
|
||||
{{ form_end(form) }}
|
||||
|
|
5
templates/Parts/info/_history.html.twig
Normal file
5
templates/Parts/info/_history.html.twig
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div class="mt-2">
|
||||
{% if datatable is not null %}
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
{% endif %}
|
||||
</div>
|
|
@ -23,7 +23,9 @@
|
|||
</h5>
|
||||
<h3>{{ part.name }}
|
||||
{# You need edit permission to use the edit button #}
|
||||
{% if is_granted('edit', part) %}
|
||||
{% if timeTravel is not null %}
|
||||
<a href="{{ part|entityURL('info') }}"><i title="{% trans %}part.back_to_info{% endtrans %}" class="fas fa-fw fa-arrow-circle-left"></i></a>
|
||||
{% elseif is_granted('edit', part) %}
|
||||
<a href="{{ part|entityURL('edit') }}"><i class="fas fa-fw fa-sm fa-edit"></i></a>
|
||||
{% endif %}
|
||||
</h3>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{% import "helper.twig" as helper %}
|
||||
|
||||
{% if timeTravel is not null %}
|
||||
<b class="mb-2">{% trans with {'%timestamp%': timeTravel|format_datetime('short')} %}part.info.timetravel_hint{% endtrans %}</b>
|
||||
{% endif %}
|
||||
|
||||
<div class="mb-3">
|
||||
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
|
||||
<i class="fas fa-history fa-fw"></i> {{ helper.date_user_combination(part, true) }}
|
||||
|
|
|
@ -31,9 +31,19 @@
|
|||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ part.id) }}">
|
||||
<div class="form-group">
|
||||
<button class="btn btn-danger" {% if not is_granted("delete", part) %}disabled{% endif %}>
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
{% trans %}part.delete{% endtrans %}
|
||||
</button>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-danger" {% if not is_granted("delete", part) %}disabled{% endif %}>
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
{% trans %}part.delete{% endtrans %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<div class="dropdown-menu p-2">
|
||||
<div class="form-group"><label for="delete_log_comment">{% trans %}edit.log_comment{% endtrans %}</label>
|
||||
<input type="text" id="delete_log_comment" name="log_comment" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -4,16 +4,28 @@
|
|||
{% trans %}part.info.title{% endtrans %} {{ part.name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block card_type %}
|
||||
|
||||
{% if timeTravel == null %}
|
||||
bg-primary text-white
|
||||
{% else %}
|
||||
bg-primary-striped text-white
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fa {{ part.favorite ? 'fa-star' : 'fa-info-circle'}} fa-fw" aria-hidden="true"></i>
|
||||
{% trans %}part.info.title{% endtrans %} <b>"{{ part.name }}"</b>
|
||||
{% if timeTravel != null %}
|
||||
<i>({{ timeTravel | format_datetime('short') }})</i>
|
||||
{% endif %}
|
||||
<div class="float-right">
|
||||
{% trans %}id.label{% endtrans %}: {{ part.id }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block card_content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
{% include "Parts/info/_main_infos.html.twig" %}
|
||||
|
@ -28,14 +40,14 @@
|
|||
<div class="">
|
||||
<div class="">
|
||||
<ul class="nav nav-tabs" id="partTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if part.partLots %}active{% endif %}" id="part_lots-tab" data-toggle="tab"
|
||||
href="#part_lots" role="tab">
|
||||
<i class="fas fa-box fa-fw"></i>
|
||||
{% trans %}part.part_lots.label{% endtrans %}
|
||||
<span class="badge badge-secondary">{{ part.partLots | length }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if part.partLots %}active{% endif %}" id="part_lots-tab" data-toggle="tab"
|
||||
href="#part_lots" role="tab">
|
||||
<i class="fas fa-box fa-fw"></i>
|
||||
{% trans %}part.part_lots.label{% endtrans %}
|
||||
<span class="badge badge-secondary">{{ part.partLots | length }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if part.comment is not empty %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="comment-tab" data-toggle="tab"
|
||||
|
@ -60,8 +72,8 @@
|
|||
<span class="badge badge-secondary">{{ part.orderdetails | length }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="history-tab" data-toggle="tab" href="#history" role="tab">
|
||||
<li class="nav-item {% if datatable is null %}not-allowed{% endif %}">
|
||||
<a class="nav-link {% if datatable is null %}disabled{% endif %}" id="history-tab" data-toggle="tab" href="#history" role="tab">
|
||||
<i class="fas fa-history"></i>
|
||||
{% trans %}vendor.partinfo.history{% endtrans %}
|
||||
</a>
|
||||
|
@ -102,13 +114,11 @@
|
|||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="history" role="tabpanel" aria-labelledby="history-tab">
|
||||
TODO
|
||||
{% include "Parts/info/_history.html.twig" %}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tools" role="tabpanel" aria-labelledby="tools-tab">
|
||||
|
||||
{% include "Parts/info/_tools.html.twig" %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="extended_info" role="tabpanel" aria-labelledby="extended_info-tab">
|
||||
|
|
|
@ -39,4 +39,13 @@
|
|||
{% trans %} homepage.others {% endtrans %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if datatable is not null %}
|
||||
<div class="card mt-3">
|
||||
<div class="card-header"><i class="fas fa-fw fa-history"></i> {% trans %}homepage.last_activity{% endtrans %}</div>
|
||||
<div class="card-body">
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -137,14 +137,6 @@ class PermissionsEmbedTest extends TestCase
|
|||
$embed->getPermissionValue('parts', 1);
|
||||
}
|
||||
|
||||
public function testInvalidBit3(): void
|
||||
{
|
||||
$embed = new PermissionsEmbed();
|
||||
//When encoutering an too high bit number it must throw an error.
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$embed->getPermissionValue('parts', 32);
|
||||
}
|
||||
|
||||
public function getStatesBINARY()
|
||||
{
|
||||
return [
|
||||
|
|
71
tests/Services/LogSystem/EventCommentHelperTest.php
Normal file
71
tests/Services/LogSystem/EventCommentHelperTest.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Services\LogSystem;
|
||||
|
||||
use App\Services\LogSystem\EventCommentHelper;
|
||||
use App\Services\LogSystem\EventLogger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class EventCommentHelperTest extends WebTestCase
|
||||
{
|
||||
/**
|
||||
* @var EventCommentHelper
|
||||
*/
|
||||
protected $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::$container->get(EventCommentHelper::class);
|
||||
}
|
||||
|
||||
public function testInitialState()
|
||||
{
|
||||
$this->assertNull($this->service->getMessage());
|
||||
$this->assertFalse($this->service->isMessageSet());
|
||||
}
|
||||
|
||||
public function testClearMessage()
|
||||
{
|
||||
$this->service->setMessage('Test');
|
||||
$this->assertTrue($this->service->isMessageSet());
|
||||
$this->service->clearMessage();
|
||||
$this->assertFalse($this->service->isMessageSet());
|
||||
}
|
||||
|
||||
public function testGetSetMessage()
|
||||
{
|
||||
$this->service->setMessage('Test');
|
||||
$this->assertSame('Test', $this->service->getMessage());
|
||||
}
|
||||
|
||||
public function testIsMessageSet()
|
||||
{
|
||||
$this->service->setMessage('Test');
|
||||
$this->assertTrue($this->service->isMessageSet());
|
||||
$this->service->clearMessage();
|
||||
$this->assertFalse($this->service->isMessageSet());
|
||||
}
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="de">
|
||||
<file id="SchebTwoFactorBundle.de">
|
||||
<unit id="QoghNQ6" name="login">
|
||||
<segment>
|
||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
||||
<file source-language="en" target-language="de" datatype="plaintext" original="file.ext">
|
||||
<header>
|
||||
<tool tool-id="symfony" tool-name="Symfony"/>
|
||||
</header>
|
||||
<body>
|
||||
<trans-unit id="QoghNQ6" resname="login">
|
||||
<source>login</source>
|
||||
<target>Login</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
14
translations/SchebTwoFactorBundle.de.xlf
Normal file
14
translations/SchebTwoFactorBundle.de.xlf
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="de">
|
||||
<file id="SchebTwoFactorBundle.de">
|
||||
<unit id="QoghNQ6" name="login">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\templates\security\2fa_base_form.html.twig:52</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>login</source>
|
||||
<target>Login</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
14
translations/SchebTwoFactorBundle.en.xlf
Normal file
14
translations/SchebTwoFactorBundle.en.xlf
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="en">
|
||||
<file id="SchebTwoFactorBundle.en">
|
||||
<unit id="QoghNQ6" name="login">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\templates\security\2fa_base_form.html.twig:52</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>login</source>
|
||||
<target>Login</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,7 @@
|
|||
<file id="security.de">
|
||||
<unit id="baI_ZxO" name="An authentication exception occurred.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -12,6 +13,7 @@
|
|||
</unit>
|
||||
<unit id="OETylMq" name="Authentication credentials could not be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -21,6 +23,7 @@
|
|||
</unit>
|
||||
<unit id="3RJINQ0" name="Authentication request could not be processed due to a system problem.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -30,6 +33,7 @@
|
|||
</unit>
|
||||
<unit id="qr0aiUo" name="Invalid credentials.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -39,6 +43,7 @@
|
|||
</unit>
|
||||
<unit id="zrJWK0F" name="Cookie has already been used by someone else.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -48,6 +53,7 @@
|
|||
</unit>
|
||||
<unit id="blC0fXX" name="Not privileged to request the resource.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -57,6 +63,7 @@
|
|||
</unit>
|
||||
<unit id="dLzMRPR" name="Invalid CSRF token.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -66,6 +73,7 @@
|
|||
</unit>
|
||||
<unit id="PhhlLem" name="No authentication provider found to support the authentication token.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -75,6 +83,7 @@
|
|||
</unit>
|
||||
<unit id="v_RS21A" name="No session available, it either timed out or cookies are not enabled.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -84,6 +93,7 @@
|
|||
</unit>
|
||||
<unit id="EYCKpDH" name="No token could be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -93,6 +103,7 @@
|
|||
</unit>
|
||||
<unit id="z3cOUZo" name="Username could not be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -102,6 +113,7 @@
|
|||
</unit>
|
||||
<unit id="By5eLYM" name="Account has expired.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -111,6 +123,7 @@
|
|||
</unit>
|
||||
<unit id="YfZhiuA" name="Credentials have expired.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -120,6 +133,7 @@
|
|||
</unit>
|
||||
<unit id="NrSSfLs" name="Account is disabled.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -129,6 +143,7 @@
|
|||
</unit>
|
||||
<unit id="O5ZyxHr" name="Account is locked.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<file id="security.en">
|
||||
<unit id="baI_ZxO" name="An authentication exception occurred.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -12,6 +13,7 @@
|
|||
</unit>
|
||||
<unit id="OETylMq" name="Authentication credentials could not be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -21,6 +23,7 @@
|
|||
</unit>
|
||||
<unit id="3RJINQ0" name="Authentication request could not be processed due to a system problem.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -30,6 +33,7 @@
|
|||
</unit>
|
||||
<unit id="qr0aiUo" name="Invalid credentials.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -39,6 +43,7 @@
|
|||
</unit>
|
||||
<unit id="zrJWK0F" name="Cookie has already been used by someone else.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -48,6 +53,7 @@
|
|||
</unit>
|
||||
<unit id="blC0fXX" name="Not privileged to request the resource.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -57,6 +63,7 @@
|
|||
</unit>
|
||||
<unit id="dLzMRPR" name="Invalid CSRF token.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -66,6 +73,7 @@
|
|||
</unit>
|
||||
<unit id="PhhlLem" name="No authentication provider found to support the authentication token.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -75,6 +83,7 @@
|
|||
</unit>
|
||||
<unit id="v_RS21A" name="No session available, it either timed out or cookies are not enabled.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -84,6 +93,7 @@
|
|||
</unit>
|
||||
<unit id="EYCKpDH" name="No token could be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -93,6 +103,7 @@
|
|||
</unit>
|
||||
<unit id="z3cOUZo" name="Username could not be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -102,6 +113,7 @@
|
|||
</unit>
|
||||
<unit id="By5eLYM" name="Account has expired.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -111,6 +123,7 @@
|
|||
</unit>
|
||||
<unit id="YfZhiuA" name="Credentials have expired.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -120,6 +133,7 @@
|
|||
</unit>
|
||||
<unit id="NrSSfLs" name="Account is disabled.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -129,6 +143,7 @@
|
|||
</unit>
|
||||
<unit id="O5ZyxHr" name="Account is locked.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Attachments\AttachmentContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\Company.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\PartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\StructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
|
@ -20,6 +20,22 @@
|
|||
<note category="file-source" priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Attachments\AttachmentContainingDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Manufacturer.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\MeasurementUnit.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Part.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Storelocation.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Supplier.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>part.master_attachment.must_be_picture</source>
|
||||
|
@ -29,9 +45,9 @@
|
|||
<unit id="VJHTkxx" name="structural.entity.unique_name">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\Company.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\PartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\StructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
|
@ -41,6 +57,19 @@
|
|||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Supplier.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Manufacturer.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\MeasurementUnit.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Storelocation.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Supplier.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note priority="1">src\Entity\AttachmentType.php:0</note>
|
||||
<note priority="1">src\Entity\Category.php:0</note>
|
||||
<note priority="1">src\Entity\Company.php:0</note>
|
||||
|
@ -61,14 +90,26 @@
|
|||
<unit id="isXL.ie" name="validator.user.username_already_used">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>validator.user.username_already_used</source>
|
||||
<target></target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="NcM463r" name="user.invalid_username">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>user.invalid_username</source>
|
||||
<target>Der Benutzername darf nur Buchstaben, Zahlen, Unterstriche, Punkte, Plus- oder Minuszeichen enthalten.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="zh5oKD9" name="This value should be false.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -78,6 +119,7 @@
|
|||
</unit>
|
||||
<unit id="NN2_iru" name="This value should be true.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -87,6 +129,7 @@
|
|||
</unit>
|
||||
<unit id="OjM_kpf" name="This value should be of type {{ type }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -96,6 +139,7 @@
|
|||
</unit>
|
||||
<unit id="f0P5pBD" name="This value should be blank.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -105,6 +149,7 @@
|
|||
</unit>
|
||||
<unit id="ih.4TRN" name="The value you selected is not a valid choice.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -114,6 +159,7 @@
|
|||
</unit>
|
||||
<unit id="u81CkP8" name="0d999f2">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -123,6 +169,7 @@
|
|||
</unit>
|
||||
<unit id="nIvOQ_o" name="0824486">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -132,6 +179,7 @@
|
|||
</unit>
|
||||
<unit id="87zjiHi" name="One or more of the given values is invalid.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -141,6 +189,7 @@
|
|||
</unit>
|
||||
<unit id="3NeQftv" name="This field was not expected.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -150,6 +199,7 @@
|
|||
</unit>
|
||||
<unit id="SwMV4zp" name="This field is missing.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -159,6 +209,7 @@
|
|||
</unit>
|
||||
<unit id="LO2vFKN" name="This value is not a valid date.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -168,6 +219,7 @@
|
|||
</unit>
|
||||
<unit id="86dU_nv" name="This value is not a valid datetime.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -177,6 +229,7 @@
|
|||
</unit>
|
||||
<unit id="PSvNXdi" name="This value is not a valid email address.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -186,6 +239,7 @@
|
|||
</unit>
|
||||
<unit id="3KeHbZy" name="The file could not be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -195,6 +249,7 @@
|
|||
</unit>
|
||||
<unit id="KtJhQZo" name="The file is not readable.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -204,6 +259,7 @@
|
|||
</unit>
|
||||
<unit id="JocOVM2" name="1ad411a">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -213,6 +269,7 @@
|
|||
</unit>
|
||||
<unit id="YW21SPH" name="30a318d">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -222,6 +279,7 @@
|
|||
</unit>
|
||||
<unit id="NubOmrs" name="This value should be {{ limit }} or less.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -231,6 +289,7 @@
|
|||
</unit>
|
||||
<unit id="HX7TOFm" name="0e0c1e1">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -240,6 +299,7 @@
|
|||
</unit>
|
||||
<unit id="qgR8M_U" name="This value should be {{ limit }} or more.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -249,6 +309,7 @@
|
|||
</unit>
|
||||
<unit id="ekfrU.c" name="5188ff9">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -258,6 +319,7 @@
|
|||
</unit>
|
||||
<unit id="1KV4L.t" name="This value should not be blank.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -267,6 +329,7 @@
|
|||
</unit>
|
||||
<unit id="2G4Vepm" name="This value should not be null.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -276,6 +339,7 @@
|
|||
</unit>
|
||||
<unit id="yDc3m6E" name="This value should be null.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -285,6 +349,7 @@
|
|||
</unit>
|
||||
<unit id="zKzWejA" name="This value is not valid.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -294,6 +359,7 @@
|
|||
</unit>
|
||||
<unit id="HSuBZpQ" name="This value is not a valid time.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -303,6 +369,7 @@
|
|||
</unit>
|
||||
<unit id="snWc_QT" name="This value is not a valid URL.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -312,6 +379,7 @@
|
|||
</unit>
|
||||
<unit id="jpaLsb2" name="The two values should be equal.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -321,6 +389,7 @@
|
|||
</unit>
|
||||
<unit id="fIlB1B_" name="The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -330,6 +399,7 @@
|
|||
</unit>
|
||||
<unit id="tW7o0t9" name="The file is too large.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -339,6 +409,7 @@
|
|||
</unit>
|
||||
<unit id=".exF5Ww" name="The file could not be uploaded.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -348,6 +419,7 @@
|
|||
</unit>
|
||||
<unit id="d7sS5yw" name="This value should be a valid number.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -357,6 +429,7 @@
|
|||
</unit>
|
||||
<unit id="BS2Ez6i" name="This file is not a valid image.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -366,6 +439,7 @@
|
|||
</unit>
|
||||
<unit id="ydcT9kU" name="This is not a valid IP address.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -375,6 +449,7 @@
|
|||
</unit>
|
||||
<unit id="lDOGNFX" name="This value is not a valid language.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -384,6 +459,7 @@
|
|||
</unit>
|
||||
<unit id="y9IdYkA" name="This value is not a valid locale.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -393,6 +469,7 @@
|
|||
</unit>
|
||||
<unit id="1YC0pOd" name="This value is not a valid country.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -402,6 +479,7 @@
|
|||
</unit>
|
||||
<unit id="B5ebaMp" name="This value is already used.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -411,6 +489,7 @@
|
|||
</unit>
|
||||
<unit id="L6097a6" name="The size of the image could not be detected.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -420,6 +499,7 @@
|
|||
</unit>
|
||||
<unit id="zVtJJEa" name="266051e">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -429,6 +509,7 @@
|
|||
</unit>
|
||||
<unit id="s8LFQGC" name="c1c23f9">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -438,6 +519,7 @@
|
|||
</unit>
|
||||
<unit id="Z.NgqFj" name="9a128f7">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -447,6 +529,7 @@
|
|||
</unit>
|
||||
<unit id="AW1lWVM" name="8a4cd70">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -456,6 +539,7 @@
|
|||
</unit>
|
||||
<unit id="PSdMNab" name="This value should be the user's current password.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -465,6 +549,7 @@
|
|||
</unit>
|
||||
<unit id="gYImVyV" name="fd389d6">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -474,6 +559,7 @@
|
|||
</unit>
|
||||
<unit id="xJ2Bcr_" name="The file was only partially uploaded.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -483,6 +569,7 @@
|
|||
</unit>
|
||||
<unit id="HzkJDtF" name="No file was uploaded.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -492,6 +579,7 @@
|
|||
</unit>
|
||||
<unit id="mHfEaB3" name="No temporary folder was configured in php.ini.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -501,6 +589,7 @@
|
|||
</unit>
|
||||
<unit id="y9K3BGb" name="Cannot write temporary file to disk.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -510,6 +599,7 @@
|
|||
</unit>
|
||||
<unit id="kx3yHIM" name="A PHP extension caused the upload to fail.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -519,6 +609,7 @@
|
|||
</unit>
|
||||
<unit id="gTJYRl6" name="b54c218">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -528,6 +619,7 @@
|
|||
</unit>
|
||||
<unit id="FFn3lVn" name="949632c">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -537,6 +629,7 @@
|
|||
</unit>
|
||||
<unit id="bSdilZv" name="e0582dc">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -546,6 +639,7 @@
|
|||
</unit>
|
||||
<unit id="MAzmID7" name="Invalid card number.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -555,6 +649,7 @@
|
|||
</unit>
|
||||
<unit id="c3REGK3" name="Unsupported card type or invalid card number.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -564,6 +659,7 @@
|
|||
</unit>
|
||||
<unit id="XSVzcbV" name="This is not a valid International Bank Account Number (IBAN).">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -573,6 +669,7 @@
|
|||
</unit>
|
||||
<unit id="yHirwNr" name="This value is not a valid ISBN-10.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -582,6 +679,7 @@
|
|||
</unit>
|
||||
<unit id="c_q0_ua" name="This value is not a valid ISBN-13.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -591,6 +689,7 @@
|
|||
</unit>
|
||||
<unit id="M4FlD6n" name="This value is neither a valid ISBN-10 nor a valid ISBN-13.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -600,6 +699,7 @@
|
|||
</unit>
|
||||
<unit id="cuct0Ow" name="This value is not a valid ISSN.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -609,6 +709,7 @@
|
|||
</unit>
|
||||
<unit id="JBLs1a1" name="This value is not a valid currency.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -618,6 +719,7 @@
|
|||
</unit>
|
||||
<unit id="c.WxzFW" name="This value should be equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -627,6 +729,7 @@
|
|||
</unit>
|
||||
<unit id="_jdjkwq" name="This value should be greater than {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -636,6 +739,7 @@
|
|||
</unit>
|
||||
<unit id="o8A8a0H" name="This value should be greater than or equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -645,6 +749,7 @@
|
|||
</unit>
|
||||
<unit id="bOF1fpm" name="9670078">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -654,6 +759,7 @@
|
|||
</unit>
|
||||
<unit id="jG0QFKw" name="This value should be less than {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -663,6 +769,7 @@
|
|||
</unit>
|
||||
<unit id="9lWrKmm" name="This value should be less than or equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -672,6 +779,7 @@
|
|||
</unit>
|
||||
<unit id="ftTwGs." name="This value should not be equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -681,6 +789,7 @@
|
|||
</unit>
|
||||
<unit id="Bi22JLt" name="0eedf91">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -690,6 +799,7 @@
|
|||
</unit>
|
||||
<unit id="VczCWzQ" name="9c3ad0f">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -699,6 +809,7 @@
|
|||
</unit>
|
||||
<unit id="v57PXhq" name="4376d45">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -708,6 +819,7 @@
|
|||
</unit>
|
||||
<unit id="rpajj.a" name="The image is square ({{ width }}x{{ height }}px). Square images are not allowed.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -717,6 +829,7 @@
|
|||
</unit>
|
||||
<unit id="G_lu2qW" name="1dc128a">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -726,6 +839,7 @@
|
|||
</unit>
|
||||
<unit id="sFyGx4B" name="9e27714">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -735,6 +849,7 @@
|
|||
</unit>
|
||||
<unit id="jZgqcpL" name="An empty file is not allowed.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -744,6 +859,7 @@
|
|||
</unit>
|
||||
<unit id="bcfVezI" name="The host could not be resolved.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -753,6 +869,7 @@
|
|||
</unit>
|
||||
<unit id="NtzKvgt" name="This value does not match the expected {{ charset }} charset.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -762,6 +879,7 @@
|
|||
</unit>
|
||||
<unit id="Wi2y9.N" name="This is not a valid Business Identifier Code (BIC).">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -771,6 +889,7 @@
|
|||
</unit>
|
||||
<unit id="VKDowX6" name="Error">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -780,6 +899,7 @@
|
|||
</unit>
|
||||
<unit id="8zqt0Ik" name="This is not a valid UUID.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -789,6 +909,7 @@
|
|||
</unit>
|
||||
<unit id="ru.4wkH" name="This value should be a multiple of {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -798,6 +919,7 @@
|
|||
</unit>
|
||||
<unit id="M3vyK6s" name="This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -807,6 +929,7 @@
|
|||
</unit>
|
||||
<unit id="2v2xpAh" name="This value should be valid JSON.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -816,6 +939,7 @@
|
|||
</unit>
|
||||
<unit id="9CWVEGq" name="This collection should contain only unique elements.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -825,6 +949,7 @@
|
|||
</unit>
|
||||
<unit id="WdvZfq." name="This value should be positive.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -834,6 +959,7 @@
|
|||
</unit>
|
||||
<unit id="ubHMK2q" name="This value should be either positive or zero.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -843,6 +969,7 @@
|
|||
</unit>
|
||||
<unit id="IwNTzo_" name="This value should be negative.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -852,6 +979,7 @@
|
|||
</unit>
|
||||
<unit id="0GfwMfP" name="This value should be either negative or zero.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -861,6 +989,7 @@
|
|||
</unit>
|
||||
<unit id="fs3qQZR" name="This value is not a valid timezone.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -870,6 +999,7 @@
|
|||
</unit>
|
||||
<unit id="40dnsod" name="7e27e92">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -879,6 +1009,7 @@
|
|||
</unit>
|
||||
<unit id="VvxxWas" name="This value should be between {{ min }} and {{ max }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -886,8 +1017,27 @@
|
|||
<target>Dieser Wert sollte zwischen {{ min }} und {{ max }} sein.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="7g313cV" name="This value is not a valid hostname.">
|
||||
<notes>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>This value is not a valid hostname.</source>
|
||||
<target>Dieser Wert ist kein gültiger Hostname.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="xwtBimR" name="d165c02">
|
||||
<notes>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
|
||||
<target>Die Anzahl an Elementen in dieser Sammlung sollte ein Vielfaches von {{ compared_value }} sein.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id=".SEaaBa" name="This form should not contain extra fields.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -897,6 +1047,7 @@
|
|||
</unit>
|
||||
<unit id="WPnLAh9" name="The uploaded file was too large. Please try to upload a smaller file.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -906,6 +1057,7 @@
|
|||
</unit>
|
||||
<unit id="fvxWW3V" name="The CSRF token is invalid. Please try to resubmit the form.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -915,6 +1067,7 @@
|
|||
</unit>
|
||||
<unit id="lZvhKYu" name="validator.noneofitschild.self">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -924,6 +1077,7 @@
|
|||
</unit>
|
||||
<unit id="pr07aV4" name="validator.noneofitschild.children">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -933,6 +1087,7 @@
|
|||
</unit>
|
||||
<unit id="0IF0VIF" name="validator.isSelectable">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -942,6 +1097,7 @@
|
|||
</unit>
|
||||
<unit id="nd207H6" name="validator.part_lot.location_full.no_increasment">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -951,6 +1107,7 @@
|
|||
</unit>
|
||||
<unit id="R6Ov4Yt" name="validator.part_lot.location_full">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -960,6 +1117,7 @@
|
|||
</unit>
|
||||
<unit id="6vIlN5q" name="validator.part_lot.only_existing">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -969,6 +1127,7 @@
|
|||
</unit>
|
||||
<unit id="BNQk2e7" name="validator.part_lot.single_part">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -976,11 +1135,5 @@
|
|||
<target>Der Lagerort wurde als "Nur ein Bauteil" markiert, daher kann kein neues Bauteil hinzugefügt werden.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="NcM463r" name="user.invalid_username">
|
||||
<segment>
|
||||
<source>user.invalid_username</source>
|
||||
<target>Der Benutzername darf nur Buchstaben, Zahlen, Unterstriche, Punkte, Plus- oder Minuszeichen enthalten.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Attachments\AttachmentContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\Company.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\PartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\StructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
|
@ -20,6 +20,22 @@
|
|||
<note category="file-source" priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Attachments\AttachmentContainingDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Manufacturer.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\MeasurementUnit.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Part.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Storelocation.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Supplier.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>part.master_attachment.must_be_picture</source>
|
||||
|
@ -29,9 +45,9 @@
|
|||
<unit id="VJHTkxx" name="structural.entity.unique_name">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\Company.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\PartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\StructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
|
@ -41,6 +57,19 @@
|
|||
<note category="file-source" priority="1">Part-DB1\src\Entity\Parts\Supplier.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Attachments\AttachmentType.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractCompany.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractPartsContainingDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Base\AbstractStructuralDBElement.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Devices\Device.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Category.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Footprint.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Manufacturer.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\MeasurementUnit.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Storelocation.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\Parts\Supplier.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\PriceInformations\Currency.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
|
||||
<note priority="1">src\Entity\AttachmentType.php:0</note>
|
||||
<note priority="1">src\Entity\Category.php:0</note>
|
||||
<note priority="1">src\Entity\Company.php:0</note>
|
||||
|
@ -61,14 +90,26 @@
|
|||
<unit id="isXL.ie" name="validator.user.username_already_used">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>validator.user.username_already_used</source>
|
||||
<target></target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="NcM463r" name="user.invalid_username">
|
||||
<notes>
|
||||
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>user.invalid_username</source>
|
||||
<target>The username must contain only letters, numbers, underscores, dots, pluses or minuses.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="zh5oKD9" name="This value should be false.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -78,6 +119,7 @@
|
|||
</unit>
|
||||
<unit id="NN2_iru" name="This value should be true.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -87,6 +129,7 @@
|
|||
</unit>
|
||||
<unit id="OjM_kpf" name="This value should be of type {{ type }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -96,6 +139,7 @@
|
|||
</unit>
|
||||
<unit id="f0P5pBD" name="This value should be blank.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -105,6 +149,7 @@
|
|||
</unit>
|
||||
<unit id="ih.4TRN" name="The value you selected is not a valid choice.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -114,6 +159,7 @@
|
|||
</unit>
|
||||
<unit id="u81CkP8" name="0d999f2">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -123,6 +169,7 @@
|
|||
</unit>
|
||||
<unit id="nIvOQ_o" name="0824486">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -132,6 +179,7 @@
|
|||
</unit>
|
||||
<unit id="87zjiHi" name="One or more of the given values is invalid.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -141,6 +189,7 @@
|
|||
</unit>
|
||||
<unit id="3NeQftv" name="This field was not expected.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -150,6 +199,7 @@
|
|||
</unit>
|
||||
<unit id="SwMV4zp" name="This field is missing.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -159,6 +209,7 @@
|
|||
</unit>
|
||||
<unit id="LO2vFKN" name="This value is not a valid date.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -168,6 +219,7 @@
|
|||
</unit>
|
||||
<unit id="86dU_nv" name="This value is not a valid datetime.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -177,6 +229,7 @@
|
|||
</unit>
|
||||
<unit id="PSvNXdi" name="This value is not a valid email address.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -186,6 +239,7 @@
|
|||
</unit>
|
||||
<unit id="3KeHbZy" name="The file could not be found.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -195,6 +249,7 @@
|
|||
</unit>
|
||||
<unit id="KtJhQZo" name="The file is not readable.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -204,6 +259,7 @@
|
|||
</unit>
|
||||
<unit id="JocOVM2" name="1ad411a">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -213,6 +269,7 @@
|
|||
</unit>
|
||||
<unit id="YW21SPH" name="30a318d">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -222,6 +279,7 @@
|
|||
</unit>
|
||||
<unit id="NubOmrs" name="This value should be {{ limit }} or less.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -231,6 +289,7 @@
|
|||
</unit>
|
||||
<unit id="HX7TOFm" name="0e0c1e1">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -240,6 +299,7 @@
|
|||
</unit>
|
||||
<unit id="qgR8M_U" name="This value should be {{ limit }} or more.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -249,6 +309,7 @@
|
|||
</unit>
|
||||
<unit id="ekfrU.c" name="5188ff9">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -258,6 +319,7 @@
|
|||
</unit>
|
||||
<unit id="1KV4L.t" name="This value should not be blank.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -267,6 +329,7 @@
|
|||
</unit>
|
||||
<unit id="2G4Vepm" name="This value should not be null.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -276,6 +339,7 @@
|
|||
</unit>
|
||||
<unit id="yDc3m6E" name="This value should be null.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -285,6 +349,7 @@
|
|||
</unit>
|
||||
<unit id="zKzWejA" name="This value is not valid.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -294,6 +359,7 @@
|
|||
</unit>
|
||||
<unit id="HSuBZpQ" name="This value is not a valid time.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -303,6 +369,7 @@
|
|||
</unit>
|
||||
<unit id="snWc_QT" name="This value is not a valid URL.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -312,6 +379,7 @@
|
|||
</unit>
|
||||
<unit id="jpaLsb2" name="The two values should be equal.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -321,6 +389,7 @@
|
|||
</unit>
|
||||
<unit id="fIlB1B_" name="The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -330,6 +399,7 @@
|
|||
</unit>
|
||||
<unit id="tW7o0t9" name="The file is too large.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -339,6 +409,7 @@
|
|||
</unit>
|
||||
<unit id=".exF5Ww" name="The file could not be uploaded.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -348,6 +419,7 @@
|
|||
</unit>
|
||||
<unit id="d7sS5yw" name="This value should be a valid number.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -357,6 +429,7 @@
|
|||
</unit>
|
||||
<unit id="BS2Ez6i" name="This file is not a valid image.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -366,6 +439,7 @@
|
|||
</unit>
|
||||
<unit id="ydcT9kU" name="This is not a valid IP address.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -375,6 +449,7 @@
|
|||
</unit>
|
||||
<unit id="lDOGNFX" name="This value is not a valid language.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -384,6 +459,7 @@
|
|||
</unit>
|
||||
<unit id="y9IdYkA" name="This value is not a valid locale.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -393,6 +469,7 @@
|
|||
</unit>
|
||||
<unit id="1YC0pOd" name="This value is not a valid country.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -402,6 +479,7 @@
|
|||
</unit>
|
||||
<unit id="B5ebaMp" name="This value is already used.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -411,6 +489,7 @@
|
|||
</unit>
|
||||
<unit id="L6097a6" name="The size of the image could not be detected.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -420,6 +499,7 @@
|
|||
</unit>
|
||||
<unit id="zVtJJEa" name="266051e">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -429,6 +509,7 @@
|
|||
</unit>
|
||||
<unit id="s8LFQGC" name="c1c23f9">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -438,6 +519,7 @@
|
|||
</unit>
|
||||
<unit id="Z.NgqFj" name="9a128f7">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -447,6 +529,7 @@
|
|||
</unit>
|
||||
<unit id="AW1lWVM" name="8a4cd70">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -456,6 +539,7 @@
|
|||
</unit>
|
||||
<unit id="PSdMNab" name="This value should be the user's current password.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -465,6 +549,7 @@
|
|||
</unit>
|
||||
<unit id="gYImVyV" name="fd389d6">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -474,6 +559,7 @@
|
|||
</unit>
|
||||
<unit id="xJ2Bcr_" name="The file was only partially uploaded.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -483,6 +569,7 @@
|
|||
</unit>
|
||||
<unit id="HzkJDtF" name="No file was uploaded.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -492,6 +579,7 @@
|
|||
</unit>
|
||||
<unit id="mHfEaB3" name="No temporary folder was configured in php.ini.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -501,6 +589,7 @@
|
|||
</unit>
|
||||
<unit id="y9K3BGb" name="Cannot write temporary file to disk.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -510,6 +599,7 @@
|
|||
</unit>
|
||||
<unit id="kx3yHIM" name="A PHP extension caused the upload to fail.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -519,6 +609,7 @@
|
|||
</unit>
|
||||
<unit id="gTJYRl6" name="b54c218">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -528,6 +619,7 @@
|
|||
</unit>
|
||||
<unit id="FFn3lVn" name="949632c">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -537,6 +629,7 @@
|
|||
</unit>
|
||||
<unit id="bSdilZv" name="e0582dc">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -546,6 +639,7 @@
|
|||
</unit>
|
||||
<unit id="MAzmID7" name="Invalid card number.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -555,6 +649,7 @@
|
|||
</unit>
|
||||
<unit id="c3REGK3" name="Unsupported card type or invalid card number.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -564,6 +659,7 @@
|
|||
</unit>
|
||||
<unit id="XSVzcbV" name="This is not a valid International Bank Account Number (IBAN).">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -573,6 +669,7 @@
|
|||
</unit>
|
||||
<unit id="yHirwNr" name="This value is not a valid ISBN-10.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -582,6 +679,7 @@
|
|||
</unit>
|
||||
<unit id="c_q0_ua" name="This value is not a valid ISBN-13.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -591,6 +689,7 @@
|
|||
</unit>
|
||||
<unit id="M4FlD6n" name="This value is neither a valid ISBN-10 nor a valid ISBN-13.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -600,6 +699,7 @@
|
|||
</unit>
|
||||
<unit id="cuct0Ow" name="This value is not a valid ISSN.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -609,6 +709,7 @@
|
|||
</unit>
|
||||
<unit id="JBLs1a1" name="This value is not a valid currency.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -618,6 +719,7 @@
|
|||
</unit>
|
||||
<unit id="c.WxzFW" name="This value should be equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -627,6 +729,7 @@
|
|||
</unit>
|
||||
<unit id="_jdjkwq" name="This value should be greater than {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -636,6 +739,7 @@
|
|||
</unit>
|
||||
<unit id="o8A8a0H" name="This value should be greater than or equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -645,6 +749,7 @@
|
|||
</unit>
|
||||
<unit id="bOF1fpm" name="9670078">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -654,6 +759,7 @@
|
|||
</unit>
|
||||
<unit id="jG0QFKw" name="This value should be less than {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -663,6 +769,7 @@
|
|||
</unit>
|
||||
<unit id="9lWrKmm" name="This value should be less than or equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -672,6 +779,7 @@
|
|||
</unit>
|
||||
<unit id="ftTwGs." name="This value should not be equal to {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -681,6 +789,7 @@
|
|||
</unit>
|
||||
<unit id="Bi22JLt" name="0eedf91">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -690,6 +799,7 @@
|
|||
</unit>
|
||||
<unit id="VczCWzQ" name="9c3ad0f">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -699,6 +809,7 @@
|
|||
</unit>
|
||||
<unit id="v57PXhq" name="4376d45">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -708,6 +819,7 @@
|
|||
</unit>
|
||||
<unit id="rpajj.a" name="The image is square ({{ width }}x{{ height }}px). Square images are not allowed.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -717,6 +829,7 @@
|
|||
</unit>
|
||||
<unit id="G_lu2qW" name="1dc128a">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -726,6 +839,7 @@
|
|||
</unit>
|
||||
<unit id="sFyGx4B" name="9e27714">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -735,6 +849,7 @@
|
|||
</unit>
|
||||
<unit id="jZgqcpL" name="An empty file is not allowed.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -744,6 +859,7 @@
|
|||
</unit>
|
||||
<unit id="bcfVezI" name="The host could not be resolved.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -753,6 +869,7 @@
|
|||
</unit>
|
||||
<unit id="NtzKvgt" name="This value does not match the expected {{ charset }} charset.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -762,6 +879,7 @@
|
|||
</unit>
|
||||
<unit id="Wi2y9.N" name="This is not a valid Business Identifier Code (BIC).">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -771,6 +889,7 @@
|
|||
</unit>
|
||||
<unit id="VKDowX6" name="Error">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -780,6 +899,7 @@
|
|||
</unit>
|
||||
<unit id="8zqt0Ik" name="This is not a valid UUID.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -789,6 +909,7 @@
|
|||
</unit>
|
||||
<unit id="ru.4wkH" name="This value should be a multiple of {{ compared_value }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -798,6 +919,7 @@
|
|||
</unit>
|
||||
<unit id="M3vyK6s" name="This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -807,6 +929,7 @@
|
|||
</unit>
|
||||
<unit id="2v2xpAh" name="This value should be valid JSON.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -816,6 +939,7 @@
|
|||
</unit>
|
||||
<unit id="9CWVEGq" name="This collection should contain only unique elements.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -825,6 +949,7 @@
|
|||
</unit>
|
||||
<unit id="WdvZfq." name="This value should be positive.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -834,6 +959,7 @@
|
|||
</unit>
|
||||
<unit id="ubHMK2q" name="This value should be either positive or zero.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -843,6 +969,7 @@
|
|||
</unit>
|
||||
<unit id="IwNTzo_" name="This value should be negative.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -852,6 +979,7 @@
|
|||
</unit>
|
||||
<unit id="0GfwMfP" name="This value should be either negative or zero.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -861,6 +989,7 @@
|
|||
</unit>
|
||||
<unit id="fs3qQZR" name="This value is not a valid timezone.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -870,6 +999,7 @@
|
|||
</unit>
|
||||
<unit id="40dnsod" name="7e27e92">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -879,6 +1009,7 @@
|
|||
</unit>
|
||||
<unit id="VvxxWas" name="This value should be between {{ min }} and {{ max }}.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -886,8 +1017,27 @@
|
|||
<target>This value should be between {{ min }} and {{ max }}.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="7g313cV" name="This value is not a valid hostname.">
|
||||
<notes>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>This value is not a valid hostname.</source>
|
||||
<target>This value is not a valid hostname.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="xwtBimR" name="d165c02">
|
||||
<notes>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
|
||||
<target>The number of elements in this collection should be a multiple of {{ compared_value }}.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id=".SEaaBa" name="This form should not contain extra fields.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -897,6 +1047,7 @@
|
|||
</unit>
|
||||
<unit id="WPnLAh9" name="The uploaded file was too large. Please try to upload a smaller file.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -906,6 +1057,7 @@
|
|||
</unit>
|
||||
<unit id="fvxWW3V" name="The CSRF token is invalid. Please try to resubmit the form.">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -915,6 +1067,7 @@
|
|||
</unit>
|
||||
<unit id="lZvhKYu" name="validator.noneofitschild.self">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -924,6 +1077,7 @@
|
|||
</unit>
|
||||
<unit id="pr07aV4" name="validator.noneofitschild.children">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -933,6 +1087,7 @@
|
|||
</unit>
|
||||
<unit id="0IF0VIF" name="validator.isSelectable">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -942,6 +1097,7 @@
|
|||
</unit>
|
||||
<unit id="nd207H6" name="validator.part_lot.location_full.no_increasment">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -951,6 +1107,7 @@
|
|||
</unit>
|
||||
<unit id="R6Ov4Yt" name="validator.part_lot.location_full">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -960,6 +1117,7 @@
|
|||
</unit>
|
||||
<unit id="6vIlN5q" name="validator.part_lot.only_existing">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -969,6 +1127,7 @@
|
|||
</unit>
|
||||
<unit id="BNQk2e7" name="validator.part_lot.single_part">
|
||||
<notes>
|
||||
<note priority="1">obsolete</note>
|
||||
<note category="state" priority="1">obsolete</note>
|
||||
</notes>
|
||||
<segment>
|
||||
|
@ -976,11 +1135,5 @@
|
|||
<target>The storage location was marked as "single part", so you can not add a new part to it.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="NcM463r" name="user.invalid_username">
|
||||
<segment>
|
||||
<source>user.invalid_username</source>
|
||||
<target>The username must contain only letters, numbers, underscores, dots, pluses or minuses.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue