A free open source IT asset/license management system
Fixed RB-21533 - Undefined variable $indirectItemsCount on bulk print, added test
snipe4a0797d59fab
diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.phpindex 27145cbfa0..abcd8abafa 100644--- a/resources/views/users/print.blade.php+++ b/resources/views/users/print.blade.php@@ -365,7 +365,7 @@@endforeach</table>@endif- @if($indirectItemsCount > 0 && $settings->show_assigned_assets)+ @if(($indirectItemsCount ?? 0) > 0 && $settings->show_assigned_assets)<div id="indirect-assignments-toolbar"><h4>{{ $indirectItemsCount.' '.trans('mail.assigned_to_assets') }}</h4></div>diff --git a/tests/Feature/Users/Ui/PrintUserInventoryTest.php b/tests/Feature/Users/Ui/PrintUserInventoryTest.phpindex 32a82fd1ca..e7ff8d40fd 100644--- a/tests/Feature/Users/Ui/PrintUserInventoryTest.php+++ b/tests/Feature/Users/Ui/PrintUserInventoryTest.php@@ -38,4 +38,17 @@ class PrintUserInventoryTest extends TestCase->get(route('users.print', $user))->assertStatus(302);}++ public function test_bulk_print_user_inventory_does_not_error_on_missing_indirect_items_count()+ {+ $actor = User::factory()->viewUsers()->create();+ [$userA, $userB] = User::factory()->count(2)->create();++ $this->actingAs($actor)+ ->post(route('users/bulkedit'), [+ 'ids' => [$userA->id, $userB->id],+ 'bulk_actions' => 'print',+ ])+ ->assertOk();+ }}