Bug 5529 - Staff client shows "Your lists:" and "public lists:" when there are none
Summary: Staff client shows "Your lists:" and "public lists:" when there are none
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: 3.4
Hardware: All All
: PATCH-Sent (DO NOT USE) normal (vote)
Assignee: Colin Campbell
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-20 20:56 UTC by Owen Leonard
Modified: 2012-10-25 23:09 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed Patch (11.18 KB, patch)
2011-04-06 14:50 UTC, Colin Campbell
Details | Diff | Splinter Review
Revised patch (12.54 KB, patch)
2011-04-07 10:27 UTC, Colin Campbell
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2010-12-20 20:56:06 UTC
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.
Comment 1 Colin Campbell 2011-04-06 11:43:22 UTC
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
Comment 2 Colin Campbell 2011-04-06 14:50:45 UTC Comment hidden (obsolete)
Comment 3 Frederic Durand 2011-04-07 09:13:28 UTC
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.
Comment 4 Colin Campbell 2011-04-07 10:27:15 UTC
Created attachment 3781 [details] [review]
Revised patch

Add to patch: change to template to display new list option irrespective of existence of existing lists
Comment 5 Frederic Durand 2011-04-07 14:25:54 UTC
All is working perfectly.
Comment 6 Chris Cormack 2011-04-07 22:57:45 UTC
Pushed please test