Bug 26081 - 0 items in an order cannot be received do to invalid date handling
Summary: 0 items in an order cannot be received do to invalid date handling
Status: RESOLVED DUPLICATE of bug 21811
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-29 11:21 UTC by Joonas Kylmälä
Modified: 2020-08-03 15:08 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

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Kylmälä 2020-07-29 11:21:32 UTC
When I try to receive 0 items ("Quantity received: 0") for a order in the page /cgi-bin/koha/acqui/orderreceive.pl?ordernumber=1&invoiceid=1 I get the following error when clicking save: 

Invalid value passed, dateaccessioned=07/30/2020 expected type is date at /usr/share/perl5/Exception/Class/Base.pm line 88

The $datereceived variable is not being processed properly.
Comment 1 Katrin Fischer 2020-07-29 11:29:55 UTC
I think you should not be able to receive 0 - to my knowledge that just didn't save before. The error seems new - are you creating/updating items on receive?
Comment 2 Joonas Kylmälä 2020-07-29 11:49:29 UTC
You are right Katrin, the issue happens only with the  AcqCreateItem set to "Create an item when placing an order." To reproduce this bug be sure to first set this syspref to the aformentioned value and then after that create a new order basket and go receive the item there. (the syspref gets only applied to newly create baskets.)
Comment 3 Jonathan Druart 2020-07-29 13:43:09 UTC
I think the error has been highlighted by
    Bug 23463: Replace ModItem with Koha::Item->store
Comment 4 Jonathan Druart 2020-07-29 13:45:46 UTC
What's the expected behaviour? A JS check to make sure the form is only submitted when the quantity > 0?
Comment 5 Katrin Fischer 2020-07-29 18:56:16 UTC
I actually filed a bug for that, because I forgot to fill in quantity received a lot:

Bug 21811 - Add warning when order receive form is saved without entering 'quantity received'

I think a Javascript check or simply marking the field required (as in has to be greater 1 for saving)?
Comment 6 Jonathan Druart 2020-08-03 10:41:20 UTC

*** This bug has been marked as a duplicate of bug 21811 ***
Comment 7 Joonas Kylmälä 2020-08-03 10:44:21 UTC
Jonathan, if this is duplicate of bug 21811 then it seems like the code that uses $datereceived variable in orderreceive.pl is unused and should be removed.
Comment 8 Jonathan Druart 2020-08-03 11:22:28 UTC
(In reply to Joonas Kylmälä from comment #7)
> Jonathan, if this is duplicate of bug 21811 then it seems like the code that
> uses $datereceived variable in orderreceive.pl is unused and should be
> removed.

It's passed to the template:
250     datereceived          => $datereceived,
Comment 9 Joonas Kylmälä 2020-08-03 11:34:52 UTC
(In reply to Jonathan Druart from comment #8)
> (In reply to Joonas Kylmälä from comment #7)
> > Jonathan, if this is duplicate of bug 21811 then it seems like the code that
> > uses $datereceived variable in orderreceive.pl is unused and should be
> > removed.
> 
> It's passed to the template:
> 250     datereceived          => $datereceived,

Sorry, I confused the file to acqui/finishreceive.pl, on line 175 there is a while loop where the variable is used and not necessarily modified to fit the DB format:

> while ( my $item = $items->next )  {
> ...
Comment 10 Jonathan Druart 2020-08-03 15:08:58 UTC
Yes, you are right. I let a comment on bug 21811.