From 4e5d60137b429314b351c9de359c064be977380f 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 --- .../mysql/en/optional/patron_categories.yml | 5 ++++ .../fr-FR/2-Optionel/patron_categories.sql | 18 ++++++------- .../nb-NO/2-Valgfritt/patron_categories.sql | 26 +++++++++---------- t/db_dependent/Patrons.t | 10 +++---- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/installer/data/mysql/en/optional/patron_categories.yml b/installer/data/mysql/en/optional/patron_categories.yml index e5a02d1084..3d8d72696f 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/installer/data/mysql/fr-FR/2-Optionel/patron_categories.sql b/installer/data/mysql/fr-FR/2-Optionel/patron_categories.sql index 22ddcd99f8..47902271aa 100644 --- a/installer/data/mysql/fr-FR/2-Optionel/patron_categories.sql +++ b/installer/data/mysql/fr-FR/2-Optionel/patron_categories.sql @@ -1,15 +1,15 @@ SET NAMES utf8; -INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`) VALUES -('ADULT','Adulte',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'), -('ETUD','Etudiant',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'), +INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`, `canbeguarantee`) VALUES +('ADULT','Adulte',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A',0), +('ETUD','Etudiant',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A',0), -('ENF','Enfant',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C'), -('ADO','Adolescent',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C'), +('ENF','Enfant',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C',1), +('ADO','Adolescent',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C',1), -('PROF','Professeur',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','P'), -('PERS','Personnel bibliothèque',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','P'), +('PROF','Professeur',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','P',1), +('PERS','Personnel bibliothèque',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','P',1), -('PEB','Prêt Entre Bibliothèque',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I'), +('PEB','Prêt Entre Bibliothèque',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I',0), ('PMI','PMI',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I'), -('BDP','Bibliothèque Départementale',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I'); +('BDP','Bibliothèque Départementale',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I',0); diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/patron_categories.sql b/installer/data/mysql/nb-NO/2-Valgfritt/patron_categories.sql index 456eed81f4..0d7c233779 100644 --- a/installer/data/mysql/nb-NO/2-Valgfritt/patron_categories.sql +++ b/installer/data/mysql/nb-NO/2-Valgfritt/patron_categories.sql @@ -19,26 +19,26 @@ -- You should have received a copy of the GNU General Public License -- along with Koha; if not, see . -INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`) VALUES +INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`, `canbeguarantee`) VALUES -- Adult Patrons -('PT','Låner',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'), -('ST','Student',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'), -('HB','Hjemmelåner',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'), +('PT','Låner',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A',0), +('ST','Student',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A',0), +('HB','Hjemmelåner',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A',0), -- Children -('K','Barn',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C'), -('J','Ungdom',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C'), -('YA','Ung voksen',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C'), +('K','Barn',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C',1), +('J','Ungdom',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C',1), +('YA','Ung voksen',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','C',1), -- Professionals -('T','Lærer',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','P'), -('B','Styremedlem',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','P'), +('T','Lærer',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','P',1), +('B','Styremedlem',99,17,5,NULL,NULL,'0.000000',1,NULL,'0.000000','P',1), -- Institutional -('IL','Fjernlån',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I'), -('SC','Skole',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I'), -('L','Bibliotek',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I'), +('IL','Fjernlån',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I',0), +('SC','Skole',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I',0), +('L','Bibliotek',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','I',0), -- Staff -('S','Bibliotekansatt',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','S'); +('S','Bibliotekansatt',99,999,18,NULL,NULL,'0.000000',0,NULL,'0.000000','S',0); diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t index 9453882501..c78afea5a2 100755 --- a/t/db_dependent/Patrons.t +++ b/t/db_dependent/Patrons.t @@ -201,13 +201,13 @@ 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->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'); is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,0,'Guarantee was removed when made adult'); -- 2.25.1