Description
Rolando Isidoro
2013-01-23 10:36:59 UTC
Created attachment 14778 [details]
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.
Created attachment 14784 [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. Created attachment 14785 [details] [review] [SIGNED-OFF] 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. Signed-off-by: Vitor Fernandes Tested the patch in a standard Koha 3.8.5 installation and it works as described and expected. 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. Created attachment 14822 [details] [review] [SIGNED-OFF] Bug 9453: Update records acording to the new UNIMARCField100Language system preference Problems with perlcritic corrected. Script without parameters shows help. Signed-off-by: Vitor Fernandes 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. 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. 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. 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. Still valid? |