mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-07-06 17:31:45 +00:00
Compare commits
No commits in common. "8b417d6441cf4f5e8bf414af7d243a049c81c727" and "442a7aa235f6a9d21385570255a06bf6cfc3539f" have entirely different histories.
8b417d6441
...
442a7aa235
3 changed files with 421 additions and 422 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
1.17.2
|
1.17.1
|
||||||
|
|
|
||||||
|
|
@ -237,49 +237,6 @@ class KiCadHelper
|
||||||
$result["fields"]["Part-DB IPN"] = $this->createField($part->getIpn());
|
$result["fields"]["Part-DB IPN"] = $this->createField($part->getIpn());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add supplier information from orderdetails (include obsolete orderdetails)
|
|
||||||
if ($part->getOrderdetails(false)->count() > 0) {
|
|
||||||
$supplierCounts = [];
|
|
||||||
|
|
||||||
foreach ($part->getOrderdetails(false) as $orderdetail) {
|
|
||||||
if ($orderdetail->getSupplier() !== null && $orderdetail->getSupplierPartNr() !== '') {
|
|
||||||
$supplierName = $orderdetail->getSupplier()->getName();
|
|
||||||
|
|
||||||
$supplierName .= " SPN"; // Append "SPN" to the supplier name to indicate Supplier Part Number
|
|
||||||
|
|
||||||
if (!isset($supplierCounts[$supplierName])) {
|
|
||||||
$supplierCounts[$supplierName] = 0;
|
|
||||||
}
|
|
||||||
$supplierCounts[$supplierName]++;
|
|
||||||
|
|
||||||
// Create field name with sequential number if more than one from same supplier (e.g. "Mouser", "Mouser 2", etc.)
|
|
||||||
$fieldName = $supplierCounts[$supplierName] > 1
|
|
||||||
? $supplierName . ' ' . $supplierCounts[$supplierName]
|
|
||||||
: $supplierName;
|
|
||||||
|
|
||||||
$result["fields"][$fieldName] = $this->createField($orderdetail->getSupplierPartNr());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add fields for KiCost:
|
|
||||||
if ($part->getManufacturer() !== null) {
|
|
||||||
$result["fields"]["manf"] = $this->createField($part->getManufacturer()->getName());
|
|
||||||
}
|
|
||||||
if ($part->getManufacturerProductNumber() !== "") {
|
|
||||||
$result['fields']['manf#'] = $this->createField($part->getManufacturerProductNumber());
|
|
||||||
}
|
|
||||||
|
|
||||||
//For each supplier, add a field with the supplier name and the supplier part number for KiCost
|
|
||||||
if ($part->getOrderdetails(false)->count() > 0) {
|
|
||||||
foreach ($part->getOrderdetails(false) as $orderdetail) {
|
|
||||||
if ($orderdetail->getSupplier() !== null && $orderdetail->getSupplierPartNr() !== '') {
|
|
||||||
$fieldName = mb_strtolower($orderdetail->getSupplier()->getName()) . '#';
|
|
||||||
|
|
||||||
$result["fields"][$fieldName] = $this->createField($orderdetail->getSupplierPartNr());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue