Minor fixes for bank transaction import

This commit is contained in:
David Bomba 2023-07-04 08:37:09 +10:00
parent 57f6bce7d9
commit 1a000427fb
5 changed files with 18 additions and 13 deletions

View File

@ -105,7 +105,7 @@ class ImportMigrations extends Command
$import_file = public_path("storage/migrations/$filename/migration.json");
Import::dispatch($import_file, $this->getUser()->companies()->first(), $this->getUser());
// StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first());
} catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
\Mail::to($user)->send(new MigrationFailed($e, $company));

View File

@ -123,6 +123,21 @@ class TaskFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
public function task_status(string $value = ''): Builder
{
if (strlen($value) == 0) {
return $this->builder;
}
$status_parameters = explode(',', $value);
if(count($status_parameters) > 0)
return $this->builder->whereIn('status_id', $this->transformKeys($status_parameters));
return $this->builder;
}
/**
* Filters the query by the users company ID.
*

View File

@ -163,12 +163,8 @@ class ImportController extends Controller
$bestDelimiter = ' ';
$count = 0;
foreach ($delimiters as $delimiter) {
// if (substr_count($csvfile, $delimiter) > $count) {
// $count = substr_count($csvfile, $delimiter);
// $bestDelimiter = $delimiter;
// }
if (substr_count(strstr($csvfile, "\n", true), $delimiter) > $count) {
if (substr_count(strstr($csvfile, "\n", true), $delimiter) >= $count) {
$count = substr_count($csvfile, $delimiter);
$bestDelimiter = $delimiter;
}

View File

@ -60,10 +60,6 @@ class StartMigration implements ShouldQueue
public $timeout = 0;
// public $maxExceptions = 2;
//public $backoff = 86430;
public function __construct($filepath, User $user, Company $company)
{
$this->filepath = $filepath;
@ -159,8 +155,6 @@ class StartMigration implements ShouldQueue
}
//always make sure we unset the migration as running
return true;
}

View File

@ -150,7 +150,7 @@ class ClientTransformer extends EntityTransformer
'has_valid_vat_number' => (bool) $client->has_valid_vat_number,
'is_tax_exempt' => (bool) $client->is_tax_exempt,
'routing_id' => (string) $client->routing_id,
// 'tax_data' => $client->tax_data ?: '',
'tax_data' => $client->tax_data ?: '',
];
}
}