From 079de81c104441e1e87799affb7ab8eaef0f91f4 Mon Sep 17 00:00:00 2001 From: Christophe Croullebois Date: Wed, 11 Feb 2015 14:46:47 +0100 Subject: [PATCH] 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 Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- 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 95fb4e736a..91c89f8183 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -683,7 +683,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 ac79f44219..8460da6eb5 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -130,6 +130,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 3317c3c16e..6c30fb83ce 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -10776,6 +10776,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); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. 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 ee908d2d16..060fbac8af 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 @@ -159,3 +159,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. -- 2.39.5