mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
cleanup
This commit is contained in:
parent
ef64843d2f
commit
64a9859efd
|
@ -245,7 +245,6 @@ class ItemImporter extends Importer
|
||||||
$this->log('Asset Model Updated');
|
$this->log('Asset Model Updated');
|
||||||
|
|
||||||
return $asset_model->id;
|
return $asset_model->id;
|
||||||
// here
|
|
||||||
}
|
}
|
||||||
$this->log('No Matching Model, Creating a new one');
|
$this->log('No Matching Model, Creating a new one');
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
||||||
|
|
||||||
|
|
||||||
// Update the eol_explicit column with the value from asset_eol_date if it exists and is different from the calculated value
|
// Update the eol_explicit column with the value from asset_eol_date if it exists and is different from the calculated value
|
||||||
$assetsWithEolDates = Asset::whereNotNull('asset_eol_date')->chunk(100, function ($assetsWithEolDates) {
|
Asset::whereNotNull('asset_eol_date')->chunk(100, function ($assetsWithEolDates) {
|
||||||
foreach ($assetsWithEolDates as $asset) {
|
foreach ($assetsWithEolDates as $asset) {
|
||||||
if ($asset->asset_eol_date && $asset->purchase_date) {
|
if ($asset->asset_eol_date && $asset->purchase_date) {
|
||||||
$months = Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date);
|
$months = Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date);
|
||||||
|
@ -35,10 +35,9 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
unset($assetsWithEolDates);
|
|
||||||
|
|
||||||
// Update the asset_eol_date column with the calculated value if it doesn't exist
|
// Update the asset_eol_date column with the calculated value if it doesn't exist
|
||||||
$assets = Asset::whereNull('asset_eol_date')->chunk(100, function ($assets) {
|
Asset::whereNull('asset_eol_date')->chunk(100, function ($assets) {
|
||||||
foreach ($assets as $asset) {
|
foreach ($assets as $asset) {
|
||||||
$model = Asset::find($asset->id)->model;
|
$model = Asset::find($asset->id)->model;
|
||||||
if (!empty($model->eol)) {
|
if (!empty($model->eol)) {
|
||||||
|
|
Loading…
Reference in a new issue