Bug 35181 - Can no longer edit sample records with advanced cataloguing editor
Summary: Can no longer edit sample records with advanced cataloguing editor
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Katrin Fischer
URL:
Keywords: regression
Depends on: 34014
Blocks:
  Show dependency treegraph
 
Reported: 2023-10-29 09:47 UTC by Katrin Fischer
Modified: 2023-12-05 17:38 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.06


Attachments
Bug 35181: Don't pass undef to header (2.55 KB, patch)
2023-11-02 10:59 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35181: Don't pass undef to header (2.16 KB, patch)
2023-11-02 16:55 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35181: Don't pass undef to header (2.21 KB, patch)
2023-11-02 20:26 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 35181: Don't pass undef to header (2.27 KB, patch)
2023-11-04 12:33 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2023-10-29 09:47:53 UTC
I wonder if this is a side effect on the recent work on 'invalid metadata'.

* Activate
* Make sure you open any record with the advanced editor
* Try to open: Perl best practices / Damian Conway. 
* You get stuck in loading
* Javascript error shows "Invalid-metadata" on top of the MARC record, causing a syntax error
Comment 1 Phil Ringnalda 2023-11-02 05:10:44 UTC
git bisect says

8dc2152e2f32b79abfe5f5531ddc225601498116 is the first bad commit
commit 8dc2152e2f32b79abfe5f5531ddc225601498116
Author: Nick Clemens <nick@bywatersolutions.com>
Date:   Tue Oct 17 17:06:22 2023 +0000

    Bug 34014: Add support for advanced cataloging editor

And amusingly, you can edit at least one sample record, 369, the one with encoding errors. You just can't edit any record which does not have encoding errors.
Comment 2 Nick Clemens (kidclamp) 2023-11-02 10:59:35 UTC
Created attachment 158241 [details] [review]
Bug 35181: Don't pass undef to header

It seems passing an undef value causes the headers to be malformed.

To test:
1 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
2 - Note 'Invalid-metadata' at top of page, as well as other headers
3 - Apply patch, restart all
4 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
5 - Page should now appear as xml
6 - Edit record 303, or any record with valid metadata in the advanced cataloging editor
7 - Confirm there is no error or alert
8 - Edit record 369 in the advanced cataloging editor
9 - Confirm there is an alert
Comment 3 David Nind 2023-11-02 14:05:28 UTC
After the patch, if I edit 303 (Pawn structure chess), I can:

1. Edit and save in the normal editor, even though the 003 tag is mandatory (I changed the title $245$a)

2. Get an error in the advanced editor: sort of pop up alert "Record structure invalid, cannot save", then "Missing mandatory tag: 003" at the top of the advanced editor.

3. If I edit "Programming perl" (262), the same thing occurs.

Changed the priority of the bug to major.
Comment 4 Nick Clemens (kidclamp) 2023-11-02 14:33:32 UTC
(In reply to David Nind from comment #3)
> After the patch, if I edit 303 (Pawn structure chess), I can:
> 
> 1. Edit and save in the normal editor, even though the 003 tag is mandatory
> (I changed the title $245$a)
> 
> 2. Get an error in the advanced editor: sort of pop up alert "Record
> structure invalid, cannot save", then "Missing mandatory tag: 003" at the
> top of the advanced editor.
> 
> 3. If I edit "Programming perl" (262), the same thing occurs.
> 
> Changed the priority of the bug to major.

That all makes sense - though the basic editor probably should enforce fields.
If you add the 003 it saves normally? Or if it gives other errors, solve them too. Then all is good for SO
Comment 5 Phil Ringnalda 2023-11-02 15:08:10 UTC
The book 303 is in the Audio Cassettes, CDs framework, which has 003 mandatory but not visible in the basic editor. That should probably be flagged in the framework test, but what the basic editor should do in that case is... unclear, but certainly not this bug.

But the patch left a stray

+#        print $query->header( -type => 'text/xml', -charset => 'utf-8' );

in svc/bib, which is going to get you in trouble.
Comment 6 Nick Clemens (kidclamp) 2023-11-02 16:55:54 UTC
Created attachment 158276 [details] [review]
Bug 35181: Don't pass undef to header

It seems passing an undef value causes the headers to be malformed.

To test:
1 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
2 - Note 'Invalid-metadata' at top of page, as well as other headers
3 - Apply patch, restart all
4 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
5 - Page should now appear as xml
6 - Edit record 303, or any record with valid metadata in the advanced cataloging editor
7 - Confirm there is no error or alert
8 - Edit record 369 in the advanced cataloging editor
9 - Confirm there is an alert
Comment 7 Phil Ringnalda 2023-11-02 20:26:25 UTC
Created attachment 158284 [details] [review]
Bug 35181: Don't pass undef to header

It seems passing an undef value causes the headers to be malformed.

To test:
1 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
2 - Note 'Invalid-metadata' at top of page, as well as other headers
3 - Apply patch, restart all
4 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
5 - Page should now appear as xml
6 - Edit record 303, or any record with valid metadata in the advanced cataloging editor
7 - Confirm there is no error or alert
8 - Edit record 369 in the advanced cataloging editor
9 - Confirm there is an alert

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 8 Katrin Fischer 2023-11-04 12:33:18 UTC
Created attachment 158376 [details] [review]
Bug 35181: Don't pass undef to header

It seems passing an undef value causes the headers to be malformed.

To test:
1 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
2 - Note 'Invalid-metadata' at top of page, as well as other headers
3 - Apply patch, restart all
4 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
5 - Page should now appear as xml
6 - Edit record 303, or any record with valid metadata in the advanced cataloging editor
7 - Confirm there is no error or alert
8 - Edit record 369 in the advanced cataloging editor
9 - Confirm there is an alert

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Tomás Cohen Arazi 2023-11-06 11:40:41 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 10 Fridolin Somers 2023-11-10 07:10:41 UTC
Pushed to 23.05.x for 23.05.06
Comment 11 Katrin Fischer 2023-12-01 09:27:36 UTC
*** Bug 35416 has been marked as a duplicate of this bug. ***