From c9cdbb130ba05cdf5dda610a8e1b3fd9064fa937 Mon Sep 17 00:00:00 2001 From: Maryse Simard Date: Thu, 12 Nov 2020 16:01:35 -0500 Subject: [PATCH] Bug 12446: Add canbeguarantee value to patron categories sample data This patch changes sample data so patron categories of type 'C' or 'P' can be guarantees by default. Signed-off-by: Salman Ali Signed-off-by: Salman Ali Signed-off-by: David Nind Signed-off-by: Owen Leonard Signed-off-by: Jonathan Druart --- installer/data/mysql/en/optional/patron_categories.yml | 5 +++++ t/db_dependent/Patrons.t | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/en/optional/patron_categories.yml b/installer/data/mysql/en/optional/patron_categories.yml index e5a02d10844..3d8d72696ff 100644 --- a/installer/data/mysql/en/optional/patron_categories.yml +++ b/installer/data/mysql/en/optional/patron_categories.yml @@ -99,6 +99,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'C' + canbeguarantee: 1 - categorycode: 'J' description: 'Juvenile' @@ -112,6 +113,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'C' + canbeguarantee: 1 - categorycode: 'YA' description: 'Young Adult' @@ -125,6 +127,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'C' + canbeguarantee: 1 # Professionals - categorycode: 'T' @@ -139,6 +142,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'P' + canbeguarantee: 1 - categorycode: 'B' description: 'Board' @@ -152,6 +156,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'P' + canbeguarantee: 1 # Institutional - categorycode: 'IL' diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t index 4a5ff218c1e..6e34ec548f2 100755 --- a/t/db_dependent/Patrons.t +++ b/t/db_dependent/Patrons.t @@ -201,12 +201,12 @@ subtest "Update patron categories" => sub { is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->next->borrowernumber, $child1->borrowernumber ); 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 because too young'); is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantee was removed when made adult'); - is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2})->update_category_to({category=>$a_categorycode_2}),2,'Two child patrons updated to adult category'); - is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantees were not removed when made adult which can be guarantee'); is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->next->borrowernumber, $child3->borrowernumber ); is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category because too old'); is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,1,'Guarantee was removed when made adult'); + is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2})->update_category_to({category=>$a_categorycode_2}),1,'Two child patrons updated to adult category'); + is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,1,'Guarantees were not removed when made adult which can be guarantee'); is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,1,'Guarantor has 1 guarantees'); is( Koha::Patrons->search_patrons_to_update_category({from=>$p_categorycode})->update_category_to({category=>$a_categorycode}),1,'One professional patron updated to adult category'); -- 2.25.1