From 7d61fd62f510c229c18ed48662b7aa64dee1525e Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Thu, 5 Mar 2009 14:21:56 -0700 Subject: [PATCH] New feature ceiling Due Date. 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. Signed-off-by: Galen Charlton --- C4/Circulation.pm | 7 +++++++ admin/systempreferences.pl | 1 + installer/data/mysql/en/mandatory/sysprefs.sql | 1 + .../fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql | 1 + 4 files changed, 10 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 4b02a26b3d..5da5b3685d 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 790138aa6b..24065f6dc8 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -130,6 +130,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 8802096b5b..0c1b1cd50f 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -144,6 +144,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 00a63cb9ee..15ddc1c580 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 @@ -154,6 +154,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'); -- 2.39.5