Compare commits
5 Commits
proper-dar
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89a232ae14 | ||
|
|
6eaefa0bdd | ||
|
|
a272bdc796 | ||
|
|
416b32cbc8 | ||
|
|
b3996f1970 |
@@ -137,6 +137,8 @@ PUBLIC_AWS_ACCESS_KEY_ID=null
|
|||||||
PUBLIC_AWS_DEFAULT_REGION=null
|
PUBLIC_AWS_DEFAULT_REGION=null
|
||||||
PUBLIC_AWS_BUCKET=null
|
PUBLIC_AWS_BUCKET=null
|
||||||
PUBLIC_AWS_URL=null
|
PUBLIC_AWS_URL=null
|
||||||
|
PUBLIC_AWS_ENDPOINT=null
|
||||||
|
PUBLIC_AWS_PATH_STYLE=null
|
||||||
PUBLIC_AWS_BUCKET_ROOT=null
|
PUBLIC_AWS_BUCKET_ROOT=null
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
@@ -147,6 +149,8 @@ PRIVATE_AWS_SECRET_ACCESS_KEY=null
|
|||||||
PRIVATE_AWS_DEFAULT_REGION=null
|
PRIVATE_AWS_DEFAULT_REGION=null
|
||||||
PRIVATE_AWS_BUCKET=null
|
PRIVATE_AWS_BUCKET=null
|
||||||
PRIVATE_AWS_URL=null
|
PRIVATE_AWS_URL=null
|
||||||
|
PRIVATE_AWS_ENDPOINT=null
|
||||||
|
PRIVATE_AWS_PATH_STYLE=null
|
||||||
PRIVATE_AWS_BUCKET_ROOT=null
|
PRIVATE_AWS_BUCKET_ROOT=null
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ PUBLIC_AWS_ACCESS_KEY_ID=null
|
|||||||
PUBLIC_AWS_DEFAULT_REGION=null
|
PUBLIC_AWS_DEFAULT_REGION=null
|
||||||
PUBLIC_AWS_BUCKET=null
|
PUBLIC_AWS_BUCKET=null
|
||||||
PUBLIC_AWS_URL=null
|
PUBLIC_AWS_URL=null
|
||||||
|
PUBLIC_AWS_ENDPOINT=null
|
||||||
|
PUBLIC_AWS_PATH_STYLE=null
|
||||||
PUBLIC_AWS_BUCKET_ROOT=null
|
PUBLIC_AWS_BUCKET_ROOT=null
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
@@ -154,6 +156,8 @@ PRIVATE_AWS_SECRET_ACCESS_KEY=null
|
|||||||
PRIVATE_AWS_DEFAULT_REGION=null
|
PRIVATE_AWS_DEFAULT_REGION=null
|
||||||
PRIVATE_AWS_BUCKET=null
|
PRIVATE_AWS_BUCKET=null
|
||||||
PRIVATE_AWS_URL=null
|
PRIVATE_AWS_URL=null
|
||||||
|
PRIVATE_AWS_ENDPOINT=null
|
||||||
|
PRIVATE_AWS_PATH_STYLE=null
|
||||||
PRIVATE_AWS_BUCKET_ROOT=null
|
PRIVATE_AWS_BUCKET_ROOT=null
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ PUBLIC_AWS_ACCESS_KEY_ID=null
|
|||||||
PUBLIC_AWS_DEFAULT_REGION=null
|
PUBLIC_AWS_DEFAULT_REGION=null
|
||||||
PUBLIC_AWS_BUCKET=null
|
PUBLIC_AWS_BUCKET=null
|
||||||
PUBLIC_AWS_URL=null
|
PUBLIC_AWS_URL=null
|
||||||
|
PUBLIC_AWS_ENDPOINT=null
|
||||||
|
PUBLIC_AWS_PATH_STYLE=null
|
||||||
PUBLIC_AWS_BUCKET_ROOT=null
|
PUBLIC_AWS_BUCKET_ROOT=null
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
@@ -153,6 +155,8 @@ PRIVATE_AWS_SECRET_ACCESS_KEY=null
|
|||||||
PRIVATE_AWS_DEFAULT_REGION=null
|
PRIVATE_AWS_DEFAULT_REGION=null
|
||||||
PRIVATE_AWS_BUCKET=null
|
PRIVATE_AWS_BUCKET=null
|
||||||
PRIVATE_AWS_URL=null
|
PRIVATE_AWS_URL=null
|
||||||
|
PRIVATE_AWS_ENDPOINT=null
|
||||||
|
PRIVATE_AWS_PATH_STYLE=null
|
||||||
PRIVATE_AWS_BUCKET_ROOT=null
|
PRIVATE_AWS_BUCKET_ROOT=null
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ class ComponentsController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$components = Component::select('components.*')
|
$components = Component::select('components.*')
|
||||||
->with('company', 'location', 'category', 'assets', 'supplier', 'adminuser', 'manufacturer', 'uncontrainedAssets')
|
->with('company', 'location', 'category', 'supplier', 'adminuser', 'manufacturer')
|
||||||
->withSum('uncontrainedAssets', 'components_assets.assigned_qty');
|
->withSum('uncontrainedAssets as sum_unconstrained_assets', 'components_assets.assigned_qty');
|
||||||
|
|
||||||
$filter = [];
|
$filter = [];
|
||||||
|
|
||||||
@@ -112,7 +112,8 @@ class ComponentsController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||||
$offset = ($request->input('offset') > $components->count()) ? $components->count() : app('api_offset_value');
|
$components_count = $components->count();
|
||||||
|
$offset = ($request->input('offset') > $components_count) ? $components_count : app('api_offset_value');
|
||||||
$limit = app('api_limit_value');
|
$limit = app('api_limit_value');
|
||||||
|
|
||||||
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||||
@@ -143,7 +144,7 @@ class ComponentsController extends Controller
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$total = $components->count();
|
$total = $components_count;
|
||||||
$components = $components->skip($offset)->take($limit)->get();
|
$components = $components->skip($offset)->take($limit)->get();
|
||||||
|
|
||||||
return (new ComponentsTransformer)->transformComponents($components, $total);
|
return (new ComponentsTransformer)->transformComponents($components, $total);
|
||||||
|
|||||||
@@ -238,14 +238,26 @@ class Component extends SnipeModel
|
|||||||
* @since [v5.0]
|
* @since [v5.0]
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function numCheckedOut()
|
public function numCheckedOut(bool $recalculate = false)
|
||||||
{
|
{
|
||||||
$checkedout = 0;
|
/**
|
||||||
|
*
|
||||||
|
* WARNING: This method caches the result, so if you're doing something
|
||||||
|
* that is going to change the number of checked-out items, make sure to pass
|
||||||
|
* 'true' as the first parameter to force this to recalculate the number of checked-out
|
||||||
|
* items!!!!!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
// In case there are elements checked out to assets that belong to a different company
|
// In case there are elements checked out to assets that belong to a different company
|
||||||
// than this asset and full multiple company support is on we'll remove the global scope,
|
// than this asset and full multiple company support is on we'll remove the global scope,
|
||||||
// so they are included in the count.
|
// so they are included in the count.
|
||||||
return $this->uncontrainedAssets->sum('pivot.assigned_qty');
|
if (is_null($this->sum_unconstrained_assets) || $recalculate) {
|
||||||
|
// This, in a components-listing context, is mostly important for when it sets a 'zero' which
|
||||||
|
// is *not* null - so we don't have to keep recalculating for un-checked-out components
|
||||||
|
$this->sum_unconstrained_assets = $this->uncontrainedAssets()->sum('assigned_qty') ?? 0;
|
||||||
|
}
|
||||||
|
return $this->sum_unconstrained_assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ $config = [
|
|||||||
'region' => env('PUBLIC_AWS_DEFAULT_REGION'),
|
'region' => env('PUBLIC_AWS_DEFAULT_REGION'),
|
||||||
'bucket' => env('PUBLIC_AWS_BUCKET'),
|
'bucket' => env('PUBLIC_AWS_BUCKET'),
|
||||||
'url' => env('PUBLIC_AWS_URL'),
|
'url' => env('PUBLIC_AWS_URL'),
|
||||||
|
'endpoint' => env('PUBLIC_AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('PUBLIC_AWS_PATH_STYLE'),
|
||||||
'root' => env('PUBLIC_AWS_BUCKET_ROOT'),
|
'root' => env('PUBLIC_AWS_BUCKET_ROOT'),
|
||||||
'visibility' => 'public'
|
'visibility' => 'public'
|
||||||
],
|
],
|
||||||
@@ -78,6 +80,8 @@ $config = [
|
|||||||
'region' => env('PRIVATE_AWS_DEFAULT_REGION'),
|
'region' => env('PRIVATE_AWS_DEFAULT_REGION'),
|
||||||
'bucket' => env('PRIVATE_AWS_BUCKET'),
|
'bucket' => env('PRIVATE_AWS_BUCKET'),
|
||||||
'url' => env('PRIVATE_AWS_URL'),
|
'url' => env('PRIVATE_AWS_URL'),
|
||||||
|
'endpoint' => env('PRIVATE_AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('PRIVATE_AWS_PATH_STYLE'),
|
||||||
'root' => env('PRIVATE_AWS_BUCKET_ROOT'),
|
'root' => env('PRIVATE_AWS_BUCKET_ROOT'),
|
||||||
'visibility' => 'private'
|
'visibility' => 'private'
|
||||||
],
|
],
|
||||||
@@ -168,4 +172,4 @@ $config['allowed_upload_mimetypes'] = implode(',', $config['allowed_upload_mimet
|
|||||||
$config['allowed_upload_extensions_for_validator'] = implode(',', $config['allowed_upload_extensions_array']);
|
$config['allowed_upload_extensions_for_validator'] = implode(',', $config['allowed_upload_extensions_array']);
|
||||||
$config['allowed_upload_extensions'] = '.'.implode(', .', $config['allowed_upload_extensions_array']);
|
$config['allowed_upload_extensions'] = '.'.implode(', .', $config['allowed_upload_extensions_array']);
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ echo "This script will attempt to: \n\n";
|
|||||||
echo "- validate some very basic .env file settings \n";
|
echo "- validate some very basic .env file settings \n";
|
||||||
echo "- check your PHP version and extension requirements \n";
|
echo "- check your PHP version and extension requirements \n";
|
||||||
echo "- check directory permissions \n";
|
echo "- check directory permissions \n";
|
||||||
echo "- change your 'git remote' to the new Snipe-IT GitHub URL \n"
|
echo "- change your 'git remote' to the new Snipe-IT GitHub URL \n";
|
||||||
echo "- do a git pull to bring you to the latest version \n";
|
echo "- do a git pull to bring you to the latest version \n";
|
||||||
echo "- run composer install to get your vendors up to date \n";
|
echo "- run composer install to get your vendors up to date \n";
|
||||||
echo "- run a backup \n";
|
echo "- run a backup \n";
|
||||||
|
|||||||
Reference in New Issue
Block a user