[Bug 19693] New: authtypefrom incorrectly set when updating auth recs from file
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Bug ID: 19693 Summary: authtypefrom incorrectly set when updating auth recs from file Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: MARC Authority data support Assignee: koha-bugs@lists.koha-community.org Reporter: januszop@gmail.com QA Contact: testopia@bugs.koha-community.org In those cases when authorities are updated by an external agency (or even internally, by reviewing and correcting an exported authority file) when the heading tag will be changed (seems odd but happens: 111 Congress ==> 110 Corporate body.Congress ; 100 Person ==> 110 Corporate body (a company named with person's name ; 151 City--object ==> 150 Object (city) etc.) and then the authority record in Koha database will be updated with bulkmarcimport or by calling directly ModAuthority from a custom script, the merge function "doesn't know" that the change to the authority type has been made and, consequently, doesn't adequately change the tag in related fields in biblio records (as it would if two different records with different authtypecode were merged with Koha interface). This is because at the moment when merge function is being called by ModAuthority Koha::Authority::Types->find($autfrom->authtypecode) Koha::Authority::Types->find($authto->authtypecode) both have the same value (because $autfrom == $autfrom). Therefore the authtype guessed from the old version of the record should be considered. To test: 1) have an authority record used in biblio; export it to file; change 1XX heading tag to different (but reasonable) value and possibly change also the content of the heading (one can delete also 942 but it doesn't matter); make bulkmarcimport.pl -a -update -file <modified_auth_file> and see that the tag in biblio record has not been changed (whereas the type of authority record did change); 2) make orders in database (so that the authority type and the tag of the field in biblio record correspond); apply the patch; 3) repeat the test from 1). -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |januszop@gmail.com |ity.org | --- Comment #1 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 69344 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69344&action=edit Bug 19693: authtypefrom incorrectly set when updating auth from file -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69344|0 |1 is obsolete| | --- Comment #2 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 69349 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69349&action=edit Bug 19693: authtypefrom incorrectly set when updating auth from file A corrected version. It is more safe to use the GuessAuthTypeCode function only if really needed, i.e. when merging to itself (especially when using some non standard authority types that for some reason are not covered in GuessAuthTypeCode). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69349|0 |1 is obsolete| | --- Comment #3 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 69350 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69350&action=edit Bug 19693: authtypefrom incorrectly set when updating auth from file -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|trivial |minor --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Not really trivial -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtompset@hotmail.com Status|Needs Signoff |Failed QA --- Comment #5 from M. Tompsett <mtompset@hotmail.com> --- t/db_dependent/Authority/Merge.t triggers this code change fully. However, there is no new test that fails before this patch, and succeeds after. Marking Failed QA. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|authtypefrom incorrectly |update of an authority |set when updating auth recs |record creates |from file |inconsistency when the | |heading tag is changed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69350|0 |1 is obsolete| | --- Comment #6 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 138121 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=138121&action=edit Bug 19693: update of an authority record creates inconsistency when the heading tag is changed Since after a few years the problem is still unresolved here comes a new attempt to address it: In those rare cases when authorities are updated by an external agency (or even internally, by reviewing and correcting an exported authority file) when the heading tag will be changed (seems odd but happens: 111 Congress ==> 110 Corporate body.Congress ; 100 Person ==> 110 Corporate body (a company named with person's name ; 151 City--object ==> 150 Object (city) etc.) and then the authority record in Koha database will be updated with bulkmarcimport or by calling directly ModAuthority from a custom script, the merge function "doesn't know" that the change to the authority type has been made and, consequently, doesn't adequately change the tag in related fields in biblio records (as it would if two different records with different authtypecode were merged with Koha interface). This is because at the moment when merge function is being called by ModAuthority: Koha::Authority::Types->find($autfrom->authtypecode) Koha::Authority::Types->find($authto->authtypecode) both have the same value (because $mergefrom == $mergeto). Therefore in case when $mergefrom == $mergeto and the heading tag changes, $authtypefrom and $authfrom calculated in merge in the ordinar way are misleading and should not be taken unto consideration. Test plan: ========== 1. run t/db_dependent/Authority/Merge.t 2. you should see problems in "Test update A with modified heading tag (changing authtype)" 3. apply the patch 4. run t/db_dependent/Authority/Merge.t again 5. the test should pass Alternatively: 1. have an authority record used in biblio; export it to file; change 1XX heading tag to a different (but reasonable) value and possibly change also the content of the heading (one can delete also 942 but it doesn't matter); make bulkmarcimport.pl -a -update -file <modified_auth_file> and see that the tag in biblio record has not been changed (whereas the type of authority record did change); 2. make orders in database (so that the authority type and the tag of the field in biblio record correspond); apply the patch; 3. repeat the test from 1. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 --- Comment #7 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 138122 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=138122&action=edit Bug 19693: Add test sub to Merge.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff Priority|P5 - low |P3 Severity|minor |normal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #138122|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 140915 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140915&action=edit Bug 19693: Add test sub to Merge.t In those rare cases when authorities are updated by an external agency (or even internally, by reviewing and correcting an exported authority file) when the heading tag will be changed (seems odd but happens: 111 Congress ==> 110 Corporate body.Congress ; 100 Person ==> 110 Corporate body (a company named with person's name ; 151 City--object ==> 150 Object (city) etc.) and then the authority record in Koha database will be updated with bulkmarcimport or by calling directly ModAuthority from a custom script, the merge function "doesn't know" that the change to the authority type has been made and, consequently, doesn't adequately change the tag in related fields in biblio records (as it would if two different records with different authtypecode were merged with Koha interface). This is because at the moment when merge function is being called by ModAuthority: Koha::Authority::Types->find($autfrom->authtypecode) Koha::Authority::Types->find($authto->authtypecode) both have the same value (because $mergefrom == $mergeto). Therefore in case when $mergefrom == $mergeto and the heading tag changes, $authtypefrom and $authfrom calculated in merge in the ordinar way are misleading and should not be taken unto consideration. Test plan: ========== 1. run t/db_dependent/Authority/Merge.t 2. you should see problems in "Test update A with modified heading tag (changing authtype)" 3. apply the patch 4. run t/db_dependent/Authority/Merge.t again 5. the test should pass Alternatively: 1. have an authority record used in biblio; export it to file; change 1XX heading tag to a different (but reasonable) value and possibly change also the content of the heading (one can delete also 942 but it doesn't matter); make bulkmarcimport.pl -a -update -file <modified_auth_file> and see that the tag in biblio record has not been changed (whereas the type of authority record did change); 2. make orders in database (so that the authority type and the tag of the field in biblio record correspond); apply the patch; 3. repeat the test from 1. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 140916 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140916&action=edit Bug 19693: Update of an authority record creates inconsistency when the heading tag is changed In those rare cases when authorities are updated by an external agency (or even internally, by reviewing and correcting an exported authority file) when the heading tag will be changed (seems odd but happens: 111 Congress ==> 110 Corporate body.Congress ; 100 Person ==> 110 Corporate body (a company named with person's name ; 151 City--object ==> 150 Object (city) etc.) and then the authority record in Koha database will be updated with bulkmarcimport or by calling directly ModAuthority from a custom script, the merge function "doesn't know" that the change to the authority type has been made and, consequently, doesn't adequately change the tag in related fields in biblio records (as it would if two different records with different authtypecode were merged with Koha interface). This is because at the moment when merge function is being called by ModAuthority: Koha::Authority::Types->find($autfrom->authtypecode) Koha::Authority::Types->find($authto->authtypecode) both have the same value (because $mergefrom == $mergeto). Therefore in case when $mergefrom == $mergeto and the heading tag changes, $authtypefrom and $authfrom calculated in merge in the ordinar way are misleading and should not be taken unto consideration. Test plan: ========== 1. run t/db_dependent/Authority/Merge.t 2. you should see problems in "Test update A with modified heading tag (changing authtype)" 3. apply the patch 4. run t/db_dependent/Authority/Merge.t again 5. the test should pass Alternatively: 1. have an authority record used in biblio; export it to file; change 1XX heading tag to a different (but reasonable) value and possibly change also the content of the heading (one can delete also 942 but it doesn't matter); make bulkmarcimport.pl -a -update -file <modified_auth_file> and see that the tag in biblio record has not been changed (whereas the type of authority record did change); 2. make orders in database (so that the authority type and the tag of the field in biblio record correspond); apply the patch; 3. repeat the test from 1. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|Needs Signoff |Signed Off --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Works as described and the code makes sense.. also nice looking unit tests as a quick glance. Signing off. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #138121|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |BLOCKED QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QAing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Great catch, Janusz. I know the code of merge very well, although time has passed :) Have the feeling that we are cheating a bit here, but I tend to agree with your solution direction. Tempted to polish it a bit further.. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|BLOCKED |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #140915|0 |1 is obsolete| | --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 141480 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141480&action=edit Bug 19693: Add test sub to Merge.t In those rare cases when authorities are updated by an external agency (or even internally, by reviewing and correcting an exported authority file) when the heading tag will be changed (seems odd but happens: 111 Congress ==> 110 Corporate body.Congress ; 100 Person ==> 110 Corporate body (a company named with person's name ; 151 City--object ==> 150 Object (city) etc.) and then the authority record in Koha database will be updated with bulkmarcimport or by calling directly ModAuthority from a custom script, the merge function "doesn't know" that the change to the authority type has been made and, consequently, doesn't adequately change the tag in related fields in biblio records (as it would if two different records with different authtypecode were merged with Koha interface). This is because at the moment when merge function is being called by ModAuthority: Koha::Authority::Types->find($autfrom->authtypecode) Koha::Authority::Types->find($authto->authtypecode) both have the same value (because $mergefrom == $mergeto). Therefore in case when $mergefrom == $mergeto and the heading tag changes, $authtypefrom and $authfrom calculated in merge in the ordinar way are misleading and should not be taken unto consideration. Test plan: ========== 1. run t/db_dependent/Authority/Merge.t 2. you should see problems in "Test update A with modified heading tag (changing authtype)" 3. apply the patch 4. run t/db_dependent/Authority/Merge.t again 5. the test should pass Alternatively: 1. have an authority record used in biblio; export it to file; change 1XX heading tag to a different (but reasonable) value and possibly change also the content of the heading (one can delete also 942 but it doesn't matter); make bulkmarcimport.pl -a -update -file <modified_auth_file> and see that the tag in biblio record has not been changed (whereas the type of authority record did change); 2. make orders in database (so that the authority type and the tag of the field in biblio record correspond); apply the patch; 3. repeat the test from 1. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #140916|0 |1 is obsolete| | --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 141481 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141481&action=edit Bug 19693: Update of an authority record creates inconsistency when the heading tag is changed In those rare cases when authorities are updated by an external agency (or even internally, by reviewing and correcting an exported authority file) when the heading tag will be changed (seems odd but happens: 111 Congress ==> 110 Corporate body.Congress ; 100 Person ==> 110 Corporate body (a company named with person's name ; 151 City--object ==> 150 Object (city) etc.) and then the authority record in Koha database will be updated with bulkmarcimport or by calling directly ModAuthority from a custom script, the merge function "doesn't know" that the change to the authority type has been made and, consequently, doesn't adequately change the tag in related fields in biblio records (as it would if two different records with different authtypecode were merged with Koha interface). This is because at the moment when merge function is being called by ModAuthority: Koha::Authority::Types->find($autfrom->authtypecode) Koha::Authority::Types->find($authto->authtypecode) both have the same value (because $mergefrom == $mergeto). Therefore in case when $mergefrom == $mergeto and the heading tag changes, $authtypefrom and $authfrom calculated in merge in the ordinar way are misleading and should not be taken unto consideration. Test plan: ========== 1. run t/db_dependent/Authority/Merge.t 2. you should see problems in "Test update A with modified heading tag (changing authtype)" 3. apply the patch 4. run t/db_dependent/Authority/Merge.t again 5. the test should pass Alternatively: 1. have an authority record used in biblio; export it to file; change 1XX heading tag to a different (but reasonable) value and possibly change also the content of the heading (one can delete also 942 but it doesn't matter); make bulkmarcimport.pl -a -update -file <modified_auth_file> and see that the tag in biblio record has not been changed (whereas the type of authority record did change); 2. make orders in database (so that the authority type and the tag of the field in biblio record correspond); apply the patch; 3. repeat the test from 1. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 141482 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141482&action=edit Bug 19693: (QA follow-up) Replace changed tag test The test $MARCfrom->field('1..', '2..'))[0]->tag ne ($MARCto->field('1..', '2..'))[0]->tag is not completely consistent with following code in sub merge. I decided to get the authtype code from the old record that comes from Koha and should include the type. Remaining changes refer to indentation/comments. Test plan: Run t/db_dependent/Authority/Merge.t Note: The test actually could be extended a bit for mocking MARC flavor, but needs some additional framework support to work. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=31704 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |22.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|update of an authority |Update of an authority |record creates |record creates |inconsistency when the |inconsistency when the |heading tag is changed |heading tag is changed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Version(s)|22.11.00 |22.11.00, 22.05.08 released in| | Status|Pushed to master |Pushed to stable --- Comment #17 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 22.05.x for upcoming 22.05.08 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable CC| |arthur.suzuki@biblibre.com Version(s)|22.11.00, 22.05.08 |22.11.00, 22.05.08, released in| |21.11.15 --- Comment #18 from Arthur Suzuki <arthur.suzuki@biblibre.com> --- applied to 21.11 for 21.11.15 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19693 wainuiwitikapark@catalyst.net.nz changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #19 from wainuiwitikapark@catalyst.net.nz --- Not backported to 21.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org