Merge pull request #10522 from inietov/fixes/depreciation_report_shows_assets_that_not_deprecate
Fixes bug where the depreciation report shows assets that not depreciate
This commit is contained in:
commit
c8c559784d
3 changed files with 12 additions and 3 deletions
|
@ -54,7 +54,7 @@ class AssetsController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
\Log::debug(Route::currentRouteName());
|
\Log::debug(Route::currentRouteName());
|
||||||
|
$filter_non_deprecable_assets = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This looks MAD janky (and it is), but the AssetsController@index does a LOT of heavy lifting throughout the
|
* This looks MAD janky (and it is), but the AssetsController@index does a LOT of heavy lifting throughout the
|
||||||
|
@ -68,6 +68,7 @@ class AssetsController extends Controller
|
||||||
* which would have been far worse of a mess. *sad face* - snipe (Sept 1, 2021)
|
* which would have been far worse of a mess. *sad face* - snipe (Sept 1, 2021)
|
||||||
*/
|
*/
|
||||||
if (Route::currentRouteName()=='api.depreciation-report.index') {
|
if (Route::currentRouteName()=='api.depreciation-report.index') {
|
||||||
|
$filter_non_deprecable_assets = true;
|
||||||
$transformer = 'App\Http\Transformers\DepreciationReportTransformer';
|
$transformer = 'App\Http\Transformers\DepreciationReportTransformer';
|
||||||
$this->authorize('reports.view');
|
$this->authorize('reports.view');
|
||||||
} else {
|
} else {
|
||||||
|
@ -118,6 +119,12 @@ class AssetsController extends Controller
|
||||||
'model.category', 'model.manufacturer', 'model.fieldset','supplier'); //it might be tempting to add 'assetlog' here, but don't. It blows up update-heavy users.
|
'model.category', 'model.manufacturer', 'model.fieldset','supplier'); //it might be tempting to add 'assetlog' here, but don't. It blows up update-heavy users.
|
||||||
|
|
||||||
|
|
||||||
|
if($filter_non_deprecable_assets) {
|
||||||
|
$non_deprecable_models = AssetModel::select('id')->whereNotNull('depreciation_id')->get();
|
||||||
|
|
||||||
|
$assets->InModelList($non_deprecable_models->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
// These are used by the API to query against specific ID numbers.
|
// These are used by the API to query against specific ID numbers.
|
||||||
// They are also used by the individual searches on detail pages like
|
// They are also used by the individual searches on detail pages like
|
||||||
// locations, etc.
|
// locations, etc.
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Custom Fieldset -->
|
<!-- Custom Fieldset -->
|
||||||
@livewire('custom-field-set-default-values-for-model',["model_id" => $item->id])
|
@if (isset($item->id))
|
||||||
|
@livewire('custom-field-set-default-values-for-model',["model_id" => $item->id])
|
||||||
|
@endif
|
||||||
|
|
||||||
@include ('partials.forms.edit.notes')
|
@include ('partials.forms.edit.notes')
|
||||||
@include ('partials.forms.edit.requestable', ['requestable_text' => trans('admin/models/general.requestable')])
|
@include ('partials.forms.edit.requestable', ['requestable_text' => trans('admin/models/general.requestable')])
|
||||||
|
|
|
@ -296,7 +296,7 @@ Route::group(['prefix' => 'v1', 'middleware' => 'api'], function () {
|
||||||
); // end depreciations API routes
|
); // end depreciations API routes
|
||||||
|
|
||||||
|
|
||||||
Route::post('reports/depreciation',
|
Route::get('reports/depreciation',
|
||||||
[
|
[
|
||||||
Api\AssetsController::class,
|
Api\AssetsController::class,
|
||||||
'index'
|
'index'
|
||||||
|
|
Loading…
Add table
Reference in a new issue