Bug 9177 - Duplicate patron: Prepopulated fields ar cleared when setting cursor

When adding a duplicated patron record some fields are prepopulated from
the original patron record. Focusing your cursor on these fields
automatically clears them. This works well if you assume that the user
only focuses on fields which should be changed. This works badly if you
consider that a user might want to tab between all fields. I think the
disadvantages outweigh the minor benefit of not having to delete the
contents of a field.

This patch removes the clearing action.

TEST PLAN
---------
1) Log in to staff client
2) Patrons
3) Find an existing patron
4) Click on the link in the Name column
5) Click on the Duplicate button
6) Click on fields with data in them.
   -- they will clear, which is more problematic than correcting
      the entry.
7) On the line
   "Home > Patrons > {patron name} > Duplicate Adult Patron"
   click the patron name to go back.
8) Click on the Duplicate button
9) Tab through the fields
   -- the fields should remain unchanged, but sadly they clear.
10) Apply the patch
11) On the line
   "Home > Patrons > {patron name} > Duplicate Adult Patron"
   click the patron name to go back.
12) Click on the Duplicate button
13) Navigate through the fields
    -- tabbing nor clicking should clear any fields.
14) Run koha qa tests

NOTE: Had to rebase again. Yes, bug 7878 interfered.
      However, it deals with comment #6, which Owen
      appropriately noted.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Less surprises, improves accessibility by enabling to
tab through the form without losing data.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Owen Leonard 2014-11-11 11:09:17 -05:00 committed by Tomas Cohen Arazi
parent 25f42f6fd4
commit 3a23bdaa29

View file

