[Koha-patches] [PATCH] Bug 13697 : Option to do not add a fee, if the patron changes to a category with enrolment fee

Christophe Croullebois christophe.croullebois at biblibre.com
Wed Feb 11 14:50:40 CET 2015


---
 C4/Members.pm                          |    2 ++
 installer/data/mysql/updatedatabase.pl |    7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/C4/Members.pm b/C4/Members.pm
index 6f95b94..1cec21f 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 ) {
+            if (C4::Context->preference('FeeOnChangePatronCategory') == 0){
             AddEnrolmentFeeIfNeeded( $data{categorycode}, $data{borrowernumber} );
+            }
         }
 
         # If NorwegianPatronDBEnable is enabled, we set syncstatus to something that a
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index dab1c62..654fad1 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -9759,6 +9759,13 @@ if ( CheckVersion($DBversion) ) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.19.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('FeeOnChangePatronCategory','0','If set, when the patron changes to a category with enrolment fee, a fee is not 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)
-- 
1.7.9.5



More information about the Koha-patches mailing list