Bug 26377: Clearly label parts of subscription-add.pl that relate to optional item records

This patch modifies the form for adding a new subscription so that the
collection and item type fields are shown only when the subscription is
configured to create an item when receiving.

To test, apply the patch and go to Serials -> New subscription.

- When the page first loads, the "Do not create an item record when
  receiving this serial" radio button should be selected.
- Under the "Location" field there should be no item type or collection
  field.
- Select the "Create an item when receiving this serial" radio button.
- The item type and collection fields should appear.
- Test that the values are correctly saved when you add or edit a
  subscription.
- If you edit a subscription which had item type and collection defined,
  and you switch to "Do not create an item..." the record should save with
  empty values for those fields.
- Confirm that existing subscriptions open with the correct settings
  applied: Only records with "Create an item..." checked should open
  with the item type and collection fields displayed.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 13525cff5c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2022-05-12 16:25:05 +00:00 committed by Lucas Gass
parent f70fd04521
commit 5db848f2ce
2 changed files with 22 additions and 2 deletions

View file

@ -199,7 +199,7 @@ fieldset.rows table { clear: none; margin: 0; }
[% END %]
</select>
</li>
<li>
<li class="use_items" style="display:none">
<label for="ccode">Collection:</label>
<select name="ccode" id="ccode">
<option value="">None</option>
@ -212,7 +212,7 @@ fieldset.rows table { clear: none; margin: 0; }
[% END %]
</select>
</li>
<li>
<li class="use_items" style="display:none">
<label for="itemtype">Item type:</label>
<select name="itemtype" id="itemtype">
<option value=""></option>

View file

@ -739,4 +739,24 @@ $(document).ready(function() {
});
});
if( $("#serialsadditems-yes").prop("checked") ){
$(".use_items").show();
}
$("#serialsadditems-yes").on("change", function(){
if( $(this).prop("checked") ){
$(".use_items").show();
} else {
$(".use_items").hide().find("select").val("");
}
});
$("#serialsadditems-no").on("change", function(){
if( $(this).prop("checked") ){
$(".use_items").hide().find("select").val("");
} else {
$(".use_items").show();
}
});
});