Bugzilla – Attachment 94794 Details for
Bug 17168
Add a command line script for updating patron category based on status
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17168: (QA follow-up) Only remove guarantor relationship if not Child AND not Professional
Bug-17168-QA-follow-up-Only-remove-guarantor-relat.patch (text/plain), 3.49 KB, created by
Nick Clemens
on 2019-10-25 18:22:41 UTC
(
hide
)
Description:
Bug 17168: (QA follow-up) Only remove guarantor relationship if not Child AND not Professional
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2019-10-25 18:22:41 UTC
Size:
3.49 KB
patch
obsolete
>From d554a51372a4437c29c542f02cb3772e6c61209a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 25 Oct 2019 18:22:01 +0000 >Subject: [PATCH] Bug 17168: (QA follow-up) Only remove guarantor relationship > if not Child AND not Professional > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Patron.pm | 2 +- > t/db_dependent/Patrons.t | 11 +++++++++-- > 2 files changed, 10 insertions(+), 3 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index e3a79bb3ae..6f88023b72 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -264,7 +264,7 @@ sub store { > # Clean up guarantors on category change if required > $self->guarantor_relationships->delete > if ( $self->category->category_type ne 'C' >- || $self->category->category_type ne 'P' ); >+ && $self->category->category_type ne 'P' ); > > } > >diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t >index 25739c9cbe..b11a9d34f5 100755 >--- a/t/db_dependent/Patrons.t >+++ b/t/db_dependent/Patrons.t >@@ -106,13 +106,18 @@ foreach my $b ( $patrons->as_list() ) { > } > > subtest "Update patron categories" => sub { >- plan tests => 17; >+ plan tests => 19; > t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' ); > my $c_categorycode = $builder->build({ source => 'Category', value => { > category_type=>'C', > upperagelimit=>17, > dateofbirthrequired=>5, > } })->{categorycode}; >+ my $c_categorycode_2 = $builder->build({ source => 'Category', value => { >+ category_type=>'C', >+ upperagelimit=>17, >+ dateofbirthrequired=>5, >+ } })->{categorycode}; > my $a_categorycode = $builder->build({ source => 'Category', value => {category_type=>'A'} })->{categorycode}; > my $p_categorycode = $builder->build({ source => 'Category', value => {category_type=>'P'} })->{categorycode}; > my $i_categorycode = $builder->build({ source => 'Category', value => {category_type=>'I'} })->{categorycode}; >@@ -179,7 +184,9 @@ subtest "Update patron categories" => sub { > is( Koha::Patrons->search_patrons_to_update_category({from=>$a_categorycode,fine_max=>5})->next->borrowernumber,$adult1->borrowernumber,'One patron with fines under $5 is expected one'); > > is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,3,'Guarantor has 3 guarantees'); >- is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode,too_young=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category'); >+ is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode})->update_category_to({category=>$c_categorycode_2}),3,'Three child patrons updated to another child category with no params passed'); >+ is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,3,'Guarantees not removed when made changing child categories'); >+ is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category'); > is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantee was removed when made adult'); > > is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,1,'Guarantor has 1 guarantees'); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17168
:
60279
|
60280
|
60665
|
70921
|
73012
|
74936
|
75698
|
76974
|
76975
|
76976
|
85870
|
85871
|
85872
|
85873
|
85878
|
88809
|
88810
|
88811
|
88812
|
88813
|
88814
|
91677
|
94665
|
94666
|
94667
|
94668
|
94669
|
94670
|
94671
|
94790
|
94793
| 94794