Bug 30482: Potential for bad string concatenation in cataloging validation error...
authorOwen Leonard <oleonard@myacpl.org>
Thu, 7 Apr 2022 09:36:00 +0000 (09:36 +0000)
committerKyle Hall <kyle@bywatersolutions.com>
Fri, 6 May 2022 16:26:38 +0000 (12:26 -0400)
commitf7f18ce21baedb463629b704dc7451acdf12ffb6
treefb13e9b4d7b67763776ddc18517dc3779e242c14
parent62a6aefb2ceaefc4ce45e0e633cd8467f20741ae
Bug 30482: Potential for bad string concatenation in cataloging validation error message

In validating the basic MARC editor form before submission, we run
AreFieldsNotOk() twice (once with the parameter "false") and concatenate
the result for output. This creates the potential for the error string
to be appended with "0" if AreFieldsNotOk() returns false.

This patch improves the logic around building the error string.

To test, apply the patch and make sure one of your MARC frameworks
contains at least one mandatory field and at least one important field.

- Edit or create a MARC record in the basic MARC editor.
- Submit the form in various states of completion:
  - If a mandatory and an important field are empty, you should see two
    error messages at the top. "The following mandatory subfields aren't
    filled" and "The following important subfields aren’t filled."
  - If a mandatory OR an important field is empty, you should see a
    single message.
    - If it's the important field which is empty, a confirmation will
      ask if you want to save the record anyway. Test that both answers
      to this confirmation work correctly.
  - If no mandatory or important fields are empty the form should
    submit.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt