Merge pull request #13038 from uberbrady/fix_asset_checkout_on_update

Importer fix for non-Location imports
This commit is contained in:
snipe 2023-05-16 16:41:27 -07:00 committed by GitHub
commit 4ca914d773
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,19 +103,19 @@ class ItemImporter extends Importer
/**
* Parse row to determine what (if anything) we should checkout to.
* @param array $row CSV Row being parsed
* @return SnipeModel Model to be checked out to
* @return ?SnipeModel Model to be checked out to
*/
protected function determineCheckout($row)
{
if (get_class($this) == LocationImporter::class) {
return;
}
// We only support checkout-to-location for asset, so short circuit otherwise.
if (get_class($this) != AssetImporter::class) {
return $this->createOrFetchUser($row);
}
if (get_class($this) != LocationImporter::class) {
return;
}
if (strtolower($this->item['checkout_class']) === 'location' && $this->findCsvMatch($row, 'checkout_location') != null ) {
return Location::findOrFail($this->createOrFetchLocation($this->findCsvMatch($row, 'checkout_location')));
}