Bug 29419: Retain user's inputs when suggesting for purchase and match found

If a user suggests for purchase and a match is found, their inputs was
not retained: quantity, item type, library, reason.

Test plan:
1. Suggest for purchase
2. Fill the title in with a string that will match an existing record
3. Fill value in quantity, item type, library and reason input/dropdown
4. Submit
=> Notice that with this patch the values you entered are retained on
the confirmation screen

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2021-11-16 11:55:08 +01:00 committed by Fridolin Somers
parent 1824b761a8
commit c780d61f90

View file

@ -163,11 +163,11 @@
<li id="opac-suggestion-quantity">
[% IF ( quantity_required ) %]
<label for="quantity" class="required">Quantity:</label>
<input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
<input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" value="[% quantity | html %]" />
<div class="required_label required">Required</div>
[% ELSE %]
<label for="quantity">Quantity:</label>
<input type="text" id="quantity" name="quantity" maxlength="4" size="4" />
<input type="text" id="quantity" name="quantity" maxlength="4" size="4" value="[% quantity | html %]" />
[% END %]
</li>
[% END %]
@ -175,11 +175,11 @@
<li>
[% IF ( itemtype_required ) %]
<label for="itemtype" class="required">Item type:</label>
[% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, required = 1, blank = 1 %]
[% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, required = 1, blank = 1, default=itemtype %]
<div class="required_label required">Required</div>
[% ELSE %]
<label for="itemtype">Item type:</label>
[% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, blank = 1 %]
[% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, blank = 1, default=itemtype %]
[% END %]
</li>
[% END %]
@ -188,13 +188,13 @@
[% IF ( branchcode_required ) %]
<label for="branch" class="required">Library:</label>
<select name="branchcode" id="branch" required="required">
[% PROCESS options_for_libraries libraries => Branches.all %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
</select>
<div class="required_label required">Required</div>
[% ELSE %]
<label for="branch">Library:</label>
<select name="branchcode" id="branch">
[% PROCESS options_for_libraries libraries => Branches.all %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
</select>
[% END %]
</li>
@ -207,7 +207,11 @@
<select name="patronreason" id="patronreason" required="required">
<option value="">-- Choose --</option>
[% FOREACH patron_reason_loo IN patron_reason_loop %]
<option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
[% IF patron_reason_loo.authorised_value == patronreason %]
<option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
[% ELSE %]
<option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
[% END %]
[% END %]
</select>
<div class="required_label required">Required</div>
@ -216,7 +220,11 @@
<select name="patronreason" id="patronreason">
<option value="">-- Choose --</option>
[% FOREACH patron_reason_loo IN patron_reason_loop %]
<option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
[% IF patron_reason_loo.authorised_value == patronreason %]
<option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
[% ELSE %]
<option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
[% END %]
[% END %]
</select>
[% END %]