mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
New code for updated import routine.
This commit is contained in:
@@ -36,7 +36,7 @@ class StageAhoyHandler
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
for ($i = 0; $i < 15; $i++) {
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
Log::debug(sprintf('Am now in stage AHOY hander, sleeping... (%d)', $i));
|
||||
sleep(1);
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace FireflyIII\Support\Import\Routine\Fake;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class StageFinalHandler
|
||||
*
|
||||
@@ -9,6 +11,18 @@ namespace FireflyIII\Support\Import\Routine\Fake;
|
||||
*/
|
||||
class StageFinalHandler
|
||||
{
|
||||
|
||||
private $job;
|
||||
|
||||
/**
|
||||
* @param mixed $job
|
||||
*/
|
||||
public function setJob($job): void
|
||||
{
|
||||
$this->job = $job;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -17,12 +31,92 @@ class StageFinalHandler
|
||||
$transactions = [];
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$transaction = [];
|
||||
$transaction = [
|
||||
'type' => 'withdrawal',
|
||||
'date' => Carbon::create()->format('Y-m-d'),
|
||||
'tags' => '',
|
||||
'user' => $this->job->user_id,
|
||||
|
||||
// all custom fields:
|
||||
'internal_reference' => null,
|
||||
'notes' => null,
|
||||
|
||||
// journal data:
|
||||
'description' => 'Some random description #' . random_int(1, 10000),
|
||||
'piggy_bank_id' => null,
|
||||
'piggy_bank_name' => null,
|
||||
'bill_id' => null,
|
||||
'bill_name' => null,
|
||||
|
||||
// transaction data:
|
||||
'transactions' => [
|
||||
[
|
||||
'currency_id' => null,
|
||||
'currency_code' => 'EUR',
|
||||
'description' => null,
|
||||
'amount' => random_int(500, 5000) / 100,
|
||||
'budget_id' => null,
|
||||
'budget_name' => null,
|
||||
'category_id' => null,
|
||||
'category_name' => null,
|
||||
'source_id' => null,
|
||||
'source_name' => 'Checking Account',
|
||||
'destination_id' => null,
|
||||
'destination_name' => 'Random expense account #' . random_int(1, 10000),
|
||||
'foreign_currency_id' => null,
|
||||
'foreign_currency_code' => null,
|
||||
'foreign_amount' => null,
|
||||
'reconciled' => false,
|
||||
'identifier' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$transactions[] = $transaction;
|
||||
}
|
||||
|
||||
// add a transfer I know exists already
|
||||
$transactions[] = [
|
||||
'type' => 'transfer',
|
||||
'date' => '2017-02-28',
|
||||
'tags' => '',
|
||||
'user' => $this->job->user_id,
|
||||
|
||||
// all custom fields:
|
||||
'internal_reference' => null,
|
||||
'notes' => null,
|
||||
|
||||
// journal data:
|
||||
'description' => 'Saving money for February',
|
||||
'piggy_bank_id' => null,
|
||||
'piggy_bank_name' => null,
|
||||
'bill_id' => null,
|
||||
'bill_name' => null,
|
||||
|
||||
// transaction data:
|
||||
'transactions' => [
|
||||
[
|
||||
'currency_id' => null,
|
||||
'currency_code' => 'EUR',
|
||||
'description' => null,
|
||||
'amount' => '140',
|
||||
'budget_id' => null,
|
||||
'budget_name' => null,
|
||||
'category_id' => null,
|
||||
'category_name' => null,
|
||||
'source_id' => 1,
|
||||
'source_name' => 'Checking Account',
|
||||
'destination_id' => 2,
|
||||
'destination_name' => null,
|
||||
'foreign_currency_id' => null,
|
||||
'foreign_currency_code' => null,
|
||||
'foreign_amount' => null,
|
||||
'reconciled' => false,
|
||||
'identifier' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
return $transactions;
|
||||
|
||||
|
@@ -36,7 +36,7 @@ class StageNewHandler
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
for ($i = 0; $i < 15; $i++) {
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
Log::debug(sprintf('Am now in stage new hander, sleeping... (%d)', $i));
|
||||
sleep(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user