Fixed some small issues in import routine.

This commit is contained in:
James Cole
2018-03-24 11:49:26 +01:00
parent 55602d632d
commit 796ab4bf2c
4 changed files with 21 additions and 6 deletions

View File

@@ -184,6 +184,7 @@ class Roles implements ConfigurationInterface
*/
private function ignoreUnmappableColumns(): bool
{
Log::debug('Now in ignoreUnmappableColumns()');
$config = $this->getConfig();
$count = $config['column-count'];
for ($i = 0; $i < $count; ++$i) {
@@ -254,24 +255,38 @@ class Roles implements ConfigurationInterface
$hasForeignAmount = true;
}
}
if ($assigned > 0 && $hasAmount && ($hasForeignCode === false && $hasForeignAmount === false)) {
Log::debug(
sprintf(
'Assigned is %d, hasAmount %s, hasForeignCode %s, hasForeignAmount %s',
$assigned,
var_export($hasAmount, true),
var_export($hasForeignCode, true),
var_export($hasForeignAmount, true)
)
);
// all assigned and correct foreign info
if ($assigned > 0 && $hasAmount && ($hasForeignCode === $hasForeignAmount)) {
$this->warning = '';
$this->saveConfig($config);
Log::debug('isRolesComplete() returns true.');
return true;
}
// warn if has foreign amount but no currency code:
if ($hasForeignAmount && !$hasForeignCode) {
$this->warning = strval(trans('import.foreign_amount_warning'));
Log::debug('isRolesComplete() returns FALSE because foreign amount present without foreign code.');
return false;
}
if (0 === $assigned || !$hasAmount) {
$this->warning = strval(trans('import.roles_warning'));
Log::debug('isRolesComplete() returns FALSE because no amount present.');
return false;
}
Log::debug('isRolesComplete() returns FALSE because no reason.');
return false;
}