mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Merge branch 'develop' of https://github.com/snipe/snipe-it into develop
This commit is contained in:
commit
3138f45e8c
|
@ -95,7 +95,14 @@ class CustomFieldsController extends Controller
|
|||
$field = new CustomField;
|
||||
|
||||
$data = $request->all();
|
||||
$validator = Validator::make($data, $field->validationRules());
|
||||
$regex_format = null;
|
||||
|
||||
if (str_contains($data["format"], "regex:")){
|
||||
$regex_format = $data["format"];
|
||||
}
|
||||
|
||||
$validator = Validator::make($data, $field->validationRules($regex_format));
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, $validator->errors()));
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ class CustomField extends Model
|
|||
* @since [v4.1.10]
|
||||
* @return array
|
||||
*/
|
||||
public function validationRules()
|
||||
public function validationRules($regex_format = null)
|
||||
{
|
||||
return [
|
||||
"name" => "required|unique:custom_fields",
|
||||
|
@ -362,7 +362,7 @@ class CustomField extends Model
|
|||
Rule::in(['text', 'listbox', 'textarea', 'checkbox', 'radio'])
|
||||
],
|
||||
'format' => [
|
||||
Rule::in(array_merge(array_keys(CustomField::PREDEFINED_FORMATS), CustomField::PREDEFINED_FORMATS))
|
||||
Rule::in(array_merge(array_keys(CustomField::PREDEFINED_FORMATS), CustomField::PREDEFINED_FORMATS, [$regex_format]))
|
||||
],
|
||||
'field_encrypted' => "nullable|boolean"
|
||||
];
|
||||
|
|
|
@ -160,10 +160,10 @@
|
|||
<a href="{{ route('locations.edit', ['location' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-primary pull-left">{{ trans('admin/locations/table.update') }} </a>
|
||||
</div>
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<a href="{{ route('locations.print_assigned', ['location' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_assigned') }} </a>
|
||||
<a href="{{ route('locations.print_assigned', ['locationId' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_assigned') }} </a>
|
||||
</div>
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<a href="{{ route('locations.print_all_assigned', ['location' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_all_assigned') }} </a>
|
||||
<a href="{{ route('locations.print_all_assigned', ['locationId' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_all_assigned') }} </a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue