Bug 27063

Summary: Allow changing which record an order is linked to
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: AcquisitionsAssignee: Aleisha Amohia <aleisha>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, david, michaela.sieber
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33305
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10758
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 37109, 35402    
Bug Blocks:    
Attachments: Bug 27063: Add modal for linking a basket order to a different record
Bug 27063: Add modal for linking a basket order to a different record
Bug 27063: [WIP] Link different record to order from existing records
Bug 27063: Add modal for linking a basket order to a different record
Bug 27063: [WIP] Link different record to order from existing records
Bug 27063: Add modal for linking a basket order to a different record
Bug 27063: [WIP] Link different record to order from existing records
Bug 27063: Add modal for linking a basket order to a different record
Bug 27063: Link different record to order from existing records
Bug 27063: Link different record to order from existing records
Bug 27063: Allow received orders to also be relinked
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
Bug 27063: Add modal for linking a basket order to a different record
Bug 27063: Link different record to order from existing records
Bug 27063: Allow received orders to also be relinked
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
Bug 27063: Use Bootstrap 5 syntax for modal
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
Bug 27063: Use Bootstrap 5 syntax for modal

Description Katrin Fischer 2020-11-20 10:03:14 UTC
At the moment if the basket is still open you can update the bbliographic details of an order or overwrite the existing record via Z39.50, but if you notice that you have used the wrong record, there is no way to fix this.

It would be great if it was possible to change the record an order is linked to while the basket is still open. This should explicitly allow to use a record that is already in the catalog.

--
There is also a use case here for libraries using standing orders for tracking electronic resources such as series. They usually place the order on the series record. When the volumes arrive they'd like to change it so the acq information is tied to the volume. But without using items (which is not the case here for electronic resources), this is not possible.
Comment 1 Aleisha Amohia 2024-06-11 04:53:50 UTC Comment hidden (obsolete)
Comment 2 Aleisha Amohia 2024-06-13 01:43:42 UTC Comment hidden (obsolete)
Comment 3 Aleisha Amohia 2024-06-13 01:43:45 UTC Comment hidden (obsolete)
Comment 4 Aleisha Amohia 2024-06-17 05:44:30 UTC Comment hidden (obsolete)
Comment 5 Aleisha Amohia 2024-06-17 05:44:33 UTC Comment hidden (obsolete)
Comment 6 Aleisha Amohia 2024-06-18 03:54:19 UTC Comment hidden (obsolete)
Comment 7 Aleisha Amohia 2024-06-18 03:54:22 UTC Comment hidden (obsolete)
Comment 8 Aleisha Amohia 2024-06-25 05:26:18 UTC Comment hidden (obsolete)
Comment 9 Aleisha Amohia 2024-06-25 05:26:21 UTC Comment hidden (obsolete)
Comment 10 Aleisha Amohia 2024-07-06 01:40:03 UTC Comment hidden (obsolete)
Comment 11 Aleisha Amohia 2024-07-06 02:12:13 UTC Comment hidden (obsolete)
Comment 12 Aleisha Amohia 2024-08-07 00:53:21 UTC Comment hidden (obsolete)
Comment 13 Aleisha Amohia 2024-08-07 03:33:55 UTC Comment hidden (obsolete)
Comment 14 Aleisha Amohia 2024-08-09 02:46:14 UTC Comment hidden (obsolete)
Comment 15 Michaela Sieber 2024-08-15 16:23:21 UTC
(In reply to Aleisha Amohia from comment #11)
> Created attachment 168572 [details] [review] [review]
> Bug 27063: Allow received orders to also be relinked
> 
> Useful for when the bibliographic records of received orders have been
> deleted, but we want to keep the ordernumber history/invoice data etc.
> 
> To test:
> 
> 1. Add an order to a standing basket
> 2. Receive the order
> 3. Once received, delete the record attached to the order
> 4. Go back to the basket
> 5. Attempt to relink the order with the deleted record
> 6. This should work
> 


This one does not work.

But I do not understand why it is necessary. We already store the biblionumber of the deleted record in the orderline and since Bug 10758 we display the title of this deleted record. So we already keep the ordernumber history/invoice data etc.
Comment 16 Aleisha Amohia 2024-08-20 02:19:50 UTC Comment hidden (obsolete)
Comment 17 Aleisha Amohia 2024-08-20 02:43:58 UTC Comment hidden (obsolete)
Comment 18 Aleisha Amohia 2024-08-26 03:52:16 UTC
Created attachment 170692 [details] [review]
Bug 27063: Add modal for linking a basket order to a different record
Comment 19 Aleisha Amohia 2024-08-26 03:52:19 UTC
Created attachment 170693 [details] [review]
Bug 27063: Link different record to order from existing records

This patch adds the ability to link an order to a different record. This applies to:
* orders in open baskets (not closed)
* unreceived orders in standing baskets

Orders can be linked:
* from an existing record
* from a suggestion
* from a subscription
* from a new (empty) record
* from existing orders (copy)
* from an external source

To test:

1. Apply the patches and restart services
2. Create a normal basket (do not check 'orders are standing'). Add an order to the basket.
3. Notice there is a 'Link to different record' option in the Modify column.
4. Close the basket.
5. Create another basket, this time do check the 'orders are standing' option. Add two orders to the basket.
6. Click 'Link to different record' for one of the orders.
7. Create a suggestion. Create a subscription. Have a MARC record available to stage/import.
8. Loop through each option, linking:
* from an existing record
* from a suggestion
* from a subscription
* from a new (empty) record
* from existing orders (copy)
* from an external source
Make sure that the accounting information is always kept, and just the record details of the order are changed.
9. Go to the vendor page and click 'Receive shipments'. Fill in invoice details.
10. On the receiving page, 'Receive' one of your standing orders. Increment the quantity and finish receiving.
11. Go to the standing basket. Confirm there is no 'Link to different record' option for the received order.

Sponsored-by: Auckland University of Technology
Comment 20 Aleisha Amohia 2024-08-26 03:52:21 UTC
Created attachment 170694 [details] [review]
Bug 27063: Allow received orders to also be relinked

Useful for when the bibliographic records of received orders have been deleted, but we want to keep the ordernumber history/invoice data etc.

To test:

1. Add an order to a standing basket
2. Receive the order
3. Once received, delete the record attached to the order
4. Go back to the basket
5. Attempt to relink the order with the deleted record
6. This should work

Sponsored-by: Auckland University of Technology
Comment 21 Aleisha Amohia 2024-08-26 03:52:24 UTC
Created attachment 170695 [details] [review]
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement

This follow-up patch adds a new system preference KeepInvoiceOnOrderRelink.

When enabled, relinking a received order will keep the invoice ID of the original order.

This is useful for standing orders where the record has been deleted and linked to a new record/order.

To test:

1. Enable the system preference KeepInvoiceOnOrderRelink
2. Add an order to a standing basket
3. Receive the order
4. Once received, go to the record and view the Acquisitions details tab. Notice the invoice is linked.
5. Go back to the basket
6. Relink the received order to a different record
7. Go to the record and view the Acquisitions details tab. Notice the invoice has been kept.
8. Repeat the test plan with the system preference KeepInvoiceOnOrderRelink disabled. Notice the invoice is nullified after the order is relinked.

Sponsored-by: Auckland University of Technology
Comment 22 Aleisha Amohia 2024-08-26 03:52:27 UTC
Created attachment 170696 [details] [review]
Bug 27063: Use Bootstrap 5 syntax for modal
Comment 23 David Nind 2024-10-27 19:43:41 UTC
The patch no longer applies - getting the SHA1/fake ancestor error.

git bz apply 27063

Bug 27063 - Allow changing which record an order is linked to

170692 - Bug 27063: Add modal for linking a basket order to a different record
170693 - Bug 27063: Link different record to order from existing records
170694 - Bug 27063: Allow received orders to also be relinked
170695 - Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
170696 - Bug 27063: Use Bootstrap 5 syntax for modal

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 27063: Add modal for linking a basket order to a different record
Applying: Bug 27063: Link different record to order from existing records
Applying: Bug 27063: Allow received orders to also be relinked
Applying: Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt).
error: could not build fake ancestor
Patch failed at 0001 Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement
Comment 24 Aleisha Amohia 2024-11-18 00:31:34 UTC
Created attachment 174648 [details] [review]
Bug 27063: Syspref KeepInvoiceOnOrderRelink and implement

