Fix integrity constraint violation on sqlite.

If the requestable checkbox was not checked, it did not exist in the request.
Setting requestable to null in such a case would cause a violation because it should be 0/1.

Also fix a copy/paste where we reset requestable after checking for rtd_location_id.
This commit is contained in:
Daniel Meltzer 2016-06-27 23:16:03 -04:00
parent 2867cd523d
commit d3b035cfe9

View file

@ -352,16 +352,13 @@ class AssetsController extends Controller
$asset->supplier_id = null;
}
if ($request->has('requestable')) {
$asset->requestable = e($request->input('requestable'));
} else {
$asset->requestable = null;
}
// If the box isn't checked, it's not in the request at all.
$asset->requestable = $request->has('requestable');
if ($request->has('rtd_location_id')) {
$asset->rtd_location_id = e($request->input('rtd_location_id'));
} else {
$asset->requestable = null;
$asset->rtd_location_id = null;
}
if ($request->has('image_delete')) {