Bug 32523

Summary: Shortcuts / Links to missing fields in MARC-Editor don't work as expected
Product: Koha Reporter: Jan Kissig <bibliothek>
Component: Staff interfaceAssignee: Jan Kissig <bibliothek>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: minor    
Priority: P5 - low CC: a.roussos, aleisha, arthur.suzuki, caroline.cyr-la-rose, david, gmcharlt, lucas, martin.renvoize, wainuiwitikapark
Version: Main   
Hardware: All   
OS: Linux   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the standard MARC editor so that the links for any errors go to the correct tab. Currently, the links only work if you are the correct tab.
Version(s) released in:
23.05.00,22.11.03,22.05.10,21.11.18
Attachments: Bug 32523 - Shortcuts / Links to missing fields in MARC-Editor don't work as expected
Bug 32523: Links to missing fields in MARC-editor error
Bug 32523: Links to missing fields in MARC-editor error
Bug 32523: Links to missing fields in MARC editor error
Bug 32523: Links to missing fields in MARC editor error
Bug 32523: Links to missing fields in MARC editor error
Bug 32523: Links to missing fields in MARC editor error

Description Jan Kissig 2022-12-23 11:57:44 UTC
The links / shortcuts to missing mandatory fields in the biblio marc editor won't work after redesign (or update from 22.05 to 22.11). Clicking on a "Go to field"-button will not focus that specific field.

Test plan:
* go to  /cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
* click Save
* Error dialog appears, informing about missing input in mandatory fields.
* Click on tab 0 (section 0) to make sure only marc 0XX fields are visible.
* In the error dialog click on a "Go to field" which points f.e. to section 9
* The selected / active tab will switch to section 9 and will not focus on the selected field

I already have a clue how to solve that issue and try to upload a patch
Comment 1 Jan Kissig 2022-12-23 20:18:37 UTC
Created attachment 144829 [details] [review]
Bug 32523 - Shortcuts / Links to missing fields in MARC-Editor don't work as expected
Comment 2 Jan Kissig 2022-12-23 20:19:54 UTC
Comment on attachment 144829 [details] [review]
Bug 32523 - Shortcuts / Links to missing fields in MARC-Editor don't work as expected

This bug appears after switching to the new staff interface design (from 22.05 to 22.11).
When adding/editing a biblio in staff interface leaving out mandatory fields and click on save, you get an error dialog with shortcuts/links to these missing fields. Clicking on these links should change section tabs and focus the field. 
This patch fixes that error.

Test plan:
1) in staff interface go to /cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
2) click Save
3) Error dialog appears, informing about missing input in mandatory fields.
4) Click on tab 0 (section 0) to make sure only marc 0XX fields are visible.
5) In the error dialog click on a "Go to field" which points f.e. to section 9
6) The selected / active tab will switch to section 9 and will not focus on the selected field
7) apply patch
8) repeat step 1) to 6)
Comment 3 Martin Renvoize 2022-12-28 10:26:06 UTC
Hi Jan, 

I'm thinking this is ready for testing.. if it is could you switch the status to 'Needs signoff' to send up the signal that you're happy it's ready?
Comment 4 David Nind 2023-01-03 22:27:33 UTC
Hi Jan.

Your patch works (yeah!), but I can't seem to sign it off. I get this message:

root@kohadevbox:koha(bz32523)$ git bz attach -e 32523 HEAD
/usr/bin/git-bz:1908: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  obsoleted = (initial_description == patch.description)
Traceback (most recent call last):
  File "/usr/bin/git-bz", line 2722, in <module>
    do_attach(*args)
  File "/usr/bin/git-bz", line 2074, in do_attach
    attach_commits(bug, commits, edit_comments=global_options.edit)
  File "/usr/bin/git-bz", line 1988, in attach_commits
    description, body, obsoletes, statuses, patch_complexities, depends = edit_attachment_comment(bug, commit.subject, body)
  File "/usr/bin/git-bz", line 1940, in edit_attachment_comment
    lines = edit_template(template.getvalue())
  File "/usr/lib/python2.7/StringIO.py", line 271, in getvalue
    self.buf += ''.join(self.buflist)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 3: ordinal not in range(128)

I can sign off other patches (and my koha-testing-docker (KTD) is all up to date), so I don't think it is my setup (but I could be wrong!).

Also, I think you will need to amend your patch for the QA Team to be happy, including:
- Formatting title as Bug XXXXX: Title
- Including the description and test plan in the patch

See the commit message guidelines at https://wiki.koha-community.org/wiki/Commit_messages

