Bug 25308

Summary: When cataloguing search fields are prefilled from record, content after & is cut off
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: CatalogingAssignee: Phil Ringnalda <phil>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: 1joynelson, lucas, m.de.rooy, phil
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11446
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.06, 19.05.11
Attachments: Bug 25308: Escape querystring for Z39.50 popup from cataloging
Bug 25308: Escape querystring for Z39.50 popup from cataloging
Bug 25308: Escape querystring for Z39.50 popup from cataloging

Description Katrin Fischer 2020-04-28 21:01:00 UTC
To test:
- Add a new record from default framework in cataloguing
- Enter something containing an & in the middle (Stuff & stuff) in
  245$a
  100$a
- Click on Z39.50/SRU search
- Verify the fields author and title are prefilled, but information is cut off at the &

See also bug 11446 in this context.
Comment 1 Phil Ringnalda 2020-04-28 23:58:29 UTC
If you really want to turn one bug into having to file dozens more, make your first step be "create a new MARC framework with the description Ants & Bees and the code A&B." Once you get past the inability to import an exported framework into it, and just click MARC structure and get the offer to copy in from default so you can use it to catalog, I'd expect there will be a lot more bustage (besides what I noticed fixing this, that when you find a record via Z39.50 and try to load it, it will come back into the nonexistent framework "A").
Comment 2 Phil Ringnalda 2020-04-29 00:31:40 UTC
Created attachment 103892 [details] [review]
Bug 25308: Escape querystring for Z39.50 popup from cataloging

Test plan:

1. For bonus fun, Administration -> MARC Frameworks -> New framework,
with the code A&B and description Ants & Bees
2. In the A&B Actions menu, choose MARC structure since Import won't
work
3. Accept the offer to copy in structure from default
4. Cataloging -> New record -> Ants & Bees
5. Type This & That in the 245$a (and for extra credit, in 020$a, and
create an author authority with an & in it so you can put it in the
100/110)
6. Click Z39.50/SRU search, make sure everything you typed is prefilled
including the parts after &
7. Search for anything that will retrieve a record (the ISBN This &
That probably won't), choose Import
8. Check that the record came back, and verify in the Settings menu that
it's still in the Ants & Bees framework.
Comment 3 Katrin Fischer 2020-04-29 05:49:01 UTC
Hi Phil,

in order to get the fixes in fast, it's good to split things into smaller bugs. This way your other patch can go in, while we work on the next ones.

I think there is some expectation that people don't pick special chars for codes (like framework codes), but of course descriptions and data should work. It's still good to fix such things, but I think the risk for catalog data is higher.

Thx for the patch!
Comment 4 Katrin Fischer 2020-05-03 22:23:09 UTC
Created attachment 104240 [details] [review]
Bug 25308: Escape querystring for Z39.50 popup from cataloging

Test plan:

1. For bonus fun, Administration -> MARC Frameworks -> New framework,
with the code A&B and description Ants & Bees
2. In the A&B Actions menu, choose MARC structure since Import won't
work
3. Accept the offer to copy in structure from default
4. Cataloging -> New record -> Ants & Bees
5. Type This & That in the 245$a (and for extra credit, in 020$a, and
create an author authority with an & in it so you can put it in the
100/110)
6. Click Z39.50/SRU search, make sure everything you typed is prefilled
including the parts after &
7. Search for anything that will retrieve a record (the ISBN This &
That probably won't), choose Import
8. Check that the record came back, and verify in the Settings menu that
it's still in the Ants & Bees framework.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Katrin Fischer 2020-05-03 22:26:10 UTC
This works as described, there is an edge case for the frameworks, but I feel if at all, we should deal with them separately. People should really not use special chars in framework codes. 

Test:
- Select the framework with A&B from the Z39.50 pull down for import
- Search for any record and import it
- Verify you end up on an empty page, instead of the filled framework.
Comment 6 Marcel de Rooy 2020-05-15 09:45:34 UTC
Created attachment 104925 [details] [review]
Bug 25308: Escape querystring for Z39.50 popup from cataloging

Test plan:

1. For bonus fun, Administration -> MARC Frameworks -> New framework,
with the code A&B and description Ants & Bees
2. In the A&B Actions menu, choose MARC structure since Import won't
work
3. Accept the offer to copy in structure from default
4. Cataloging -> New record -> Ants & Bees
5. Type This & That in the 245$a (and for extra credit, in 020$a, and
create an author authority with an & in it so you can put it in the
100/110)
6. Click Z39.50/SRU search, make sure everything you typed is prefilled
including the parts after &
7. Search for anything that will retrieve a record (the ISBN This &
That probably won't), choose Import
8. Check that the record came back, and verify in the Settings menu that
it's still in the Ants & Bees framework.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Marcel de Rooy 2020-05-15 09:46:36 UTC
We could indeed find some more bugs in this area. Just looking at e.g. git grep Z3950Terms.
Comment 8 Martin Renvoize 2020-05-18 14:29:14 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 9 Joy Nelson 2020-05-19 23:05:30 UTC
backported to 19.11.x for 19.11.06
Comment 10 Lucas Gass 2020-05-22 14:37:49 UTC
backported to 19.05.x for 19.05.11