Skip to content

Firefly III: a personal finances manager

Added debug code for a possible import issue.

James Cole75a524c656d5
diff --git a/app/Import/Setup/CsvSetup.php b/app/Import/Setup/CsvSetup.php
index cefeebe275..782dba86dd 100644
--- a/app/Import/Setup/CsvSetup.php
+++ b/app/Import/Setup/CsvSetup.php
@@ -112,14 +112,16 @@ class CsvSetup implements SetupInterface
*/
public function getDataForSettings(): array
{
-
+ Log::debug('Now in getDataForSettings()');
if ($this->doColumnRoles()) {
+ Log::debug('doColumnRoles() is true.');
$data = $this->getDataForColumnRoles();
return $data;
}
if ($this->doColumnMapping()) {
+ Log::debug('doColumnMapping() is true.');
$data = $this->getDataForColumnMapping();
return $data;
@@ -427,10 +429,13 @@ class CsvSetup implements SetupInterface
}
/**
+ * This method collects the data that will enable a user to choose column content.
+ *
* @return array
*/
private function getDataForColumnRoles():array
{
+ Log::debug('Now in getDataForColumnRoles()');
$config = $this->job->configuration;
$data = [
'columns' => [],
@@ -447,15 +452,16 @@ class CsvSetup implements SetupInterface
$end = $start + config('csv.example_rows');
// collect example data in $data['columns']
+ Log::debug(sprintf('While %s is smaller than %d', $start, $end));
while ($start < $end) {
$row = $reader->fetchOne($start);
-
+ Log::debug(sprintf('Row %d has %d columns', $start, count($row)));
// run specifics here:
// and this is the point where the specifix go to work.
foreach ($config['specifics'] as $name => $enabled) {
/** @var SpecificInterface $specific */
$specific = app('FireflyIII\Import\Specifics\\' . $name);
-
+ Log::debug(sprintf('Will now apply specific "%s" to row %d.', $name, $start));
// it returns the row, possibly modified:
$row = $specific->run($row);
}
diff --git a/app/Import/Specifics/RabobankDescription.php b/app/Import/Specifics/RabobankDescription.php
index a3988f2a61..59ff2abb53 100644
--- a/app/Import/Specifics/RabobankDescription.php
+++ b/app/Import/Specifics/RabobankDescription.php
@@ -45,9 +45,11 @@ class RabobankDescription implements SpecificInterface
*/
public function run(array $row): array
{
- $oppositeAccount = trim($row[5]);
- $oppositeName = trim($row[6]);
- $alternateName = trim($row[10]);
+ Log::debug(sprintf('Now in RabobankSpecific::run(). Row has %d columns', count($row)));
+ $oppositeAccount = isset($row[5]) ? trim($row[5]) : '';
+ $oppositeName = isset($row[6]) ? trim($row[6]) : '';
+ $alternateName = isset($row[10]) ? trim($row[10]) : '';
+
if (strlen($oppositeAccount) < 1 && strlen($oppositeName) < 1) {
Log::debug(
sprintf(
diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php
index 131fc8a1b0..01094638e4 100644
--- a/app/Models/ImportJob.php
+++ b/app/Models/ImportJob.php
@@ -15,6 +15,7 @@ namespace FireflyIII\Models;
use Crypt;
use Illuminate\Database\Eloquent\Model;
+use Log;
use Storage;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -151,6 +152,7 @@ class ImportJob extends Model
$disk = Storage::disk('upload');
$encryptedContent = $disk->get($fileName);
$content = Crypt::decrypt($encryptedContent);
+ Log::debug(sprintf('Content size is %d bytes.', $content));
return $content;
}