Bug 26485

Summary: Simplify itemnumber handling in returns.pl
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: fridolin.somers, lucas, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26627
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00
Bug Depends on: 25969    
Bug Blocks: 26627    
Attachments: Bug 26485: Simplify itemnumber handling in returns.pl
Bug 26485: Simplify itemnumber handling in returns.pl
Bug 26485: Simplify itemnumber handling in returns.pl
Bug 26485: Simplify itemnumber handling in returns.pl

Description Jonathan Druart 2020-09-18 08:59:23 UTC
This is a follow-up for bug 25969. The way we handle itemnumber is too complicated and error prone.
Comment 1 Jonathan Druart 2020-09-18 09:01:12 UTC
Created attachment 110321 [details] [review]
Bug 26485: Simplify itemnumber handling in returns.pl

This is a follow-up for bug 25969. The way we handle itemnumber is too complicated and error prone.
Comment 2 Tomás Cohen Arazi 2020-09-29 18:33:20 UTC
It looks saner than the current code :-D
Comment 3 Fridolin Somers 2020-09-30 15:54:43 UTC
Created attachment 110999 [details] [review]
Bug 26485: Simplify itemnumber handling in returns.pl

This is a follow-up for bug 25969. The way we handle itemnumber is too complicated and error prone.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 4 Fridolin Somers 2020-09-30 15:55:24 UTC
Playing with items return and transfers is OK with this change.
Comment 5 Fridolin Somers 2020-09-30 15:55:54 UTC
OMG we also need to manage $item object :

grep 'Koha::Items->find' circ/returns.pl 
    my $item = Koha::Items->find( $itemnumber );
    my $item = Koha::Items->find({ barcode => $barcode });
        my $item = Koha::Items->find( $itemnumber );
        my $item = Koha::Items->find({ barcode => $bar_code });
    my $item_from_barcode = Koha::Items->find({barcode => $barcode }); # How many times do we fetch this item?!?
Comment 6 Martin Renvoize 2020-10-01 09:47:44 UTC
(In reply to Fridolin SOMERS from comment #5)
> OMG we also need to manage $item object :
> 
> grep 'Koha::Items->find' circ/returns.pl 
>     my $item = Koha::Items->find( $itemnumber );
>     my $item = Koha::Items->find({ barcode => $barcode });
>         my $item = Koha::Items->find( $itemnumber );
>         my $item = Koha::Items->find({ barcode => $bar_code });
>     my $item_from_barcode = Koha::Items->find({barcode => $barcode }); # How
> many times do we fetch this item?!?

Yowsers!.. Lets do this.. perhaps in a new bug
Comment 7 Martin Renvoize 2020-10-01 09:48:58 UTC
Created attachment 111028 [details] [review]
Bug 26485: Simplify itemnumber handling in returns.pl

This is a follow-up for bug 25969. The way we handle itemnumber is too complicated and error prone.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Jonathan Druart 2020-10-01 09:50:24 UTC
(In reply to Martin Renvoize from comment #6)
> (In reply to Fridolin SOMERS from comment #5)
> > OMG we also need to manage $item object :
> > 
> > grep 'Koha::Items->find' circ/returns.pl 
> >     my $item = Koha::Items->find( $itemnumber );
> >     my $item = Koha::Items->find({ barcode => $barcode });
> >         my $item = Koha::Items->find( $itemnumber );
> >         my $item = Koha::Items->find({ barcode => $bar_code });
> >     my $item_from_barcode = Koha::Items->find({barcode => $barcode }); # How
> > many times do we fetch this item?!?
> 
> Yowsers!.. Lets do this.. perhaps in a new bug

I think there is one already (without patch), but cannot find it.
Comment 9 Martin Renvoize 2020-10-01 10:17:25 UTC
Created attachment 111029 [details] [review]
Bug 26485: Simplify itemnumber handling in returns.pl

This is a follow-up for bug 25969. The way we handle itemnumber is too complicated and error prone.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2020-10-01 10:20:18 UTC
Sooo much clearer!

Passing QA
Comment 11 Jonathan Druart 2020-10-08 14:20:58 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 12 Lucas Gass 2020-11-09 20:34:32 UTC
enhancement will not be backported to 20.05.x