This commit is contained in:
James Cole
2019-09-23 17:11:01 +02:00
parent a1ae85660d
commit 3c8935c0a8
5 changed files with 24 additions and 1 deletions

View File

@@ -264,6 +264,9 @@ class BillController extends Controller
return redirect(route('bills.show', [$bill->id])); return redirect(route('bills.show', [$bill->id]));
} }
// unlink all journals:
$this->billRepository->unlinkAll($bill);
foreach ($set as $rule) { foreach ($set as $rule) {
// simply fire off all rules? // simply fire off all rules?
/** @var TransactionMatcher $matcher */ /** @var TransactionMatcher $matcher */

View File

@@ -686,4 +686,12 @@ class BillRepository implements BillRepositoryInterface
return $service->update($bill, $data); return $service->update($bill, $data);
} }
/**
* @param Bill $bill
*/
public function unlinkAll(Bill $bill): void
{
$this->user->transactionJournals()->where('bill_id', $bill->id)->update(['bill_id' => null]);
}
} }

View File

@@ -33,6 +33,12 @@ use Illuminate\Support\Collection;
*/ */
interface BillRepositoryInterface interface BillRepositoryInterface
{ {
/**
* @param Bill $bill
*/
public function unlinkAll(Bill $bill): void;
/** /**
* @param Bill $bill * @param Bill $bill
* *

View File

@@ -723,6 +723,7 @@ return [
// bills: // bills:
'match_between_amounts' => 'Bill matches transactions between :low and :high.', 'match_between_amounts' => 'Bill matches transactions between :low and :high.',
'running_again_loss' => 'Previously linked transactions to this bill may lose their connection, if they (no longer) match the rule(s).',
'bill_related_rules' => 'Rules related to this bill', 'bill_related_rules' => 'Rules related to this bill',
'repeats' => 'Repeats', 'repeats' => 'Repeats',
'connected_journals' => 'Connected transactions', 'connected_journals' => 'Connected transactions',

View File

@@ -88,7 +88,12 @@
{% endif %} {% endif %}
</div> </div>
<div class="box-footer"> <div class="box-footer">
<a id="billButtons" href="{{ route('bills.rescan',object.data.id) }}" class="btn btn-default">{{ 'rescan_old'|_ }}</a> <p><a id="billButtons" href="{{ route('bills.rescan',object.data.id) }}" class="btn btn-default">{{ 'rescan_old'|_ }}</a></p>
<p><small class="text-muted">
{{ 'running_again_loss'|_ }}
</small>
</p>
</div> </div>
</div> </div>
{% if object.data.notes %} {% if object.data.notes %}