From 744de73061d9e9e148ee0540bf65334f595a4909 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 --- .../mysql/en/optional/patron_categories.yml | 5 +++ .../nb-NO/2-Valgfritt/patron_categories.sql | 44 +++++++++++++++++++ t/db_dependent/Patrons.t | 6 +-- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/nb-NO/2-Valgfritt/patron_categories.sql 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/nb-NO/2-Valgfritt/patron_categories.sql b/installer/data/mysql/nb-NO/2-Valgfritt/patron_categories.sql new file mode 100644 index 0000000000..61428166ea --- /dev/null +++ b/installer/data/mysql/nb-NO/2-Valgfritt/patron_categories.sql @@ -0,0 +1,44 @@ +-- +-- Default classification sources and filing rules +-- for Koha. +-- +-- Copyright (C) 2011 Magnus Enger Libriotech +-- +-- This file is part of Koha. +-- +-- Koha is free software; you can redistribute it and/or modify it +-- under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- Koha is distributed in the hope that it will be useful, but +-- WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- 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`, `canbeguarantee`) VALUES + +-- Adult Patrons +('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',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',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',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',0); diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t index 4a5ff218c1..bc3f376bf8 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->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