Skip to content

A free open source IT asset/license management system

Merge remote-tracking branch 'origin/master' into develop

snipef2f8f969919e
diff --cc app/Http/Controllers/Api/AssetsController.php
index b1337c45b2,a9362188c1..cdf37a903c
--- a/app/Http/Controllers/Api/AssetsController.php
+++ b/app/Http/Controllers/Api/AssetsController.php
@@@ -367,15 -370,20 +369,25 @@@ class AssetsController extends Controll
public function showBySerial(Request $request, $serial)
{
$this->authorize('index', Asset::class);
+ if ($assets = Asset::with('assetstatus')->with('assignedTo')
+ ->withTrashed()->where('serial', $serial)->get()) {
+ return (new AssetsTransformer)->transformAssets($assets, $assets->count());
+ }
+ return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
+ $assets = Asset::with('assetstatus')->with('assignedTo');
+ if ($request->input('deleted', 'false') === 'true') {
+ $assets = $assets->withTrashed();
- }
+ }
+ $assets = $assets->where('serial', $serial)->get();
+ if ($assets) {
+ return (new AssetsTransformer)->transformAssets($assets, $assets->count());
+ } else {
+ return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
+ }
+ }
/**
* Returns JSON with information about an asset for detail view.
diff --cc app/Http/Transformers/AssetsTransformer.php
index 8af6f62c64,c323241cf0..c8a187a354
--- a/app/Http/Transformers/AssetsTransformer.php
+++ b/app/Http/Transformers/AssetsTransformer.php
@@@ -114,24 -114,14 +114,13 @@@ class AssetsTransforme
}
$permissions_array['available_actions'] = [
- 'checkout' => Gate::allows('checkout', Asset::class),
- 'checkin' => Gate::allows('checkin', Asset::class),
- 'clone' => false,
- 'restore' => false,
- 'update' => (bool) Gate::allows('update', Asset::class),
- 'delete' => ($asset->assigned_to == '' && Gate::allows('delete', Asset::class)),
- ];
-
- if ($asset->deleted_at != '') {
- $permissions_array['available_actions'] = [
- 'checkout' => true,
- 'checkin' => false,
- 'clone' => Gate::allows('create', Asset::class),
- 'restore' => Gate::allows('create', Asset::class),
- 'update' => false,
- 'delete' => false,
- ];
- }
+ 'checkout' => ($asset->deleted_at=='' && Gate::allows('checkout', Asset::class)) ? true : false,
+ 'checkin' => ($asset->deleted_at=='' && Gate::allows('checkin', Asset::class)) ? true : false,
+ 'clone' => Gate::allows('create', Asset::class) ? true : false,
+ 'restore' => ($asset->deleted_at!='' && Gate::allows('create', Asset::class)) ? true : false,
+ 'update' => ($asset->deleted_at=='' && Gate::allows('update', Asset::class)) ? true : false,
+ 'delete' => ($asset->deleted_at=='' && $asset->assigned_to =='' && Gate::allows('delete', Asset::class)) ? true : false,
- ];
-
++ ];
if (request('components')=='true') {
diff --cc app/Importer/Importer.php
index f80b869d54,352caf849d..f5b0ae44da
--- a/app/Importer/Importer.php
+++ b/app/Importer/Importer.php
@@@ -196,11 -195,12 +197,11 @@@ abstract class Importe
$val = $default;
$key = $this->lookupCustomKey($key);
- // $this->log("Custom Key: ${key}");
+ $this->log("Custom Key: ${key}");
if (array_key_exists($key, $array)) {
- $val = Encoding::toUTF8(trim($array[ $key ]));
+ $val = Encoding::toUTF8(trim($array[$key]));
}
- // $this->log("${key}: ${val}");
+ $this->log("${key}: ${val}");
return $val;
}
diff --cc app/Models/Consumable.php
index 2d456e12c4,a2fcaed839..13591123d7
--- a/app/Models/Consumable.php
+++ b/app/Models/Consumable.php
@@@ -68,7 -68,8 +68,8 @@@ class Consumable extends SnipeMode
'purchase_cost',
'purchase_date',
'qty',
+ 'min_amt',
- 'requestable'
+ 'requestable',
];
use Searchable;
@@@ -182,9 -184,10 +183,10 @@@
*/
public function category()
{
- return $this->belongsTo('\App\Models\Category', 'category_id');
+ return $this->belongsTo(\App\Models\Category::class, 'category_id');
}
+
/**
* Establishes the component -> action logs relationship
*
@@@ -222,9 -224,10 +224,10 @@@
*/
public function users()
{
- return $this->belongsToMany('\App\Models\User', 'consumables_users', 'consumable_id', 'assigned_to')->withPivot('user_id')->withTrashed()->withTimestamps();
+ return $this->belongsToMany(\App\Models\User::class, 'consumables_users', 'consumable_id', 'assigned_to')->withPivot('user_id')->withTrashed()->withTimestamps();
}
+
/**
* Determine whether to send a checkin/checkout email based on
* asset model category
diff --cc config/version.php
index 008ac13252,6d1935fcf6..3922390ee8
--- a/config/version.php
+++ b/config/version.php
@@@ -1,10 -1,10 +1,10 @@@
<?php
return array (
- 'app_version' => 'v5.3.1',
- 'full_app_version' => 'v5.3.1 - build 6490-g6690a0f1d',
- 'build_version' => '6490',
+ 'app_version' => 'v6-pre-alpha',
+ 'full_app_version' => 'v6-pre-alpha - build 6109-gace7abc1a',
+ 'build_version' => '6109',
'prerelease_version' => '',
- 'hash_version' => 'g6690a0f1d',
- 'full_hash' => 'v5.3.1-19-g6690a0f1d',
- 'branch' => 'master',
-);
+ 'hash_version' => 'gace7abc1a',
+ 'full_hash' => 'v6-pre-alpha-71-gace7abc1a',
+ 'branch' => 'develop-v6-integration',
- );
++);
diff --cc package.json
index 08a18509fb,9223278168..0437ad44ef
--- a/package.json
+++ b/package.json
@@@ -1,57 -1,58 +1,57 @@@
{
- "private": true,
- "scripts": {
- "dev": "npm run development",
- "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
- "watch": "npm run development -- --watch",
- "watch-poll": "npm run watch -- --watch-poll",
- "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
- "prod": "npm run production",
- "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
- },
- "engines": {
- "node": ">=0.12"
- },
- "devDependencies": {
- "axios": "^0.20.0",
- "babel-preset-latest": "^6.24.1",
- "cross-env": "^7.0",
- "jquery": "^3.5.1",
- "laravel-mix": "^5.0.1",
- "lodash": "^4.17.20",
- "vue": "2.4.4",
- "vue-loader": "^15.9.6",
- "vue-template-compiler": "2.4.4"
- },
- "dependencies": {
- "@fortawesome/fontawesome-free": "^5.15.1",
- "admin-lte": "^2.4.18",
- "ajv": "^6.12.6",
- "blueimp-file-upload": "^9.34.0",
- "bootstrap": "^3.4.1",
- "bootstrap-colorpicker": "^2.5.3",
- "bootstrap-datepicker": "^1.9.0",
- "bootstrap-less": "^3.3.8",
- "bootstrap-table": "^1.19.1",
- "chart.js": "^2.9.4",
- "css-loader": "^3.6.0",
- "ekko-lightbox": "^5.1.1",
- "font-awesome": "^4.7.0",
- "icheck": "^1.0.2",
- "imagemin": "^5.3.1",
- "jquery-form-validator": "^2.3.79",
- "jquery-slimscroll": "^1.3.8",
+ "private": true,
+ "scripts": {
+ "dev": "npm run development",
+ "development": "mix",
+ "watch": "mix watch",
+ "watch-poll": "mix watch -- --watch-options-poll=1000",
+ "hot": "mix watch --hot",
+ "prod": "npm run production",
+ "production": "mix --production"
+ },
+ "engines": {
+ "node": ">=0.12"
+ },
+ "devDependencies": {
+ "@fortawesome/fontawesome-free": "^5.15.4",
+ "axios": "^0.20.0",
+ "babel-preset-latest": "^6.24.1",
+ "jquery": "^3.6.0",
+ "laravel-mix": "^6.0.12",
+ "lodash": "^4.17.20",
+ "postcss": "^8.2.8",
+ "vue": "2.4.4",
+ "vue-loader": "^15.9.7",
+ "vue-template-compiler": "2.4.4"
+ },
+ "dependencies": {
+ "admin-lte": "^2.4.18",
+ "ajv": "^6.12.6",
+ "blueimp-file-upload": "^9.34.0",
+ "bootstrap": "^3.4.1",
+ "bootstrap-colorpicker": "^2.5.3",
+ "bootstrap-datepicker": "^1.9.0",
+ "bootstrap-less": "^3.3.8",
- "bootstrap-table": "^1.18.3",
++ "bootstrap-table": "^1.19.1",
+ "chart.js": "^2.9.4",
+ "css-loader": "^3.6.0",
+ "ekko-lightbox": "^5.1.1",
+ "font-awesome": "^4.7.0",
+ "icheck": "^1.0.2",
+ "imagemin": "^5.3.1",
+ "jquery-form-validator": "^2.3.79",
+ "jquery-slimscroll": "^1.3.8",
- "jquery-ui": "^1.12.1",
+ "jquery-ui": "^1.13.0",
- "jquery-ui-bundle": "^1.12.1",
- "jquery.iframe-transport": "^1.0.0",
- "less": "^3.13.1",
- "less-loader": "^4.1.0",
- "list.js": "^1.5.0",
- "papaparse": "^4.3.3",
- "phantomjs": "^2.1.7",
- "select2": "4.0.13",
- "sheetjs": "^2.0.0",
- "tableexport.jquery.plugin": "=1.10.21",
- "tether": "^1.4.0",
- "vue-resource": "^1.3.3"
- }
+ "jquery-ui-bundle": "^1.12.1",
+ "jquery.iframe-transport": "^1.0.0",
+ "less": "^4.1.1",
+ "less-loader": "^5.0.0",
+ "list.js": "^1.5.0",
+ "papaparse": "^4.3.3",
+ "select2": "4.0.13",
+ "sheetjs": "^2.0.0",
+ "tableexport.jquery.plugin": "^1.10.26",
+ "tether": "^1.4.0",
+ "vue-resource": "^1.5.2"
+ }
}
diff --cc resources/views/layouts/default.blade.php
index 0138a61923,239b6dcf8e..ac0f297e74
--- a/resources/views/layouts/default.blade.php
+++ b/resources/views/layouts/default.blade.php
@@@ -355,10 -354,17 +355,17 @@@
@endcan
<li class="divider"></li>
<li>
- <a href="{{ url('/logout') }}">
- <i class="fas fa-sign-out-alt" aria-hidden="true"></i>
- {{ trans('general.logout') }}
+
+ <a href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
+ <i class="fa fa-sign-out fa-fw"></i> {{ trans('general.logout') }}
+ {{ csrf_field() }}
- </a>
+ </a>
+
+ <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
+ {{ csrf_field() }}
+ </form>
+
+
</li>
</ul>
</li>
@@@ -947,6 -933,6 +954,7 @@@
@endif
+
+ @livewireScripts
</body>
</html>