Bug 16819 - C4::Members::DelMember should use Koha::Holds to delete holds
Summary: C4::Members::DelMember should use Koha::Holds to delete holds
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 14642
  Show dependency treegraph
 
Reported: 2016-06-27 18:02 UTC by Tomás Cohen Arazi
Modified: 2017-12-07 22:16 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 16819: Unit tests for C4::Members::DelMember (1.75 KB, patch)
2016-06-28 14:08 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16819: C4::Members::DelMember should use Koha::Holds to delete holds (1.78 KB, patch)
2016-06-28 14:08 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 16819: Unit tests for C4::Members::DelMember (1.82 KB, patch)
2016-07-01 15:17 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 16819: C4::Members::DelMember should use Koha::Holds to delete holds (1.88 KB, patch)
2016-07-01 15:17 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 16819: Unit tests for C4::Members::DelMember (1.88 KB, patch)
2016-07-03 14:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 16819: C4::Members::DelMember should use Koha::Holds to delete holds (1.94 KB, patch)
2016-07-03 15:00 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 16819: Remove use of map (798 bytes, patch)
2016-07-03 15:00 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2016-06-27 18:02:42 UTC

    
Comment 1 Tomás Cohen Arazi 2016-06-28 14:08:39 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi 2016-06-28 14:08:44 UTC Comment hidden (obsolete)
Comment 3 Héctor Eduardo Castro Avalos 2016-07-01 15:17:32 UTC Comment hidden (obsolete)
Comment 4 Héctor Eduardo Castro Avalos 2016-07-01 15:17:43 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-07-01 16:11:00 UTC
Comment on attachment 53031 [details] [review]
[SIGNED-OFF]Bug 16819: C4::Members::DelMember should use Koha::Holds to delete holds

Review of attachment 53031 [details] [review]:
-----------------------------------------------------------------

::: C4/Members.pm
@@ +1662,5 @@
>      #warn "in delmember with $borrowernumber";
>      return unless $borrowernumber;    # borrowernumber is mandatory.
> +    # Delete Patron's holds
> +    my @holds = Koha::Holds->search({ borrowernumber => $borrowernumber });
> +    map { $_->delete } @holds;

I'd have written that `$_->delete for @holds`. Since map is supposed to return something I guess it can perturb a new developer. Do you agree?
Comment 6 Jonathan Druart 2016-07-03 14:59:50 UTC
Created attachment 53054 [details] [review]
Bug 16819: Unit tests for C4::Members::DelMember

The C4::Members::DelMember function actually deletes reserves, and it is
not properly tested.

To test:
- Apply the patch
- Run:
  $ prove  t/db_dependent/Members.t
=> SUCCESS: Tests pass
- Sign off

Sponsored-by: NEKLS
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2016-07-03 15:00:00 UTC
Created attachment 53055 [details] [review]
Bug 16819: C4::Members::DelMember should use Koha::Holds to delete holds

This patch makes C4::Members::DelMember proprely use Koha::Holds to delete
holds. This is important as holds actions are started to be logged.

To reproduce:
- Apply the patch
- Run:
  $ prove t/db_dependent/Members.t
=> SUCCESS: Tests pass
- Sign off :-D

Sponsored-by: NEKLS
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
All tests pass successfully

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2016-07-03 15:00:10 UTC
Created attachment 53056 [details] [review]
Bug 16819: Remove use of map

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2016-07-03 15:01:08 UTC
(In reply to Jonathan Druart from comment #8)
> Created attachment 53056 [details] [review] [review]
> Bug 16819: Remove use of map
> 
> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Tomas or RM: feel free to obsolete this patch if you want to.
Comment 10 Tomás Cohen Arazi 2016-07-06 11:07:10 UTC
(In reply to Jonathan Druart from comment #9)
> (In reply to Jonathan Druart from comment #8)
> > Created attachment 53056 [details] [review] [review] [review]
> > Bug 16819: Remove use of map
> > 
> > Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
> 
> Tomas or RM: feel free to obsolete this patch if you want to.

I like either, passing the ball to the RM :-D
Comment 11 Kyle M Hall 2016-07-08 14:49:36 UTC
Pushed to master for 16.11, thanks Tomas, Jonathan!
Comment 12 Frédéric Demians 2016-08-01 13:36:23 UTC
Pushed in 16.05. Will be in 16.05.02.