mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 22:35:03 +00:00
Fix #2456
This commit is contained in:
@@ -54,6 +54,7 @@ class BillController extends Controller
|
||||
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function __construct()
|
||||
@@ -239,12 +240,23 @@ class BillController extends Controller
|
||||
*/
|
||||
public function rescan(Request $request, Bill $bill)
|
||||
{
|
||||
$total = 0;
|
||||
if (false === $bill->active) {
|
||||
$request->session()->flash('warning', (string)trans('firefly.cannot_scan_inactive_bill'));
|
||||
|
||||
return redirect(route('bills.show', [$bill->id]));
|
||||
}
|
||||
$set = new Collection;
|
||||
if (true === $bill->active) {
|
||||
$set = $this->billRepository->getRulesForBill($bill);
|
||||
$total = 0;
|
||||
}
|
||||
if (0 === $set->count()) {
|
||||
$request->session()->flash('error', (string)trans('firefly.no_rules_for_bill'));
|
||||
|
||||
return redirect(route('bills.show', [$bill->id]));
|
||||
}
|
||||
|
||||
foreach ($set as $rule) {
|
||||
// simply fire off all rules?
|
||||
/** @var TransactionMatcher $matcher */
|
||||
@@ -260,7 +272,6 @@ class BillController extends Controller
|
||||
|
||||
$request->session()->flash('success', (string)trans('firefly.rescanned_bill', ['total' => $total]));
|
||||
app('preferences')->mark();
|
||||
}
|
||||
|
||||
return redirect(route('bills.show', [$bill->id]));
|
||||
}
|
||||
@@ -325,6 +336,7 @@ class BillController extends Controller
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
|
@@ -551,7 +551,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
{
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($transactions as $transaction) {
|
||||
$journal = $transaction->transactionJournal;
|
||||
$journal = $bill->user->transactionJournals()->find((int)$transaction['transaction_journal_id']);
|
||||
$journal->bill_id = $bill->id;
|
||||
$journal->save();
|
||||
Log::debug(sprintf('Linked journal #%d to bill #%d', $journal->id, $bill->id));
|
||||
|
@@ -55,6 +55,7 @@ return [
|
||||
'new_withdrawal' => 'New withdrawal',
|
||||
'create_new_transaction' => 'Create new transaction',
|
||||
'new_transaction' => 'New transaction',
|
||||
'no_rules_for_bill' => 'This bill has no rules associated to it.',
|
||||
'go_to_asset_accounts' => 'View your asset accounts',
|
||||
'go_to_budgets' => 'Go to your budgets',
|
||||
'go_to_categories' => 'Go to your categories',
|
||||
|
Reference in New Issue
Block a user