From e1df5918701b27ad5df5063cbdd14cd8201ee131 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 Signed-off-by: Tomas Cohen Arazi --- .../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 0426e8855d..5d524587fc 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -361,6 +361,14 @@ [% END %] + [% IF Koha.Preference( 'opacbookbag' ) == 1 %] + Add to cart + [% END %] + + [% IF Koha.Preference('virtualshelves') %] + Add to list + [% END %] + [% IF ( TagsInputEnabled && loggedinusername ) %] Tag @@ -379,7 +387,7 @@ -
+ [% IF can_manage_shelf %] @@ -1077,6 +1085,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.39.5