[Koha-patches] [PATCH] Bug 3212 Force leader 9 position to 'a' for new biblios
Frédéric Demians
f.demians at tamil.fr
Wed Jan 5 11:45:52 CET 2011
When Creating a new biblio record, if the cataloguer doesn't use the leader
plugin, a biblio record can be saved with a leader not containing a 'a' in 9
position. If the biblio contains UTF-8 characters, its decoding can fail.
This issue applies to MARC-21 not UNIMARC.
---
C4/Biblio.pm | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index c3a3094..881085e 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -1901,8 +1901,13 @@ sub TransformHtmlToMarc {
if ( $tag < 10 ) { # no code for theses fields
# in MARC editor, 000 contains the leader.
if ( $tag eq '000' ) {
- $record->leader( $cgi->param( $params->[ $j + 1 ] ) ) if length( $cgi->param( $params->[ $j + 1 ] ) ) == 24;
-
+ # Force a fake leader even if not provided to avoid crashing
+ # during decoding MARC record containing UTF-8 characters
+ $record->leader(
+ length( $cgi->param($params->[$j+1]) ) == 24
+ ? $cgi->param( $params->[ $j + 1 ] )
+ : ' nam a22 4500'
+ ;
# between 001 and 009 (included)
} elsif ( $cgi->param( $params->[ $j + 1 ] ) ne '' ) {
$newfield = MARC::Field->new( $tag, $cgi->param( $params->[ $j + 1 ] ), );
--
1.7.3.2
More information about the Koha-patches
mailing list