Bug 30321 - Order receive page dies if quantity received is more than 0
Summary: Order receive page dies if quantity received is more than 0
Status: RESOLVED DUPLICATE of bug 32472
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: 21.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Emmi Takkinen
QA Contact: Testopia
URL:
Keywords:
Depends on: 23376
Blocks:
  Show dependency treegraph
 
Reported: 2022-03-21 06:48 UTC by Emmi Takkinen
Modified: 2023-06-16 06:09 UTC (History)
1 user (show)

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


Attachments
Bug 23376: Fix template error on order receive page (2.07 KB, text/plain)
2022-03-21 06:49 UTC, Emmi Takkinen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emmi Takkinen 2022-03-21 06:48:38 UTC
Order receive page dies on error 500 if orders quantityreceived is more than 0. The error logs reads: "Template process failed: undef error - The method Koha::Item->count is not covered by tests!" This happens because in template orderreceive.tt we have "order.items.count" not "orders.items.count" as it should be. It seems that this error doesn't occur if template param edit is set as 1.
Comment 1 Emmi Takkinen 2022-03-21 06:49:39 UTC
Created attachment 131939 [details]
Bug 23376: Fix template error on order receive page

Order receive page dies on error 500 if orders quantityreceived
is more than 0. The error logs reads: "Template process failed: undef
error - The method Koha::Item->count is not covered by tests!"
In template orderreceive.tt we have "order.items.count" not
"orders.items.count" as it should be.  Note! It seems that this error
doesn't occur if template param edit is set as 1.
Comment 2 Nick Clemens 2022-03-22 12:40:25 UTC
I can't seem to trigger this, can you give a detailed test plan?
Comment 3 Emmi Takkinen 2022-03-23 09:35:26 UTC
(In reply to Nick Clemens from comment #2)
> I can't seem to trigger this, can you give a detailed test plan?

It seems order also needs to have items listing. I'm now looking at two orders, both with quantityreceived 1 and only one of those which has items linked to it is throwing error 500. I'll provide new test plan after I've confirmed this.
Comment 4 Emmi Takkinen 2022-03-23 12:35:58 UTC
(In reply to Emmi Takkinen from comment #3)
> (In reply to Nick Clemens from comment #2)
> > I can't seem to trigger this, can you give a detailed test plan?
> 
> It seems order also needs to have items listing. I'm now looking at two
> orders, both with quantityreceived 1 and only one of those which has items
> linked to it is throwing error 500. I'll provide new test plan after I've
> confirmed this.

Been testing this in master and version 21.11.xx and it looks like this problem is only present in 21.11. In master we still have order.items.count and since order receive page works there without problem, it seems that line wasn't incorrect after all. Could it be something was fixed in master that fixed this?
Comment 5 Emmi Takkinen 2022-03-23 12:36:46 UTC
Comment on attachment 131939 [details]
Bug 23376: Fix template error on order receive page

Obsoleting patch since it doesn't actually fix the problem.
Comment 6 Emmi Takkinen 2022-04-14 12:18:59 UTC
So I've been testing this and it occurs in version 21.11.03 and the conditions are following:

- order has _only one item_ attached to it
- orders quantityreceived value is more than 0

For some reason when there's only one item on order template orderreceived.tt handles it as Koha::Item, not Koha::Items as it should, thus "Koha::Item->count is not covered by tests!". In orderreceived.pl order->items returns Koha::Items.
Comment 7 Katrin Fischer 2022-06-25 15:43:00 UTC
Hi Emmi,

do you still see this issue and could you add a step by step on how to reproduce it?
Comment 8 Emmi Takkinen 2022-08-05 10:16:25 UTC
Still seeing this on 21.11. 

To test:
1. Find order with one item and with quantity received as 1.
2. Navigate to receive this order from parcel.pl.
3. Click "Receive".
OR
4. Use direct link to the order: /cgi-bin/koha/acqui/orderreceive.pl?ordernumber=<ordernumber>&invoiceid=<invoiceid>  
=> error 500 is raised
Comment 9 Nick Clemens 2022-08-05 16:19:55 UTC
(In reply to Emmi Takkinen from comment #8)
> Still seeing this on 21.11. 
> 
> To test:
> 1. Find order with one item and with quantity received as 1.
> 2. Navigate to receive this order from parcel.pl.
> 3. Click "Receive".
> OR
> 4. Use direct link to the order:
> /cgi-bin/koha/acqui/orderreceive.
> pl?ordernumber=<ordernumber>&invoiceid=<invoiceid>  
> => error 500 is raised

Can you describe the basket settings? When are items being created? I could use a full walkthrough from basket creation to error as I am not overly familiar with acquisitions workflows
Comment 10 Katrin Fischer 2022-08-07 12:12:12 UTC
(In reply to Emmi Takkinen from comment #8)
> Still seeing this on 21.11. 
> 
> To test:
> 1. Find order with one item and with quantity received as 1.

Wondering about this line - did you mean quantity ordered or indeed quantity received? If the item has been "fully" received, it should not show int he list of toe receive order lines.

Could this be a data issue?
Comment 11 Emmi Takkinen 2022-12-15 10:17:19 UTC
(In reply to Katrin Fischer from comment #10)
> (In reply to Emmi Takkinen from comment #8)
> > Still seeing this on 21.11. 
> > 
> > To test:
> > 1. Find order with one item and with quantity received as 1.
> 
> Wondering about this line - did you mean quantity ordered or indeed quantity
> received? If the item has been "fully" received, it should not show int he
> list of toe receive order lines.
> 
> Could this be a data issue?

I'm quite sure this caused by issue described in bug 32472.
Comment 12 Emmi Takkinen 2023-06-16 06:09:32 UTC
Yeah, this most definitely is a same problem as in bug 32472. Setting this as duplicate.

*** This bug has been marked as a duplicate of bug 32472 ***