Skip to content

Commit

Permalink
Merge branch 'snipe:master' into fixes/auto_asset_tag_phrasing
Browse files Browse the repository at this point in the history
  • Loading branch information
adagioajanes committed Dec 31, 2021
2 parents 5fe2083 + 2ee84c2 commit 87bb741
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/PredefinedKitsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function index(Request $request)

$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();
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Controllers/CustomFieldsetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
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.
*
Expand Down
50 changes: 42 additions & 8 deletions app/Http/Controllers/ModalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,49 @@

class ModalController extends Controller
{
function show($type, $itemId = null) {
$view = view("modals.${type}");

if($type == "statuslabel") {
$view->with('statuslabel_types', Helper::statusTypeList());
}
if(in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) {
$view->with('kitId', $itemId);
/**
* 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] [<[email protected]>]
* @author [A. Gianotto] [<[email protected]]
* @return View
*/
function show ($type, $itemId = null) {

// These values should correspond to a file in resources/views/modals/
$allowed_types = [
'category',
'kit-model',
'kit-license',
'kit-consumable',
'kit-accessory',
'location',
'manufacturer',
'model',
'statuslabel',
'supplier',
'upload-file',
'user',
];


if (in_array($type, $allowed_types)) {
$view = view("modals.${type}");

if ($type == "statuslabel") {
$view->with('statuslabel_types', Helper::statusTypeList());
}
if (in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) {
$view->with('kitId', $itemId);
}
return $view;
}
return $view;

abort(404,'Page not found');

}
}
4 changes: 2 additions & 2 deletions app/Http/Transformers/GroupsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
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)
Expand Down
4 changes: 2 additions & 2 deletions app/Models/Supplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ChangeSupplierAddressLength extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('suppliers', function (Blueprint $table) {
//
$table->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();
});
}
}

0 comments on commit 87bb741

Please sign in to comment.