From 45f64b2248fad942d6a95d6c53b54b36cbe5cb17 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 --- .../mysql/en/optional/patron_categories.yml | 5 +++ .../fr-FR/2-Optionel/patron_categories.sql | 18 ++++---- .../nb-NO/2-Valgfritt/patron_categories.sql | 44 +++++++++++++++++++ t/db_dependent/Patrons.t | 6 +-- 4 files changed, 61 insertions(+), 12 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/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 new file mode 100644 index 0000000000..0d7c233779 --- /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 548c6c01b4..b9e414cb8f 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