The `MoveReserve` method is called once, in `AddIssue`. The latter has the related `Koha::Item` object already fetched from the DB, but it passed the `itemnumber` which is used by `MoveReserve` to fetch the item from the DB. This should not happen.
Created attachment 182915 [details] [review] Bug 40055: Make MoveReserve be passed objects instead of ids The `MoveReserve` method is called once, in `AddIssue`. The latter has the related `Koha::Item` object already fetched from the DB, but it passed the `itemnumber` which is used by `MoveReserve` to fetch the item from the DB. This should not happen. To test: 1. Run: $ ktd --shell k$ prove t/db_dependent/Reserves* \ t/db_dependent/Koha/Hold* \ t/db_dependent/Hold* \ t/db_dependent/Circulation* => SUCCESS: Tests pass 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! 4. Sign off :-D
Created attachment 182953 [details] [review] Bug 40055: Make MoveReserve be passed objects instead of ids The `MoveReserve` method is called once, in `AddIssue`. The latter has the related `Koha::Item` object already fetched from the DB, but it passed the `itemnumber` which is used by `MoveReserve` to fetch the item from the DB. This should not happen. To test: 1. Run: $ ktd --shell k$ prove t/db_dependent/Reserves* \ t/db_dependent/Koha/Hold* \ t/db_dependent/Hold* \ t/db_dependent/Circulation* => SUCCESS: Tests pass 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
I don't like the use of 'id'. We have borrowernumber and userid on this object. And we have patron_id for the REST API. It might be obvious for you and me, but for new developers it can be very confusing I think.
Or we batch replace all the occurrences. Otherwise we are just adding yet another inconsistency.
(In reply to Jonathan Druart from comment #3) > I don't like the use of 'id'. We have borrowernumber and userid on this > object. > And we have patron_id for the REST API. > > It might be obvious for you and me, but for new developers it can be very > confusing I think. I always felt like ->id (being the defined PRIMARY KEY) was a good practice as, in general, we end up using `$patron->id` which reads as 'the patron id' (at least in my brain). In this case, the comparison is with a 'borrowernumber' attribute, so I'd say I will change it to `$patron->borrowernumber` as it reads well.
Created attachment 182989 [details] [review] Bug 40055: Make MoveReserve be passed objects instead of ids The `MoveReserve` method is called once, in `AddIssue`. The latter has the related `Koha::Item` object already fetched from the DB, but it passed the `itemnumber` which is used by `MoveReserve` to fetch the item from the DB. This should not happen. To test: 1. Run: $ ktd --shell k$ prove t/db_dependent/Reserves* \ t/db_dependent/Koha/Hold* \ t/db_dependent/Hold* \ t/db_dependent/Circulation* => SUCCESS: Tests pass 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
(In reply to Jonathan Druart from comment #3) > I don't like the use of 'id'. We have borrowernumber and userid on this > object. I changed it to `$patron->borrowernumber`. Thanks for reviewing it.
Created attachment 182999 [details] [review] Bug 40055: Make MoveReserve be passed objects instead of ids The `MoveReserve` method is called once, in `AddIssue`. The latter has the related `Koha::Item` object already fetched from the DB, but it passed the `itemnumber` which is used by `MoveReserve` to fetch the item from the DB. This should not happen. To test: 1. Run: $ ktd --shell k$ prove t/db_dependent/Reserves* \ t/db_dependent/Koha/Hold* \ t/db_dependent/Hold* \ t/db_dependent/Circulation* => SUCCESS: Tests pass 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>