Bug 13697: Syspref to not add a fee when a patron changes to a category with enrolmen...
authorChristophe Croullebois <christophe.croullebois@biblibre.com>
Wed, 11 Feb 2015 13:46:47 +0000 (14:46 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 28 Aug 2015 12:51:45 +0000 (09:51 -0300)
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 <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Members.pm
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref

index 95fb4e7..91c89f8 100644 (file)
@@ -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
index ac79f44..8460da6 100644 (file)
@@ -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'),
index 3317c3c..6c30fb8 100755 (executable)
@@ -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.
index ee908d2..060fbac 100644 (file)
@@ -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.