Bug 19030 - Link order <-> subscription is lost when an order is edited
Summary: Link order <-> subscription is lost when an order is edited
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Julian Maurice
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-03 12:34 UTC by Zeno Tajoli
Modified: 2019-10-14 19:57 UTC (History)
6 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Documentation of the bug (1.09 MB, application/pdf)
2017-08-03 12:36 UTC, Zeno Tajoli
Details
Bug 19030: Preserve link between order and subscription when editing an order (1.20 KB, patch)
2018-04-16 20:46 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19030: Preserve link between order and subscription when editing an order (1.33 KB, patch)
2018-04-16 22:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19030: Preserve link between order and subscription when editing an order (4.33 KB, patch)
2018-04-17 11:28 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19030: Preserve link between order and subscription when editing an order (4.47 KB, patch)
2018-04-17 18:19 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 19030: Preserve link between order and subscription when editing an order (4.60 KB, patch)
2018-04-20 09:03 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Zeno Tajoli 2017-08-03 12:34:01 UTC
In table aqorders there is the fiedl 'aqorders.subscriptionid'.
It is present because during creation of a basket if you add an order from a subscription, you register subscriptionid into aqorders.subscriptionid.

But when I try to change data (price, change ratio, etc.) of order, using acqui/parcel.pl, the link to order doesn't send the subscriptionid param.
So the value of subscriptionid is deleted in aqorders table and the connection is lost.

The problem is described in the pdf file here attached and in this e-mail thread:
https://lists.katipo.co.nz/pipermail/koha/2017-July/048475.html

Probably we need:
1) A new C4::Acquisition function that gives suscriptionid connect with a specific odernumber
2)Changes in acqui/parcel.pl and in koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
Comment 1 Zeno Tajoli 2017-08-03 12:36:17 UTC
Created attachment 65457 [details]
Documentation of the bug
Comment 2 Zeno Tajoli 2017-08-03 12:41:52 UTC
Comment on attachment 65457 [details]
Documentation of the bug

Pdf file written by Paul Pandian, pandian@imsc.res.in
Comment 3 Séverine Queune 2018-03-09 13:50:41 UTC
The BULAC (http://www.bulac.fr/) would like to sponsor this development !

As long as “Change sponsored?” is set on “Seeking developer”, anyone wanting to quote us for the development of such a feature or just ask for more information is welcome to write to us: <sigb@bulac.fr>.
Comment 4 Jonathan Druart 2018-04-16 20:46:18 UTC
Created attachment 74275 [details] [review]
Bug 19030: Preserve link between order and subscription when editing an order

The aqorders.subscriptionid info is not sent to the template when the
order is edited. Which means we lose this link.

Test plan:
Create an order from a subscription
Edit the order
=> Without this patch, the aqorders.subscriptionid value is set to NULL
and items are created when receiving serial.

=> With this patch applied the link is preserved and expected behaviors
are preserved during all the acquisition workflow
Comment 5 Séverine Queune 2018-04-16 21:17:06 UTC
The link between aqorder and subscription is now correctly kept when modifying the order but, if it's not the first order on this subscription, the modification always reset the different "Price" & "Note" fields to the values of the previous order.
This is a problem I don't have on master branch.
Comment 6 Katrin Fischer 2018-04-16 21:23:03 UTC
Good testing, Severine!
Comment 7 Jonathan Druart 2018-04-16 22:41:26 UTC
Created attachment 74285 [details] [review]
Bug 19030: Preserve link between order and subscription when editing an order

The aqorders.subscriptionid info is not sent to the template when the
order is edited. Which means we lose this link.

Test plan:
Create an order from a subscription
Edit the order
=> Without this patch, the aqorders.subscriptionid value is set to NULL
and items are created when receiving serial.

=> With this patch applied the link is preserved and expected behaviors
are preserved during all the acquisition workflow
Comment 8 Jonathan Druart 2018-04-16 22:41:44 UTC
(In reply to Katrin Fischer from comment #6)
> Good testing, Severine!

Indeed! :)
Comment 9 Jonathan Druart 2018-04-17 03:56:23 UTC
Still wrong
Comment 10 Jonathan Druart 2018-04-17 11:28:18 UTC
Created attachment 74313 [details] [review]
Bug 19030: Preserve link between order and subscription when editing an order

The aqorders.subscriptionid info is not sent to the template when the
order is edited. Which means we lose this link.

Test plan:
Create an order from a subscription
Edit the order
=> Without this patch, the aqorders.subscriptionid value is set to NULL
and items are created when receiving serial.

=> With this patch applied the link is preserved and expected behaviors
are preserved during all the acquisition workflow

You should also try and create several orders from the same subscription
Comment 11 Séverine Queune 2018-04-17 11:42:32 UTC
Hi Jonathan,
I failed when I try to apply it :

$ git bz apply 19030
Bug 19030 - Link order <-> subscription is lost when an order is edited

74313 - Bug 19030: Preserve link between order and subscription when editing an order

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19030: Preserve link between order and subscription when editing an order
Using index info to reconstruct a base tree...
M	koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt
Failed to merge in the changes.
Patch failed at 0001 Bug 19030: Preserve link between order and subscription when editing an order
The copy of the patch that failed is found in:
   /var/repositories/koha/.git/rebase-apply/patch
Comment 12 Jonathan Druart 2018-04-17 11:59:28 UTC
Séverine, the patch conflicts with bug 20365, so I decided to write this one on top of it. I have forgotten to add the dependency.
Comment 13 Séverine Queune 2018-04-17 18:19:00 UTC
Created attachment 74378 [details] [review]
Bug 19030: Preserve link between order and subscription when editing an order

The aqorders.subscriptionid info is not sent to the template when the
order is edited. Which means we lose this link.

Test plan:
Create an order from a subscription
Edit the order
=> Without this patch, the aqorders.subscriptionid value is set to NULL
and items are created when receiving serial.

=> With this patch applied the link is preserved and expected behaviors
are preserved during all the acquisition workflow

You should also try and create several orders from the same subscription

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 14 Séverine Queune 2018-04-17 18:23:15 UTC
I tried different kind of subscriptions and didn't notice weird behaviour this time.
Comment 15 Julian Maurice 2018-04-20 08:46:32 UTC
Does this really need to depend on bug 20365 ?
Comment 16 Julian Maurice 2018-04-20 09:03:41 UTC
Created attachment 74603 [details] [review]
Bug 19030: Preserve link between order and subscription when editing an order

The aqorders.subscriptionid info is not sent to the template when the
order is edited. Which means we lose this link.

Test plan:
Create an order from a subscription
Edit the order
=> Without this patch, the aqorders.subscriptionid value is set to NULL
and items are created when receiving serial.

=> With this patch applied the link is preserved and expected behaviors
are preserved during all the acquisition workflow

You should also try and create several orders from the same subscription

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 17 Julian Maurice 2018-04-20 09:06:16 UTC
(In reply to Julian Maurice from comment #15)
> Does this really need to depend on bug 20365 ?

I decided that it doesn't need to. This one fixes a bug, and bug 20365 is an enhancement that still needs some work.
I rebased the patch on master (without 20365), and signed off it.
Passed QA
Comment 18 Jonathan Druart 2018-04-20 15:25:13 UTC
(Sponsored-by: BULAC - http://www.bulac.fr will be added when pushing this patch)
Comment 19 Jonathan Druart 2018-04-20 15:49:28 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 20 Nick Clemens 2018-05-22 11:07:25 UTC
Pushed to stable for 17.11.6
Comment 21 Fridolin Somers 2018-05-23 05:26:01 UTC
Pushed to 17.05.x for v17.05.12