This follow-up patch adds a new system preference KeepInvoiceOnOrderRelink.

When enabled, relinking a received order will keep the invoice ID of the original order.

This is useful for standing orders where the record has been deleted and linked to a new record/order.

To test:

1. Enable the system preference KeepInvoiceOnOrderRelink
2. Add an order to a standing basket
3. Receive the order
4. Once received, go to the record and view the Acquisitions details tab. Notice the invoice is linked.
5. Go back to the basket
6. Relink the received order to a different record
7. Go to the record and view the Acquisitions details tab. Notice the invoice has been kept.
8. Repeat the test plan with the system preference KeepInvoiceOnOrderRelink disabled. Notice the invoice is nullified after the order is relinked.

Sponsored-by: Auckland University of Technology
Comment 25 Aleisha Amohia 2024-11-18 00:31:37 UTC
Created attachment 174649 [details] [review]
Bug 27063: Use Bootstrap 5 syntax for modal
Comment 26 David Nind 2024-12-25 20:01:13 UTC
I always struggle with acquisitions, so I'll leave up to someone else to test this properly.

I did have a go at working through the test plan, here are the things I noted:

General
-------

1. The patches still apply. Needed to run an updatedatabase (for the new system preference KeepInvoiceOnOrderRelink).

Patch - Link different record to order from existing records
------------------------------------------------------------

1. Step 8 - Options available: I only see these options for "Link to a different record":
   - From an existing record
   - From a suggestion
   - From a subscription
   - From a new (empty) record
   - From existing orders (copy)
   - From an external source
   I don't have:
   - From a new file
   - From a staged file
   - From titles with highest hold ratios

2. Step 8 - From an external source: The catalog details aren't filled in - is that expected?

3. Step 11 - Standing basket: There is still a "Link to different record" for the item received.

Patch - Allow received orders to also be relinked
-------------------------------------------------

1. Not sure how to do step 5 - if I delete the record, I can't locate the record to re-link it to.
Comment 27 Owen Leonard 2025-01-27 12:14:18 UTC
(In reply to David Nind from comment #26)
>    I don't have:
>    - From a new file
>    - From a staged file
>    - From titles with highest hold ratios

Same, but I see they're not mentioned in the test plan, so expected?


> 2. Step 8 - From an external source: The catalog details aren't filled in -
> is that expected?

Same. And the order is saved as a new one, separate from the one chose to link.