Bug 39029

Summary: When a basket contains an order transferred from another basket some information is incorrect
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: AcquisitionsAssignee: Imani <imani.thomas>
Status: Pushed to main --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: andrew.auld, imani.thomas, Laura.escamilla, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:
Attachments: Bug 39029: When a basket contains an order transferred from another basket some info is incorrect.
Bug 39029: When a basket contains an order transferred from another basket some info is incorrect.
Bug 39029: When a basket contains an order transferred from another basket some info is incorrect.

Description Nick Clemens (kidclamp) 2025-02-04 17:40:10 UTC
When a basket has orders transferred from another basket we do this:
                                                            [% IF (books_loo.transferred_from) %]
                                                                [% basket = books_loo.transferred_from.basket %]
                                                                [% bookseller = books_loo.transferred_from.bookseller %]
                                                                [% timestamp = books_loo.transferred_from.timestamp %]


But later when building the 'Add to basket' modal - we have this:
                                    <div id="addtoBasket" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel" aria-hidden="true" data-basketno="[% basket.basketname | html %]">

We are using the wrong basket now to pull info
Comment 1 Nick Clemens (kidclamp) 2025-02-04 17:41:52 UTC
To recreate:
1 - Create a new basket - 'Gonna transfer'
2 - Add an order to the basket
3 - Create another basket 'Has the transfer'
4 - Return to first basket and transfer order to second
5 - Return to second basket, click 'Add to basket' and inspect the modal
6 - Note basketno says 'Gonna transfer'

It should have correct name, and maybe be renamed to 'basketname'
Comment 2 Imani 2025-02-12 21:02:45 UTC
I have changes for this but am running into some errors trying to attach my patch.

Traceback (most recent call last):
  File "/usr/bin/git-bz", line 2845, in <module>
    do_attach(*args)
  File "/usr/bin/git-bz", line 2171, in do_attach
    add_url(bug, commits)
  File "/usr/bin/git-bz", line 1719, in add_url
    add_url_to_head_commit(commit, bug)
  File "/usr/bin/git-bz", line 1682, in add_url_to_head_commit
    git.commit(file="-", amend=True, _input=input)
  File "/usr/bin/git-bz", line 197, in f
    o = git_run(command, *args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/git-bz", line 167, in git_run
    output, error = process.communicate(input)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1207, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 2039, in _communicate
    input_view = memoryview(self._input)
                 ^^^^^^^^^^^^^^^^^^^^^^^


I tried doing a fresh ktd pull but still the same error.
Comment 3 Imani 2025-02-12 21:34:29 UTC
Created attachment 177978 [details] [review]
Bug 39029: When a basket contains an order transferred from another basket some info is incorrect.

To test:
1 - Create a new basket - 'Gonna transfer'
2 - Add an order to the basket
3 - Create another basket 'Has the transfer'
4 - Return to first basket and transfer order to second
5 - Return to second basket, click 'Add to basket' and inspect the modal
6 - Note basketno says 'Gonna transfer'
7 - apply the patch
8 - redo steps 1 through 6 with fresh baskets and the modal should have the correct values
Comment 4 Andrew Auld 2025-04-03 09:23:08 UTC
Created attachment 180473 [details] [review]
Bug 39029: When a basket contains an order transferred from another basket some info is incorrect.

To test:
1 - Create a new basket - 'Gonna transfer'
2 - Add an order to the basket
3 - Create another basket 'Has the transfer'
4 - Return to first basket and transfer order to second
5 - Return to second basket, click 'Add to basket' and inspect the modal
6 - Note basketno says 'Gonna transfer'
7 - apply the patch
8 - redo steps 1 through 6 with fresh baskets and the modal should have the correct values

Signed-off-by: Andrew Auld <andrew.auld@openfifth.co.uk>
Comment 5 Andrew Auld 2025-04-03 09:23:39 UTC
Works like a charm
Comment 6 Martin Renvoize (ashimema) 2025-05-12 12:59:27 UTC
Created attachment 182270 [details] [review]
Bug 39029: When a basket contains an order transferred from another basket some info is incorrect.

To test:
1 - Create a new basket - 'Gonna transfer'
2 - Add an order to the basket
3 - Create another basket 'Has the transfer'
4 - Return to first basket and transfer order to second
5 - Return to second basket, click 'Add to basket' and inspect the modal
6 - Note basketno says 'Gonna transfer'
7 - apply the patch
8 - redo steps 1 through 6 with fresh baskets and the modal should have the correct values

Signed-off-by: Andrew Auld <andrew.auld@openfifth.co.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 7 Katrin Fischer 2025-05-12 16:25:22 UTC
Good catch!
Comment 8 Katrin Fischer 2025-05-12 16:31:57 UTC
Pushed for 25.05!

Well done everyone, thank you!