From d6bbe15a76ccba2079fe71b9c3a719b3f9c1d255 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Oct 2017 04:04:05 -0700 Subject: [PATCH 1/2] Added upload state back to log test --- database/factories/ActionLogFactory.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/database/factories/ActionLogFactory.php b/database/factories/ActionLogFactory.php index 3cf6b408db..a49d56b852 100644 --- a/database/factories/ActionLogFactory.php +++ b/database/factories/ActionLogFactory.php @@ -14,6 +14,17 @@ $factory->define(Actionlog::class, function (Faker\Generator $faker) { }); +$factory->defineAs(App\Models\Actionlog::class, 'asset-upload', function ($faker) { + $asset = factory(App\Models\Asset::class)->create(); + return [ + 'item_type' => get_class($asset), + 'item_id' => 1, + 'user_id' => 1, + 'filename' => $faker->word, + 'action_type' => 'uploaded' + ]; +}); + $factory->defineAs(Actionlog::class, 'asset-checkout-user', function (Faker\Generator $faker) { $target = User::inRandomOrder()->first(); From ed4aa7dec203fe33a34d166366001fdc5b9b9bf5 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Oct 2017 04:48:52 -0700 Subject: [PATCH 2/2] Account for deleted suppliers in asset maintenances report This should all be reworked via the API though anyway --- .../reports/asset_maintenances.blade.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/resources/views/reports/asset_maintenances.blade.php b/resources/views/reports/asset_maintenances.blade.php index 79dbb806cd..31d61e0b76 100644 --- a/resources/views/reports/asset_maintenances.blade.php +++ b/resources/views/reports/asset_maintenances.blade.php @@ -41,25 +41,30 @@ $totalCost = 0; ?> @foreach ($assetMaintenances as $assetMaintenance) + asset_maintenance_time); ?> @if ($assetMaintenance->asset) {{ ($assetMaintenance->asset->company) ? $assetMaintenance->asset->company->name : '' }} {{ $assetMaintenance->asset->asset_tag }} {{ $assetMaintenance->asset->name }} - {{ $assetMaintenance->supplier->name }} + + @if ($assetMaintenance->supplier) + {{ $assetMaintenance->supplier->name }} + @else + (deleted supplier) + @endif + {{ $assetMaintenance->asset_maintenance_type }} {{ $assetMaintenance->title }} {{ $assetMaintenance->start_date }} {{ is_null($assetMaintenance->completion_date) ? trans('admin/asset_maintenances/message.asset_maintenance_incomplete') : $assetMaintenance->completion_date }} - @if (is_null($assetMaintenance->asset_maintenance_time)) - diffInDays(Carbon::parse($assetMaintenance->start_date))); - ?> - @else - asset_maintenance_time); - ?> - @endif + asset_maintenance_time)) { + $assetMaintenanceTime = intval(Carbon::now()->diffInDays(Carbon::parse($assetMaintenance->start_date))); + } + + ?> {{ $assetMaintenanceTime }} {{ $snipeSettings->default_currency }}