Bug 28689

Summary: Extra %s in alert message when saving an item
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: david, fridolin.somers, kyle, m.de.rooy, victor
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27526
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This removes an unnecessary %s in the alert message when there are errors in the cataloging add item form (for example when mandatory fields are not entered).
Version(s) released in:
21.11.00,21.05.03,20.11.09
Bug Depends on: 21091    
Bug Blocks:    
Attachments: Bug 28689: Extra %s in alert message when saving an items
Bug 28689: Extra %s in alert message when saving an items
Bug 28689: Extra %s in alert message when saving an items

Description Jonathan Druart 2021-07-08 13:57:06 UTC
On the additem form, if a subfield is marked mandatory but not filled you get:
        alertString2 += "\n- " + "%s " + MSG_MANDATORY_FIELDS_EMPTY.format(total_errors);

It displays an extra "%s"
Comment 1 Owen Leonard 2021-07-15 13:44:38 UTC
Created attachment 122860 [details] [review]
Bug 28689: Extra %s in alert message when saving an items

This patch removes an unnecessary %s in the text built to show when
there are errors in the cataloging add item form.

To reproduce, open the add item form in cataloging and click "Add item"
without filling in all mandatory fields. You should see an alert message
that contains, "- %s 1 mandatory fields empty (highlighted)"

To test, apply the patch and return to the add item form. Now when you
save an incomplete form the message should omit the %s:

- 1 mandatory fields empty (highlighted)

https://bugs.koha-community.org/show_bug.cgi?id=28690
Comment 2 David Nind 2021-07-29 21:10:24 UTC
Created attachment 123289 [details] [review]
Bug 28689: Extra %s in alert message when saving an items

This patch removes an unnecessary %s in the text built to show when
there are errors in the cataloging add item form.

To reproduce, open the add item form in cataloging and click "Add item"
without filling in all mandatory fields. You should see an alert message
that contains, "- %s 1 mandatory fields empty (highlighted)"

To test, apply the patch and return to the add item form. Now when you
save an incomplete form the message should omit the %s:

- 1 mandatory fields empty (highlighted)

https://bugs.koha-community.org/show_bug.cgi?id=28690

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2021-07-29 21:19:03 UTC
Testing notes:
- To make a field in the add item form mandatory: edit the 952 tag and make a subfield mandatory for the bibliographic framework (Administration > Catalog > MARC bibliographic framework)
Comment 4 Marcel de Rooy 2021-07-30 09:37:56 UTC
Created attachment 123294 [details] [review]
Bug 28689: Extra %s in alert message when saving an items

This patch removes an unnecessary %s in the text built to show when
there are errors in the cataloging add item form.

To reproduce, open the add item form in cataloging and click "Add item"
without filling in all mandatory fields. You should see an alert message
that contains, "- %s 1 mandatory fields empty (highlighted)"

To test, apply the patch and return to the add item form. Now when you
save an incomplete form the message should omit the %s:

- 1 mandatory fields empty (highlighted)

https://bugs.koha-community.org/show_bug.cgi?id=28690

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Jonathan Druart 2021-07-30 14:02:36 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 6 Kyle M Hall 2021-08-06 12:20:27 UTC
Pushed to 21.05.x for 21.05.03
Comment 7 Fridolin Somers 2021-08-11 19:25:56 UTC
Pushed to 20.11.x for 20.11.09
Comment 8 Victor Grousset/tuxayo 2021-08-16 20:09:46 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.