Bug 17886: Don't show option to add to existing list if there are no lists

This patch modifies the page for adding a title to a list so that the
"Add to existing list" option doesn't appear if there are no lists
defined.

TEST PLAN
---------
1) Make sure no lists exist at all.
2) Make there is at least one findable biblio record entered
3) Find that biblio record in the OPAC
4) Click 'Save to your lists'
   -- Notice that the whole save to list section is there.
5) Apply this patch
6) Click 'Cancel'
7) Click 'Save to your lists'
   -- Notice you can only add now, which makes sense.
8) Run koha qa test tools.

Perform the same tests in the staff client.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and the patch works.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit b6010314df)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Caitlin Goodger 2018-05-29 17:32:12 +00:00 committed by Fridolin Somers
parent a876da7c05
commit bdb60e7d19
2 changed files with 45 additions and 43 deletions

View File

@ -17,26 +17,27 @@
<div id="custom-doc" class="yui-t7">
<div id="bd">
[% IF ( multiple ) %]
<h1>Add [% total %] items to [% IF ( singleshelf ) %]<em>[% shelfname | html%]</em>: [% ELSE %]a list:[% END %]</h1>
<h1>Add [% total %] items to [% IF ( singleshelf ) %]<em>[% shelfname | html%]</em>: [% ELSE %]a list:[% END %]</h1>
[% ELSE %]
<h1>Add to [% IF ( singleshelf ) %]<em>[% shelfname | html %]</em>[% ELSE %]a list:[% END %]</h1>
[% END %]
<ul>
[% FOREACH biblio IN biblios %]
<li> <span class="title">[% biblio.title |html %]</span>
[% IF ( biblio.author ) %]<span class="author"> [% biblio.author %] </span>[% END %]
</li>
[% END %]
<ul>
[% FOREACH biblio IN biblios %]
<li> <span class="title">[% biblio.title |html %]</span>
[% IF ( biblio.author ) %]<span class="author"> [% biblio.author %] </span>[% END %]
</li>
[% END %]
</ul>
<form name="f1" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" method="post">
<form name="f1" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" method="post">
[% FOREACH biblio IN biblios %] <input type="hidden" name="biblionumber" value="[% biblio.biblionumber %]" />[% END %]
<input type="hidden" name="confirmed" value="1" />
[% IF ( shelfnumber ) %]<input type="hidden" name="shelfnumber" value="[% shelfnumber %]" />[% END %]
<input type="hidden" name="confirmed" value="1" />
[% IF ( shelfnumber ) %]<input type="hidden" name="shelfnumber" value="[% shelfnumber %]" />[% END %]
[% UNLESS ( shelfnumber ) %]
[% UNLESS ( newshelf ) %]
[% IF ( private_shelves.count ) %]
<fieldset class="rows">
<legend>Select an existing list</legend>
<ol>
@ -67,38 +68,39 @@
</select>
</li>
</ol>
[% FOREACH biblio IN biblios %]<input type="hidden" name="biblionumber" value="[% biblio.biblionumber %]" />[% END %]
[% UNLESS ( biblionumbers ) %]
<input type="hidden" name="biblionumber" value="[% biblionumber %]" />
[% ELSE %]
<input type="hidden" name="biblionumbers" value="[% biblionumbers %]" />
[% END %]
</fieldset>
[% FOREACH biblio IN biblios %]<input type="hidden" name="biblionumber" value="[% biblio.biblionumber %]" />[% END %]
[% UNLESS ( biblionumbers ) %]
<input type="hidden" name="biblionumber" value="[% biblionumber %]" />
[% ELSE %]
<input type="hidden" name="biblionumbers" value="[% biblionumbers %]" />
[% END %]
</fieldset>
<p>... or...</p>
<p>... or...</p>
[% END %]
[% END %]
<fieldset class="rows"><legend>Add to a new list:</legend>
<ol><li>
<label for="newvirtualshelf">
List name:
</label>
[% FOREACH biblio IN biblios %]<input type="hidden" name="biblionumber" value="[% biblio.biblionumber %]" />[% END %]
[% UNLESS ( biblionumbers ) %]
<input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber %]" />
[% ELSE %]
<input type="hidden" name="biblionumbers" id="biblionumbers" value="[% biblionumbers %]" />
[% END %]
<input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" />
<input type="hidden" name="confirmed" value="1" />
</li>
<li>
<label for="category">Category:</label>
<select name="category" id="category">
<option value="1">Private</option>
<option value="2">Public</option>
</select>
</li></ol>
<ol><li>
<label for="newvirtualshelf">
List name:
</label>
[% FOREACH biblio IN biblios %]<input type="hidden" name="biblionumber" value="[% biblio.biblionumber %]" />[% END %]
[% UNLESS ( biblionumbers ) %]
<input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber %]" />
[% ELSE %]
<input type="hidden" name="biblionumbers" id="biblionumbers" value="[% biblionumbers %]" />
[% END %]
<input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" />
<input type="hidden" name="confirmed" value="1" />
</li>
<li>
<label for="category">Category:</label>
<select name="category" id="category">
<option value="1">Private</option>
<option value="2">Public</option>
</select>
</li></ol>
</fieldset>
@ -106,11 +108,11 @@
<!-- SAVE -->
<fieldset class="action">
<fieldset class="action">
<input type="hidden" name="sortfield" value="title" />
<input type="submit" value="Save" class="submit" /> <a class="close cancel" href="#">Cancel</a>
</fieldset>
</form>
<input type="submit" value="Save" class="submit" /> <a class="close cancel" href="#">Cancel</a>
</fieldset>
</form>
<!-- /SAVE -->
</div>

View File

@ -23,7 +23,7 @@
</li>
[% END %]
</ul>
[% IF private_shelves.count or public_shelves.count or private_shelves_shared_with_me %]
[% IF private_shelves.count or public_shelves.count or private_shelves_shared_with_me.count %]
<form name="f1" action="/cgi-bin/koha/opac-addbybiblionumber.pl" method="post">
<fieldset>
<legend>Select a list</legend>