mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Merge pull request #10590 from inietov/fixes/bulkedit_does_not_show_in_history_develop
Fixes Bulk edit doesn't show in Asset's history nor Activity report for develop [sc-16550]
This commit is contained in:
commit
8083ba8dca
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Assets;
|
namespace App\Http\Controllers\Assets;
|
||||||
|
|
||||||
|
use App\Models\Actionlog;
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Http\Controllers\CheckInOutRequest;
|
use App\Http\Controllers\CheckInOutRequest;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
@ -123,6 +124,24 @@ class BulkAssetsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$changed = [];
|
||||||
|
$asset = Asset::where('id' ,$assetId)->get();
|
||||||
|
|
||||||
|
foreach ($this->update_array as $key => $value) {
|
||||||
|
if ($this->update_array[$key] != $asset->toArray()[0][$key]) {
|
||||||
|
$changed[$key]['old'] = $asset->toArray()[0][$key];
|
||||||
|
$changed[$key]['new'] = $this->update_array[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$logAction = new Actionlog();
|
||||||
|
$logAction->item_type = Asset::class;
|
||||||
|
$logAction->item_id = $assetId;
|
||||||
|
$logAction->created_at = date("Y-m-d H:i:s");
|
||||||
|
$logAction->user_id = Auth::id();
|
||||||
|
$logAction->log_meta = json_encode($changed);
|
||||||
|
$logAction->logaction('update');
|
||||||
|
|
||||||
DB::table('assets')
|
DB::table('assets')
|
||||||
->where('id', $assetId)
|
->where('id', $assetId)
|
||||||
->update($this->update_array);
|
->update($this->update_array);
|
||||||
|
|
Loading…
Reference in a new issue