Slightly better fix for requestable import bug

This commit is contained in:
snipe 2020-02-10 17:34:32 -08:00
parent 81880645ed
commit 192917cc84
2 changed files with 3 additions and 6 deletions

View file

@ -76,7 +76,8 @@ class AssetImporter extends ItemImporter
}
$this->item['image'] = $this->findCsvMatch($row, "image");
$this->item['requestable'] = (bool) $this->findCsvMatch($row, "requestable");
$this->item['requestable'] = $this->fetchHumanBoolean($this->findCsvMatch($row, "requestable"));;
$asset->requestable = $this->fetchHumanBoolean($this->findCsvMatch($row, "requestable"));
$this->item['warranty_months'] = intval($this->findCsvMatch($row, "warranty_months"));
$this->item['model_id'] = $this->createOrFetchAssetModel($row);

View file

@ -443,11 +443,7 @@ abstract class Importer
public function fetchHumanBoolean($value)
{
if (($value =='1') || (strtolower($value) =='true') || (strtolower($value) =='yes'))
{
return '1';
}
return '0';
return (int) filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
/**