mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
Use custom report validator
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
f2fb5b43e3
commit
4d841dbc79
|
@ -23,6 +23,7 @@ use Input;
|
||||||
use League\Csv\Reader;
|
use League\Csv\Reader;
|
||||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
use League\Csv\EscapeFormula;
|
use League\Csv\EscapeFormula;
|
||||||
|
use App\Http\Requests\CustomAssetReportRequest;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -403,11 +404,12 @@ class ReportsController extends Controller
|
||||||
* @since [v1.0]
|
* @since [v1.0]
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function postCustom(Request $request)
|
public function postCustom(CustomAssetReportRequest $request)
|
||||||
{
|
{
|
||||||
ini_set('max_execution_time', env('REPORT_TIME_LIMIT', 12000)); //12000 seconds = 200 minutes
|
ini_set('max_execution_time', env('REPORT_TIME_LIMIT', 12000)); //12000 seconds = 200 minutes
|
||||||
$this->authorize('reports.view');
|
$this->authorize('reports.view');
|
||||||
|
|
||||||
|
|
||||||
\Debugbar::disable();
|
\Debugbar::disable();
|
||||||
$customfields = CustomField::get();
|
$customfields = CustomField::get();
|
||||||
$response = new StreamedResponse(function () use ($customfields, $request) {
|
$response = new StreamedResponse(function () use ($customfields, $request) {
|
||||||
|
@ -656,22 +658,22 @@ class ReportsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($request->filled('checkin_date_start'))) {
|
if (($request->filled('checkin_date_start'))) {
|
||||||
$assets->whereBetween('last_checkin', [
|
$assets->whereBetween('last_checkin', [
|
||||||
Carbon::parse($request->input('checkin_date_start'))->startOfDay(),
|
Carbon::parse($request->input('checkin_date_start'))->startOfDay(),
|
||||||
// use today's date is `checkin_date_end` is not provided
|
// use today's date is `checkin_date_end` is not provided
|
||||||
Carbon::parse($request->input('checkin_date_end', now()))->endOfDay(),
|
Carbon::parse($request->input('checkin_date_end', now()))->endOfDay(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) {
|
if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) {
|
||||||
$assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]);
|
$assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
|
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
|
||||||
$last_audit_start = \Carbon::parse($request->input('last_audit_start'))->startOfDay();
|
$last_audit_start = \Carbon::parse($request->input('last_audit_start'))->startOfDay();
|
||||||
$last_audit_end = \Carbon::parse($request->input('last_audit_end'))->endOfDay();
|
$last_audit_end = \Carbon::parse($request->input('last_audit_end'))->endOfDay();
|
||||||
|
|
||||||
$assets->whereBetween('assets.last_audit_date', [$last_audit_start, $last_audit_end]);
|
$assets->whereBetween('assets.last_audit_date', [$last_audit_start, $last_audit_end]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) {
|
if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) {
|
||||||
|
|
Loading…
Reference in a new issue