mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-14 15:08:47 +02:00
Merge branch 'master' into settings-bundle
This commit is contained in:
commit
3e657a7cac
305 changed files with 7543 additions and 4274 deletions
|
@ -72,7 +72,7 @@ class MouserProvider implements InfoProviderInterface
|
|||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return !empty($this->settings->apiKey);
|
||||
return $this->settings->apiKey !== '' && $this->settings->apiKey !== null;
|
||||
}
|
||||
|
||||
public function searchByKeyword(string $keyword): array
|
||||
|
@ -175,7 +175,7 @@ class MouserProvider implements InfoProviderInterface
|
|||
}
|
||||
|
||||
if (count($tmp) > 1) {
|
||||
throw new \RuntimeException('Multiple parts found with ID '.$id);
|
||||
throw new \RuntimeException('Multiple parts found with ID '.$id . ' ('.count($tmp).' found). This is basically a bug in Mousers API response. See issue #616.');
|
||||
}
|
||||
|
||||
return $tmp[0];
|
||||
|
@ -209,6 +209,12 @@ class MouserProvider implements InfoProviderInterface
|
|||
$result = [];
|
||||
foreach ($products as $product) {
|
||||
|
||||
//Check if we have a valid product number. We assume that a product number, must have at least 4 characters
|
||||
//Otherwise filter it out
|
||||
if (strlen($product['MouserPartNumber']) < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Check if we have a mass field available
|
||||
$mass = null;
|
||||
if (isset($product['UnitWeightKg']['UnitWeight'])) {
|
||||
|
@ -245,7 +251,7 @@ class MouserProvider implements InfoProviderInterface
|
|||
|
||||
private function parseDataSheets(?string $sheetUrl, ?string $sheetName): ?array
|
||||
{
|
||||
if (empty($sheetUrl)) {
|
||||
if ($sheetUrl === null || $sheetUrl === '' || $sheetUrl === '0') {
|
||||
return null;
|
||||
}
|
||||
$result = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue