Bug 21467 - Allow several receipts for a given subscription
Summary: Allow several receipts for a given subscription
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low new feature (vote)
Target Milestone: ---
Assignee: Jonathan Druart
QA Contact: Katrin Fischer
URL:
Whiteboard:
Keywords: release-notes-needed
: 17876 (view as bug list)
Depends on: 21474
Blocks: 21588 21799
  Show dependency treegraph
 
Reported: 2018-10-02 01:54 UTC by Jonathan Druart
Modified: 2018-11-27 11:44 UTC (History)
6 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Medium patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Allows the user to set a quantity for a serial order, useful in the case where payments are made per receipt of individual issues. This development also allows for altering the total expected quantity for a serial in the case of a periodicity change.


Attachments
Bug 21467: Allow several receipts for a given subscription (13.25 KB, patch)
2018-10-02 02:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber (3.54 KB, patch)
2018-10-02 02:18 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Allow several receipts for a given subscription (13.27 KB, patch)
2018-10-02 16:51 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber (3.54 KB, patch)
2018-10-02 16:51 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Add subscription's info when ordering (2.75 KB, patch)
2018-10-02 16:51 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Do not erase the internal note of the first order (5.32 KB, patch)
2018-10-02 16:51 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Display the quantity and adjust the amounts (3.49 KB, patch)
2018-10-02 16:51 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Display a summary line per parent_ordernumber (7.26 KB, patch)
2018-10-12 18:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Fix default sort (2.35 KB, patch)
2018-10-17 13:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Display a summary line per parent_ordernumber (7.26 KB, patch)
2018-10-17 13:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21474: Add the Koha::Subscription->frequency method (5.35 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Allow several receipts for a given subscription (13.39 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber (3.68 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Add subscription's info when ordering (2.88 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Do not erase the internal note of the first order (5.45 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Display the quantity and adjust the amounts (3.63 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Fix default sort (2.48 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Display a summary line per parent_ordernumber (7.39 KB, patch)
2018-10-17 14:31 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 21467: Allow several receipts for a given subscription (13.46 KB, patch)
2018-10-28 11:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber (3.71 KB, patch)
2018-10-28 11:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Add subscription's info when ordering (2.93 KB, patch)
2018-10-28 11:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Do not erase the internal note of the first order (5.51 KB, patch)
2018-10-28 11:48 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Display the quantity and adjust the amounts (3.68 KB, patch)
2018-10-28 11:48 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Fix default sort (2.54 KB, patch)
2018-10-28 11:48 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: Display a summary line per parent_ordernumber (7.46 KB, patch)
2018-10-28 11:48 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: (QA follow-up) Fix filter and variable declaration in .t (2.03 KB, patch)
2018-10-28 21:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Prevent tests to fail (1.21 KB, patch)
2018-11-01 12:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21467: (QA follow-up) Move hint a little bit (1.39 KB, patch)
2018-11-01 12:56 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: (follow-up) Display a summary line per parent_ordernumber (1.10 KB, patch)
2018-11-01 13:03 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21474: Add the Koha::Subscription->frequency method (5.69 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Allow several receipts for a given subscription (13.51 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber (3.77 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Add subscription's info when ordering (2.99 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Do not erase the internal note of the first order (5.57 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Display the quantity and adjust the amounts (3.74 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Fix default sort (2.59 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Display a summary line per parent_ordernumber (7.52 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: (QA follow-up) Fix filter and variable declaration in .t (2.09 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Prevent tests to fail (1.27 KB, patch)
2018-11-01 13:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: (QA follow-up) Move hint a little bit (1.45 KB, patch)
2018-11-01 13:51 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: (follow-up) Display a summary line per parent_ordernumber (1.15 KB, patch)
2018-11-01 13:51 UTC, Katrin Fischer
Details | Diff | Splinter Review
View of receipt page (13.39 KB, image/png)
2018-11-08 20:39 UTC, Nick Clemens
Details
Bug 21467: Allow several receipts for a given subscription (13.31 KB, patch)
2018-11-08 22:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber (3.77 KB, patch)
2018-11-08 22:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Add subscription's info when ordering (2.99 KB, patch)
2018-11-08 22:06 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Do not erase the internal note of the first order (5.57 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Display the quantity and adjust the amounts (3.74 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Fix default sort (2.59 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Display a summary line per parent_ordernumber (7.52 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: (QA follow-up) Fix filter and variable declaration in .t (2.09 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: Prevent tests to fail (1.27 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: (QA follow-up) Move hint a little bit (1.45 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21467: (follow-up) Display a summary line per parent_ordernumber (1.15 KB, patch)
2018-11-08 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2018-10-02 01:54:36 UTC
When a new order is created from a subscription the quantity is set to 1 and cannot be modified.
The idea was to order 1 subscription.
This behavior leads to a limitation: it is not possible to mark a receipt as partially received. However it is how it works in real life, the vendors send invoices throughout the year. The number of items can also be changed.

The idea would be to rethink the "quantity" value for an order created from a subscription and use it to track the number of invoices already paid.
Comment 1 Jonathan Druart 2018-10-02 02:17:59 UTC
Created attachment 79801 [details] [review]
Bug 21467: Allow several receipts for a given subscription

When a new order is created from a subscription the quantity is set to 1
and cannot be modified.
The idea was to order 1 subscription.
This behavior leads to a limitation: it is not possible to mark a
receipt as partially received. However it is how it works in real life,
the vendors send invoices throughout the year. The number of items can
also be changed.

The idea is be to rethink the "quantity" value for an order created
from a subscription and use it to track the number of invoices already
paid.

FIXME: This approach will not cohabit with standing orders.
This patch is a first draft to get feedback on the idea.

FIXME: What about cancelled orders?

Test plan:
- Create a new order from a subscription
- Enter the number of items you think you will receive for this
subscription (for instance 1 per month: 12)
- Close the basket
- Receive 3 items (a trimester) and create a specific invoice for this
receipt. Note that the price are per unit.
If you want to receive items with different prices you should make
split the receipt
- Receive more items. This time you will notice that the previous order
will be displayed on the "order receive" under a new block "Receipt
history for this subscription"
- Note that the "Quantity to receive" has been decrease by the number of
items you previously received
- Also you can notice that this "Quantity to receive" can be modified.
Indeed it can happen that the number of items to receive changed during
the year
- Go to the detail of the subscription and notice that the orders have
been grouped by "parent ordernumber"
- Continue to receive items until all have been received
Comment 2 Jonathan Druart 2018-10-02 02:18:03 UTC
Created attachment 79802 [details] [review]
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber
Comment 3 Jonathan Druart 2018-10-02 16:51:04 UTC
Created attachment 79834 [details] [review]
Bug 21467: Allow several receipts for a given subscription

When a new order is created from a subscription the quantity is set to 1
and cannot be modified.
The idea was to order 1 subscription.
This behavior leads to a limitation: it is not possible to mark a
receipt as partially received. However it is how it works in real life,
the vendors send invoices throughout the year. The number of items can
also be changed.

The idea is be to rethink the "quantity" value for an order created
from a subscription and use it to track the number of invoices already
paid.

FIXME: This approach will not cohabit with standing orders.
This patch is a first draft to get feedback on the idea.

FIXME: What about cancelled orders?

Test plan:
- Create a new order from a subscription
- Enter the number of items you think you will receive for this
subscription (for instance 1 per month: 12)
- Close the basket
- Receive 3 items (a trimester) and create a specific invoice for this
receipt. Note that the price are per unit.
If you want to receive items with different prices you should make
split the receipt
- Receive more items. This time you will notice that the previous order
will be displayed on the "order receive" under a new block "Receipt
history for this subscription"
- Note that the "Quantity to receive" has been decrease by the number of
items you previously received
- Also you can notice that this "Quantity to receive" can be modified.
Indeed it can happen that the number of items to receive changed during
the year
- Go to the detail of the subscription and notice that the orders have
been grouped by "parent ordernumber"
- Continue to receive items until all have been received
Comment 4 Jonathan Druart 2018-10-02 16:51:09 UTC
Created attachment 79835 [details] [review]
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber
Comment 5 Jonathan Druart 2018-10-02 16:51:13 UTC
Created attachment 79836 [details] [review]
Bug 21467: Add subscription's info when ordering

When ordering from a subscription, there is now a "hint" to display the
number of issues and the frequency. It will be easier to estimate the
quantity to receive.
Comment 6 Jonathan Druart 2018-10-02 16:51:17 UTC
Created attachment 79837 [details] [review]
Bug 21467: Do not erase the internal note of the first order

For the subscription we would like to keep the original internal note
(from the first order), to display it unmodified each time we receive
issues.
Comment 7 Jonathan Druart 2018-10-02 16:51:21 UTC
Created attachment 79838 [details] [review]
Bug 21467: Display the quantity and adjust the amounts

On the subscription detail view we should display the amounts depending
on the quantity (can be different than 0 now!)
Comment 8 Jonathan Druart 2018-10-12 18:20:07 UTC
Created attachment 80546 [details] [review]
Bug 21467: Display a summary line per parent_ordernumber

This will help to keep track of the different orders for a given
subscription.
Comment 9 Katrin Fischer 2018-10-15 08:37:41 UTC
Why "In Discussion"?
Comment 10 Jonathan Druart 2018-10-15 14:58:03 UTC
(In reply to Katrin Fischer from comment #9)
> Why "In Discussion"?

The patch is not ready for testing, I am iterating with the sponsor (Séverine @BULAC) by email.

But you can read/test the patches and provide feedback if you want :)
Comment 11 Jonathan Druart 2018-10-17 13:40:49 UTC
Created attachment 80706 [details] [review]
Bug 21467: Fix default sort
Comment 12 Jonathan Druart 2018-10-17 13:40:54 UTC
Created attachment 80707 [details] [review]
Bug 21467: Display a summary line per parent_ordernumber

This will help to keep track of the different orders for a given
subscription.
Comment 13 Séverine Queune 2018-10-17 14:31:08 UTC
Created attachment 80717 [details] [review]
Bug 21474: Add the Koha::Subscription->frequency method

And the 2 modules for the subscriptions' frequencies

Test plan:
  prove t/db_dependent/Koha/Subscription.t
must return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 14 Séverine Queune 2018-10-17 14:31:12 UTC
Created attachment 80718 [details] [review]
Bug 21467: Allow several receipts for a given subscription

When a new order is created from a subscription the quantity is set to 1
and cannot be modified.
The idea was to order 1 subscription.
This behavior leads to a limitation: it is not possible to mark a
receipt as partially received. However it is how it works in real life,
the vendors send invoices throughout the year. The number of items can
also be changed.

The idea is be to rethink the "quantity" value for an order created
from a subscription and use it to track the number of invoices already
paid.

FIXME: This approach will not cohabit with standing orders.
This patch is a first draft to get feedback on the idea.

FIXME: What about cancelled orders?

Test plan:
- Create a new order from a subscription
- Enter the number of items you think you will receive for this
subscription (for instance 1 per month: 12)
- Close the basket
- Receive 3 items (a trimester) and create a specific invoice for this
receipt. Note that the price are per unit.
If you want to receive items with different prices you should make
split the receipt
- Receive more items. This time you will notice that the previous order
will be displayed on the "order receive" under a new block "Receipt
history for this subscription"
- Note that the "Quantity to receive" has been decrease by the number of
items you previously received
- Also you can notice that this "Quantity to receive" can be modified.
Indeed it can happen that the number of items to receive changed during
the year
- Go to the detail of the subscription and notice that the orders have
been grouped by "parent ordernumber"
- Continue to receive items until all have been received

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 15 Séverine Queune 2018-10-17 14:31:16 UTC
Created attachment 80719 [details] [review]
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 16 Séverine Queune 2018-10-17 14:31:20 UTC
Created attachment 80720 [details] [review]
Bug 21467: Add subscription's info when ordering

When ordering from a subscription, there is now a "hint" to display the
number of issues and the frequency. It will be easier to estimate the
quantity to receive.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 17 Séverine Queune 2018-10-17 14:31:25 UTC
Created attachment 80721 [details] [review]
Bug 21467: Do not erase the internal note of the first order

For the subscription we would like to keep the original internal note
(from the first order), to display it unmodified each time we receive
issues.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 18 Séverine Queune 2018-10-17 14:31:30 UTC
Created attachment 80722 [details] [review]
Bug 21467: Display the quantity and adjust the amounts

On the subscription detail view we should display the amounts depending
on the quantity (can be different than 0 now!)

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 19 Séverine Queune 2018-10-17 14:31:35 UTC
Created attachment 80723 [details] [review]
Bug 21467: Fix default sort

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 20 Séverine Queune 2018-10-17 14:31:40 UTC
Created attachment 80724 [details] [review]
Bug 21467: Display a summary line per parent_ordernumber

This will help to keep track of the different orders for a given
subscription.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 21 Katrin Fischer 2018-10-28 00:52:20 UTC
Patch doesn't apply (on top of bug 21475:

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 21467: Allow several receipts for a given subscription
Applying: Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber
Using index info to reconstruct a base tree...
M	koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
Applying: Bug 21467: Add subscription's info when ordering
Applying: Bug 21467: Do not erase the internal note of the first order
Applying: Bug 21467: Display the quantity and adjust the amounts
Applying: Bug 21467: Fix default sort
Applying: Bug 21467: Display a summary line per parent_ordernumber
error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt).
error: could not build fake ancestor
Patch failed at 0001 Bug 21467: Display a summary line per parent_ordernumber
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-21467-Display-a-summary-line-per-parentordernu-mjKFO_.patch
Comment 22 Jonathan Druart 2018-10-28 11:47:48 UTC
Created attachment 81394 [details] [review]
Bug 21467: Allow several receipts for a given subscription

When a new order is created from a subscription the quantity is set to 1
and cannot be modified.
The idea was to order 1 subscription.
This behavior leads to a limitation: it is not possible to mark a
receipt as partially received. However it is how it works in real life,
the vendors send invoices throughout the year. The number of items can
also be changed.

The idea is be to rethink the "quantity" value for an order created
from a subscription and use it to track the number of invoices already
paid.

FIXME: This approach will not cohabit with standing orders.
This patch is a first draft to get feedback on the idea.

FIXME: What about cancelled orders?

Test plan:
- Create a new order from a subscription
- Enter the number of items you think you will receive for this
subscription (for instance 1 per month: 12)
- Close the basket
- Receive 3 items (a trimester) and create a specific invoice for this
receipt. Note that the price are per unit.
If you want to receive items with different prices you should make
split the receipt
- Receive more items. This time you will notice that the previous order
will be displayed on the "order receive" under a new block "Receipt
history for this subscription"
- Note that the "Quantity to receive" has been decrease by the number of
items you previously received
- Also you can notice that this "Quantity to receive" can be modified.
Indeed it can happen that the number of items to receive changed during
the year
- Go to the detail of the subscription and notice that the orders have
been grouped by "parent ordernumber"
- Continue to receive items until all have been received

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 23 Jonathan Druart 2018-10-28 11:47:53 UTC
Created attachment 81395 [details] [review]
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 24 Jonathan Druart 2018-10-28 11:47:57 UTC
Created attachment 81396 [details] [review]
Bug 21467: Add subscription's info when ordering

When ordering from a subscription, there is now a "hint" to display the
number of issues and the frequency. It will be easier to estimate the
quantity to receive.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 25 Jonathan Druart 2018-10-28 11:48:00 UTC
Created attachment 81397 [details] [review]
Bug 21467: Do not erase the internal note of the first order

For the subscription we would like to keep the original internal note
(from the first order), to display it unmodified each time we receive
issues.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 26 Jonathan Druart 2018-10-28 11:48:05 UTC
Created attachment 81398 [details] [review]
Bug 21467: Display the quantity and adjust the amounts

On the subscription detail view we should display the amounts depending
on the quantity (can be different than 0 now!)

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 27 Jonathan Druart 2018-10-28 11:48:09 UTC
Created attachment 81399 [details] [review]
Bug 21467: Fix default sort

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 28 Jonathan Druart 2018-10-28 11:48:13 UTC
Created attachment 81400 [details] [review]
Bug 21467: Display a summary line per parent_ordernumber

This will help to keep track of the different orders for a given
subscription.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 29 Katrin Fischer 2018-10-28 19:08:31 UTC
In case you are faster than me:

 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt
   FAIL	  filters
		wrong_html_filter at line 79 (                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | html %]" title="Invoice detail page">)

 FAIL	t/db_dependent/Acquisition.t
   OK	  critic
   OK	  forbidden patterns
   OK	  git manipulation
   OK	  pod
   OK	  spelling
   FAIL	  valid
		Can't redeclare "my" in "my" 
		t/db_dependent/Acquisition.t had compilation errors.
Comment 30 Katrin Fischer 2018-10-28 21:06:38 UTC
Created attachment 81430 [details] [review]
Bug 21467: (QA follow-up) Fix filter and variable declaration in .t
Comment 31 Katrin Fischer 2018-10-28 21:14:49 UTC
Jonathan, can you explain a bit more?

1) I am a little confused as to what items means in the test plan. Items from the order = Invoices I plan to enter? Or Issues?

2) What about the FIXMEs?
- standing orders - why can't it cohabit? If these changes only applied to 'order by subscription' it would be ok, right?

- cancelling order

I'll come back to this, but continuing somewhere else first.

Can you please check my follow-up?
Comment 32 Jonathan Druart 2018-10-29 22:32:58 UTC
(In reply to Katrin Fischer from comment #31)
> Jonathan, can you explain a bit more?
> 
> 1) I am a little confused as to what items means in the test plan. Items
> from the order = Invoices I plan to enter? Or Issues?

The number of issues you are expecting for this subscription.

> 2) What about the FIXMEs?
> - standing orders - why can't it cohabit? If these changes only applied to
> 'order by subscription' it would be ok, right?

You can create an order from a subscription, using a basket that has the standing orders flag.

> - cancelling order

It was a question for the tester, and Séverine confirmed me it seems to work ok in case of cancelled orders.

> I'll come back to this, but continuing somewhere else first.
> 
> Can you please check my follow-up?

It looks great, thanks!
Comment 33 Jonathan Druart 2018-10-29 23:08:11 UTC
*** Bug 17876 has been marked as a duplicate of this bug. ***
Comment 34 Katrin Fischer 2018-11-01 12:38:54 UTC
QA tools are green, but there is a problem with the tests. I will continue testing, hoping for a quick follow-up:

kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Acquisition.t
t/db_dependent/Acquisition.t .. 70/71 DBD::mysql::db do failed: Out of range value for column 'tax_value_on_ordering' at row 1 [for Statement "
            UPDATE aqorders
            SET
                tax_value_on_ordering = quantity * ecost_tax_excluded * tax_rate_on_ordering,
                tax_value_on_receiving = quantity * unitprice_tax_excluded * tax_rate_on_receiving
            WHERE ordernumber = ?
        "] at /home/vagrant/kohaclone/C4/Acquisition.pm line 1484.
    # No tests run!
t/db_dependent/Acquisition.t .. 71/71 
#   Failed test 'No tests run for subtest "ModReceiveOrder and subscription"'
#   at t/db_dependent/Acquisition.t line 748.
DBD::mysql::db do failed: Out of range value for column 'tax_value_on_ordering' at row 1 [for Statement "
            UPDATE aqorders
            SET
                tax_value_on_ordering = quantity * ecost_tax_excluded * tax_rate_on_ordering,
                tax_value_on_receiving = quantity * unitprice_tax_excluded * tax_rate_on_receiving
            WHERE ordernumber = ?
        "] at /home/vagrant/kohaclone/C4/Acquisition.pm line 1484.
# Looks like your test exited with 255 just after 71.
t/db_dependent/Acquisition.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/71 subtests 

Test Summary Report
-------------------
t/db_dependent/Acquisition.t (Wstat: 65280 Tests: 71 Failed: 1)
  Failed test:  71
  Non-zero exit status: 255
Comment 35 Jonathan Druart 2018-11-01 12:53:26 UTC
Created attachment 81797 [details] [review]
Bug 21467: Prevent tests to fail

The following error is raised if TestBuilder generates too big numbers:
 Out of range value for column 'tax_value_on_ordering'

     UPDATE aqorders
     SET
         tax_value_on_ordering = quantity * ecost_tax_excluded * tax_rate_on_ordering,
         tax_value_on_receiving = quantity * unitprice_tax_excluded * tax_rate_on_receiving
     WHERE ordernumber = ?
 "] at /home/vagrant/kohaclone/C4/Acquisition.pm line 1484.
Comment 36 Katrin Fischer 2018-11-01 12:56:41 UTC
Created attachment 81798 [details] [review]
Bug 21467: (QA follow-up) Move hint a little bit
Comment 37 Jonathan Druart 2018-11-01 13:03:44 UTC
Created attachment 81799 [details] [review]
Bug 21467: (follow-up) Display a summary line per parent_ordernumber

Wrong resolution conflict
Comment 38 Katrin Fischer 2018-11-01 13:11:08 UTC
QA tool green, tests tool pass now. Acq tab in subscription detail works correctly.
Comment 39 Katrin Fischer 2018-11-01 13:50:19 UTC
Created attachment 81800 [details] [review]
Bug 21474: Add the Koha::Subscription->frequency method

And the 2 modules for the subscriptions' frequencies

Test plan:
  prove t/db_dependent/Koha/Subscription.t
must return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

https://bugs.koha-community.org/show_bug.cgi?id=21475

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 40 Katrin Fischer 2018-11-01 13:50:23 UTC
Created attachment 81801 [details] [review]
Bug 21467: Allow several receipts for a given subscription

When a new order is created from a subscription the quantity is set to 1
and cannot be modified.
The idea was to order 1 subscription.
This behavior leads to a limitation: it is not possible to mark a
receipt as partially received. However it is how it works in real life,
the vendors send invoices throughout the year. The number of items can
also be changed.

The idea is be to rethink the "quantity" value for an order created
from a subscription and use it to track the number of invoices already
paid.

FIXME: This approach will not cohabit with standing orders.
This patch is a first draft to get feedback on the idea.

FIXME: What about cancelled orders?

Test plan:
- Create a new order from a subscription
- Enter the number of items you think you will receive for this
subscription (for instance 1 per month: 12)
- Close the basket
- Receive 3 items (a trimester) and create a specific invoice for this
receipt. Note that the price are per unit.
If you want to receive items with different prices you should make
split the receipt
- Receive more items. This time you will notice that the previous order
will be displayed on the "order receive" under a new block "Receipt
history for this subscription"
- Note that the "Quantity to receive" has been decrease by the number of
items you previously received
- Also you can notice that this "Quantity to receive" can be modified.
Indeed it can happen that the number of items to receive changed during
the year
- Go to the detail of the subscription and notice that the orders have
been grouped by "parent ordernumber"
- Continue to receive items until all have been received

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 41 Katrin Fischer 2018-11-01 13:50:28 UTC
Created attachment 81802 [details] [review]
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 42 Katrin Fischer 2018-11-01 13:50:32 UTC
Created attachment 81803 [details] [review]
Bug 21467: Add subscription's info when ordering

When ordering from a subscription, there is now a "hint" to display the
number of issues and the frequency. It will be easier to estimate the
quantity to receive.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 43 Katrin Fischer 2018-11-01 13:50:37 UTC
Created attachment 81804 [details] [review]
Bug 21467: Do not erase the internal note of the first order

For the subscription we would like to keep the original internal note
(from the first order), to display it unmodified each time we receive
issues.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 44 Katrin Fischer 2018-11-01 13:50:41 UTC
Created attachment 81805 [details] [review]
Bug 21467: Display the quantity and adjust the amounts

On the subscription detail view we should display the amounts depending
on the quantity (can be different than 0 now!)

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 45 Katrin Fischer 2018-11-01 13:50:46 UTC
Created attachment 81806 [details] [review]
Bug 21467: Fix default sort

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 46 Katrin Fischer 2018-11-01 13:50:50 UTC
Created attachment 81807 [details] [review]
Bug 21467: Display a summary line per parent_ordernumber

This will help to keep track of the different orders for a given
subscription.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 47 Katrin Fischer 2018-11-01 13:50:55 UTC
Created attachment 81808 [details] [review]
Bug 21467: (QA follow-up) Fix filter and variable declaration in .t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 48 Katrin Fischer 2018-11-01 13:50:59 UTC
Created attachment 81809 [details] [review]
Bug 21467: Prevent tests to fail

The following error is raised if TestBuilder generates too big numbers:
 Out of range value for column 'tax_value_on_ordering'

     UPDATE aqorders
     SET
         tax_value_on_ordering = quantity * ecost_tax_excluded * tax_rate_on_ordering,
         tax_value_on_receiving = quantity * unitprice_tax_excluded * tax_rate_on_receiving
     WHERE ordernumber = ?
 "] at /home/vagrant/kohaclone/C4/Acquisition.pm line 1484.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 49 Katrin Fischer 2018-11-01 13:51:04 UTC
Created attachment 81810 [details] [review]
Bug 21467: (QA follow-up) Move hint a little bit

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 50 Katrin Fischer 2018-11-01 13:51:09 UTC
Created attachment 81811 [details] [review]
Bug 21467: (follow-up) Display a summary line per parent_ordernumber

Wrong resolution conflict

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 51 Katrin Fischer 2018-11-01 13:55:03 UTC
I believe this is great in its flexibility and will work much better for acquisition of serials than the standing order feature. You will be able to handle an end-of-year invoice or being charged by issue. The amounts will be encumbered for the year.

I think the only thing missing now would be an option to bring those orders into the next year, but the duplicate order line feature also waiting will help with that :)
Comment 52 Nick Clemens 2018-11-08 20:39:41 UTC
Created attachment 82117 [details]
View of receipt page

The language here is confusing in english, could:
Quantity to receive
be:
Quantity outstanding

or do you have another suggestion? the two receive/received is confusing
Comment 53 Katrin Fischer 2018-11-08 21:01:00 UTC
The terms haven't changed with these patches. Should we fix here or discuss a better wording in a separate bug?
Comment 54 Andrew 2018-11-08 21:08:12 UTC
Katrin makes a fair point about keeping this bug on-task and letting wording questions go elsewhere, but:
I agree that receive/received gets confusing quickly in spoken English. "Outstanding" works but is not the most common usage. I'd go with "Quantity expected" or "Quantity ordered."
Comment 55 Katrin Fischer 2018-11-08 21:10:05 UTC
(In reply to Andrew from comment #54)
> Katrin makes a fair point about keeping this bug on-task and letting wording
> questions go elsewhere, but:
> I agree that receive/received gets confusing quickly in spoken English.
> "Outstanding" works but is not the most common usage. I'd go with "Quantity
> expected" or "Quantity ordered."

I could write a follow-up. Maybe we could say Quantity delivered instead of expected?
Comment 56 Katrin Fischer 2018-11-08 22:06:46 UTC
Created attachment 82122 [details] [review]
Bug 21467: Allow several receipts for a given subscription

When a new order is created from a subscription the quantity is set to 1
and cannot be modified.
The idea was to order 1 subscription.
This behavior leads to a limitation: it is not possible to mark a
receipt as partially received. However it is how it works in real life,
the vendors send invoices throughout the year. The number of items can
also be changed.

The idea is be to rethink the "quantity" value for an order created
from a subscription and use it to track the number of invoices already
paid.

FIXME: This approach will not cohabit with standing orders.
This patch is a first draft to get feedback on the idea.

FIXME: What about cancelled orders?

Test plan:
- Create a new order from a subscription
- Enter the number of items you think you will receive for this
subscription (for instance 1 per month: 12)
- Close the basket
- Receive 3 items (a trimester) and create a specific invoice for this
receipt. Note that the price are per unit.
If you want to receive items with different prices you should make
split the receipt
- Receive more items. This time you will notice that the previous order
will be displayed on the "order receive" under a new block "Receipt
history for this subscription"
- Note that the "Quantity to receive" has been decrease by the number of
items you previously received
- Also you can notice that this "Quantity to receive" can be modified.
Indeed it can happen that the number of items to receive changed during
the year
- Go to the detail of the subscription and notice that the orders have
been grouped by "parent ordernumber"
- Continue to receive items until all have been received

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 57 Katrin Fischer 2018-11-08 22:06:52 UTC
Created attachment 82123 [details] [review]
Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 58 Katrin Fischer 2018-11-08 22:06:58 UTC
Created attachment 82124 [details] [review]
Bug 21467: Add subscription's info when ordering

When ordering from a subscription, there is now a "hint" to display the
number of issues and the frequency. It will be easier to estimate the
quantity to receive.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 59 Katrin Fischer 2018-11-08 22:07:07 UTC
Created attachment 82125 [details] [review]
Bug 21467: Do not erase the internal note of the first order

For the subscription we would like to keep the original internal note
(from the first order), to display it unmodified each time we receive
issues.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 60 Katrin Fischer 2018-11-08 22:07:14 UTC
Created attachment 82126 [details] [review]
Bug 21467: Display the quantity and adjust the amounts

On the subscription detail view we should display the amounts depending
on the quantity (can be different than 0 now!)

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 61 Katrin Fischer 2018-11-08 22:07:20 UTC
Created attachment 82127 [details] [review]
Bug 21467: Fix default sort

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 62 Katrin Fischer 2018-11-08 22:07:26 UTC
Created attachment 82128 [details] [review]
Bug 21467: Display a summary line per parent_ordernumber

This will help to keep track of the different orders for a given
subscription.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 63 Katrin Fischer 2018-11-08 22:07:32 UTC
Created attachment 82129 [details] [review]
Bug 21467: (QA follow-up) Fix filter and variable declaration in .t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 64 Katrin Fischer 2018-11-08 22:07:38 UTC
Created attachment 82130 [details] [review]
Bug 21467: Prevent tests to fail

The following error is raised if TestBuilder generates too big numbers:
 Out of range value for column 'tax_value_on_ordering'

     UPDATE aqorders
     SET
         tax_value_on_ordering = quantity * ecost_tax_excluded * tax_rate_on_ordering,
         tax_value_on_receiving = quantity * unitprice_tax_excluded * tax_rate_on_receiving
     WHERE ordernumber = ?
 "] at /home/vagrant/kohaclone/C4/Acquisition.pm line 1484.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 65 Katrin Fischer 2018-11-08 22:07:44 UTC
Created attachment 82131 [details] [review]
Bug 21467: (QA follow-up) Move hint a little bit

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 66 Katrin Fischer 2018-11-08 22:07:50 UTC
Created attachment 82132 [details] [review]
Bug 21467: (follow-up) Display a summary line per parent_ordernumber

Wrong resolution conflict

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 67 Katrin Fischer 2018-11-08 22:13:49 UTC
Rebased - number of tests and changes on the order receive form (added hints from  Bug 21619)
Comment 68 Katrin Fischer 2018-11-08 22:22:03 UTC
Suggestion for template change on
Bug 21799 - Change wording for quantity input fields on order receive page
Comment 69 Nick Clemens 2018-11-13 21:15:40 UTC
Awesome work all!

Pushed to master for 18.11
Comment 70 Martin Renvoize 2018-11-16 14:26:36 UTC
New Feature, will not be backported to 18.05.x series.