Bug 31056

Summary: Unable to 'Close and export as PDF' a basket group
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: AcquisitionsAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, lucas, martin.renvoize
Version: MainKeywords: regression
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32935
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04
Circulation function:
Bug Depends on: 13614    
Bug Blocks:    
Attachments: Bug 31056: Restore closeandprint function on basketgroups page
Bug 31056: Restore closeandprint function on basketgroups page
Bug 31056: Restore closeandprint function on basketgroups page

Description Caroline Cyr La Rose 2022-06-27 19:13:19 UTC
The button to 'Close and export as PDF' in the basket groups page seems to be broken.

To test:
0) Make sure to have budgets, funds, and vendors set up in the acquisitions module
1) Go to Acquisitions
2) Search for a vendor
3) Create a new basket
4) Add materials to the basket
5) Close the basket (do NOT create a basket group at this time)
6) Click on the Basket groups tab on the left
7) Create a new basket group and add the basket (do NOT check the 'close basket group' box)
8) From the open basket groups list, click 'Close and export as PDF'
--> Nothing happens

In order to export as PDF, you have to edit the basket group, check the 'Close basket group' box, save and then export as PDF.
Comment 1 Katrin Fischer 2023-02-09 23:12:29 UTC
Created attachment 146461 [details] [review]
Bug 31056: Restore closeandprint function on basketgroups page

Bug 13614 removed the basketgroup.js asset from the basket group
page. This file includes the closeandprint function used for
closing and printing the PDF from the open basket groups tab.
The patch restores just this function directly in the file where
it's needed as this is the only spot and it's only a few lines.
The rest of basketgroup.js appears unused.

To test:
* Create a basket with one or more oder lines
* Close the basket and check the checkbox to add it to a
  basket group
* Reopen the basket group from the basket groups page
* Verify the close and print only leads to a JS error and
  nothing happens
* Apply patch
* Repeat and verify you can now 'Close and print' from the
  open basket group tab
* Verify all other buttons work as expected as well
Comment 2 Caroline Cyr La Rose 2023-02-10 16:58:06 UTC
Created attachment 146507 [details] [review]
Bug 31056: Restore closeandprint function on basketgroups page

Bug 13614 removed the basketgroup.js asset from the basket group
page. This file includes the closeandprint function used for
closing and printing the PDF from the open basket groups tab.
The patch restores just this function directly in the file where
it's needed as this is the only spot and it's only a few lines.
The rest of basketgroup.js appears unused.

To test:
* Create a basket with one or more oder lines
* Close the basket and check the checkbox to add it to a
  basket group
* Reopen the basket group from the basket groups page
* Verify the close and print only leads to a JS error and
  nothing happens
* Apply patch
* Repeat and verify you can now 'Close and print' from the
  open basket group tab
* Verify all other buttons work as expected as well

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 3 Caroline Cyr La Rose 2023-02-10 16:58:22 UTC
Thanks Katrin!
Comment 4 Katrin Fischer 2023-02-10 17:11:59 UTC
(In reply to Caroline Cyr La Rose from comment #3)
> Thanks Katrin!

You are very welcome! :)
Comment 5 Jonathan Druart 2023-02-22 15:44:39 UTC
I don't understand, it's in

koha-tmpl/intranet-tmpl/prog/js/basketgroup.js:function closeandprint(bg){

You are not supposed to redefine it here.

The js file still exists, but never used

I think you may simply need to re-add it.
Comment 6 Katrin Fischer 2023-02-22 16:18:07 UTC
(In reply to Jonathan Druart from comment #5)
> I don't understand, it's in
> 
> koha-tmpl/intranet-tmpl/prog/js/basketgroup.js:function closeandprint(bg){
> 
> You are not supposed to redefine it here.
> 
> The js file still exists, but never used
> 
> I think you may simply need to re-add it.

I explained that in the commit message:

Bug 13614 removed the basketgroup.js asset from the basket group
page. This file includes the closeandprint function used for
closing and printing the PDF from the open basket groups tab.
The patch restores just this function directly in the file where
it's needed as this is the only spot and it's only a few lines.
The rest of basketgroup.js appears unused.

And I also filed bug 32935 to remove basketgroup.js.
Comment 7 Jonathan Druart 2023-02-23 08:54:26 UTC
Created attachment 147192 [details] [review]
Bug 31056: Restore closeandprint function on basketgroups page

Bug 13614 removed the basketgroup.js asset from the basket group
page. This file includes the closeandprint function used for
closing and printing the PDF from the open basket groups tab.
The patch restores just this function directly in the file where
it's needed as this is the only spot and it's only a few lines.
The rest of basketgroup.js appears unused.

To test:
* Create a basket with one or more oder lines
* Close the basket and check the checkbox to add it to a
  basket group
* Reopen the basket group from the basket groups page
* Verify the close and print only leads to a JS error and
  nothing happens
* Apply patch
* Repeat and verify you can now 'Close and print' from the
  open basket group tab
* Verify all other buttons work as expected as well

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

JD Amended patch: fix indentation and spacing

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2023-02-23 08:54:56 UTC
PQA as it restores the exact same function that existed already, but this sleep 3s is wrong.
Comment 9 Tomás Cohen Arazi (tcohen) 2023-02-27 14:42:05 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 10 Matt Blenkinsop 2023-03-01 09:51:05 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 11 Lucas Gass (lukeg) 2023-03-10 14:26:53 UTC
Missing dependencies for 22.05.x, no backport.
Comment 12 Katrin Fischer 2023-03-20 20:52:32 UTC
*** Bug 32077 has been marked as a duplicate of this bug. ***