@@ -, +, @@ --- Koha/Template/Plugin/Borrowers.pm | 2 + installer/data/mysql/updatedatabase.pl | 2 +- .../intranet-tmpl/prog/en/includes/calendar.inc | 28 ++++++++++++++++++ .../intranet-tmpl/prog/en/modules/circ/returns.tt | 30 ++++++++++++++++++-- 4 files changed, 58 insertions(+), 4 deletions(-) --- a/Koha/Template/Plugin/Borrowers.pm +++ a/Koha/Template/Plugin/Borrowers.pm @@ -44,6 +44,8 @@ in any way in the script. sub IsDebarred { my ( $self, $borrower ) = @_; + return unless $borrower; + if ( $borrower->{'debarred'} && check_date( split( /-/, $borrower->{'debarred'} ) ) ) { if ( Date_to_Days(Date::Calc::Today) < Date_to_Days( split( /-/, $borrower->{'debarred'} ) ) ) { return 1; --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8018,7 +8018,7 @@ if ( CheckVersion($DBversion) ) { INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES - ('SpecifyReturnDate',1,'Define whether to display \"Specify Return Date\" form in Circulation','','YesNo') + ('SpecifyReturnDate',0,'Define whether to display \"Specify Return Date\" form in Circulation','','YesNo') }); print "Upgrade to $DBversion done (Bug 10694 - Allow arbitrary backdating of returns)\n"; SetVersion($DBversion); --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -21,6 +21,34 @@ function Date_from_syspref(dstring) { } } +function DateTime_from_syspref(date_time) { + var parts = date_time.split(" "); + var date = parts[0]; + var time = parts[1]; + parts = time.split(":"); + var hour = parts[0]; + var minute = parts[1]; + + if ( hour < 0 || hour > 23 ) { + return 0; + } + if ( minute < 0 || minute > 59 ) { + return 0; + } + + var datetime = Date_from_syspref( date ); + + if ( isNaN( datetime.getTime() ) ) { + return 0; + } + + datetime.setHours( hour ); + datetime.setMinutes( minute ); + + return datetime; +} + + /* Instead of including multiple localization files as you would normally see with jQueryUI we expose the localization strings in the default configuration */ jQuery(function($){ --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -8,7 +8,7 @@ [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] - +