On the staff client search results page the "Add to" menu offers a list of private and public lists to which results can be added. If there are no private and public lists, the menu still lists the labels, "Your lists:" and "public lists:" In search.pl: if (@pubshelves) { $template->param( addpubshelves => scalar (@pubshelves)); $template->param( addpubshelvesloop => @pubshelves); } if (@barshelves) { $template->param( addbarshelves => scalar (@barshelves)); $template->param( addbarshelvesloop => @barshelves); } The script passes template variables with the list count and list contents if @pubshelves and @barshelves evaluate as true. These variables will evaluate as true even if there are no lists in the database.
Testing a fix. Problem is some poor code in C4::VirtualShelves, it assigns a array_ref to an array in array context so that if you look at pubshelves in search.pl it is actually a 1 element array that element being a reference to an empty array i.e. [ [], ] so it is true consisting of 1 element. Need to ensure nowhere relies on incorrect behaviour
Created attachment 3751 [details] [review] Proposed Patch
With no lists already created (private or public ones) the "Add to" just contains "Cart" option, then all is working good for this point. As well the option to add biblios to 'New list' disappeared too, meaning it s quite more complicated and longer to create a new list than before.
Created attachment 3781 [details] [review] Revised patch Add to patch: change to template to display new list option irrespective of existence of existing lists
All is working perfectly.
Pushed please test