Bug 31632 - Add ability to manually link orders to suggestions
Summary: Add ability to manually link orders to suggestions
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Aleisha Amohia
QA Contact: Emily Lamancusa (emlam)
URL:
Keywords: roadmap_24_11
: 35367 (view as bug list)
Depends on: 36246
Blocks: 19358
  Show dependency treegraph
 
Reported: 2022-09-27 11:19 UTC by Nick Clemens (kidclamp)
Modified: 2024-11-12 14:40 UTC (History)
9 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement allows library staff to link an order (in an unclosed basket, or a standing order) to an accepted suggestion.
Version(s) released in:
Circulation function:


Attachments
Bug 31632: Add missing suggestion statuses to API (713 bytes, patch)
2022-09-27 13:09 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 31632: Add ability to link orders to suggestions when adding to basket from a file (10.72 KB, patch)
2022-09-27 13:09 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 31632: Display multiple suggestions for record in basket (3.11 KB, patch)
2022-09-27 13:09 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 31632: Link a suggestion to an existing order (7.60 KB, patch)
2024-07-23 03:49 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 31632: Link a suggestion to an existing order (7.66 KB, patch)
2024-08-07 21:20 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 31632: (follow-up) Simplify link text (1.69 KB, patch)
2024-08-07 21:20 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 31632: (follow-up) CSRF protection for linking order to suggestion (4.78 KB, patch)
2024-09-02 23:55 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 31632: Link a suggestion to an existing order (7.66 KB, patch)
2024-11-12 00:30 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 31632: (follow-up) Simplify link text (1.69 KB, patch)
2024-11-12 00:30 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 31632: (follow-up) CSRF protection for linking order to suggestion (4.76 KB, patch)
2024-11-12 00:30 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 31632: Link a suggestion to an existing order (7.72 KB, patch)
2024-11-12 14:40 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 31632: (follow-up) Simplify link text (1.76 KB, patch)
2024-11-12 14:40 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 31632: (follow-up) CSRF protection for linking order to suggestion (4.82 KB, patch)
2024-11-12 14:40 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2022-09-27 11:19:24 UTC

    
Comment 1 Katrin Fischer 2022-09-27 12:48:04 UTC
+1 Having a direct link from suggestion to order would be great.
Comment 2 Nick Clemens (kidclamp) 2022-09-27 13:09:39 UTC
Created attachment 141028 [details] [review]
Bug 31632: Add missing suggestion statuses to API
Comment 3 Nick Clemens (kidclamp) 2022-09-27 13:09:43 UTC
Created attachment 141029 [details] [review]
Bug 31632: Add ability to link orders to suggestions when adding to basket from a file

This patch adds a new include for suggestions searching, and adds JS on the addorderiso2907 page
to allow linking new orders to suggestions while importing into a basket

To test:
 1 - Export or find a file of bibs
 2 - Stage the file using Tools->Stage MARC for Import
 3 - Find or create an open basket in acquisitions
 4 - Add to basket from the staged file
 5 - Select/check a record
 6 - Note new 'Suggestions' area
 7 - Click 'Link suggestions'
 8 - Search for suggestions - click 'Select'
 9 - Select button is gone
10 - Dismiss modal
11 - Suggestion is listed for this record
12 - Click 'Link suggestions'
13 - Confirm the suggestion cannot be chosen again
14 - Add another
15 - Dismiss the modal
16 - Click 'Remove' on the first suggestion
17 - Confirm it is removed
18 - Confirm you can now link it again
19 - Select budget etc and submit
20 - Confirm record linked to suggestions
Comment 4 Nick Clemens (kidclamp) 2022-09-27 13:09:47 UTC
Created attachment 141030 [details] [review]
Bug 31632: Display multiple suggestions for record in basket

In case suggestions are duplicated, allow several to be attached and display them all

To test:
1 - Follow plan in previous patch to attach 2 suggestions when adding order
2 - Confirm both suggestions display after record added to basket
Comment 5 Nick Clemens (kidclamp) 2022-09-27 13:11:05 UTC
(In reply to Katrin Fischer from comment #1)
> +1 Having a direct link from suggestion to order would be great.

This is really 'link to biblio' during ordering - maybe another bug to add suggestion_id to aqorders table?

Still need to cleanup and add to neworderempty - but attaching WIP to clarify
Comment 6 Katrin Fischer 2022-09-27 13:16:47 UTC
(In reply to Nick Clemens from comment #5)
> (In reply to Katrin Fischer from comment #1)
> > +1 Having a direct link from suggestion to order would be great.
> 
> This is really 'link to biblio' during ordering - maybe another bug to add
> suggestion_id to aqorders table?

I think it already exists, but couldn't find it. The current approach is problematic, because you might end up emailing the 'wrong' users.

Also: We'd need suggestions.ordernumber, because you might have several people suggesting the same popular item at the same time, less likely to have multiple orders for one suggestion.
Comment 7 Katrin Fischer 2022-09-27 13:18:24 UTC
Is this a (partial) duplicate of bug 19358?
Comment 8 Nick Clemens (kidclamp) 2022-09-27 13:23:41 UTC
(In reply to Katrin Fischer from comment #7)
> Is this a (partial) duplicate of bug 19358?

It's a step towards that one, adding depends/blocks
Comment 9 Aleisha Amohia 2023-11-20 07:45:28 UTC
*** Bug 35367 has been marked as a duplicate of this bug. ***
Comment 10 Aleisha Amohia 2024-07-23 03:49:17 UTC
Created attachment 169391 [details] [review]
Bug 31632: Link a suggestion to an existing order

This enhancement allows library staff to link an order (in an unclosed basket, or a standing order) to an accepted suggestion.

To test:

1) In the staff interface, go to Suggestions and create at least two suggestions.
2) Mark at least two suggestions as Accepted.
3) Go to Acquisitions, create a vendor if you don't have one already.
4) Have or create two baskets - one should be standing, and one not standing (normal).
5) In the normal basket (not standing), add an order from any source but NOT from a suggestion.
6) When you save the order, there should be a new link in the Modify column of the Orders table - "Search for suggestion to link". Click this.
7) Choose one of your suggestions to link to the order.
8) You should be redirected back to the basket. Confirm your order has been correctly linked to the suggestion. Confirm there is no link to "Search for suggestion to link" for this order now that a suggestion has already been linked.
9) Add another order to this basket from any source but NOT from a suggestion.
10) Close the basket. Confirm there is no link to "Search for suggestion to link" because the basket is closed, but you could reopen the basket to link the order if you wanted to.
11) Go to Baskets in the left navigation so you can find your standing basket.
12) Add an order to your standing basket from any source but NOT from a suggestion.
13) Go to the vendor and Receive shipments. Receive your standing order and finish receiving.
14) Go to the standing basket. There should be a new unreceived standing order for the record you just received, with a link to "Search for suggestion to link". Click this.
15) Choose a suggestion to link to the order.
16) You should be redirected back to the basket. Confirm your orders for this record have been correctly linked to the suggestion.

Sponsored-by: Pymble Ladies' College
Comment 11 Tomás Cohen Arazi (tcohen) 2024-08-07 21:20:05 UTC
Created attachment 170147 [details] [review]
Bug 31632: Link a suggestion to an existing order

This enhancement allows library staff to link an order (in an unclosed basket, or a standing order) to an accepted suggestion.

To test:

1) In the staff interface, go to Suggestions and create at least two suggestions.
2) Mark at least two suggestions as Accepted.
3) Go to Acquisitions, create a vendor if you don't have one already.
4) Have or create two baskets - one should be standing, and one not standing (normal).
5) In the normal basket (not standing), add an order from any source but NOT from a suggestion.
6) When you save the order, there should be a new link in the Modify column of the Orders table - "Search for suggestion to link". Click this.
7) Choose one of your suggestions to link to the order.
8) You should be redirected back to the basket. Confirm your order has been correctly linked to the suggestion. Confirm there is no link to "Search for suggestion to link" for this order now that a suggestion has already been linked.
9) Add another order to this basket from any source but NOT from a suggestion.
10) Close the basket. Confirm there is no link to "Search for suggestion to link" because the basket is closed, but you could reopen the basket to link the order if you wanted to.
11) Go to Baskets in the left navigation so you can find your standing basket.
12) Add an order to your standing basket from any source but NOT from a suggestion.
13) Go to the vendor and Receive shipments. Receive your standing order and finish receiving.
14) Go to the standing basket. There should be a new unreceived standing order for the record you just received, with a link to "Search for suggestion to link". Click this.
15) Choose a suggestion to link to the order.
16) You should be redirected back to the basket. Confirm your orders for this record have been correctly linked to the suggestion.

Sponsored-by: Pymble Ladies' College
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 12 Tomás Cohen Arazi (tcohen) 2024-08-07 21:20:08 UTC
Created attachment 170148 [details] [review]
Bug 31632: (follow-up) Simplify link text

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 13 Tomás Cohen Arazi (tcohen) 2024-08-07 21:24:49 UTC
The behavior matches the description and seems correct. QA scripts happy.
I would only change the link text to simplify it. Feel free to obsolete if disagree.
Comment 14 Aleisha Amohia 2024-08-07 21:25:38 UTC
(In reply to Tomás Cohen Arazi from comment #13)
> The behavior matches the description and seems correct. QA scripts happy.
> I would only change the link text to simplify it. Feel free to obsolete if
> disagree.

Naming things is the hardest part! Happy with your amendment :)
Comment 15 Tomás Cohen Arazi (tcohen) 2024-08-08 20:31:18 UTC
(In reply to Aleisha Amohia from comment #14)
> (In reply to Tomás Cohen Arazi from comment #13)
> > The behavior matches the description and seems correct. QA scripts happy.
> > I would only change the link text to simplify it. Feel free to obsolete if
> > disagree.
> 
> Naming things is the hardest part! Happy with your amendment :)

Not a blocker, but I wonder what you didn't like about Nick's modal. And if we could reintroduce it (here or on a follow-up).
Comment 16 Aleisha Amohia 2024-08-08 23:49:36 UTC
(In reply to Tomás Cohen Arazi from comment #15)
> Not a blocker, but I wonder what you didn't like about Nick's modal. And if
> we could reintroduce it (here or on a follow-up).

I honestly didn't look at it! I just saw that the patches were a couple of years old and figured it would've needed some reworking just because of that. I also had an approved plan by the sponsoring library, which is how my patch took its shape.
Comment 17 Emily Lamancusa (emlam) 2024-08-28 13:27:06 UTC
This is a really nice workflow! Just one thing - The link_order op needs to follow the CSRF protection coding guidelines, since it triggers an update action. Seems like a good use case for the form submission pattern in https://wiki.koha-community.org/wiki/Coding_Guidelines#JS16:_JavaScript_form_submission_via_links
Comment 18 Aleisha Amohia 2024-09-02 23:55:56 UTC
Created attachment 170953 [details] [review]
Bug 31632: (follow-up) CSRF protection for linking order to suggestion
Comment 19 Jonathan Druart 2024-09-03 08:21:07 UTC
There are already bug 28844 and bug 31632. Can you explain the direction of this one please?
Comment 20 Aleisha Amohia 2024-09-03 20:58:04 UTC
(In reply to Jonathan Druart from comment #19)
> There are already bug 28844 and bug 31632. Can you explain the direction of
> this one please?

This enhancement allows a library to link an order to a suggestion after the order is created. Useful if:
- the librarian forgot to link to an existing suggestion
- the librarian didn't know there was a suggestion at the time of creating the order and discovered it after
- a user made a suggestion, not knowing the record was already on order

It's just another way to have an order linked to a suggestion. I don't see it clashing with Bug 35717 at all. My patch wasn't intended to allow linking multiple suggestions to one order - Nick's might have been that, but mine went in a different direction.

Hope that explains.
Comment 21 Aleisha Amohia 2024-11-12 00:30:24 UTC
Created attachment 174393 [details] [review]
Bug 31632: Link a suggestion to an existing order

This enhancement allows library staff to link an order (in an unclosed basket, or a standing order) to an accepted suggestion.

To test:

1) In the staff interface, go to Suggestions and create at least two suggestions.
2) Mark at least two suggestions as Accepted.
3) Go to Acquisitions, create a vendor if you don't have one already.
4) Have or create two baskets - one should be standing, and one not standing (normal).
5) In the normal basket (not standing), add an order from any source but NOT from a suggestion.
6) When you save the order, there should be a new link in the Modify column of the Orders table - "Search for suggestion to link". Click this.
7) Choose one of your suggestions to link to the order.
8) You should be redirected back to the basket. Confirm your order has been correctly linked to the suggestion. Confirm there is no link to "Search for suggestion to link" for this order now that a suggestion has already been linked.
9) Add another order to this basket from any source but NOT from a suggestion.
10) Close the basket. Confirm there is no link to "Search for suggestion to link" because the basket is closed, but you could reopen the basket to link the order if you wanted to.
11) Go to Baskets in the left navigation so you can find your standing basket.
12) Add an order to your standing basket from any source but NOT from a suggestion.
13) Go to the vendor and Receive shipments. Receive your standing order and finish receiving.
14) Go to the standing basket. There should be a new unreceived standing order for the record you just received, with a link to "Search for suggestion to link". Click this.
15) Choose a suggestion to link to the order.
16) You should be redirected back to the basket. Confirm your orders for this record have been correctly linked to the suggestion.

