mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-28 00:57:11 +00:00
Fix various bugs in the import routine, discovered by Doug.
This commit is contained in:
@@ -279,11 +279,14 @@ class ImportableConverter
|
||||
*/
|
||||
private function verifyObjectId(string $key, int $objectId): ?int
|
||||
{
|
||||
|
||||
if (isset($this->mappedValues[$key]) && \in_array($objectId, $this->mappedValues[$key], true)) {
|
||||
Log::debug(sprintf('verifyObjectId(%s, %d) is valid!',$key, $objectId));
|
||||
return $objectId;
|
||||
}
|
||||
|
||||
return null;
|
||||
Log::debug(sprintf('verifyObjectId(%s, %d) is NOT in the list, but it could still be valid.',$key, $objectId));
|
||||
return $objectId;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -87,6 +87,7 @@ class MappedValuesValidator
|
||||
$return = [];
|
||||
Log::debug('Now in validateMappedValues()');
|
||||
foreach ($mappings as $role => $values) {
|
||||
Log::debug(sprintf('Now at role "%s"', $role));
|
||||
$values = array_unique($values);
|
||||
if (\count($values) > 0) {
|
||||
switch ($role) {
|
||||
@@ -115,9 +116,11 @@ class MappedValuesValidator
|
||||
$return[$role] = $valid;
|
||||
break;
|
||||
case 'category-id':
|
||||
Log::debug('Going to validate these category ids: ', $values);
|
||||
$set = $this->catRepos->getByIds($values);
|
||||
$valid = $set->pluck('id')->toArray();
|
||||
$return[$role] = $valid;
|
||||
Log::debug('Valid category IDs are: ', $valid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user