mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-15 14:49:33 +00:00
Merge branch 'Part-DB:master' into Buerklin-provider
This commit is contained in:
commit
bd2d5355c6
9 changed files with 37 additions and 7 deletions
|
|
@ -167,7 +167,7 @@ class EntityImporter
|
|||
}
|
||||
|
||||
//Only return objects once
|
||||
return array_values(array_unique($valid_entities));
|
||||
return array_values(array_unique($valid_entities, SORT_REGULAR));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ class PKDatastructureImporter
|
|||
public function importPartCustomStates(array $data): int
|
||||
{
|
||||
if (!isset($data['partcustomstate'])) {
|
||||
throw new \RuntimeException('$data must contain a "partcustomstate" key!');
|
||||
return 0; //Not all PartKeepr installations have custom states
|
||||
}
|
||||
|
||||
$partCustomStateData = $data['partcustomstate'];
|
||||
|
|
|
|||
|
|
@ -150,6 +150,11 @@ trait PKImportHelperTrait
|
|||
|
||||
$target->addAttachment($attachment);
|
||||
$this->em->persist($attachment);
|
||||
|
||||
//If the attachment is an image, and the target has no master picture yet, set it
|
||||
if ($attachment->isPicture() && $target->getMasterPictureAttachment() === null) {
|
||||
$target->setMasterPictureAttachment($attachment);
|
||||
}
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,10 @@ class PKPartImporter
|
|||
$this->setAssociationField($entity, 'partUnit', MeasurementUnit::class, $part['partUnit_id']);
|
||||
}
|
||||
|
||||
$this->setAssociationField($entity, 'partCustomState', MeasurementUnit::class, $part['partCustomState_id']);
|
||||
if (isset($part['partCustomState_id'])) {
|
||||
$this->setAssociationField($entity, 'partCustomState', MeasurementUnit::class,
|
||||
$part['partCustomState_id']);
|
||||
}
|
||||
|
||||
//Create a part lot to store the stock level and location
|
||||
$lot = new PartLot();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue