Bug 21183

Summary: C4::Items - Remove GetItemnumberFromBarcode
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: josef.moravec, martin.renvoize, nick
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 21182    
Bug Blocks: 18252, 21184, 22288    
Attachments: Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls
Bug 21183: Remove GetItemnumberFromBarcode
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls
Bug 21183: Fix ->get_column call context
Bug 21183: Remove GetItemnumberFromBarcode
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls
Bug 21183: Fix ->get_column call context
Bug 21183: Remove GetItemnumberFromBarcode
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls
Bug 21183: Fix ->get_column call context

Description Jonathan Druart 2018-08-08 18:11:09 UTC
C4::Items::GetItemnumberFromBarcode calls can be replaced with
  Koha::Items->find({ barcode => $barcode });
Comment 1 Jonathan Druart 2018-08-08 18:26:53 UTC
Created attachment 77586 [details] [review]
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls

C4::Items::GetItemnumberFromBarcode calls can be replaced with
  Koha::Items->find({ barcode => $barcode });

We should make sure the barcode existed in DB and so that ->find
returns an object. Note that most of the time we just wanted to know if
the barcode existed.
The changes are very simple, the only one that need attention is
the one in batchMod.pl. It is basically reusing what we did on
bug 21141.

Test plan:
Use the batch item modification/deletion tools to modify/delete items
from their barcode (using the textarea or a file)
Comment 2 Jonathan Druart 2018-08-08 18:26:57 UTC
Created attachment 77587 [details] [review]
Bug 21183: Remove GetItemnumberFromBarcode

Test plan:
  git grep GetItemnumberFromBarcode
should not return anything
Comment 3 Jonathan Druart 2018-08-10 15:04:11 UTC
Created attachment 77687 [details] [review]
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls

C4::Items::GetItemnumberFromBarcode calls can be replaced with
  Koha::Items->find({ barcode => $barcode });

We should make sure the barcode existed in DB and so that ->find
returns an object. Note that most of the time we just wanted to know if
the barcode existed.
The changes are very simple, the only one that need attention is
the one in batchMod.pl. It is basically reusing what we did on
bug 21141.

Test plan:
Use the batch item modification/deletion tools to modify/delete items
from their barcode (using the textarea or a file)
Comment 4 Josef Moravec 2018-08-16 10:57:49 UTC
After submitting some barcodes in tools -> item batch modification:

Can't locate object method "get_column" via package "0" (perhaps you forgot to load "0"?) at /home/vagrant/kohaclone/tools/batchMod.pl line 268.
Comment 5 Jonathan Druart 2018-08-16 14:35:27 UTC
Created attachment 77930 [details] [review]
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls

C4::Items::GetItemnumberFromBarcode calls can be replaced with
  Koha::Items->find({ barcode => $barcode });

We should make sure the barcode existed in DB and so that ->find
returns an object. Note that most of the time we just wanted to know if
the barcode existed.
The changes are very simple, the only one that need attention is
the one in batchMod.pl. It is basically reusing what we did on
bug 21141.

Test plan:
Use the batch item modification/deletion tools to modify/delete items
from their barcode (using the textarea or a file)
Comment 6 Josef Moravec 2018-08-16 15:01:14 UTC
Sorry, but still not working:

Can't use string ("2") as an ARRAY ref while "strict refs" in use at /home/vagrant/kohaclone/tools/batchMod.pl line 269
Comment 7 Jonathan Druart 2018-08-16 15:12:42 UTC
Created attachment 77933 [details] [review]
Bug 21183: Fix ->get_column call context

I am not sure to understand what's going on here.
Comment 8 Jonathan Druart 2018-08-16 15:13:12 UTC
Hum, weird...
Comment 9 Josef Moravec 2018-08-16 15:50:10 UTC
Created attachment 77936 [details] [review]
Bug 21183: Remove GetItemnumberFromBarcode

Test plan:
  git grep GetItemnumberFromBarcode
should not return anything

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 10 Josef Moravec 2018-08-16 15:50:14 UTC
Created attachment 77937 [details] [review]
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls

C4::Items::GetItemnumberFromBarcode calls can be replaced with
  Koha::Items->find({ barcode => $barcode });

We should make sure the barcode existed in DB and so that ->find
returns an object. Note that most of the time we just wanted to know if
the barcode existed.
The changes are very simple, the only one that need attention is
the one in batchMod.pl. It is basically reusing what we did on
bug 21141.

Test plan:
Use the batch item modification/deletion tools to modify/delete items
from their barcode (using the textarea or a file)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 11 Josef Moravec 2018-08-16 15:50:18 UTC
Created attachment 77938 [details] [review]
Bug 21183: Fix ->get_column call context

I am not sure to understand what's going on here.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 12 Katrin Fischer 2018-08-21 21:59:16 UTC
Created attachment 78056 [details] [review]
Bug 21183: Remove GetItemnumberFromBarcode

Test plan:
  git grep GetItemnumberFromBarcode
should not return anything

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2018-08-21 21:59:20 UTC
Created attachment 78057 [details] [review]
Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls

C4::Items::GetItemnumberFromBarcode calls can be replaced with
  Koha::Items->find({ barcode => $barcode });

We should make sure the barcode existed in DB and so that ->find
returns an object. Note that most of the time we just wanted to know if
the barcode existed.
The changes are very simple, the only one that need attention is
the one in batchMod.pl. It is basically reusing what we did on
bug 21141.

Test plan:
Use the batch item modification/deletion tools to modify/delete items
from their barcode (using the textarea or a file)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2018-08-21 21:59:24 UTC
Created attachment 78058 [details] [review]
Bug 21183: Fix ->get_column call context

I am not sure to understand what's going on here.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Nick Clemens 2018-08-30 14:12:02 UTC
Awesome work all!

Pushed to master for 18.11
Comment 16 Martin Renvoize 2018-09-05 10:27:05 UTC
Refactoring enhancement, will not be backported to 18.05.x series.