Bug 24010: Number of issues to display to staff accepts non-integer values
authorOwen Leonard <oleonard@myacpl.org>
Fri, 13 May 2022 15:14:26 +0000 (15:14 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 12 Aug 2022 15:28:47 +0000 (15:28 +0000)
commitfb08b10b75c2b54c3186055a6eef718771214c08
tree82089f49f959a870043bc66bb03129a5aa63559d
parentb3969e1867a323712b0922721467cf0d957d48ec
Bug 24010: Number of issues to display to staff accepts non-integer values

This patch modifies the subscription entry form so that it will perform
a check on the staffdisplaycount and opacdisplaycount fields before
proceding to the second step. It verifies that the values are numeric.

The changes are made in the style of the existing form validation, which
should be rewritten to either use the validation plugin or to peform
checks in a way that all checks are run before warning the user.
However, this smaller change will work in the meantime.

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

- Fill out the form with at least the required fields, but put something
  other than a number if the "Number of issues to display to staff" and
  "Number of issues to display to the public" with non-numeric characters.
- When you click the "Next" button you should get an error message,
  "Number of issues to display to staff must be a number."
- Correct the issues to display to staff field and submit again.
- You should get a different error message, "Number of issues to display
  to the public must be a number."
- Correct this field and you should be able to proceed to the next step.

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 57221e083bb329f3c428fd20e7e7f65a6ab10186)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
koha-tmpl/intranet-tmpl/prog/js/subscription-add.js