Add new bank specific fixes.

This commit is contained in:
James Cole
2015-07-06 20:21:55 +02:00
parent af13d1943f
commit c555e28988
13 changed files with 471 additions and 336 deletions

View File

@@ -33,6 +33,9 @@ class Data
/** @var array */
protected $roles;
/** @var array */
protected $specifix;
/**
*
*/
@@ -44,6 +47,7 @@ class Data
$this->sessionMap();
$this->sessionRoles();
$this->sessionMapped();
$this->sessionSpecifix();
}
protected function sessionHasHeaders()
@@ -88,6 +92,13 @@ class Data
}
}
protected function sessionSpecifix()
{
if (Session::has('csv-specifix')) {
$this->specifix = (array)Session::get('csv-specifix');
}
}
/**
* @return string
*/
@@ -231,5 +242,22 @@ class Data
$this->roles = $roles;
}
/**
* @return array
*/
public function getSpecifix()
{
return $this->specifix;
}
/**
* @param array $specifix
*/
public function setSpecifix($specifix)
{
Session::put('csv-specifix', $specifix);
$this->specifix = $specifix;
}
}

View File

@@ -37,6 +37,8 @@ class Importer
protected $roles;
/** @var int */
protected $rows = 0;
/** @var array */
protected $specifix;
/**
* @return array
@@ -69,9 +71,10 @@ class Importer
{
set_time_limit(0);
$this->map = $this->data->getMap();
$this->roles = $this->data->getRoles();
$this->mapped = $this->data->getMapped();
$this->map = $this->data->getMap();
$this->roles = $this->data->getRoles();
$this->mapped = $this->data->getMapped();
$this->specifix = $this->data->getSpecifix();
foreach ($this->data->getReader() as $index => $row) {
if ($this->parseRow($index)) {
@@ -174,8 +177,7 @@ class Importer
{
// do bank specific fixes (must be enabled but now all of them.
$set = Config::get('csv.specifix');
foreach ($set as $className) {
foreach ($this->getSpecifix() as $className) {
/** @var SpecifixInterface $specifix */
$specifix = App::make('FireflyIII\Helpers\Csv\Specifix\\' . $className);
$specifix->setData($data);
@@ -195,6 +197,14 @@ class Importer
return $data;
}
/**
* @return array
*/
public function getSpecifix()
{
return $this->specifix;
}
/**
* @param $data
*
@@ -304,4 +314,5 @@ class Importer
{
$this->data = $data;
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace FireflyIII\Helpers\Csv\Specifix;
/**
* Class Dummy
*
* @package FireflyIII\Helpers\Csv\Specifix
*/
class Dummy
{
/** @var array */
protected $data;
/** @var array */
protected $row;
/**
* @return array
*/
public function fix()
{
return $this->data;
}
/**
* @param array $data
*/
public function setData($data)
{
$this->data = $data;
}
/**
* @param array $row
*/
public function setRow($row)
{
$this->row = $row;
}
}