mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Merge branch 'release/3.9.1'
This commit is contained in:
commit
10c7786248
@ -33,6 +33,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
private $uploadDisk;
|
private $uploadDisk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* AttachmentCollector constructor.
|
* AttachmentCollector constructor.
|
||||||
*
|
*
|
||||||
* @param ExportJob $job
|
* @param ExportJob $job
|
||||||
@ -44,6 +45,8 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
// make storage:
|
// make storage:
|
||||||
$this->uploadDisk = Storage::disk('upload');
|
$this->uploadDisk = Storage::disk('upload');
|
||||||
$this->exportDisk = Storage::disk('export');
|
$this->exportDisk = Storage::disk('export');
|
||||||
|
|
||||||
|
// todo needs work for new importer (potentially collect other types as well)
|
||||||
$this->expected = 'csv-upload-' . Auth::user()->id . '-';
|
$this->expected = 'csv-upload-' . Auth::user()->id . '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,10 +32,11 @@ class ConnectTransactionToPiggyBank
|
|||||||
*/
|
*/
|
||||||
public function handle(TransactionStored $event): bool
|
public function handle(TransactionStored $event): bool
|
||||||
{
|
{
|
||||||
echo '<pre>';
|
|
||||||
/** @var PiggyBankRepositoryInterface $repository */
|
/** @var PiggyBankRepositoryInterface $repository */
|
||||||
$repository = app(PiggyBankRepositoryInterface::class);
|
$repository = app(PiggyBankRepositoryInterface::class);
|
||||||
$transaction = $event->transaction;
|
$transaction = $event->transaction;
|
||||||
|
|
||||||
$piggyBank = $repository->find($transaction['piggy_bank_id']);
|
$piggyBank = $repository->find($transaction['piggy_bank_id']);
|
||||||
|
|
||||||
// valid piggy:
|
// valid piggy:
|
||||||
|
@ -34,6 +34,10 @@ class UpdateJournalConnection
|
|||||||
{
|
{
|
||||||
$journal = $event->journal;
|
$journal = $event->journal;
|
||||||
|
|
||||||
|
if (!$journal->isTransfer()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// get the event connected to this journal:
|
// get the event connected to this journal:
|
||||||
/** @var PiggyBankEvent $event */
|
/** @var PiggyBankEvent $event */
|
||||||
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
|
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
|
||||||
|
@ -13,7 +13,9 @@ namespace FireflyIII\Http\Controllers;
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||||
use FireflyIII\Http\Requests\CategoryFormRequest;
|
use FireflyIII\Http\Requests\CategoryFormRequest;
|
||||||
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
@ -157,11 +159,12 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param CRI $repository
|
* @param CRI $repository
|
||||||
|
* @param AccountCrudInterface $crud
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return \Illuminate\View\View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function show(CRI $repository, Category $category)
|
public function show(CRI $repository, AccountCrudInterface $crud, Category $category)
|
||||||
{
|
{
|
||||||
/** @var Carbon $carbon */
|
/** @var Carbon $carbon */
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
@ -205,12 +208,12 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$categoryCollection = new Collection([$category]);
|
$categoryCollection = new Collection([$category]);
|
||||||
$empty = new Collection;
|
$accounts = $crud->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
while ($end >= $start) {
|
while ($end >= $start) {
|
||||||
$end = Navigation::startOfPeriod($end, $range);
|
$end = Navigation::startOfPeriod($end, $range);
|
||||||
$currentEnd = Navigation::endOfPeriod($end, $range);
|
$currentEnd = Navigation::endOfPeriod($end, $range);
|
||||||
$spent = $repository->spentInPeriod($categoryCollection, $empty, $end, $currentEnd);
|
$spent = $repository->spentInPeriod($categoryCollection, $accounts, $end, $currentEnd);
|
||||||
$earned = $repository->earnedInPeriod($categoryCollection, $empty, $end, $currentEnd);
|
$earned = $repository->earnedInPeriod($categoryCollection, $accounts, $end, $currentEnd);
|
||||||
$dateStr = $end->format('Y-m-d');
|
$dateStr = $end->format('Y-m-d');
|
||||||
$dateName = Navigation::periodShow($end, $range);
|
$dateName = Navigation::periodShow($end, $range);
|
||||||
$entries->push([$dateStr, $dateName, $spent, $earned]);
|
$entries->push([$dateStr, $dateName, $spent, $earned]);
|
||||||
|
41
app/Http/Controllers/ImportController.php
Normal file
41
app/Http/Controllers/ImportController.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
|
use FireflyIII\Http\Requests;
|
||||||
|
use View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ImportController
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Http\Controllers
|
||||||
|
*/
|
||||||
|
class ImportController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
View::share('mainTitleIcon', 'fa-archive');
|
||||||
|
View::share('title', trans('firefly.import_data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$subTitle = trans('firefly.import_data_index');
|
||||||
|
$subTitleIcon = 'fa-home';
|
||||||
|
$importFileTypes = [];
|
||||||
|
$defaultImportType = config('firefly.default_import_format');
|
||||||
|
|
||||||
|
foreach (array_keys(config('firefly.import_formats')) as $type) {
|
||||||
|
$importFileTypes[$type] = trans('firefly.import_file_type_' . $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('import.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType'));
|
||||||
|
}
|
||||||
|
}
|
@ -270,7 +270,7 @@ class PiggyBankController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
|
public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
|
||||||
{
|
{
|
||||||
$amount = round(Input::get('amount'), 2);
|
$amount = strval(round(Input::get('amount'), 2));
|
||||||
|
|
||||||
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
|
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
|
||||||
|
|
||||||
|
@ -157,7 +157,6 @@ Route::group(
|
|||||||
Route::post('/categories/update/{category}', ['uses' => 'CategoryController@update', 'as' => 'categories.update']);
|
Route::post('/categories/update/{category}', ['uses' => 'CategoryController@update', 'as' => 'categories.update']);
|
||||||
Route::post('/categories/destroy/{category}', ['uses' => 'CategoryController@destroy', 'as' => 'categories.destroy']);
|
Route::post('/categories/destroy/{category}', ['uses' => 'CategoryController@destroy', 'as' => 'categories.destroy']);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSV controller
|
* CSV controller
|
||||||
*/
|
*/
|
||||||
@ -172,6 +171,7 @@ Route::group(
|
|||||||
|
|
||||||
Route::get('/csv/process', ['uses' => 'CsvController@process', 'as' => 'csv.process']);
|
Route::get('/csv/process', ['uses' => 'CsvController@process', 'as' => 'csv.process']);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Currency Controller
|
* Currency Controller
|
||||||
*/
|
*/
|
||||||
@ -235,6 +235,11 @@ Route::group(
|
|||||||
Route::get('/chart/report/in-out-sum/{reportType}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\ReportController@yearInOutSummarized']);
|
Route::get('/chart/report/in-out-sum/{reportType}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\ReportController@yearInOutSummarized']);
|
||||||
Route::get('/chart/report/net-worth/{reportType}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\ReportController@netWorth']);
|
Route::get('/chart/report/net-worth/{reportType}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\ReportController@netWorth']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMPORT CONTROLLER
|
||||||
|
*/
|
||||||
|
Route::get('/import', ['uses' => 'ImportController@index', 'as' => 'import.index']);
|
||||||
|
Route::post('/import/upload', ['uses' => 'ImportController@upload', 'as' => 'import.upload']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Help Controller
|
* Help Controller
|
||||||
|
@ -87,7 +87,8 @@ class General extends Twig_Extension
|
|||||||
'activeRoutePartial', function () : string {
|
'activeRoutePartial', function () : string {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$route = $args[0]; // name of the route.
|
$route = $args[0]; // name of the route.
|
||||||
if (!(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
|
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||||
|
if (!(strpos($name, $route) === false)) {
|
||||||
return 'active';
|
return 'active';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'chart' => 'chartjs',
|
'chart' => 'chartjs',
|
||||||
'version' => '3.9.0',
|
'version' => '3.9.1',
|
||||||
'csv_import_enabled' => true,
|
'csv_import_enabled' => true,
|
||||||
'maxUploadSize' => 5242880,
|
'maxUploadSize' => 5242880,
|
||||||
'allowedMimes' => ['image/png', 'image/jpeg', 'application/pdf'],
|
'allowedMimes' => ['image/png', 'image/jpeg', 'application/pdf'],
|
||||||
@ -15,7 +15,14 @@ return [
|
|||||||
'csv' => 'FireflyIII\Export\Exporter\CsvExporter',
|
'csv' => 'FireflyIII\Export\Exporter\CsvExporter',
|
||||||
// mt940 FireflyIII Export Exporter MtExporter
|
// mt940 FireflyIII Export Exporter MtExporter
|
||||||
],
|
],
|
||||||
|
'import_formats' => [
|
||||||
|
'csv' => 'FireflyIII\Import\Importer\CsvImporter',
|
||||||
|
// mt940 FireflyIII Import Importer MtImporter
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
'default_export_format' => 'csv',
|
'default_export_format' => 'csv',
|
||||||
|
'default_import_format' => 'csv',
|
||||||
'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
|
'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
|
||||||
|
|
||||||
'accountRoles' => [
|
'accountRoles' => [
|
||||||
|
52
resources/views/import/index.twig
Normal file
52
resources/views/import/index.twig
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{% extends "./layout/default.twig" %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
{{ Breadcrumbs.renderIfExists }}
|
||||||
|
{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
|
<!-- ACCOUNTS -->
|
||||||
|
<div class="box box-default">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">{{ 'import'|_ }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<p>
|
||||||
|
{{ 'import_intro_text'|_ }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
<div class="row">
|
||||||
|
<form method="POST" action="{{ route('import.upload') }}" accept-charset="UTF-8" class="form-horizontal" id="update"
|
||||||
|
enctype="multipart/form-data">
|
||||||
|
|
||||||
|
<input name="_token" type="hidden" value="{{ csrf_token() }}">
|
||||||
|
|
||||||
|
<div class="col-lg-6 col-md-8 col-sm-12 col-xs-12">
|
||||||
|
{{ ExpandedForm.file('import_file',{helpText: 'import_file_help'|_}) }}
|
||||||
|
|
||||||
|
{{ ExpandedForm.select('import_file_type', importFileTypes, defaultImportType, {'helpText' : 'import_file_type_help'|_}) }}
|
||||||
|
|
||||||
|
<div class="form-group" id="import_file_holder">
|
||||||
|
<label for="ffInput_submit" class="col-sm-4 control-label"> </label>
|
||||||
|
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<button type="submit" class="btn pull-right btn-success">
|
||||||
|
{{ ('import_start')|_ }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% block scripts %}
|
||||||
|
{% endblock %}
|
||||||
|
{% block styles %}
|
||||||
|
{% endblock %}
|
@ -111,14 +111,11 @@
|
|||||||
|
|
||||||
<!-- import and export -->
|
<!-- import and export -->
|
||||||
<li class="{{ activeRoutePartial('export') }} {{ activeRoutePartial('csv') }} treeview">
|
<li class="{{ activeRoutePartial('export') }} {{ activeRoutePartial('csv') }} treeview">
|
||||||
|
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<i class="fa fa-arrows-alt fa-fw"></i>
|
<i class="fa fa-arrows-alt fa-fw"></i>
|
||||||
<span>
|
<span>
|
||||||
{% if Config.get('firefly.csv_import_enabled') %}
|
|
||||||
{{ 'import_and_export'|_ }}
|
{{ 'import_and_export'|_ }}
|
||||||
{% else %}
|
|
||||||
{{ 'export_data'|_ }}
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
</span>
|
||||||
<i class="fa fa-angle-left pull-right"></i>
|
<i class="fa fa-angle-left pull-right"></i>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user