From e21e339cb027c02cc28ab9152aaf440002bcb7ba Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 19 Dec 2017 18:53:50 +0100 Subject: [PATCH] Fix some spelling errors. --- .../Controllers/Chart/ReportController.php | 4 ++-- app/Http/Controllers/HomeController.php | 2 +- app/Import/Converter/Amount.php | 2 +- .../{AmountDebet.php => AmountDebit.php} | 6 ++--- ...{INGDebetCredit.php => INGDebitCredit.php} | 8 +++---- ...ebetCredit.php => RabobankDebitCredit.php} | 6 ++--- app/Import/Object/ImportJournal.php | 24 +++++++++---------- .../Import/Configuration/File/Initial.php | 8 ++++++- .../Import/Configuration/File/Roles.php | 3 +-- config/csv.php | 14 +++++------ resources/lang/en_US/import.php | 8 +++---- 11 files changed, 45 insertions(+), 40 deletions(-) rename app/Import/Converter/{AmountDebet.php => AmountDebit.php} (93%) rename app/Import/Converter/{INGDebetCredit.php => INGDebitCredit.php} (87%) rename app/Import/Converter/{RabobankDebetCredit.php => RabobankDebitCredit.php} (91%) diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php index 9a57385d3e..d8c2736153 100644 --- a/app/Http/Controllers/Chart/ReportController.php +++ b/app/Http/Controllers/Chart/ReportController.php @@ -88,7 +88,7 @@ class ReportController extends Controller } /** - * Shows income and expense, debet/credit: operations. + * Shows income and expense, debit/credit: operations. * * @param Collection $accounts * @param Carbon $start @@ -143,7 +143,7 @@ class ReportController extends Controller } /** - * Shows sum income and expense, debet/credit: operations. + * Shows sum income and expense, debit/credit: operations. * * @param Carbon $start * @param Carbon $end diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 54a188de5d..db6c7fe744 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -102,7 +102,7 @@ class HomeController extends Controller */ public function displayDebug(Request $request) { - $phpVersion = PHP_VERSION; + $phpVersion = str_replace('~','\~',PHP_VERSION); $phpOs = php_uname(); $interface = PHP_SAPI; $now = Carbon::create()->format('Y-m-d H:i:s e'); diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.php index 5d6708c5be..e35604a0ba 100644 --- a/app/Import/Converter/Amount.php +++ b/app/Import/Converter/Amount.php @@ -25,7 +25,7 @@ namespace FireflyIII\Import\Converter; use Log; /** - * Class RabobankDebetCredit. + * Class Amount. */ class Amount implements ConverterInterface { diff --git a/app/Import/Converter/AmountDebet.php b/app/Import/Converter/AmountDebit.php similarity index 93% rename from app/Import/Converter/AmountDebet.php rename to app/Import/Converter/AmountDebit.php index f4c55153e4..46162ec484 100644 --- a/app/Import/Converter/AmountDebet.php +++ b/app/Import/Converter/AmountDebit.php @@ -1,6 +1,6 @@ $value]); + Log::debug('Going to convert ing debit credit', ['value' => $value]); if ('Af' === $value) { Log::debug('Return -1'); diff --git a/app/Import/Converter/RabobankDebetCredit.php b/app/Import/Converter/RabobankDebitCredit.php similarity index 91% rename from app/Import/Converter/RabobankDebetCredit.php rename to app/Import/Converter/RabobankDebitCredit.php index 626f457cca..242f4ca38f 100644 --- a/app/Import/Converter/RabobankDebetCredit.php +++ b/app/Import/Converter/RabobankDebitCredit.php @@ -1,6 +1,6 @@ amount, true))); - Log::debug(sprintf('debet amount is %s', var_export($this->amountDebet, true))); + Log::debug(sprintf('debit amount is %s', var_export($this->amountDebit, true))); Log::debug(sprintf('credit amount is %s', var_export($this->amountCredit, true))); if (null === $this->convertedAmount) { @@ -188,8 +188,8 @@ class ImportJournal case 'amount': $this->amount = $array; break; - case 'amount_debet': - $this->amountDebet = $array; + case 'amount_debit': + $this->amountDebit = $array; break; case 'amount_credit': $this->amountCredit = $array; @@ -250,8 +250,8 @@ class ImportJournal break; case '_ignore': break; - case 'ing-debet-credit': - case 'rabo-debet-credit': + case 'ing-debit-credit': + case 'rabo-debit-credit': $this->addToModifier($array); break; case 'opposing-iban': @@ -284,7 +284,7 @@ class ImportJournal /** * If convertedAmount is NULL, this method will try to calculate the correct amount. - * It starts with amount, but can be overruled by debet and credit amounts. + * It starts with amount, but can be overruled by debit and credit amounts. * * @throws FireflyException */ @@ -332,13 +332,13 @@ class ImportJournal $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amount['role']))); $info = $this->amount; } - if (!is_null($this->amountDebet)) { - Log::debug('Amount DEBET value is not NULL, assume this is the correct value (overrules Amount).'); - $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amountDebet['role']))); - $info = $this->amountDebet; + if (!is_null($this->amountDebit)) { + Log::debug('Amount DEBIT value is not NULL, assume this is the correct value (overrules Amount).'); + $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amountDebit['role']))); + $info = $this->amountDebit; } if (!is_null($this->amountCredit)) { - Log::debug('Amount CREDIT value is not NULL, assume this is the correct value (overrules Amount and AmountDebet).'); + Log::debug('Amount CREDIT value is not NULL, assume this is the correct value (overrules Amount and AmountDebit).'); $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amountCredit['role']))); $info = $this->amountCredit; } diff --git a/app/Support/Import/Configuration/File/Initial.php b/app/Support/Import/Configuration/File/Initial.php index b17090bd72..d41277d84c 100644 --- a/app/Support/Import/Configuration/File/Initial.php +++ b/app/Support/Import/Configuration/File/Initial.php @@ -35,7 +35,7 @@ use Log; class Initial implements ConfigurationInterface { /** - * @var + * @var ImportJob */ private $job; @@ -53,6 +53,11 @@ class Initial implements ConfigurationInterface 'tab' => trans('form.csv_tab'), ]; + // update job with default date format: + $config = $this->job->configuration; + $config['date-format'] = 'Ymd'; + $this->job->configuration = $config; + $this->job->save(); $specifics = []; // collect specifics. @@ -68,6 +73,7 @@ class Initial implements ConfigurationInterface 'specifix' => [], 'delimiters' => $delimiters, 'specifics' => $specifics, + ]; return $data; diff --git a/app/Support/Import/Configuration/File/Roles.php b/app/Support/Import/Configuration/File/Roles.php index fe270a12cc..466c0c515c 100644 --- a/app/Support/Import/Configuration/File/Roles.php +++ b/app/Support/Import/Configuration/File/Roles.php @@ -55,7 +55,6 @@ class Roles implements ConfigurationInterface { $config = $this->job->configuration; $content = $this->job->uploadFileContents(); - $config['has-headers'] = true; $headers = []; $offset = 0; // create CSV reader. @@ -272,7 +271,7 @@ class Roles implements ConfigurationInterface if ('_ignore' !== $role) { ++$assigned; } - if (in_array($role, ['amount', 'amount_credit', 'amount_debet'])) { + if (in_array($role, ['amount', 'amount_credit', 'amount_debit'])) { $hasAmount = true; } } diff --git a/config/csv.php b/config/csv.php index e580b36383..0677cc1f8b 100644 --- a/config/csv.php +++ b/config/csv.php @@ -175,16 +175,16 @@ return [ 'field' => 'budget', 'mapper' => 'Budgets', ], - 'rabo-debet-credit' => [ + 'rabo-debit-credit' => [ 'mappable' => false, 'pre-process-map' => false, - 'converter' => 'RabobankDebetCredit', + 'converter' => 'RabobankDebitCredit', 'field' => 'amount-modifier', ], - 'ing-debet-credit' => [ + 'ing-debit-credit' => [ 'mappable' => false, 'pre-process-map' => false, - 'converter' => 'INGDebetCredit', + 'converter' => 'INGDebitCredit', 'field' => 'amount-modifier', ], 'category-id' => [ @@ -280,11 +280,11 @@ return [ 'converter' => 'Amount', 'field' => 'amount', ], - 'amount_debet' => [ + 'amount_debit' => [ 'mappable' => false, 'pre-process-map' => false, - 'converter' => 'AmountDebet', - 'field' => 'amount_debet', + 'converter' => 'AmountDebit', + 'field' => 'amount_debit', ], 'amount_credit' => [ 'mappable' => false, diff --git a/resources/lang/en_US/import.php b/resources/lang/en_US/import.php index 709c5baddd..6fffe9a597 100644 --- a/resources/lang/en_US/import.php +++ b/resources/lang/en_US/import.php @@ -106,7 +106,7 @@ return [ 'column_account-id' => 'Asset account ID (matching Firefly)', 'column_account-name' => 'Asset account (name)', 'column_amount' => 'Amount', - 'column_amount_debet' => 'Amount (debet column)', + 'column_amount_debit' => 'Amount (debit column)', 'column_amount_credit' => 'Amount (credit column)', 'column_amount-comma-separated' => 'Amount (comma as decimal separator)', 'column_bill-id' => 'Bill ID (matching Firefly)', @@ -128,11 +128,11 @@ return [ 'column_opposing-id' => 'Opposing account ID (matching Firefly)', 'column_external-id' => 'External ID', 'column_opposing-name' => 'Opposing account (name)', - 'column_rabo-debet-credit' => 'Rabobank specific debet/credit indicator', - 'column_ing-debet-credit' => 'ING specific debet/credit indicator', + 'column_rabo-debit-credit' => 'Rabobank specific debit/credit indicator', + 'column_ing-debit-credit' => 'ING specific debit/credit indicator', 'column_sepa-ct-id' => 'SEPA Credit Transfer end-to-end ID', 'column_sepa-ct-op' => 'SEPA Credit Transfer opposing account', - 'column_sepa-db' => 'SEPA Direct Debet', + 'column_sepa-db' => 'SEPA Direct Debit', 'column_tags-comma' => 'Tags (comma separated)', 'column_tags-space' => 'Tags (space separated)', 'column_account-number' => 'Asset account (account number)',