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;
|
||||
|
||||
/**
|
||||
*
|
||||
* AttachmentCollector constructor.
|
||||
*
|
||||
* @param ExportJob $job
|
||||
@ -44,6 +45,8 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
||||
// make storage:
|
||||
$this->uploadDisk = Storage::disk('upload');
|
||||
$this->exportDisk = Storage::disk('export');
|
||||
|
||||
// todo needs work for new importer (potentially collect other types as well)
|
||||
$this->expected = 'csv-upload-' . Auth::user()->id . '-';
|
||||
}
|
||||
|
||||
|
@ -32,10 +32,11 @@ class ConnectTransactionToPiggyBank
|
||||
*/
|
||||
public function handle(TransactionStored $event): bool
|
||||
{
|
||||
echo '<pre>';
|
||||
|
||||
/** @var PiggyBankRepositoryInterface $repository */
|
||||
$repository = app(PiggyBankRepositoryInterface::class);
|
||||
$transaction = $event->transaction;
|
||||
|
||||
$piggyBank = $repository->find($transaction['piggy_bank_id']);
|
||||
|
||||
// valid piggy:
|
||||
|
@ -34,6 +34,10 @@ class UpdateJournalConnection
|
||||
{
|
||||
$journal = $event->journal;
|
||||
|
||||
if (!$journal->isTransfer()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// get the event connected to this journal:
|
||||
/** @var PiggyBankEvent $event */
|
||||
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
|
||||
|
@ -13,7 +13,9 @@ namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Http\Requests\CategoryFormRequest;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
@ -156,12 +158,13 @@ class CategoryController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CRI $repository
|
||||
* @param Category $category
|
||||
* @param CRI $repository
|
||||
* @param AccountCrudInterface $crud
|
||||
* @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 */
|
||||
$range = Preferences::get('viewRange', '1M')->data;
|
||||
@ -205,12 +208,12 @@ class CategoryController extends Controller
|
||||
|
||||
|
||||
$categoryCollection = new Collection([$category]);
|
||||
$empty = new Collection;
|
||||
$accounts = $crud->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
while ($end >= $start) {
|
||||
$end = Navigation::startOfPeriod($end, $range);
|
||||
$currentEnd = Navigation::endOfPeriod($end, $range);
|
||||
$spent = $repository->spentInPeriod($categoryCollection, $empty, $end, $currentEnd);
|
||||
$earned = $repository->earnedInPeriod($categoryCollection, $empty, $end, $currentEnd);
|
||||
$spent = $repository->spentInPeriod($categoryCollection, $accounts, $end, $currentEnd);
|
||||
$earned = $repository->earnedInPeriod($categoryCollection, $accounts, $end, $currentEnd);
|
||||
$dateStr = $end->format('Y-m-d');
|
||||
$dateName = Navigation::periodShow($end, $range);
|
||||
$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)
|
||||
{
|
||||
$amount = round(Input::get('amount'), 2);
|
||||
$amount = strval(round(Input::get('amount'), 2));
|
||||
|
||||
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
|
||||
|
||||
|
@ -157,7 +157,6 @@ Route::group(
|
||||
Route::post('/categories/update/{category}', ['uses' => 'CategoryController@update', 'as' => 'categories.update']);
|
||||
Route::post('/categories/destroy/{category}', ['uses' => 'CategoryController@destroy', 'as' => 'categories.destroy']);
|
||||
|
||||
|
||||
/**
|
||||
* CSV controller
|
||||
*/
|
||||
@ -169,9 +168,10 @@ Route::group(
|
||||
Route::get('/csv/download-config', ['uses' => 'CsvController@downloadConfig', 'as' => 'csv.download-config']);
|
||||
Route::get('/csv/download', ['uses' => 'CsvController@downloadConfigPage', 'as' => 'csv.download-config-page']);
|
||||
Route::post('/csv/save_mapping', ['uses' => 'CsvController@saveMapping', 'as' => 'csv.save_mapping']);
|
||||
|
||||
|
||||
Route::get('/csv/process', ['uses' => 'CsvController@process', 'as' => 'csv.process']);
|
||||
|
||||
|
||||
/**
|
||||
* 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/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
|
||||
|
@ -87,7 +87,8 @@ class General extends Twig_Extension
|
||||
'activeRoutePartial', function () : string {
|
||||
$args = func_get_args();
|
||||
$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';
|
||||
}
|
||||
|
||||
|
@ -4,18 +4,25 @@ declare(strict_types = 1);
|
||||
|
||||
return [
|
||||
'chart' => 'chartjs',
|
||||
'version' => '3.9.0',
|
||||
'version' => '3.9.1',
|
||||
'csv_import_enabled' => true,
|
||||
'maxUploadSize' => 5242880,
|
||||
'allowedMimes' => ['image/png', 'image/jpeg', 'application/pdf'],
|
||||
'resend_confirmation' => 3600,
|
||||
'confirmation_age' => 14400, // four hours
|
||||
|
||||
'export_formats' => [
|
||||
'export_formats' => [
|
||||
'csv' => 'FireflyIII\Export\Exporter\CsvExporter',
|
||||
// mt940 FireflyIII Export Exporter MtExporter
|
||||
],
|
||||
'import_formats' => [
|
||||
'csv' => 'FireflyIII\Import\Importer\CsvImporter',
|
||||
// mt940 FireflyIII Import Importer MtImporter
|
||||
],
|
||||
|
||||
|
||||
'default_export_format' => 'csv',
|
||||
'default_import_format' => 'csv',
|
||||
'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
|
||||
|
||||
'accountRoles' => [
|
||||
@ -103,7 +110,7 @@ return [
|
||||
|
||||
],
|
||||
|
||||
'bindables' => [
|
||||
'bindables' => [
|
||||
// models
|
||||
'account' => 'FireflyIII\Models\Account',
|
||||
'attachment' => 'FireflyIII\Models\Attachment',
|
||||
|
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 -->
|
||||
<li class="{{ activeRoutePartial('export') }} {{ activeRoutePartial('csv') }} treeview">
|
||||
|
||||
<a href="#">
|
||||
<i class="fa fa-arrows-alt fa-fw"></i>
|
||||
<span>
|
||||
{% if Config.get('firefly.csv_import_enabled') %}
|
||||
{{ 'import_and_export'|_ }}
|
||||
{% else %}
|
||||
{{ 'export_data'|_ }}
|
||||
{% endif %}
|
||||
{{ 'import_and_export'|_ }}
|
||||
</span>
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user