For some reason change made in bug 37033 to cart pop up has broken its functionalities. All following functionalities are now broken: - More details - Send - Download - Print - Empty and close - Remove - Add to a list - Place hold - Batch modify - Batch delete To reproduce: 1. Search for items and add one or more search results to your cart. 2. Open cart. 3. Attempt to use one functionality mentioned above. => Either nothing happens or table is loaded again with no items in table. However items are still displayed in cart when it's opened again. Also following errors are displayed in browsers console: > Uncaught TypeError: antiClickjack is null > Uncaught TypeError: $(...).dataTable is not a function Removing line [% INCLUDE 'intranet-bottom.inc' popup_window=1 %] from basket.tt fixes the problem, but then plugin intranet_js won't work.
Welp, it seems this one was easy to tackle. Moving line [% INCLUDE 'intranet-bottom.inc' popup_window=1 %] above other include lines fixes the issue. However we still need to make sure that this doesn't cause same problem which bug 37033 fixed.
Created attachment 173263 [details] [review] Bug 38257: Fix cart pop up functionalities Almost all functionalities in cart pop up were broken due changes made in bug 37033. Also following errors were displayed in browsers console: > Uncaught TypeError: antiClickjack is null > Uncaught TypeError: $(...).dataTable is not a function This happens because when 'intranet-bottom.inc' is loaded after other .inc files in page. To test: 1. Search for items and add one or more search results to your cart. 2. Open cart. 3. Attempt to use one or more functionalities (download, remove item etc.). => Either nothing happens or table is loaded again with no items in table. However items are still displayed in cart when it's opened again. 4. Apply this patch, restart services if needed. 5. Again attempt to download, remove items, print etc. from cart => Everything should now work as expected. Sponsored-by: Koha-Suomi Oy
Lari tested this and plugins should still work as expected.
There is still a problem with Download button.
Created attachment 173488 [details] [review] Bug 38257: Fix cart pop up functionalities Almost all functionalities in cart pop up were broken due changes made in bug 37033. Also following errors were displayed in browsers console: > Uncaught TypeError: antiClickjack is null > Uncaught TypeError: $(...).dataTable is not a function This happens because when 'intranet-bottom.inc' is loaded after other .inc files in page. To test: 1. Search for items and add one or more search results to your cart. 2. Open cart. 3. Attempt to use one or more functionalities (download, remove item etc.). => Either nothing happens or table is loaded again with no items in table. However items are still displayed in cart when it's opened again. 4. Apply this patch, restart services if needed. 5. Again attempt to download, remove items, print etc. from cart => Everything should now work as expected. Sponsored-by: Koha-Suomi Oy
Created attachment 173489 [details] [review] Bug 38257: Do not use js_includes.inc in two different files Downloading cart didn't work because js_includes.inc file was included both in basket.tt and intranet-bottom.inc. This patch removes related codeline from basket.tt. To test: 1. Search for items and add one or more search results to your cart. 2. Open cart. 3. Attempt to download items from your cart. => Either nothing happens. 4. Apply this patch, restart services if needed. 5. Again attempt to download. => Download menu should now work as expected. Sponsored-by: Koha-Suomi Oy
Created attachment 173683 [details] [review] Bug 38257: Do not use js_includes.inc in two different files Downloading cart didn't work because js_includes.inc file was included both in basket.tt and intranet-bottom.inc. This patch removes related codeline from basket.tt. To test: 1. Search for items and add one or more search results to your cart. 2. Open cart. 3. Attempt to download items from your cart. => Either nothing happens. 4. Apply this patch, restart services if needed. 5. Again attempt to download. => Download menu should now work as expected. Sponsored-by: Koha-Suomi Oy Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Sorry team I'm not able to reproduce the bug at all. Can you provide more information about what might cause the cart to break so I can properly test this?
(In reply to Aleisha Amohia from comment #8) > Sorry team I'm not able to reproduce the bug at all. > > Can you provide more information about what might cause the cart to break so > I can properly test this? Are you testing with item search cart or e.g. acquisitions cart? This is related to the former one. In bug 37033 we added this line to basket.tt file: >[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] It was added after other include and asset files in the same file: >[% INCLUDE js_includes.inc %] >[% INCLUDE 'datatables.inc' %] >[% Asset.js("js/cart.js") | $raw %] >[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] It seems that this prevents those other files from working properly, leading to every functionality of the cart not working and following errors in browsers console (last one strongly suggest that datatables.inc is not loaded properly): > Uncaught TypeError: antiClickjack is null > Uncaught TypeError: $(...).dataTable is not a function Moving intranet-bottom.inc as before all those other files fixed most of the functionalities, but downloading the cart was still not working. In intranet-bottom.inc file js_includes.inc is also declared at the bottom of the file. So my guess is that somehow declaring js_includes.inc both in intranet-bottom.inc and basket.tt prevents js_includes.inc from working. After moving it from basket.tt, downloading started working again.
Created attachment 173835 [details] [review] Bug 38257: Fix cart pop up functionalities Almost all functionalities in cart pop up were broken due changes made in bug 37033. Also following errors were displayed in browsers console: > Uncaught TypeError: antiClickjack is null > Uncaught TypeError: $(...).dataTable is not a function This happens because when 'intranet-bottom.inc' is loaded after other .inc files in page. To test: 1. Search for items and add one or more search results to your cart. 2. Open cart. 3. Attempt to use one or more functionalities (download, remove item etc.). => Either nothing happens or table is loaded again with no items in table. However items are still displayed in cart when it's opened again. 4. Apply this patch, restart services if needed. 5. Again attempt to download, remove items, print etc. from cart => Everything should now work as expected. Sponsored-by: Koha-Suomi Oy Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Created attachment 173836 [details] [review] Bug 38257: Do not use js_includes.inc in two different files Downloading cart didn't work because js_includes.inc file was included both in basket.tt and intranet-bottom.inc. This patch removes related codeline from basket.tt. To test: 1. Search for items and add one or more search results to your cart. 2. Open cart. 3. Attempt to download items from your cart. => Either nothing happens. 4. Apply this patch, restart services if needed. 5. Again attempt to download. => Download menu should now work as expected. Sponsored-by: Koha-Suomi Oy Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov> Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Pushed for 24.11! Well done everyone, thank you!
Backported to 24.05.x for upcoming 24.05.06
Looks like this does not impact 23.11.x