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
{
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);
}

View File

@ -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(

View File

@ -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;
}