David
Comment 5 David Nind 2023-01-03 22:38:38 UTC
I've added a draft release note.
Comment 6 Jan Kissig 2023-01-04 09:50:18 UTC
Created attachment 144976 [details] [review]
Bug 32523: Links to missing fields in MARC-editor error

This bug appears after switching to the new staff interface design (from 22.05 to 22.11).
When adding/editing a biblio in staff interface leaving out mandatory fields and click on save, you get an error dialog with shortcuts/links to these missing fields. Clicking on these links should change section tabs and focus the field.
This patch fixes that error.

Test plan:
1) in staff interface go to /cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
2) click Save
3) Error dialog appears, informing about missing input in mandatory fields.
4) Click on tab 0 (section 0) to make sure only marc 0XX fields are visible.
5) In the error dialog click on a "Go to field" which points f.e. to section 9
6) The selected / active tab will switch to section 9 and will not focus on the selected field
7) apply patch
8) repeat step 1) to 6)
Comment 7 Jan Kissig 2023-01-04 11:02:59 UTC
Hi David,
thank you for your feedback. I have no clue where the error in
root@kohadevbox:koha(bug_32523)$ git bz attach -e 32523 HEAD
comes from.

I use koha-testing-docker and cloned koha as described: 
git clone https://git.koha-community.org/Koha-community/Koha.git koha
and use it as SYNC_REPO.
Created a branch bug_32523 and switched to it, changed the source, committed and checked if it worked after running 
ktd up
Inside the ktd (ktd --shell) I run 
root@kohadevbox:koha(bug_32523)$ git bz attach -e 32523 HEAD
and get the same error as you.

Someone a clue?
Comment 8 David Nind 2023-01-04 11:41:00 UTC
The patch now no longer applies 8-(...

Applying: Bug 32523: Links to missing fields in MARC-editor error
Using index info to reconstruct a base tree...
M       koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
error: Failed to merge in the changes.
Patch failed at 0001 Bug 32523: Links to missing fields in MARC-editor error
Comment 9 David Nind 2023-01-04 12:04:44 UTC
Must have been something with my setup, now applies!
Comment 10 David Nind 2023-01-04 12:13:33 UTC
Created attachment 145002 [details] [review]
Bug 32523: Links to missing fields in MARC-editor error

This bug appears after switching to the new staff interface design
(from 22.05 to 22.11).

When adding/editing a biblio in staff interface leaving out mandatory
fields and click on save, you get an error dialog with shortcuts/links
to these missing fields. Clicking on these links should change section
tabs and focus the field. This patch fixes that error.

Test plan:
1) in staff interface go to /cgi-bin/koha/cataloguing/addbiblio.pl?
   frameworkcode=
2) click Save
3) Error dialog appears, informing about missing input in mandatory
   fields.
4) Click on tab 0 (section 0) to make sure only marc 0XX fields are
   visible.
5) In the error dialog click on a "Go to field" which points f.e. to
   section 9
6) The selected / active tab will switch to section 9 and will not
   focus on the selected field
7) apply patch
8) repeat step 1) to 6)

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2023-01-04 12:40:37 UTC
Comment on attachment 145002 [details] [review]
Bug 32523: Links to missing fields in MARC-editor error

I've obsoleted my sign off - something weird going on with unicode errors when trying to sign off - possibly caused by the subject line:

Subject: [PATCH] =?UTF-8?q?Bug=C2=A032523:=20Links=20to=20missing=20fields?=
 =?UTF-8?q?=20in=20MARC-editor=20error?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

I don't know how to fix...
Comment 12 Jan Kissig 2023-01-04 13:11:06 UTC
Created attachment 145012 [details] [review]
Bug 32523: Links to missing fields in MARC editor error

This bug appears after switching to the new staff interface design (from 22.05 to 22.11).
When adding/editing a biblio in staff interface leaving out mandatory fields and click on save, you get an error dialog with shortcuts/links to these missing fields. Clicking on these links should change section tabs and focus the field.
This patch fixes that error.

Test plan:
1) in staff interface go to /cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
2) click Save
3) Error dialog appears, informing about missing input in mandatory fields.
4) Click on tab 0 (section 0) to make sure only marc 0XX fields are visible.
5) In the error dialog click on a "Go to field" which points f.e. to section 9
6) The selected / active tab will switch to section 9 and will not focus on the selected field
7) apply patch
8) repeat step 1) to 6)
Comment 13 Jan Kissig 2023-01-04 13:13:27 UTC
Created attachment 145013 [details] [review]
Bug 32523: Links to missing fields in MARC editor error

