mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-15 22:19:35 +00:00
Allow to import GTIN from info providers
This commit is contained in:
parent
57c8368b5e
commit
fd76ca12fc
8 changed files with 39 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ class PartDetailDTO extends SearchResultDTO
|
||||||
?ManufacturingStatus $manufacturing_status = null,
|
?ManufacturingStatus $manufacturing_status = null,
|
||||||
?string $provider_url = null,
|
?string $provider_url = null,
|
||||||
?string $footprint = null,
|
?string $footprint = null,
|
||||||
|
?string $gtin = null,
|
||||||
public readonly ?string $notes = null,
|
public readonly ?string $notes = null,
|
||||||
/** @var FileDTO[]|null */
|
/** @var FileDTO[]|null */
|
||||||
public readonly ?array $datasheets = null,
|
public readonly ?array $datasheets = null,
|
||||||
|
|
@ -68,6 +69,7 @@ class PartDetailDTO extends SearchResultDTO
|
||||||
manufacturing_status: $manufacturing_status,
|
manufacturing_status: $manufacturing_status,
|
||||||
provider_url: $provider_url,
|
provider_url: $provider_url,
|
||||||
footprint: $footprint,
|
footprint: $footprint,
|
||||||
|
gtin: $gtin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ class SearchResultDTO
|
||||||
public readonly ?string $provider_url = null,
|
public readonly ?string $provider_url = null,
|
||||||
/** @var string|null A footprint representation of the providers page */
|
/** @var string|null A footprint representation of the providers page */
|
||||||
public readonly ?string $footprint = null,
|
public readonly ?string $footprint = null,
|
||||||
|
/** @var string|null The GTIN / EAN of the part */
|
||||||
|
public readonly ?string $gtin = null,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ($preview_image_url !== null) {
|
if ($preview_image_url !== null) {
|
||||||
|
|
@ -90,6 +92,7 @@ class SearchResultDTO
|
||||||
'manufacturing_status' => $this->manufacturing_status?->value,
|
'manufacturing_status' => $this->manufacturing_status?->value,
|
||||||
'provider_url' => $this->provider_url,
|
'provider_url' => $this->provider_url,
|
||||||
'footprint' => $this->footprint,
|
'footprint' => $this->footprint,
|
||||||
|
'gtin' => $this->gtin,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,6 +115,7 @@ class SearchResultDTO
|
||||||
manufacturing_status: isset($data['manufacturing_status']) ? ManufacturingStatus::tryFrom($data['manufacturing_status']) : null,
|
manufacturing_status: isset($data['manufacturing_status']) ? ManufacturingStatus::tryFrom($data['manufacturing_status']) : null,
|
||||||
provider_url: $data['provider_url'] ?? null,
|
provider_url: $data['provider_url'] ?? null,
|
||||||
footprint: $data['footprint'] ?? null,
|
footprint: $data['footprint'] ?? null,
|
||||||
|
gtin: $data['gtin'] ?? null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,8 @@ final class DTOtoEntityConverter
|
||||||
$entity->setManufacturingStatus($dto->manufacturing_status ?? ManufacturingStatus::NOT_SET);
|
$entity->setManufacturingStatus($dto->manufacturing_status ?? ManufacturingStatus::NOT_SET);
|
||||||
$entity->setManufacturerProductURL($dto->manufacturer_product_url ?? '');
|
$entity->setManufacturerProductURL($dto->manufacturer_product_url ?? '');
|
||||||
|
|
||||||
|
$entity->setGtin($dto->gtin);
|
||||||
|
|
||||||
//Set the provider reference on the part
|
//Set the provider reference on the part
|
||||||
$entity->setProviderReference(InfoProviderReference::fromPartDTO($dto));
|
$entity->setProviderReference(InfoProviderReference::fromPartDTO($dto));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ readonly class ConradProvider implements InfoProviderInterface, URLHandlerInfoPr
|
||||||
preview_image_url: $result['image'] ?? null,
|
preview_image_url: $result['image'] ?? null,
|
||||||
provider_url: $this->getProductUrl($result['productId']),
|
provider_url: $this->getProductUrl($result['productId']),
|
||||||
footprint: $this->getFootprintFromTechnicalDetails($result['technicalDetails'] ?? []),
|
footprint: $this->getFootprintFromTechnicalDetails($result['technicalDetails'] ?? []),
|
||||||
|
gtin: $result['ean'] ?? null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,6 +303,7 @@ readonly class ConradProvider implements InfoProviderInterface, URLHandlerInfoPr
|
||||||
preview_image_url: $data['productShortInformation']['mainImage']['imageUrl'] ?? null,
|
preview_image_url: $data['productShortInformation']['mainImage']['imageUrl'] ?? null,
|
||||||
provider_url: $this->getProductUrl($data['shortProductNumber']),
|
provider_url: $this->getProductUrl($data['shortProductNumber']),
|
||||||
footprint: $this->getFootprintFromTechnicalAttributes($data['productFullInformation']['technicalAttributes'] ?? []),
|
footprint: $this->getFootprintFromTechnicalAttributes($data['productFullInformation']['technicalAttributes'] ?? []),
|
||||||
|
gtin: $data['productFullInformation']['eanCode'] ?? null,
|
||||||
notes: $data['productFullInformation']['description'] ?? null,
|
notes: $data['productFullInformation']['description'] ?? null,
|
||||||
datasheets: $this->productMediaToDatasheets($data['productMedia'] ?? []),
|
datasheets: $this->productMediaToDatasheets($data['productMedia'] ?? []),
|
||||||
parameters: $this->technicalAttributesToParameters($data['productFullInformation']['technicalAttributes'] ?? []),
|
parameters: $this->technicalAttributesToParameters($data['productFullInformation']['technicalAttributes'] ?? []),
|
||||||
|
|
@ -316,6 +318,8 @@ readonly class ConradProvider implements InfoProviderInterface, URLHandlerInfoPr
|
||||||
ProviderCapabilities::PICTURE,
|
ProviderCapabilities::PICTURE,
|
||||||
ProviderCapabilities::DATASHEET,
|
ProviderCapabilities::DATASHEET,
|
||||||
ProviderCapabilities::PRICE,
|
ProviderCapabilities::PRICE,
|
||||||
|
ProviderCapabilities::FOOTPRINT,
|
||||||
|
ProviderCapabilities::GTIN,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@ enum ProviderCapabilities
|
||||||
/** Information about the footprint of a part */
|
/** Information about the footprint of a part */
|
||||||
case FOOTPRINT;
|
case FOOTPRINT;
|
||||||
|
|
||||||
|
/** Provider can provide GTIN for a part */
|
||||||
|
case GTIN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the order index for displaying capabilities in a stable order.
|
* Get the order index for displaying capabilities in a stable order.
|
||||||
* @return int
|
* @return int
|
||||||
|
|
@ -55,6 +58,7 @@ enum ProviderCapabilities
|
||||||
self::DATASHEET => 3,
|
self::DATASHEET => 3,
|
||||||
self::PRICE => 4,
|
self::PRICE => 4,
|
||||||
self::FOOTPRINT => 5,
|
self::FOOTPRINT => 5,
|
||||||
|
self::GTIN => 6,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,6 +70,7 @@ enum ProviderCapabilities
|
||||||
self::PICTURE => 'picture',
|
self::PICTURE => 'picture',
|
||||||
self::DATASHEET => 'datasheet',
|
self::DATASHEET => 'datasheet',
|
||||||
self::PRICE => 'price',
|
self::PRICE => 'price',
|
||||||
|
self::GTIN => 'gtin',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,6 +82,7 @@ enum ProviderCapabilities
|
||||||
self::PICTURE => 'fa-image',
|
self::PICTURE => 'fa-image',
|
||||||
self::DATASHEET => 'fa-file-alt',
|
self::DATASHEET => 'fa-file-alt',
|
||||||
self::PRICE => 'fa-money-bill-wave',
|
self::PRICE => 'fa-money-bill-wave',
|
||||||
|
self::GTIN => 'fa-barcode',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,13 @@
|
||||||
<small class="text-muted">{{ dto.footprint }}</small>
|
<small class="text-muted">{{ dto.footprint }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ helper.m_status_to_badge(dto.manufacturing_status) }}</td>
|
<td>
|
||||||
|
{{ helper.m_status_to_badge(dto.manufacturing_status) }}
|
||||||
|
{% if dto.gtin %}
|
||||||
|
<br>
|
||||||
|
<span class="badge text-bg-secondary" title="{% trans %}part.gtin{% endtrans %}"><i class="fa-solid fa-barcode"></i> {{ dto.gtin }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if dto.provider_url %}
|
{% if dto.provider_url %}
|
||||||
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener">
|
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener">
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,14 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if part.gtin %}
|
||||||
|
<div>
|
||||||
|
<h6>
|
||||||
|
<span class="badge text-bg-secondary" title="{% trans %}part.gtin{% endtrans %}"><i class="fa-solid fa-barcode"></i> {{ part.gtin }}</span>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{# Needs Review tag #}
|
{# Needs Review tag #}
|
||||||
{% if part.needsReview %}
|
{% if part.needsReview %}
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
|
|
|
||||||
|
|
@ -12407,5 +12407,11 @@ Buerklin-API Authentication server:
|
||||||
<target>GTIN / EAN</target>
|
<target>GTIN / EAN</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="TyykD7B" name="info_providers.capabilities.gtin">
|
||||||
|
<segment>
|
||||||
|
<source>info_providers.capabilities.gtin</source>
|
||||||
|
<target>GTIN / EAN</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue