mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
rm validation stuff
This commit is contained in:
parent
b6fa6cba22
commit
ad0f873ece
|
@ -585,16 +585,6 @@ class AssetsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($field->element == 'checkbox') {
|
if ($field->element == 'checkbox') {
|
||||||
if ($field->field_encrypted) {
|
|
||||||
// to not break a bunch of stuff, we must decrypt + implode if the checkbox value is an array
|
|
||||||
$field_val_decrypt = Crypt::decrypt($field_val);
|
|
||||||
if (is_array($field_val_decrypt)) {
|
|
||||||
$field_val_decrypt_imploded = implode(',', $field_val_decrypt);
|
|
||||||
$field_val = Crypt::encrypt($field_val_decrypt_imploded);
|
|
||||||
} else
|
|
||||||
$field_val = Crypt::encrypt($field_val_decrypt);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(is_array($field_val)) {
|
if(is_array($field_val)) {
|
||||||
$field_val = implode(',', $field_val);
|
$field_val = implode(',', $field_val);
|
||||||
}
|
}
|
||||||
|
@ -670,24 +660,12 @@ class AssetsController extends Controller
|
||||||
$field_val = $request->input($field->db_column, null);
|
$field_val = $request->input($field->db_column, null);
|
||||||
|
|
||||||
if ($request->has($field->db_column)) {
|
if ($request->has($field->db_column)) {
|
||||||
//if ($field->field_encrypted) {
|
|
||||||
// // to not break a bunch of stuff, we must decrypt + implode if the checkbox value is an array
|
|
||||||
// $field_val_decrypt = Crypt::decrypt($field_val);
|
|
||||||
// if (is_array($field_val_decrypt)) {
|
|
||||||
// $field_val_decrypt_imploded = implode(',', $field_val_decrypt);
|
|
||||||
// $field_val = Crypt::encrypt($field_val_decrypt_imploded);
|
|
||||||
// } else
|
|
||||||
// $field_val = Crypt::encrypt($field_val_decrypt);
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
if ($field->field_encrypted == '1') {
|
if ($field->field_encrypted == '1') {
|
||||||
if (Gate::allows('admin')) {
|
if (Gate::allows('admin')) {
|
||||||
$asset->{$field->db_column} = Crypt::encrypt($field_val);
|
$asset->{$field->db_column} = Crypt::encrypt($field_val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($field->element == 'checkbox') {
|
if ($field->element == 'checkbox') {
|
||||||
|
|
||||||
if(is_array($field_val)) {
|
if(is_array($field_val)) {
|
||||||
$field_val = implode(',', $field_val);
|
$field_val = implode(',', $field_val);
|
||||||
$asset->{$field->db_column} = $field_val;
|
$asset->{$field->db_column} = $field_val;
|
||||||
|
|
|
@ -304,14 +304,6 @@ class ValidationServiceProvider extends ServiceProvider
|
||||||
$field = CustomField::where('db_column', $attribute)->first();
|
$field = CustomField::where('db_column', $attribute)->first();
|
||||||
$options = $field->formatFieldValuesAsArray();
|
$options = $field->formatFieldValuesAsArray();
|
||||||
|
|
||||||
// temporarily decrypt for validation
|
|
||||||
// so, this is breaking patches, i don't really get why.
|
|
||||||
// is it not encrypted here on an update? need to do more testing. :(
|
|
||||||
if($field->field_encrypted) {
|
|
||||||
$value = Crypt::decrypt($value);
|
|
||||||
}
|
|
||||||
dump(is_array($value));
|
|
||||||
|
|
||||||
if(is_array($value)) {
|
if(is_array($value)) {
|
||||||
$invalid = array_diff($value, $options);
|
$invalid = array_diff($value, $options);
|
||||||
if(count($invalid) > 0) {
|
if(count($invalid) > 0) {
|
||||||
|
|
Loading…
Reference in a new issue