Sponsored-by: Pymble Ladies' College
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 22 Aleisha Amohia 2024-11-12 00:30:27 UTC
Created attachment 174394 [details] [review]
Bug 31632: (follow-up) Simplify link text

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 23 Aleisha Amohia 2024-11-12 00:30:30 UTC
Created attachment 174395 [details] [review]
Bug 31632: (follow-up) CSRF protection for linking order to suggestion
Comment 24 Andrew Fuerste-Henry 2024-11-12 14:40:39 UTC
Created attachment 174415 [details] [review]
Bug 31632: Link a suggestion to an existing order

This enhancement allows library staff to link an order (in an unclosed basket, or a standing order) to an accepted suggestion.

To test:

1) In the staff interface, go to Suggestions and create at least two suggestions.
2) Mark at least two suggestions as Accepted.
3) Go to Acquisitions, create a vendor if you don't have one already.
4) Have or create two baskets - one should be standing, and one not standing (normal).
5) In the normal basket (not standing), add an order from any source but NOT from a suggestion.
6) When you save the order, there should be a new link in the Modify column of the Orders table - "Search for suggestion to link". Click this.
7) Choose one of your suggestions to link to the order.
8) You should be redirected back to the basket. Confirm your order has been correctly linked to the suggestion. Confirm there is no link to "Search for suggestion to link" for this order now that a suggestion has already been linked.
9) Add another order to this basket from any source but NOT from a suggestion.
10) Close the basket. Confirm there is no link to "Search for suggestion to link" because the basket is closed, but you could reopen the basket to link the order if you wanted to.
11) Go to Baskets in the left navigation so you can find your standing basket.
12) Add an order to your standing basket from any source but NOT from a suggestion.
13) Go to the vendor and Receive shipments. Receive your standing order and finish receiving.
14) Go to the standing basket. There should be a new unreceived standing order for the record you just received, with a link to "Search for suggestion to link". Click this.
15) Choose a suggestion to link to the order.
16) You should be redirected back to the basket. Confirm your orders for this record have been correctly linked to the suggestion.

Sponsored-by: Pymble Ladies' College
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 25 Andrew Fuerste-Henry 2024-11-12 14:40:41 UTC
Created attachment 174416 [details] [review]
Bug 31632: (follow-up) Simplify link text

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 26 Andrew Fuerste-Henry 2024-11-12 14:40:44 UTC
Created attachment 174417 [details] [review]
Bug 31632: (follow-up) CSRF protection for linking order to suggestion

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>