Bugzilla – Attachment 25661 Details for
Bug 10694
Allow arbitrary backdating of returns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10694 - Allow arbitrary backdating of returns - QA Followup 3
Bug-10694---Allow-arbitrary-backdating-of-returns-.patch (text/plain), 5.10 KB, created by
Kyle M Hall (khall)
on 2014-02-26 15:49:55 UTC
(
hide
)
Description:
Bug 10694 - Allow arbitrary backdating of returns - QA Followup 3
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-02-26 15:49:55 UTC
Size:
5.10 KB
patch
obsolete
>From 00c6f36d70e6525482836b7ce9e113677848313c Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 26 Feb 2014 10:38:48 -0500 >Subject: [PATCH] Bug 10694 - Allow arbitrary backdating of returns - QA Followup 3 > >--- > 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(-) > >diff --git a/Koha/Template/Plugin/Borrowers.pm b/Koha/Template/Plugin/Borrowers.pm >index 6c8808f..29a6fef 100644 >--- a/Koha/Template/Plugin/Borrowers.pm >+++ b/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; >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index ef253f6..aebedfb 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/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); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index 1337044..8eb3fcb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/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($){ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index aaecd51..7b7b668 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -8,7 +8,7 @@ > [% INCLUDE 'doc-head-close.inc' %] > > [% INCLUDE 'calendar.inc' %] >-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script> >+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min.js"></script> > > <script type="text/javascript"> > //<![CDATA[ >@@ -19,9 +19,33 @@ function Dopop(link) { > $(document).ready(function () { > $("#return_date_override").datetimepicker({ > onClose: function(dateText, inst) { $("#barcode").focus(); }, >+ defaultDate: -1, > hour: 23, >- minute: 59 >+ minute: 59, >+ maxDate: 0 > }); >+ $("#return_date_override").on("blur", function() { >+ check_valid_return_date(); >+ }); >+ $("#checkin-form").submit(function( event ) { >+ if ( !check_valid_return_date() ) { >+ event.preventDefault(); >+ } >+ }); >+ >+ function check_valid_return_date() { >+ if ( $("#return_date_override").val() ) { >+ var datetime = DateTime_from_syspref( $("#return_date_override").val() ); >+ var now = new Date(); >+ if ( !datetime || datetime > now ) { >+ alert("Invalid return date/time!"); >+ $("#return_date_override").val("") >+ return false; >+ } >+ } >+ return true; >+ } >+ > $("#exemptcheck").change(function () { > if (this.checked == true) { > $("#barcode").addClass("alert"); >@@ -407,7 +431,7 @@ $(document).ready(function () { > </div> > </div> > <div class="yui-g"> >- <form method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" > >+ <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" > > <div class="yui-u first"> > <fieldset> > <legend>Check in</legend> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10694
:
20146
|
20147
|
21094
|
21095
|
21096
|
22122
|
22123
|
23672
|
23673
|
23697
|
25658
|
25659
|
25660
|
25661
|
26162
|
26163
|
26707
|
26708
|
27461
|
27475