This bug appears after switching to the new staff interface design (from 22.05 to 22.11).
When adding/editing a biblio in staff interface leaving out mandatory fields and click on save, you get an error dialog with shortcuts/links to these missing fields. Clicking on these links should change section tabs and focus the field.
This patch fixes that error.

Test plan:
1) in staff interface go to /cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
2) click Save
3) Error dialog appears, informing about missing input in mandatory fields.
4) Click on tab 0 (section 0) to make sure only marc 0XX fields are visible.
5) In the error dialog click on a "Go to field" which points f.e. to section 9
6) The selected / active tab will switch to section 9 and will not focus on the selected field
7) apply patch
8) repeat step 1) to 6)
Comment 14 Jan Kissig 2023-01-04 13:17:48 UTC
I am sorry for spamming that bug page. 

@David you were right, the subject was in case the problem. 
I created the commit message inside visual studio and it seems like this caused the strange formatted subject, which then caused git bz -e to fail.

I marked the first attachment as obsolete and was able to submit again, but now with correct subject line.
Comment 15 David Nind 2023-01-04 18:38:42 UTC
Created attachment 145039 [details] [review]
Bug 32523: Links to missing fields in MARC editor error

This bug appears after switching to the new staff interface design (from 22.05 to 22.11).
When adding/editing a biblio in staff interface leaving out mandatory fields and click on save, you get an error dialog with shortcuts/links to these missing fields. Clicking on these links should change section tabs and focus the field.
This patch fixes that error.

Test plan:
1) in staff interface go to /cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
2) click Save
3) Error dialog appears, informing about missing input in mandatory fields.
4) Click on tab 0 (section 0) to make sure only marc 0XX fields are visible.
5) In the error dialog click on a "Go to field" which points f.e. to section 9
6) The selected / active tab will switch to section 9 and will not focus on the selected field
7) apply patch
8) repeat step 1) to 6)

Signed-off-by: David Nind <david@davidnind.com>
Comment 16 David Nind 2023-01-04 18:40:15 UTC
(In reply to Jan Kissig from comment #14)
> I am sorry for spamming that bug page. 
> 
> @David you were right, the subject was in case the problem. 
> I created the commit message inside visual studio and it seems like this
> caused the strange formatted subject, which then caused git bz -e to fail.
> 
> I marked the first attachment as obsolete and was able to submit again, but
> now with correct subject line.

No problem Jan!

Glad you were able to figure out how to fix it.

Now signed off.

David
Comment 17 David Nind 2023-01-04 18:42:47 UTC
I've changed the assignee to yourself, as well as changing the version to master (needs back porting to 22.11).

Good luck with the QA!
Comment 18 Katrin Fischer 2023-02-03 15:06:23 UTC
Created attachment 146151 [details] [review]
Bug 32523: Links to missing fields in MARC editor error

This bug appears after switching to the new staff interface design (from 22.05 to 22.11).
When adding/editing a biblio in staff interface leaving out mandatory fields and click on save, you get an error dialog with shortcuts/links to these missing fields. Clicking on these links should change section tabs and focus the field.
This patch fixes that error.

Test plan:
1) in staff interface go to /cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
2) click Save
3) Error dialog appears, informing about missing input in mandatory fields.
4) Click on tab 0 (section 0) to make sure only marc 0XX fields are visible.
5) In the error dialog click on a "Go to field" which points f.e. to section 9
6) The selected / active tab will switch to section 9 and will not focus on the selected field
7) apply patch
8) repeat step 1) to 6)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 19 Katrin Fischer 2023-02-03 15:07:30 UTC
Jan, congrats on your first patch for Koha!

Sorry it took a while to get around to this one!
Comment 20 Tomás Cohen Arazi 2023-02-07 13:51:56 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 21 Aleisha Amohia 2023-02-08 02:44:07 UTC
Can this fix please be backported to 22.11? Thanks!
Comment 22 Jacob O'Mara 2023-02-08 16:38:04 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 23 Lucas Gass 2023-02-15 21:25:17 UTC
Backported to 22.05.x for upcoming 22.05.10
Comment 24 Arthur Suzuki 2023-02-17 13:02:03 UTC
applied to 21.11.x for 21.11.18
Comment 25 wainuiwitikapark 2023-03-15 02:17:21 UTC
Not backported to 21.05.x
Comment 26 Nick Clemens 2023-03-20 13:39:35 UTC
*** Bug 31880 has been marked as a duplicate of this bug. ***