@ -1,4 +1,3 @@
[% IF ( opduplicate ) %][% SET focusAction = "clearDupe" %][% END %]
[% USE Koha %]
[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
@ -26,9 +25,6 @@
document.form.state.value=RegExp.$3;
document.form.country.value=RegExp.$4;
});
$(".clearDupe").on("focus",function(){
$(this).val("");
})
[% IF categorycode %]
update_category_code( "[% categorycode %]" );
@ -269,9 +265,9 @@
[% END %]
Surname: </label>
[% IF ( uppercasesurnames ) %]
<input style="text-transform:uppercase;" type="text" id="surname" name="surname" size="20" value="[% surname %]" class="[% focusAction %]" />
<input style="text-transform:uppercase;" type="text" id="surname" name="surname" size="20" value="[% surname %]" />
[% ELSE %]
<input type="text" id="surname" name="surname" size="20" value="[% surname %]" class="[% focusAction %]" />
<input type="text" id="surname" name="surname" size="20" value="[% surname %]" />
[% END %]
[% IF ( mandatorysurname ) %]<span class="required">Required</span>[% END %]
</li>
@ -317,7 +313,7 @@
<label for="initials">
[% END %]
Initials: </label>
<input type="text" id="initials" name="initials" size="20" value="[% UNLESS opduplicate %][% initials %][% END %]" class="[% focusAction %]" />
<input type="text" id="initials" name="initials" size="20" value="[% UNLESS opduplicate %][% initials %][% END %]" />
[% IF ( mandatoryinitials ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -330,7 +326,7 @@
<label for="othernames">
[% END %]
Other name: </label>
<input type="text" id="othernames" name="othernames" size="20" value="[% UNLESS opduplicate %][% othernames %][% END %]" class="[% focusAction %]" />
<input type="text" id="othernames" name="othernames" size="20" value="[% UNLESS opduplicate %][% othernames %][% END %]" />
[% IF ( mandatoryothernames ) %]<span class="required">Required</span>[% END %]
[% IF ( I ) %]<input type="hidden" name="sex" value="N" />[% END %]
</li>
@ -386,7 +382,7 @@
<span>[% contactname %]</span>
<input name="contactname" id="contactname" type="hidden" size="20" value="[% contactname %]" />
[% ELSE %]
<input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" class="[% focusAction %]" />
<input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
[% END %]
</li>
[% ELSE %]
@ -405,7 +401,7 @@
<span>[% contactname %]</span>
<input name="contactname" id="contactname" type="hidden" size="20" value="[% contactname %]" />
[% ELSE %]
<input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" class="[% focusAction %]" />
<input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
[% END %]
</li>
[% END %]
@ -416,7 +412,7 @@
<span>[% contactfirstname %]</span>
<input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="[% contactfirstname %]" />
[% ELSE %]
<input name="contactfirstname" id="contactfirstname" type="text" size="20" value="[% contactfirstname %]" class="[% focusAction %]" />
<input name="contactfirstname" id="contactfirstname" type="text" size="20" value="[% contactfirstname %]" />
[% END %]
</li>
[% END %]
@ -460,7 +456,7 @@
<label for="streetnumber">
[% END %]
Street number: </label>
<input type="text" id="streetnumber" name="streetnumber" size="5" value="[% streetnumber %]" class="[% focusAction %]" />
<input type="text" id="streetnumber" name="streetnumber" size="5" value="[% streetnumber %]" />
[% IF ( mandatorystreetnumber ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -495,7 +491,7 @@
<label for="address">
[% END %]
Address: </label>
<input type="text" id="address" name="address" size="35" value="[% address %]" class="[% focusAction %]" />
<input type="text" id="address" name="address" size="35" value="[% address %]" />
[% IF ( mandatoryaddress ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -507,7 +503,7 @@
<label for="address2">
[% END %]
Address 2: </label>
<input type="text" id="address2" name="address2" size="35" value="[% address2 %]" class="[% focusAction %]" />
<input type="text" id="address2" name="address2" size="35" value="[% address2 %]" />
[% IF ( mandatoryaddress2 ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -519,7 +515,7 @@
<label for="city">
[% END %]
City: </label>
<input type="text" id="city" name="city" size="20" value="[% city %]" class="[% focusAction %]" />
<input type="text" id="city" name="city" size="20" value="[% city %]" />
[% IF ( city_cgipopup ) %]or <strong>choose</strong>
<select id="select_city" name="select_city">
[% FOREACH city_loo IN city_loop %]
@ -544,7 +540,7 @@
<label for="state">
[% END %]
State: </label>
<input type="text" name="state" id="state" size="20" value="[% state %]" class="[% focusAction %]" />
<input type="text" name="state" id="state" size="20" value="[% state %]" />
[% IF ( mandatorystate ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -556,7 +552,7 @@
<label for="zipcode">
[% END %]
Zip/Postal code: </label>
<input type="text" name="zipcode" id="zipcode" size="10" value="[% zipcode %]" class="[% focusAction %]" />
<input type="text" name="zipcode" id="zipcode" size="10" value="[% zipcode %]" />
[% IF ( mandatoryzipcode ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -568,7 +564,7 @@
<label for="country">
[% END %]
Country: </label>
<input type="text" name="country" id="country" size="20" value="[% country %]" class="[% focusAction %]" />
<input type="text" name="country" id="country" size="20" value="[% country %]" />
[% IF ( mandatorycountry ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -587,7 +583,7 @@
<label for="phone">
[% END %]
Primary phone: </label>
<input type="text" id="phone" name="phone" value="[% phone %]" class="[% focusAction %]" />
<input type="text" id="phone" name="phone" value="[% phone %]" />
[% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
</li>
@ -600,7 +596,7 @@
<label for="phonepro">
[% END %]
Secondary phone: </label>
<input type="text" id="phonepro" name="phonepro" value="[% phonepro %]" class="[% focusAction %]" />
<input type="text" id="phonepro" name="phonepro" value="[% phonepro %]" />
[% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -612,7 +608,7 @@
<label for="mobile">
[% END %]
Mobile phone: </label>
<input type="text" id="mobile" name="mobile" value="[% mobile %]" class="[% focusAction %]" />
<input type="text" id="mobile" name="mobile" value="[% mobile %]" />
[% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -624,7 +620,7 @@
<label for="email">
[% END %]
Primary email: </label>
<input type="text" id="email" name="email" size="45" value="[% email %]" class="[% focusAction %]" />
<input type="text" id="email" name="email" size="45" value="[% email %]" />
[% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
</li>
@ -637,7 +633,7 @@
<label for="emailpro">
[% END %]
Secondary email: </label>
<input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro %]" class="[% focusAction %]" />
<input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro %]" />
[% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -649,7 +645,7 @@
<label for="fax">
[% END %]
Fax: </label>
<input type="text" id="fax" name="fax" value="[% fax %]" class="[% focusAction %]" />
<input type="text" id="fax" name="fax" value="[% fax %]" />
[% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -672,7 +668,7 @@
<label for="B_address">
[% END %]
Address: </label>
<input type="text" id="B_address" name="B_address" size="40" value="[% B_address %]" class="[% focusAction %]" />
<input type="text" id="B_address" name="B_address" size="40" value="[% B_address %]" />
[% IF ( mandatoryB_address ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -684,7 +680,7 @@
<label for="B_address2">
[% END %]
Address 2: </label>
<input type="text" id="B_address2" name="B_address2" size="40" value="[% B_address2 %]" class="[% focusAction %]" />
<input type="text" id="B_address2" name="B_address2" size="40" value="[% B_address2 %]" />
[% IF ( mandatoryB_address2 ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -696,7 +692,7 @@
<label for="B_city">
[% END %]
City: </label>
<input type="text" id="B_city" name="B_city" size="20" value="[% B_city %]" class="[% focusAction %]" />
<input type="text" id="B_city" name="B_city" size="20" value="[% B_city %]" />
[% IF ( mandatoryB_city ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -708,7 +704,7 @@
<label for="B_state">
[% END %]
State: </label>
<input type="text" id="B_state" name="B_state" size="20" value="[% B_state %]" class="[% focusAction %]" />
<input type="text" id="B_state" name="B_state" size="20" value="[% B_state %]" />
[% IF ( mandatoryB_state ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -720,7 +716,7 @@
<label for="B_zipcode">
[% END %]
Zip/Postal code: </label>
<input type="text" id="B_zipcode" name="B_zipcode" maxlength="10" size="10" value="[% B_zipcode %]" class="[% focusAction %]" />
<input type="text" id="B_zipcode" name="B_zipcode" maxlength="10" size="10" value="[% B_zipcode %]" />
[% IF ( mandatoryB_zipcode ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -732,7 +728,7 @@
<label for="B_country">
[% END %]
Country: </label>
<input type="text" id="B_country" name="B_country" size="20" value="[% B_country %]" class="[% focusAction %]" />
<input type="text" id="B_country" name="B_country" size="20" value="[% B_country %]" />
[% IF ( mandatoryB_country ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -744,7 +740,7 @@
<label for="B_phone">
[% END %]
Phone: </label>
<input type="text" id="B_phone" name="B_phone" value="[% B_phone %]" class="[% focusAction %]" />
<input type="text" id="B_phone" name="B_phone" value="[% B_phone %]" />
[% IF ( mandatoryB_phone ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -756,7 +752,7 @@
<label for="B_email">
[% END %]
Email: </label>
<input type="text" id="B_email" name="B_email" size="45" value="[% B_email %]" class="[% focusAction %]" />
<input type="text" id="B_email" name="B_email" size="45" value="[% B_email %]" />
[% IF ( mandatoryB_email ) %]<span class="required">Required</span>[% END %] </li>
[% END %]
[% UNLESS nocontactnote %]
@ -787,7 +783,7 @@
<label for="altcontactsurname">
[% END %]
Surname:</label>
<input type="text" name="altcontactsurname" id="altcontactsurname" value="[% altcontactsurname %]" class="[% focusAction %]" />
<input type="text" name="altcontactsurname" id="altcontactsurname" value="[% altcontactsurname %]" />
[% IF ( mandatoryaltcontactsurname ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -799,7 +795,7 @@
<label for="altcontactfirstname">
[% END %]
First name:</label>
<input type="text" name="altcontactfirstname" id="altcontactfirstname" value="[% altcontactfirstname %]" class="[% focusAction %]" />
<input type="text" name="altcontactfirstname" id="altcontactfirstname" value="[% altcontactfirstname %]" />
[% IF ( mandatoryaltcontactfirstname ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -811,7 +807,7 @@
<label for="altcontactaddress1">
[% END %]
Address:</label>
<input type="text" name="altcontactaddress1" id="altcontactaddress1" value="[% altcontactaddress1 %]" size="40" class="[% focusAction %]" />
<input type="text" name="altcontactaddress1" id="altcontactaddress1" value="[% altcontactaddress1 %]" size="40" />
[% IF ( mandatoryaltcontactaddress1 ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -823,7 +819,7 @@
<label for="altcontactaddress2">
[% END %]
Address 2:</label>
<input type="text" name="altcontactaddress2" id="altcontactaddress2" value="[% altcontactaddress2 %]" size="40" class="[% focusAction %]" />
<input type="text" name="altcontactaddress2" id="altcontactaddress2" value="[% altcontactaddress2 %]" size="40" />
[% IF ( mandatoryaltcontactaddress2 ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -835,7 +831,7 @@
<label for="altcontactaddress3">
[% END %]
City:</label>
<input type="text" name="altcontactaddress3" id="altcontactaddress3" value="[% altcontactaddress3 %]" size="20" class="[% focusAction %]" />
<input type="text" name="altcontactaddress3" id="altcontactaddress3" value="[% altcontactaddress3 %]" size="20" />
[% IF ( mandatoryaltcontactaddress3 ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -847,7 +843,7 @@
<label for="altcontactstate">
[% END %]
State:</label>
<input type="text" name="altcontactstate" id="altcontactstate" value="[% altcontactstate %]" size="20" class="[% focusAction %]" />
<input type="text" name="altcontactstate" id="altcontactstate" value="[% altcontactstate %]" size="20" />
[% IF ( mandatoryaltcontactstate ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -859,7 +855,7 @@
<label for="altcontactzipcode">
[% END %]
Zip/Postal code:</label>
<input type="text" name="altcontactzipcode" id="altcontactzipcode" value="[% altcontactzipcode %]" size="5" class="[% focusAction %]" />
<input type="text" name="altcontactzipcode" id="altcontactzipcode" value="[% altcontactzipcode %]" size="5" />
[% IF ( mandatoryaltcontactzipcode ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -871,7 +867,7 @@
<label for="altcontactcountry">
[% END %]
Country:</label>
<input type="text" name="altcontactcountry" id="altcontactcountry" value="[% altcontactcountry %]" size="20" class="[% focusAction %]" />
<input type="text" name="altcontactcountry" id="altcontactcountry" value="[% altcontactcountry %]" size="20" />
[% IF ( mandatoryaltcontactcountry ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -883,7 +879,7 @@
<label for="altcontactphone">
[% END %]
Phone:</label>
<input type="text" name="altcontactphone" id="altcontactphone" value="[% altcontactphone %]" class="[% focusAction %]" />
<input type="text" name="altcontactphone" id="altcontactphone" value="[% altcontactphone %]" />
[% IF ( mandatoryaltcontactphone ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -965,7 +961,7 @@
<label for="sort1">
[% END %]
Sort 1: </label>
[% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, class=focusAction, size = 20 %]
[% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, size = 20 %]
[% IF ( mandatorysort1 ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -977,7 +973,7 @@
<label for="sort2">
[% END %]
Sort 2: </label>
[% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, class=focusAction, size = 20 %]
[% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, size = 20 %]
[% IF ( mandatorysort2 ) %]<span class="required">Required</span>[% END %]
</li>
[% END %]
@ -1384,7 +1380,7 @@
[% INCLUDE 'messaging-preference-form.inc' %]
[% IF ( SMSSendDriver ) %]
<p><label for="SMSnumber">SMS number:</label>
<input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" class="[% focusAction %]" />
<input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
</p>
[% END %]
</fieldset>