[Koha-patches] [PATCH] New feature ceiling Due Date.

Michael Hafen mdhafen at tech.washk12.org
Thu Mar 5 22:21:56 CET 2009


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 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 4 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index cf42490..9f163b1 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');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 47da596..d2993eb 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -153,6 +153,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('libraryAddress','','L''adresse pour l''impression des reçus, des amendes... si elle est différente de l''adresse physique de la bibliothèque',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesMode','test','Choisissez un mode pour le calcul des amendes : Test ou Production.','test|production','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('globalDueDate','','Si défini, autorise une date de retour statique pour tous les prêts','10','free');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ceilingDueDate','','Si présent, les dates de retour des prêts ne pourront être antérieures à cette date. Formatez cette date conformément à la préférence système dateformat.',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




More information about the Koha-patches mailing list