From 148f062238f4c0d436430bed6c87b0acec125220 Mon Sep 17 00:00:00 2001 From: Christophe Croullebois Date: Wed, 11 Feb 2015 14:46:47 +0100 Subject: [PATCH 1/1] Bug 13697 : Syspref to not add a fee when a patron changes to a category with enrolment fee By default this syspref is "Do" to keep the previous behaviour. Test plan : 1/ create 2 categories (A & B). B with enrolment fee 2/ create a patron in category A 3/ change the patron category from A to B 4/ check that the patron has an enrolment fee to pay Apply the patch 1/ create a new patron in category A 2/ change the patron category from A to B. 3/ check that the patron has an enrolment fee to pay 4/ change the system preference 'FeeOnChangePatronCategory' to 'Don't'; 5/ create a new patron in category A 6/ change the patron category from A to B 7/ check that the patron has no enrolment fee to pay --- C4/Members.pm | 4 +++- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 10 ++++++++++ .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/C4/Members.pm b/C4/Members.pm index 4fb845d..efbbff3 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -811,7 +811,9 @@ sub ModMember { # If the patron changes to a category with enrollment fee, we add a fee if ( $data{categorycode} and $data{categorycode} ne $old_categorycode ) { - AddEnrolmentFeeIfNeeded( $data{categorycode}, $data{borrowernumber} ); + if ( C4::Context->preference('FeeOnChangePatronCategory') ) { + AddEnrolmentFeeIfNeeded( $data{categorycode}, $data{borrowernumber} ); + } } # If NorwegianPatronDBEnable is enabled, we set syncstatus to something that a diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 9020b4b..be5d0e1 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -124,6 +124,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ExtendedPatronAttributes','0',NULL,'Use extended patron IDs and attributes','YesNo'), ('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'), ('FacetMaxCount','20',NULL,'Specify the max facet count for each category','Integer'), +('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is added','YesNo') ('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'), ('FineNotifyAtCheckin','0',NULL,'If ON notify librarians of overdue fines on the items they are checking in.','YesNo'), ('finesCalendar','noFinesWhenClosed','ignoreCalendar|noFinesWhenClosed','Specify whether to use the Calendar in calculating duedates and fines','Choice'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0ed56c6..6fbbb4e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9793,6 +9793,16 @@ if(CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.19.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) + VALUES ('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is added','YesNo') + }); + print "Upgrade to $DBversion done (Bug 13697 - Option to don't add a fee, if the patron changes to a category with enrolment fee)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index aa567c3..067df44 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -160,3 +160,9 @@ Patrons: yes: Do no: "Don't" - search the Norwegian national patron database after a local search result was found. + - + - pref: FeeOnChangePatronCategory + choices: + yes: Do + no: "Don't" + - add a fee when a patron changes to a category with enrolment fee. -- 1.7.9.5