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) { if ($license->assigned_seats_count == 0) {
// Delete the license and the associated license seats // Delete the license and the associated license seats
DB::table('license_seats') DB::table('license_seats')
->where('id', $license->id) ->where('license_id', $license->id)
->update(['assigned_to' => null, 'asset_id' => null]); ->update(['assigned_to' => null, 'asset_id' => null]);
$licenseSeats = $license->licenseseats(); $licenseSeats = $license->licenseseats();

View file

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

View file

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

View file

@ -92,6 +92,7 @@ class AssetsTransformer
'checkout_counter' => (int) $asset->checkout_counter, 'checkout_counter' => (int) $asset->checkout_counter,
'requests_counter' => (int) $asset->requests_counter, 'requests_counter' => (int) $asset->requests_counter,
'user_can_checkout' => (bool) $asset->availableForCheckout(), '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['maintained'] = $this->findCsvMatch($row, 'maintained');
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order'); $this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable'); $this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
$this->item['manufacturer'] = $this->createOrFetchManufacturer($this->findCsvMatch($row, 'manufacturer'));
if($this->item['reassignable'] == "") if($this->item['reassignable'] == "")
{ {
$this->item['reassignable'] = 1; $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' 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); $months_passed = ($this->purchase_date->diff(now())->m)+($this->purchase_date->diff(now())->y*12);
} else { } else {
return null; return null;

View file

@ -154,6 +154,13 @@ class AssetPresenter extends Presenter
'footerFormatter' => 'sumFormatter', 'footerFormatter' => 'sumFormatter',
'class' => 'text-right', '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', 'field' => 'order_number',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,

View file

@ -47,7 +47,7 @@
"laravel/tinker": "^2.6", "laravel/tinker": "^2.6",
"laravel/ui": "^3.3", "laravel/ui": "^3.3",
"laravelcollective/html": "^6.2", "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", "lcobucci/jwt": "^3.4.5|^4.0.4",
"league/csv": "^9.7", "league/csv": "^9.7",
"league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-aws-s3-v3": "^3.0",