mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge remote-tracking branch 'origin/develop'
Some checks failed
CodeQL Security Scan / CodeQL Security Scan (javascript) (push) Has been cancelled
Codacy Security Scan / Codacy Security Scan (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
Some checks failed
CodeQL Security Scan / CodeQL Security Scan (javascript) (push) Has been cancelled
Codacy Security Scan / Codacy Security Scan (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
This commit is contained in:
commit
5ac6caf257
|
@ -61,7 +61,7 @@ class DepreciationReportTransformer
|
||||||
/**
|
/**
|
||||||
* Override the previously set null values if there is a valid model and associated depreciation
|
* Override the previously set null values if there is a valid model and associated depreciation
|
||||||
*/
|
*/
|
||||||
if (($asset->model) && ($asset->model->depreciation)) {
|
if (($asset->model) && ($asset->model->depreciation) && ($asset->model->depreciation->months !== 0)) {
|
||||||
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
||||||
$monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months);
|
$monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months);
|
||||||
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
||||||
|
|
|
@ -172,7 +172,7 @@ return [
|
||||||
| More info: https://bootstrap-table.com/docs/extensions/cookie/#cookiestorage
|
| More info: https://bootstrap-table.com/docs/extensions/cookie/#cookiestorage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'bs_table_storage' => env('BS_TABLE_STORAGE', 'cookieStorage'),
|
'bs_table_storage' => env('BS_TABLE_STORAGE', 'localStorage'),
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Unit\Transformers;
|
||||||
|
|
||||||
|
use App\Http\Transformers\DepreciationReportTransformer;
|
||||||
|
use App\Models\Asset;
|
||||||
|
use App\Models\Depreciation;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class DepreciationReportTransformerTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testHandlesModelDepreciationMonthsBeingZero()
|
||||||
|
{
|
||||||
|
$asset = Asset::factory()->create();
|
||||||
|
$depreciation = Depreciation::factory()->create(['months' => 0]);
|
||||||
|
$asset->model->depreciation()->associate($depreciation);
|
||||||
|
|
||||||
|
$transformer = new DepreciationReportTransformer;
|
||||||
|
|
||||||
|
$result = $transformer->transformAsset($asset);
|
||||||
|
|
||||||
|
$this->assertIsArray($result);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue