From cf886098db51e5eb0e470d56b7effe3225047edc 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. --- .../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 2220bf124a..6a3bd7fd20 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 %] @@ -1079,6 +1087,27 @@ $(function() { $("#download_list").submit(); }); + $(".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