Bugzilla – Attachment 166529 Details for
Bug 36169
Add guarantee to patron categories with category type 'Staff'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36169: Patron categories with type='Staff' should be able to have guarantees
Bug-36169-Patron-categories-with-typeStaff-should-.patch (text/plain), 3.84 KB, created by
HKS3 Tadeusz Sośnierz
on 2024-05-10 11:27:48 UTC
(
hide
)
Description:
Bug 36169: Patron categories with type='Staff' should be able to have guarantees
Filename:
MIME Type:
Creator:
HKS3 Tadeusz Sośnierz
Created:
2024-05-10 11:27:48 UTC
Size:
3.84 KB
patch
obsolete
>From 4f4305fc58a54dce8cc876c42e10ba4ceac49450 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Tue, 27 Feb 2024 02:31:09 +0000 >Subject: [PATCH] Bug 36169: Patron categories with type='Staff' should be able > to have guarantees >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Library staff - whose patron category has a type='Staff' should be able to have guarantees added. > >Test plan: >1) Create a 'Library staff' patron category with 'Category type' = 'Staff' > >2) Create a patron account using the 'Library staff' patron category > >3) Notice the '+ Add guarantee' button is not displayed in the members toolbar for the 'Library staff' patron you created > >4) Apply patches and restart services > >5) Refresh your browser window > >6) Notice the '+ Add guarantee' button is now displaying for the 'Library staff' patron > >7) Confirm you can successfully add a guarantee > >8) Run unit test t/db_dependent/Koha/Patrons.t > >Sponsored-By: Waitaki District Council, New Zealand >Signed-off-by: Tadeusz âtadzikâ SoÅnierz <tadeusz@sosnierz.com> >--- > Koha/Patron.pm | 4 ++-- > t/db_dependent/Koha/Patrons.t | 17 ++++++++++++++++- > 2 files changed, 18 insertions(+), 3 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index d4b848db56..f647db460b 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1998,13 +1998,13 @@ sub is_superlibrarian { > > my $is_adult = $patron->is_adult > >-Return true if the patron has a category with a type Adult (A) or Organization (I) >+Return true if the patron has a category with a type Adult (A), Organization (I) or Staff (S) > > =cut > > sub is_adult { > my ( $self ) = @_; >- return $self->category->category_type =~ /^(A|I)$/ ? 1 : 0; >+ return $self->category->category_type =~ /^(A|I|S)$/ ? 1 : 0; > } > > =head3 is_child >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 68ea342a6e..38c744195a 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1414,7 +1414,7 @@ subtest 'account_locked' => sub { > }; > > subtest 'is_child | is_adult' => sub { >- plan tests => 8; >+ plan tests => 10; > my $category = $builder->build_object( > { > class => 'Koha::Patron::Categories', >@@ -1463,21 +1463,36 @@ subtest 'is_child | is_adult' => sub { > value => { categorycode => $category->categorycode } > } > ); >+ $category = $builder->build_object( >+ { >+ class => 'Koha::Patron::Categories', >+ value => { category_type => 'S' } >+ } >+ ); >+ my $patron_staff = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { categorycode => $category->categorycode } >+ } >+ ); > is( $patron_adult->is_adult, 1, 'Patron from category A should be considered adult' ); > is( $patron_adult_i->is_adult, 1, 'Patron from category I should be considered adult' ); > is( $patron_child->is_adult, 0, 'Patron from category C should not be considered adult' ); > is( $patron_other->is_adult, 0, 'Patron from category O should not be considered adult' ); >+ is( $patron_staff->is_adult, 1, 'Patron from category S should be considered adult' ); > > is( $patron_adult->is_child, 0, 'Patron from category A should be considered child' ); > is( $patron_adult_i->is_child, 0, 'Patron from category I should be considered child' ); > is( $patron_child->is_child, 1, 'Patron from category C should not be considered child' ); > is( $patron_other->is_child, 0, 'Patron from category O should not be considered child' ); >+ is( $patron_staff->is_child, 0, 'Patron from category S should not be considered child' ); > > # Clean up > $patron_adult->delete; > $patron_adult_i->delete; > $patron_child->delete; > $patron_other->delete; >+ $patron_staff->delete; > }; > > subtest 'overdues' => sub { >-- >2.43.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 36169
:
162480
|
166529
|
169253
|
169254
|
169255