Merge branch 'develop' into snipeit_v7

This commit is contained in:
Brady Wetherington 2023-07-20 17:16:04 +01:00
commit ba8d8a6f05
8 changed files with 20 additions and 9 deletions

View file

@ -207,7 +207,7 @@ class LicensesController extends Controller
if ($license->assigned_seats_count == 0) {
// Delete the license and the associated license seats
DB::table('license_seats')
->where('id', $license->id)
->where('license_id', $license->id)
->update(['assigned_to' => null, 'asset_id' => null]);
$licenseSeats = $license->licenseseats();

View file

@ -501,7 +501,6 @@ class ReportsController extends Controller
$header[] = trans('general.zip');
}
if ($request->filled('assigned_to')) {
$header[] = trans('admin/hardware/table.checkoutto');
$header[] = trans('general.type');
@ -532,13 +531,14 @@ class ReportsController extends Controller
}
if ($request->filled('warranty')) {
$header[] = 'Warranty';
$header[] = 'Warranty Expires';
$header[] = trans('admin/hardware/form.warranty');
$header[] = trans('admin/hardware/form.warranty_expires');
}
if ($request->filled('depreciation')) {
$header[] = 'Value';
$header[] = 'Diff';
$header[] = 'Fully Depreciated';
$header[] = trans('admin/hardware/table.book_value');
$header[] = trans('admin/hardware/table.diff');
$header[] = trans('admin/hardware/form.fully_depreciated');
}
if ($request->filled('checkout_date')) {

View file

@ -286,6 +286,7 @@ class Importer extends Component
'serial' => trans('general.license_serial'),
'email' => trans('general.importer.checked_out_to_email'),
'username' => trans('general.importer.checked_out_to_username'),
'manufacturer' => trans('general.manufacturer'),
];
$this->users_fields = [

View file

@ -92,6 +92,7 @@ class AssetsTransformer
'checkout_counter' => (int) $asset->checkout_counter,
'requests_counter' => (int) $asset->requests_counter,
'user_can_checkout' => (bool) $asset->availableForCheckout(),
'book_value' => Helper::formatCurrencyOutput($asset->getLinearDepreciatedValue()),
];

View file

@ -66,6 +66,8 @@ class LicenseImporter extends ItemImporter
$this->item['maintained'] = $this->findCsvMatch($row, 'maintained');
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
$this->item['manufacturer'] = $this->createOrFetchManufacturer($this->findCsvMatch($row, 'manufacturer'));
if($this->item['reassignable'] == "")
{
$this->item['reassignable'] = 1;

View file

@ -68,7 +68,7 @@ class Depreciable extends SnipeModel
*/
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
{
if ($this->purchase_date) {
if (($this->get_depreciation()) && ($this->purchase_date)) {
$months_passed = ($this->purchase_date->diff(now())->m)+($this->purchase_date->diff(now())->y*12);
} else {
return null;

View file

@ -154,6 +154,13 @@ class AssetPresenter extends Presenter
'footerFormatter' => 'sumFormatter',
'class' => 'text-right',
], [
"field" => "book_value",
"searchable" => false,
"sortable" => false,
"title" => trans('admin/hardware/table.book_value'),
"footerFormatter" => 'sumFormatter',
"class" => "text-right",
],[
'field' => 'order_number',
'searchable' => true,
'sortable' => true,

View file

@ -47,7 +47,7 @@
"laravel/tinker": "^2.6",
"laravel/ui": "^3.3",
"laravelcollective/html": "^6.2",
"lcobucci/clock": "1.2.0|2.0.0",
"lcobucci/clock": "^1.2.0|^2.0.0",
"lcobucci/jwt": "^3.4.5|^4.0.4",
"league/csv": "^9.7",
"league/flysystem-aws-s3-v3": "^3.0",