mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Repopulate report after validation error
This commit is contained in:
parent
d8d92a6d2c
commit
740d46a50e
|
@ -393,11 +393,18 @@ class ReportsController extends Controller
|
|||
$this->authorize('reports.view');
|
||||
$customfields = CustomField::get();
|
||||
$report_templates = ReportTemplate::orderBy('name')->get();
|
||||
$template = new ReportTemplate;
|
||||
|
||||
// Set the report's input values if we were redirected back with
|
||||
// validation errors so the report is populated as expected.
|
||||
if ($request->old()) {
|
||||
$template->options = $request->old();
|
||||
}
|
||||
|
||||
return view('reports/custom', [
|
||||
'customfields' => $customfields,
|
||||
'report_templates' => $report_templates,
|
||||
'reportTemplate' => new ReportTemplate,
|
||||
'reportTemplate' => $template,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,8 @@ class ReportTemplateTest extends TestCase
|
|||
// that selecting fields in the UI, then getting redirected
|
||||
// back after hitting the "Save Template" button without
|
||||
// a name set restores the previously selected values.
|
||||
|
||||
// Note: This functionality is implemented in getCustomReport().
|
||||
}
|
||||
|
||||
public function testSavingReportTemplateRequiresCorrectPermission()
|
||||
|
|
Loading…
Reference in a new issue