Bug 12893 - 'Clear date' links on start and expiration hold date in staff not working

I introduced this bug with my patch for Bug 8181. In changing the way
the date picker widgets worked I changed the ID the "clear date"
javascript was looking for, so it stopped working.

This patch corrects it and improves the JavaScript by moving it out of
the HTML markup.

This patch also makes some minor HTML validity corrections: escaping
ampersands and removing a "size" attribute from a hidden form field.

To test, you should have the AllowHoldDateInFuture system preference
enabled. Place a hold in the staff client for a patron and confirm that
you can choose a "hold starts on" date and a "hold expires on" date and
that the respective "clear date" links work correctly for each one.

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Owen Leonard 2014-09-17 14:48:49 -04:00 committed by Tomas Cohen Arazi
parent 260c423be8
commit a53515084f

View file

@ -136,6 +136,12 @@ function checkMultiHold() {
}
});
$(".clear-date").on("click",function(e){
e.preventDefault();
var fieldID = this.id.replace("clear-date-","");
$("#" + fieldID).val("");
});
$('#hold-request-form').preventDoubleFormSubmit();
[% UNLESS ( borrowernumber || borrower_list || noitems ) %]
@ -295,7 +301,7 @@ function checkMultiHold() {
<form action="placerequest.pl" method="post" onsubmit="return checkMultiHold();" name="form">
[% END %]
<input type="hidden" size="10" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="type" value="str8" />
[% IF ( multi_hold ) %]
@ -347,14 +353,14 @@ function checkMultiHold() {
<li>
<label for="from">Hold starts on date:</label>
<input name="reserve_date" id="from" size="10" readonly="readonly" class="datepickerfrom">
<a href='#' onclick="document.getElementById('reserve_date').value='';">Clear date</a>
<a href="#" id="clear-date-from" class="clear-date">Clear date</a>
</li>
[% END %]
<li>
<label for="to">Hold expires on date:</label>
<input name="expiration_date" id="to" size="10" readonly="readonly" class="datepickerto" />
<a href='#' onclick="document.getElementById('expiration_date').value='';">Clear date</a>
<a href="#" id="clear-date-to" class="clear-date">Clear date</a>
</li>
[% UNLESS ( multi_hold ) %]
@ -483,7 +489,7 @@ function checkMultiHold() {
</table>
[% IF ( bibitemloo.hiddencount ) %]
<form>
<p class="hiddencount"><a href="request.pl?biblionumber=[% bibitemloo.biblionumber %]&borrowernumber=[% bibitemloo.borrowernumber %]&showallitems=1">Show all items ([% bibitemloo.hiddencount %] hidden)</a></p>
<p class="hiddencount"><a href="request.pl?biblionumber=[% bibitemloo.biblionumber %]&amp;borrowernumber=[% bibitemloo.borrowernumber %]&amp;showallitems=1">Show all items ([% bibitemloo.hiddencount %] hidden)</a></p>
</form>
[% END %] <!-- hiddencount -->
[% END %] <!-- bibitemloop -->