From 94fb41cbdd52f09de09d91db10fcea0b520fed25 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 3 Sep 2019 16:02:53 -0400 Subject: [PATCH] LP1832897: Belt-and-suspenders for making sure max_items is set Signed-off-by: Mike Rylander Signed-off-by: Jane Sandberg --- .../src/perlmods/lib/OpenILS/Application/Actor/Carousel.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Carousel.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Carousel.pm index 0b64841d4d..9e9fa616fc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Carousel.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Carousel.pm @@ -176,12 +176,16 @@ sub add_carousel_from_bucket { $e->xact_begin; + # gather old entries to get a count and set max_items appropriately + my $entries = $e->search_container_biblio_record_entry_bucket_item({ bucket => $bucket_id }); + my $carousel = Fieldmapper::container::carousel->new; $carousel->name($carousel_name); $carousel->type(1); # manual $carousel->owner($e->requestor->ws_ou); $carousel->creator($e->requestor->id); $carousel->editor($e->requestor->id); + $carousel->max_items(scalar(@$entries)); $e->create_container_carousel($carousel) or return $e->event; # and the bucket @@ -199,7 +203,6 @@ sub add_carousel_from_bucket { $e->update_container_carousel($carousel) or return $e->event; # and fill it - my $entries = $e->search_container_biblio_record_entry_bucket_item({ bucket => $bucket_id }); foreach my $entry (@$entries) { $entry->clear_id; $entry->bucket($bucket->id); -- 2.43.2