Bug 26082 - Follow up to bug 23463 - need to call Koha::Item store to get itemnumber
Summary: Follow up to bug 23463 - need to call Koha::Item store to get itemnumber
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Colin Campbell
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 23463
Blocks: 26438
  Show dependency treegraph
 
Reported: 2020-07-29 12:21 UTC by Colin Campbell
Modified: 2020-09-28 08:16 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.04


Attachments
Patch adding calls to store when new items created so that valid itemnumber is returned (2.06 KB, patch)
2020-07-29 12:29 UTC, Colin Campbell
Details | Diff | Splinter Review
Revised patch to add calls to store when new items are created so that valid itemnumber is returned (2.41 KB, patch)
2020-07-29 13:43 UTC, Colin Campbell
Details | Diff | Splinter Review
Bug 26082: Call store on new items to update itemnumber (2.48 KB, patch)
2020-08-19 14:41 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Campbell 2020-07-29 12:21:53 UTC
As a result of using Koha::Item instead of AddItem processing of Edifact messages are aborting. When calling Koha::Item->new we need to call store in order to have a valid itemnumber returned otherwise the itemnumber is undefined causing subsequent usage of it to abort. A case in Illrequest.pm was picked up in bug 23463 the cases in EDI.pm need to be amended similarly
Comment 1 Colin Campbell 2020-07-29 12:29:50 UTC
Created attachment 107490 [details] [review]
Patch adding calls to store when new items created so that valid itemnumber is returned
Comment 2 Colin Campbell 2020-07-29 13:43:52 UTC
Created attachment 107501 [details] [review]
Revised patch to add calls to store when new items are created so that valid itemnumber is returned


Add an explicit setting of biblioitemnumber to avoid store generating foreign key errors (this also used to be implicit behaviour)
Comment 3 Kyle M Hall 2020-08-19 14:41:25 UTC
Created attachment 108637 [details] [review]
Bug 26082: Call store on new items to update itemnumber

Need to add call to store to Koha::Item->new so that itemnumber
is returned - otherwise is not defined and causes an error
Bug is a side-effect of Bug 23463 as this was implicitly
done in AddItem

Also set biblioitemnumber explicitly for item adds this also
used to be done explicitly but can now cause an FK error

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Jonathan Druart 2020-08-20 08:21:49 UTC
Those lines are not needed, but won't hurt:
  $item_hash->{biblioitemnumber} = $bib->{biblioitemnumber};

It's handled in Koha::Item->store.

Sorry for having missed that!
Comment 5 Jonathan Druart 2020-08-20 10:34:42 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 6 Martin Renvoize 2020-09-02 08:56:49 UTC
20.05 will need this ;)
Comment 7 Lucas Gass 2020-09-04 16:38:31 UTC
backported to 20.05.x for 20.05.04
Comment 8 Aleisha Amohia 2020-09-10 03:53:23 UTC
missing dependencies, not backported to 19.11.x