Bug 9453 - Update records according to the new UNIMARCField100Language system preference
Summary: Update records according to the new UNIMARCField100Language system preference
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P1 - high enhancement (vote)
Assignee: Rolando Isidoro
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on: 8347
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-23 10:36 UTC by Rolando Isidoro
Modified: 2023-01-08 01:36 UTC (History)
4 users (show)

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


Attachments
Script to update field 100a language value with the one defined in the "UNIMARC field 100 default language" system preference (3.99 KB, text/plain)
2013-01-23 12:16 UTC, Rolando Isidoro
Details
Bug 9453: Update records acording to the new UNIMARCField100Language system preference (5.24 KB, patch)
2013-01-23 14:59 UTC, Vitor Fernandes
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 9453: Update records acording to the new UNIMARCField100Language system preference (5.28 KB, patch)
2013-01-23 15:05 UTC, Vitor Fernandes
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 9453: Update records acording to the new UNIMARCField100Language system preference (9.81 KB, patch)
2013-01-24 14:49 UTC, Vitor Fernandes
Details | Diff | Splinter Review
Bug 9453: Update records acording to the new UNIMARCField100Language system preference (5.84 KB, patch)
2013-02-07 15:39 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Rolando Isidoro 2013-01-23 10:36:59 UTC
The solution to bug 8347 introduced a new system preference, UNIMARCField100Language, which allows us to set the value for the mandatory Language of cataloguing field in the UNIMARC field 100 builder form.

Before this bug was fixed all values on that field were set to 'fre', so we need to update all the existing records to match the new system preference.
Comment 1 Rolando Isidoro 2013-01-23 12:16:55 UTC Comment hidden (obsolete)
Comment 2 Vitor Fernandes 2013-01-23 14:59:11 UTC Comment hidden (obsolete)
Comment 3 Vitor Fernandes 2013-01-23 15:05:40 UTC Comment hidden (obsolete)
Comment 4 Rolando Isidoro 2013-01-23 15:55:27 UTC
Tested the patch in a standard Koha 3.8.5 installation and it works as described and expected.
Comment 5 Jonathan Druart 2013-01-23 16:34:16 UTC
Hi Rolando,

Please fix the following perlcritic issues:

Bareword file handle opened at line 71, column 5. See pages 202,204 of PBP.
Two-argument "open" used at line 69, column 5. See page 207 of PBP.
Bareword file handle opened at line 69, column 5. See pages 202,204 of PBP.

+ the script has to display the help if it is called without parameter.

Marked as Failed QA.
Comment 6 Vitor Fernandes 2013-01-24 14:49:45 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2013-02-07 14:58:42 UTC
Vitor,

Thanks but your patch is not correct.
Your last patch does not create the new file, so I cannot apply it.
Please resubmit it and switch the status to "Needs Signoff".

Marked as Failed QA.
Comment 8 Vitor Fernandes 2013-02-07 15:05:52 UTC
Hi Jonhatan,

I removed the first from obsolete status because it can create the file.
Sorry but now I don't have time to create a new patch for this bug.
I think this way it will work because it will apply the "obsolete" patch first and the file should be created. Then the correct patch will replace the script file.
Comment 9 Jonathan Druart 2013-02-07 15:39:38 UTC
Created attachment 15145 [details] [review]
Bug 9453: Update records acording to the new UNIMARCField100Language system preference

Script to update field 100a language value with the one defined in the "UNIMARC field 100 default language" system preference

This script aims to allow users to update UNIMARC field 100a language value with the one defined in the "UNIMARC field 100 default language" system preference in a easy way.

The script uses KOHA's API methods to ensure that the DB data remains valid and that it gets reindexed.
Comment 10 Marcel de Rooy 2013-08-22 11:46:38 UTC
KOHA -> Koha ?

Just a few questions:

1) What about:
    use FindBin;
    my $module="$FindBin::Bin/../kohalib.pl";
    eval { require $module };
Seems to overcome the warning:
"require" statement with library name as string at line 26, column 12. Use a bareword instead.

2) You want to modify pos 22-24 (Language of cataloging).
You do that by:
$subfield =~ s/fre/$default_unimarc_language/g
Why global? You only want to do this once?
Since there actually is no check on the contents of the preference, this variable may contain a string that is too short or too long. In that case you are shifting characters in field 100 and corrupting your data. Could you check the length? And simply replace positions 22-24? 
Also note that fre is hardcoded here. I would favor moving it to a script parameter.
Looking at the code of ModBiblioMarc, I wonder if you need this regexp at all. The code there appears to correct the language in 100a while checking the length! 

3) Why use ModBiblioMarc and not ModBiblio?  See POD comment for ModBiblioMarc.
Comment 11 Marc Véron 2016-10-04 16:12:44 UTC
Still valid?