This adds a feature and system preference: ceilingDueDate.  If this is
set to a valid ( according to dateformat syspref ) date, then calculated
due dates will be less than this date.
---
 C4/Circulation.pm                              |    7 +++++++
 admin/systempreferences.pl                     |    1 +
 installer/data/mysql/en/mandatory/sysprefs.sql |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index e4019a4..6be9985 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -980,6 +980,13 @@ sub AddIssue {
             if ( C4::Context->preference('ReturnBeforeExpiry') && 
$datedue->output('iso') gt $borrower->{dateexpiry} ) {
                 $datedue = C4::Dates->new( $borrower->{dateexpiry}, 'iso' );
             }
+
+           # if ceilingDueDate ON the datedue can't be after the ceiling date
+           if ( C4::Context->preference('ceilingDueDate')
+                && ( C4::Context->preference('ceilingDueDate') =~ 
C4::Dates->regexp('syspref') )
+                && $datedue->output gt 
C4::Context->preference('ceilingDueDate') ) {
+               $datedue = C4::Dates->new( 
C4::Context->preference('ceilingDueDate') );
+           }
         }
         $sth->execute(
             $borrower->{'borrowernumber'},      # borrowernumber
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index c9f6b35..afff157 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -131,6 +131,7 @@ $tabsysprefs{IssuingInProcess}               = 
"Circulation";
 $tabsysprefs{patronimages}                   = "Circulation";
 $tabsysprefs{printcirculationslips}          = "Circulation";
 $tabsysprefs{ReturnBeforeExpiry}             = "Circulation";
+$tabsysprefs{ceilingDueDate}                 = "Circulation";
 $tabsysprefs{SpecifyDueDate}                 = "Circulation";
 $tabsysprefs{AutomaticItemReturn}            = "Circulation";
 $tabsysprefs{ReservesMaxPickUpDelay}         = "Circulation";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql 
b/installer/data/mysql/en/mandatory/sysprefs.sql
index 47a0c4b..63559b7 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -143,6 +143,7 @@ INSERT INTO `systempreferences` 
(variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) 
VALUES('libraryAddress','','The address to use for printing receipts, overdues, 
etc. if different than physical address',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) 
VALUES('finesMode','test','Choose the fines mode, \'off\', \'test\' (emails 
admin report) or \'production\' (accrue overdue fines).  Requires accruefines 
cronjob.','off|test|production','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) 
VALUES('globalDueDate','','If set, allows a global static due date for all 
checkouts','10','free');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) 
VALUES('ceilingDueDate','','If set, date due will not be past this date.  Enter 
date according to the dateformat System Preference',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) 
VALUES('itemBarcodeInputFilter','','If set, allows specification of a item 
barcode input filter','whitespace|T-prefix|cuecat','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) 
VALUES('singleBranchMode',0,'Operate in Single-branch mode, hide branch 
selection in the OPAC',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) 
VALUES('URLLinkText','','Text to display as the link anchor in the 
OPAC',NULL,'free');
-- 
1.5.6.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to