3
0
mirror of https://github.com/snipe/snipe-it.git synced 2025-10-29 11:21:21 +00:00

Fixed updating notes in bulk edit

This commit is contained in:
snipe 2025-10-16 14:33:21 +01:00
parent 7de25a1c37
commit a1e6f01fe9
2 changed files with 10 additions and 7 deletions

View File

@ -240,10 +240,6 @@ class BulkAssetsController extends Controller
$custom_fields_to_null[str_replace('null', '', $key)] = $value;
}
if (! $request->filled('ids') || count($request->input('ids')) == 0) {
return redirect($bulk_back_url)->with('error', trans('admin/hardware/message.update.no_assets_selected'));
@ -274,6 +270,7 @@ class BulkAssetsController extends Controller
|| ($request->filled('company_id'))
|| ($request->filled('status_id'))
|| ($request->filled('model_id'))
|| ($request->filled('notes'))
|| ($request->filled('next_audit_date'))
|| ($request->filled('asset_eol_date'))
|| ($request->filled('null_name'))

View File

@ -88,7 +88,8 @@ class BulkEditAssetsTest extends TestCase
'order_number' => '123456',
'warranty_months' => 24,
'next_audit_date' => '2024-06-01',
'requestable' => false
'requestable' => false,
'notes' => 'This is a new note!',
]);
// gets the ids together to submit to the endpoint
@ -108,7 +109,8 @@ class BulkEditAssetsTest extends TestCase
'order_number' => '7890',
'warranty_months' => 36,
'next_audit_date' => '2025-01-01',
'requestable' => true
'requestable' => true,
'notes' => 'This is a newer note!',
])
->assertStatus(302)
->assertSessionHasNoErrors();
@ -128,6 +130,7 @@ class BulkEditAssetsTest extends TestCase
$this->assertEquals('2025-01-01', $asset->next_audit_date);
// shouldn't requestable be cast as a boolean??? it's not.
$this->assertEquals(1, $asset->requestable);
$this->assertEquals('This is a newer note!', $asset->notes);
});
}
@ -156,7 +159,8 @@ class BulkEditAssetsTest extends TestCase
'order_number' => '123456',
'warranty_months' => 24,
'next_audit_date' => '2024-06-01',
'requestable' => false
'requestable' => false,
'notes' => 'This is a note that will be deleted',
]);
// gets the ids together to submit to the endpoint
@ -169,6 +173,7 @@ class BulkEditAssetsTest extends TestCase
'null_purchase_date' => '1',
'null_expected_checkin_date' => '1',
'null_next_audit_date' => '1',
'null_notes' => '1',
'status_id' => $status2->id,
'model_id' => $model2->id,
])
@ -181,6 +186,7 @@ class BulkEditAssetsTest extends TestCase
$this->assertNull($asset->purchase_date);
$this->assertNull($asset->expected_checkin);
$this->assertNull($asset->next_audit_date);
$this->assertNull($asset->notes);
});
}