mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Added option to mark all imported parts as "needs review"
This commit is contained in:
parent
b7aae7d87b
commit
193650efd4
6 changed files with 32 additions and 2 deletions
|
@ -179,8 +179,13 @@ class EntityImporter
|
|||
if ($entity instanceof AbstractStructuralDBElement) {
|
||||
$entity->setParent($options['parent']);
|
||||
}
|
||||
if ($entity instanceof Part && $options['part_category']) {
|
||||
$entity->setCategory($options['part_category']);
|
||||
if ($entity instanceof Part) {
|
||||
if ($options['part_category']) {
|
||||
$entity->setCategory($options['part_category']);
|
||||
}
|
||||
if ($options['part_needs_review']) {
|
||||
$entity->setNeedsReview(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,6 +223,7 @@ class EntityImporter
|
|||
'parent' => null, //The parent element to which the imported elements should be added
|
||||
'abort_on_validation_error' => true,
|
||||
'part_category' => null,
|
||||
'part_needs_review' => false, //If true, the imported parts will be marked as "needs review", otherwise the value from the file will be used
|
||||
'create_unknown_datastructures' => true, //If true, unknown datastructures (categories, footprints, etc.) will be created on the fly
|
||||
'path_delimiter' => '->', //The delimiter used to separate the path elements in the name of a structural element
|
||||
]);
|
||||
|
@ -227,6 +233,7 @@ class EntityImporter
|
|||
$resolver->setAllowedTypes('preserve_children', 'bool');
|
||||
$resolver->setAllowedTypes('class', 'string');
|
||||
$resolver->setAllowedTypes('part_category', [Category::class, 'null']);
|
||||
$resolver->setAllowedTypes('part_needs_review', 'bool');
|
||||
|
||||
return $resolver;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue