From d7bde9fc12430935b9d2747d45f5aca92503610f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 29 Aug 2023 16:23:52 +0000 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer --- .../bootstrap/en/modules/opac-shelves.tt | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt index 671e0c33d3..8de98b3aed 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -365,6 +365,14 @@ [% END %] + [% IF Koha.Preference( 'opacbookbag' ) == 1 %] + Add to cart + [% END %] + + [% IF Koha.Preference('virtualshelves') %] + Add to list + [% END %] + [% IF ( TagsInputEnabled && loggedinusername ) %] Tag @@ -383,7 +391,7 @@ -
+ [% IF can_manage_shelf %] @@ -1081,6 +1089,27 @@ $(function() { 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 function sortMenu( sorting_form ){ -- 2.30.2