Added debug code for a possible import issue.

This commit is contained in:
James Cole 2016-11-20 11:40:05 +01:00
parent e1e94a788c
commit 75a524c656
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
3 changed files with 16 additions and 6 deletions

View File

@ -112,14 +112,16 @@ class CsvSetup implements SetupInterface
*/ */
public function getDataForSettings(): array public function getDataForSettings(): array
{ {
Log::debug('Now in getDataForSettings()');
if ($this->doColumnRoles()) { if ($this->doColumnRoles()) {
Log::debug('doColumnRoles() is true.');
$data = $this->getDataForColumnRoles(); $data = $this->getDataForColumnRoles();
return $data; return $data;
} }
if ($this->doColumnMapping()) { if ($this->doColumnMapping()) {
Log::debug('doColumnMapping() is true.');
$data = $this->getDataForColumnMapping(); $data = $this->getDataForColumnMapping();
return $data; 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 * @return array
*/ */
private function getDataForColumnRoles():array private function getDataForColumnRoles():array
{ {
Log::debug('Now in getDataForColumnRoles()');
$config = $this->job->configuration; $config = $this->job->configuration;
$data = [ $data = [
'columns' => [], 'columns' => [],
@ -447,15 +452,16 @@ class CsvSetup implements SetupInterface
$end = $start + config('csv.example_rows'); $end = $start + config('csv.example_rows');
// collect example data in $data['columns'] // collect example data in $data['columns']
Log::debug(sprintf('While %s is smaller than %d', $start, $end));
while ($start < $end) { while ($start < $end) {
$row = $reader->fetchOne($start); $row = $reader->fetchOne($start);
Log::debug(sprintf('Row %d has %d columns', $start, count($row)));
// run specifics here: // run specifics here:
// and this is the point where the specifix go to work. // and this is the point where the specifix go to work.
foreach ($config['specifics'] as $name => $enabled) { foreach ($config['specifics'] as $name => $enabled) {
/** @var SpecificInterface $specific */ /** @var SpecificInterface $specific */
$specific = app('FireflyIII\Import\Specifics\\' . $name); $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: // it returns the row, possibly modified:
$row = $specific->run($row); $row = $specific->run($row);
} }

View File

@ -45,9 +45,11 @@ class RabobankDescription implements SpecificInterface
*/ */
public function run(array $row): array public function run(array $row): array
{ {
$oppositeAccount = trim($row[5]); Log::debug(sprintf('Now in RabobankSpecific::run(). Row has %d columns', count($row)));
$oppositeName = trim($row[6]); $oppositeAccount = isset($row[5]) ? trim($row[5]) : '';
$alternateName = trim($row[10]); $oppositeName = isset($row[6]) ? trim($row[6]) : '';
$alternateName = isset($row[10]) ? trim($row[10]) : '';
if (strlen($oppositeAccount) < 1 && strlen($oppositeName) < 1) { if (strlen($oppositeAccount) < 1 && strlen($oppositeName) < 1) {
Log::debug( Log::debug(
sprintf( sprintf(

View File

@ -15,6 +15,7 @@ namespace FireflyIII\Models;
use Crypt; use Crypt;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Log;
use Storage; use Storage;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@ -151,6 +152,7 @@ class ImportJob extends Model
$disk = Storage::disk('upload'); $disk = Storage::disk('upload');
$encryptedContent = $disk->get($fileName); $encryptedContent = $disk->get($fileName);
$content = Crypt::decrypt($encryptedContent); $content = Crypt::decrypt($encryptedContent);
Log::debug(sprintf('Content size is %d bytes.', $content));
return $content; return $content;
} }