Bug 35641: Reduce DB lookups when sending a list of barcodes to inventory
authorNick Clemens <nick@bywatersolutions.com>
Fri, 22 Dec 2023 13:35:06 +0000 (13:35 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 2 Feb 2024 17:51:54 +0000 (17:51 +0000)
commita267c38a3f05e9ec9c6848f0e7b643fe529b946e
treefda6a76b3cd4cd3be12189fdb62ffe95c232418e
parent40c8816bd4d13fa92a9a7cf37c111a3e8fc83344
Bug 35641: Reduce DB lookups when sending a list of barcodes to inventory

This patch does three things:
1 - Removes a specific query for withdrawn status of each item scanned - we can use the withdrawn field
2 - Removes a specific query for checkouts on each item scanned - we can use the onloan field
    a - additionally we don't need to fetch the checkout as we check it in to the homebranch,
    this is likely incorrect - we should use the current branch, but I preserve behavior for now
3 - Fetches the items ahead of time and builds a hash based on barcode, reduces DB lookups, may raise memory usage

To test:
1 - Checkout some items
2 - Withdraw some items
3 - Generate a lsit of barcodes including some checked out items and some withdrawn items
4 - Enter that list of barcodes into inventory tool
5 - Note your results
6 - Apply patch
7 - Issue the items again
8 - Repeat inventory
9 - Confirm results are the same as before patch

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5ae5e4367b96cd5685c40197f391ca3c4063c407)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 41580a0a589b96f7edeb8ec24f7b2664508e16ae)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
tools/inventory.pl