diff --git a/app/Http/Controllers/Api/PredefinedKitsController.php b/app/Http/Controllers/Api/PredefinedKitsController.php index 6d6f2797f..73936e4c9 100644 --- a/app/Http/Controllers/Api/PredefinedKitsController.php +++ b/app/Http/Controllers/Api/PredefinedKitsController.php @@ -31,8 +31,8 @@ class PredefinedKitsController extends Controller $offset = $request->input('offset', 0); $limit = $request->input('limit', 50); - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'assets_count'; + $order = $request->input('order') === 'desc' ? 'desc' : 'asc'; + $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'name'; $kits->orderBy($sort, $order); $total = $kits->count(); diff --git a/app/Http/Controllers/CustomFieldsetsController.php b/app/Http/Controllers/CustomFieldsetsController.php index f48493132..17077ebba 100644 --- a/app/Http/Controllers/CustomFieldsetsController.php +++ b/app/Http/Controllers/CustomFieldsetsController.php @@ -23,6 +23,12 @@ use Redirect; class CustomFieldsetsController extends Controller { + public function index() + { + return redirect()->route("fields.index") + ->with("error", trans('admin/custom_fields/message.fieldset.does_not_exist')); + } + /** * Validates and stores a new custom field. * diff --git a/app/Http/Controllers/ModalController.php b/app/Http/Controllers/ModalController.php index 61a3cf10b..9d89c6154 100644 --- a/app/Http/Controllers/ModalController.php +++ b/app/Http/Controllers/ModalController.php @@ -6,15 +6,49 @@ use App\Helpers\Helper; class ModalController extends Controller { - function show($type, $itemId = null) { - $view = view("modals.${type}"); - if($type == "statuslabel") { - $view->with('statuslabel_types', Helper::statusTypeList()); + /** + * Load the modal views after confirming they are in the allowed_types array. + * The allowed types away just prevents shithead skiddies from fuzzing the urls + * with automated scripts and junking up the logs. - snipe + * + * @version v5.3.7-pre + * @author [Brady Wetherington] [] + * @author [A. Gianotto] [with('statuslabel_types', Helper::statusTypeList()); + } + if (in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) { + $view->with('kitId', $itemId); + } + return $view; } - if(in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) { - $view->with('kitId', $itemId); - } - return $view; + + abort(404,'Page not found'); + } } diff --git a/app/Http/Transformers/GroupsTransformer.php b/app/Http/Transformers/GroupsTransformer.php index 8f116aad7..34ee83c72 100644 --- a/app/Http/Transformers/GroupsTransformer.php +++ b/app/Http/Transformers/GroupsTransformer.php @@ -9,13 +9,13 @@ use Illuminate\Database\Eloquent\Collection; class GroupsTransformer { - public function transformGroups (Collection $groups) + public function transformGroups (Collection $groups, $total = null) { $array = array(); foreach ($groups as $group) { $array[] = self::transformGroup($group); } - return (new DatatablesTransformer)->transformDatatables($array); + return (new DatatablesTransformer)->transformDatatables($array, $total); } public function transformGroup (Group $group) diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index 230a713cd..b904f8834 100755 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -14,8 +14,8 @@ class Supplier extends SnipeModel protected $rules = array( 'name' => 'required|min:1|max:255|unique_undeleted', - 'address' => 'max:50|nullable', - 'address2' => 'max:50|nullable', + 'address' => 'max:250|nullable', + 'address2' => 'max:250|nullable', 'city' => 'max:255|nullable', 'state' => 'max:32|nullable', 'country' => 'max:3|nullable', diff --git a/database/migrations/2021_12_27_151849_change_supplier_address_length.php b/database/migrations/2021_12_27_151849_change_supplier_address_length.php new file mode 100644 index 000000000..db31b9b3a --- /dev/null +++ b/database/migrations/2021_12_27_151849_change_supplier_address_length.php @@ -0,0 +1,36 @@ +string('address', 250)->nullable()->change(); + $table->string('address2', 250)->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('suppliers', function (Blueprint $table) { + // + $table->text('address', 50)->nullable()->default(null)->change(); + $table->text('address2', 50)->nullable()->default(null)->change(); + }); + } +}