Bug 30966 - Record overlay rules - can't use Z39.50 filter
Summary: Record overlay rules - can't use Z39.50 filter
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Johanna Räisä
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 14957
Blocks:
  Show dependency treegraph
 
Reported: 2022-06-15 13:44 UTC by Björn Hellberg
Modified: 2023-12-28 20:44 UTC (History)
7 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05,22.05.12,21.11.20


Attachments
Bug 30966: Record Overlay Rules - can't use Z39.50 filter (1.62 KB, patch)
2022-07-29 08:51 UTC, Johanna Räisä
Details | Diff | Splinter Review
Record Overlay Rules - can't use Z39.50 filter (2.35 KB, patch)
2022-08-11 06:26 UTC, Johanna Räisä
Details | Diff | Splinter Review
Bug 30966: Record Overlay Rules - can't use Z39.50 filter (2.41 KB, patch)
2022-08-31 14:41 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 30966: Record Overlay Rules - can't use Z39.50 filter (2.46 KB, patch)
2023-03-17 16:03 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 Björn Hellberg 2022-06-15 13:44:43 UTC
We're setting up MARC Overlay Rules in 21.11.05. When defining the rules, we aren't able to make the filter Z39.50 work. A colleague checked the code and reports that line 876 in cataloguing/addbiblio.pl sets the source to z39.50. The source value should be z3950 to match the filter.
Comment 1 Katrin Fischer 2022-06-16 15:27:48 UTC
Hi Björn, that's a great hint already - does your coworker want to provide a patch for this? We are happy to help with the steps!
Comment 2 Björn Hellberg 2022-06-28 11:12:58 UTC
(In reply to Katrin Fischer from comment #1)
> Hi Björn, that's a great hint already - does your coworker want to provide a
> patch for this? We are happy to help with the steps!

Hi, we've asked our administrators to check if this could be a solution. If it is, we'll ask them if they can provide a patch.
Comment 3 Björn Hellberg 2022-07-04 08:54:33 UTC
We've now edited the code as suggested, but it didn't work. All fields are protected except when replacing record via Z39.50/SRU search; if I replace the record this way, the fields that I've listed as protected are also edited.
Comment 4 Johanna Räisä 2022-07-28 10:13:44 UTC
We found out that the protection applies only after you have saved the imported record, which is kind of confusing when looking the record on the editor. 

Fixing the z3950 syntax works but I think that there should be done something so the protected fields appear to the editor. If you have required fields then those have to be filled before save and the new values don't even apply because of the protection.
Comment 5 Johanna Räisä 2022-07-29 08:51:36 UTC
Created attachment 138248 [details] [review]
Bug 30966: Record Overlay Rules - can't use Z39.50 filter

This patch fixes overlay rules on z39.50 import

Test plan:
1) Create protection overlay rule to some fields for z39.50.
2) Import a record via z39.50.
3) See that the protected fields are replaced on the editor.
4) Apply the patch.
5) Import a record again.
6) See that the protected fields are in place on the editor.

Sponsored-by: Koha-Suomi Oy
Comment 6 Rachael 2022-08-10 15:41:26 UTC
Attempted to apply patch, but terminal returned :

error: Failed to merge in the changes.
Comment 7 Johanna Räisä 2022-08-11 06:26:08 UTC
Created attachment 139014 [details] [review]
Record Overlay Rules - can't use Z39.50 filter

I updated the patch, please try again.
Comment 8 ByWater Sandboxes 2022-08-31 14:41:33 UTC
Created attachment 140004 [details] [review]
Bug 30966: Record Overlay Rules - can't use Z39.50 filter

This patch fixes overlay rules on z39.50 import

Test plan:
1) Create protection overlay rule to some fields for z39.50.
2) Import a record via z39.50.
3) See that the protected fields are replaced on the editor.
4) Apply the patch.
5) Import a record again.
6) See that the protected fields are in place on the editor.

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 9 Katrin Fischer 2022-10-02 11:25:49 UTC
It looks like the * (all) case might not be covered properly yet:

My overlay rules:
* source * 245 Protect Skip...
* source Z39.50 100 Protect Skip...

* Download and save from LOC control number 9162774.
  Verify it has 245 and 100 set
* Edit record
* Replace record via Z39.50 search
  * 245: was updated
  * 100: remained unchanged
* Save record
  * 245: was updated
  * 100: was protected

Hopefully an easy fix!
Comment 10 Katrin Fischer 2023-01-30 09:16:18 UTC
Hi Johanna, this is a rather bad bug. Could you have another look maybe?
Comment 11 Katrin Fischer 2023-03-17 16:02:12 UTC
I've retested this and I think the fix is correct, but there is another bug with the * rules not working as expected.

I tested Z39.50 and Batch record modification with these rules:

+----+-----+--------+----------+-----+--------+--------+--------+
| id | tag | module | filter   | add | append | remove | delete |
+----+-----+--------+----------+-----+--------+--------+--------+
|  3 | 245 | source | z3950    |   0 |      0 |      0 |      0 |
|  4 | 300 | source | *        |   0 |      0 |      0 |      0 |
|  5 | 245 | source | batchmod |   0 |      0 |      0 |      0 |
+----+-----+--------+----------+-----+--------+--------+--------+

With the patch applied
* 245 was protected/unchanged in both cases = correct
* 300 was unprotected/overwritten in both cases = incorrect

So the * is not only an issue for z39.50 and I filed this separately as:
Bug 33268 - Overlay rules don't work correctly when source is set to *

Going to pass this, because it restores some of the promised functionality and works well!
Comment 12 Katrin Fischer 2023-03-17 16:03:07 UTC
Created attachment 148375 [details] [review]
Bug 30966: Record Overlay Rules - can't use Z39.50 filter

This patch fixes overlay rules on z39.50 import

Test plan:
1) Create protection overlay rule to some fields for z39.50.
2) Import a record via z39.50.
3) See that the protected fields are replaced on the editor.
4) Apply the patch.
5) Import a record again.
6) See that the protected fields are in place on the editor.

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 13 Tomás Cohen Arazi 2023-03-27 10:06:09 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 14 Matt Blenkinsop 2023-04-11 08:54:34 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 15 Lucas Gass 2023-04-24 17:01:23 UTC
Backported to 22.05.x for upcoming 22.05.12
Comment 16 Arthur Suzuki 2023-05-03 18:39:12 UTC
applied to 21.11.x for 21.11.20