These routines fix #477

This commit is contained in:
James Cole
2016-12-19 21:07:22 +01:00
parent fc0ad622eb
commit 116e19ec06
6 changed files with 61 additions and 23 deletions

View File

@@ -99,13 +99,20 @@ class BillController extends Controller
*/
public function destroy(BillRepositoryInterface $repository, Bill $bill)
{
$name = $bill->name;
$name = $bill->name;
$billId = $bill->id;
$repository->destroy($bill);
Session::flash('success', strval(trans('firefly.deleted_bill', ['name' => $name])));
Preferences::mark();
return redirect(session('bills.delete.url'));
$uri = session('bills.delete.url');
if (!(strpos($uri, sprintf('bills/show/%s', $billId)) === false)) {
// uri would point back to bill
$uri = route('bills.index');
}
return redirect($uri);
}
/**