Bug 15222: Add to cart option/other list options missing from OPAC lists display

This patch adds the option to add titles to the cart or a list from the
view of a list's contents.

To test you should have at least one public list with titles added.
Apply the patch and go to the OPAC.

- View a public list.
- In the toolbar at the top of the table of titles you should see "Add
  to cart" and "Add to list." The controls should be disabled.
- Check checkboxes for one or more titles on the list.
- The controls should now be enabled.
- Clicking the "Add to cart" button should add the selected titles to
  the cart.
- If you are not logged into the OPAC, clicking the "Add to list" button
  should trigger an alert, "You must be logged in..."
- Log in to the OPAC and view the list again.
- Confirm that the "Add to list" control should trigger a popup allowing
  you to add your selected titles to an existing or a new list.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-08-29 16:23:52 +00:00 committed by Tomas Cohen Arazi
parent 9ea181d407
commit e1df591870
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -361,6 +361,14 @@
</span> </span>
[% END %] [% END %]
[% IF Koha.Preference( 'opacbookbag' ) == 1 %]
<a href="#" class="btn btn-link listaddtocart disabled"><i class="fa fa-shopping-cart" aria-hidden="true"></i> Add to cart</a>
[% END %]
[% IF Koha.Preference('virtualshelves') %]
<a href="#" class="btn btn-link addtolist disabled"><i class="fa fa-list" aria-hidden="true"></i> Add to list</a>
[% END %]
[% IF ( TagsInputEnabled && loggedinusername ) %] [% IF ( TagsInputEnabled && loggedinusername ) %]
<span id="addtags"> <span id="addtags">
<a id="tagsel_tag" href="#" class="btn btn-link disabled"><i class="fa fa-fw fa-tag" aria-hidden="true"></i> Tag</a> <a id="tagsel_tag" href="#" class="btn btn-link disabled"><i class="fa fa-fw fa-tag" aria-hidden="true"></i> Tag</a>
@ -379,7 +387,7 @@
</div> <!-- / .selections-toolbar --> </div> <!-- / .selections-toolbar -->
</div> <!-- /#floating --> </div> <!-- /#floating -->
<form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform"> <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="bookbag_form">
[% IF can_manage_shelf %] [% IF can_manage_shelf %]
<input type="hidden" name="op" value="remove_biblios" /> <input type="hidden" name="op" value="remove_biblios" />
<input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" /> <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
@ -1077,6 +1085,27 @@ $(function() {
Dopop( link ); Dopop( link );
}); });
$(".listaddtocart").on("click", function(e){
e.preventDefault();
addMultiple();
});
$(".addtolist").on("click", function(e){
e.preventDefault();
cartList();
});
function cartList(){
[% IF ( loggedinusername ) %]
if (vShelfAdd()) {
Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?' + vShelfAdd());
}
[% ELSE %]
alert(_("You must be logged in to create or add to lists"));
[% END %]
return false;
}
}); // document.ready }); // document.ready
function sortMenu( sorting_form ){ function sortMenu( sorting_form ){