From 0d480bbf5cd7c392c1937fe29c7f7bd4e5fe3fc8 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Mon, 6 Jun 2011 00:41:03 +0300 Subject: [PATCH] Bug 6465 - Errors in UNIMARC plugins for fixed length fields (for | and space) (T::T issue) A corrected version of the patch of 6 June 2011. Signed-off-by: Julian Maurice Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- .../value_builder/unimarc_field_100.pl | 18 +++++-- .../value_builder/unimarc_field_105.pl | 37 +++++++------ .../value_builder/unimarc_field_110.pl | 24 ++++++--- .../value_builder/unimarc_field_115a.pl | 41 ++++++++------ .../value_builder/unimarc_field_115b.pl | 25 +++++---- .../value_builder/unimarc_field_116.pl | 31 +++++++---- .../value_builder/unimarc_field_117.pl | 20 +++++-- .../value_builder/unimarc_field_120.pl | 21 +++++--- .../value_builder/unimarc_field_121a.pl | 12 ++++- .../value_builder/unimarc_field_125b.pl | 10 +++- .../value_builder/unimarc_field_126a.pl | 20 ++++--- .../value_builder/unimarc_field_128b.pl | 9 +++- .../value_builder/unimarc_field_130.pl | 10 +++- .../value_builder/unimarc_field_135a.pl | 10 +++- .../value_builder/unimarc_field_140.pl | 43 +++++++++------ cataloguing/value_builder/unimarc_leader.pl | 19 ++++--- .../value_builder/unimarc_field_100.tt | 10 ++-- .../value_builder/unimarc_field_105.tt | 18 +++---- .../value_builder/unimarc_field_110.tt | 2 +- .../value_builder/unimarc_field_115a.tt | 2 +- .../value_builder/unimarc_field_116.tt | 54 +++++++++---------- .../value_builder/unimarc_field_117.tt | 30 +++++------ .../value_builder/unimarc_field_120.tt | 14 ++--- .../value_builder/unimarc_field_121a.tt | 4 +- .../value_builder/unimarc_field_125b.tt | 2 +- .../value_builder/unimarc_field_126a.tt | 14 ++--- .../value_builder/unimarc_field_128b.tt | 6 +-- .../value_builder/unimarc_field_130.tt | 2 +- .../value_builder/unimarc_field_135a.tt | 2 +- .../value_builder/unimarc_field_140.tt | 34 ++++++------ .../value_builder/unimarc_leader.tt | 6 +-- 31 files changed, 339 insertions(+), 211 deletions(-) diff --git a/cataloguing/value_builder/unimarc_field_100.pl b/cataloguing/value_builder/unimarc_field_100.pl index c49b9568ef..0d01554458 100755 --- a/cataloguing/value_builder/unimarc_field_100.pl +++ b/cataloguing/value_builder/unimarc_field_100.pl @@ -67,6 +67,14 @@ sub plugin_javascript { return ( $field_number, $res ); } +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "dblspace" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index = $input->param('index'); @@ -90,14 +98,14 @@ sub plugin { my @today = Date::Calc::Today(); $f1 = $today[0] . sprintf('%02s',$today[1]) . sprintf('%02s',$today[2]); } - my $f2 = substr( $result, 8, 1 ); + my $f2 = substr( $result, 8, 1 ); $f2 = wrapper( $f2 ) if $f2; my $f3 = substr( $result, 9, 4 ); $f3='' if $f3 eq ' '; # empty publication year if only spaces, otherwise it's hard to fill the field my $f4 = substr( $result, 13, 4 ); $f4='' if $f4 eq ' '; - my $f5 = substr( $result, 17, 1 ); - my $f6 = substr( $result, 18, 1 ); - my $f7 = substr( $result, 19, 1 ); + my $f5 = substr( $result, 17, 1 ); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr( $result, 18, 1 ); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr( $result, 19, 1 ); $f7 = wrapper( $f7 ) if $f7; my $f8 = substr( $result, 20, 1 ); my $f9 = substr( $result, 21, 1 ); my $f10 = substr( $result, 22, 3 ); @@ -105,7 +113,7 @@ sub plugin { my $f12 = substr( $result, 26, 2 ); my $f13 = substr( $result, 28, 2 ); my $f14 = substr( $result, 30, 4 ); - my $f15 = substr( $result, 34, 2 ); + my $f15 = substr( $result, 34, 2 ); $f15 = wrapper( $f15 ) if $f15; $template->param( index => $index, diff --git a/cataloguing/value_builder/unimarc_field_105.pl b/cataloguing/value_builder/unimarc_field_105.pl index 8d44a8262d..c84e826bdc 100755 --- a/cataloguing/value_builder/unimarc_field_105.pl +++ b/cataloguing/value_builder/unimarc_field_105.pl @@ -63,6 +63,13 @@ sub plugin_javascript { return ($field_number,$res); } +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -78,21 +85,21 @@ sub plugin { flagsrequired => {editcatalogue => '*'}, debug => 1, }); - my $f1 = substr($result,0,1); - my $f2 = substr($result,1,1); - my $f3 = substr($result,2,1); - my $f4 = substr($result,3,1); - - my $f5 = substr($result,4,1); - my $f6 = substr($result,5,1); - my $f7 = substr($result,6,1); - my $f8 = substr($result,7,1); - - my $f9 = substr($result,8,1); - my $f10 = substr($result,9,1); - my $f11 = substr($result,10,1); - my $f12 = substr($result,11,1); - my $f13 = substr($result,12,1); + my $f1 = substr($result,0,1); $f1 = wrapper( $f1 ) if $f1; + my $f2 = substr($result,1,1); $f2 = wrapper( $f2 ) if $f2; + my $f3 = substr($result,2,1); $f3 = wrapper( $f3 ) if $f3; + my $f4 = substr($result,3,1); $f4 = wrapper( $f4 ) if $f4; + + my $f5 = substr($result,4,1); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr($result,5,1); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr($result,6,1); $f7 = wrapper( $f7 ) if $f7; + my $f8 = substr($result,7,1); $f8 = wrapper( $f8 ) if $f8; + + my $f9 = substr($result,8,1); $f9 = wrapper( $f9 ) if $f9; + my $f10 = substr($result,9,1); $f10 = wrapper( $f10 ) if $f10; + my $f11 = substr($result,10,1); $f11 = wrapper( $f11 ) if $f11; + my $f12 = substr($result,11,1); $f12 = wrapper( $f12 ) if $f12; + my $f13 = substr($result,12,1); $f13 = wrapper( $f13 ) if $f13; $template->param(index => $index, "f1$f1" => 1, diff --git a/cataloguing/value_builder/unimarc_field_110.pl b/cataloguing/value_builder/unimarc_field_110.pl index 848a53a3ff..2c301ae7a7 100755 --- a/cataloguing/value_builder/unimarc_field_110.pl +++ b/cataloguing/value_builder/unimarc_field_110.pl @@ -62,6 +62,14 @@ sub plugin_javascript { return ($field_number,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -76,15 +84,15 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {editcatalogue => '*'}, debug => 1, }); - my $f1 = substr($result,0,1); - my $f2 = substr($result,1,1); - my $f3 = substr($result,2,1); - my $f4 = substr($result,3,1); + my $f1 = substr($result,0,1); $f1 = wrapper( $f1 ) if $f1; + my $f2 = substr($result,1,1); $f2 = wrapper( $f2 ) if $f2; + my $f3 = substr($result,2,1); $f3 = wrapper( $f3 ) if $f3; + my $f4 = substr($result,3,1); $f4 = wrapper( $f4 ) if $f4; my $f5 = substr($result,4,3); - my $f6 = substr($result,7,1); - my $f7 = substr($result,8,1); - my $f8 = substr($result,9,1); - my $f9 = substr($result,10,1); + my $f6 = substr($result,7,1); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr($result,8,1); $f7 = wrapper( $f7 ) if $f7; + my $f8 = substr($result,9,1); $f8 = wrapper( $f8 ) if $f8; + my $f9 = substr($result,10,1); $f9 = wrapper( $f9 ) if $f9; $template->param(index => $index, "f1$f1" => 1, diff --git a/cataloguing/value_builder/unimarc_field_115a.pl b/cataloguing/value_builder/unimarc_field_115a.pl index 6144771432..2cd6806ea8 100755 --- a/cataloguing/value_builder/unimarc_field_115a.pl +++ b/cataloguing/value_builder/unimarc_field_115a.pl @@ -69,6 +69,13 @@ sub plugin_javascript { return ( $field_number, $res ); } +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index = $input->param('index'); @@ -86,24 +93,24 @@ sub plugin { debug => 1, } ); - my $f1 = substr( $result, 0, 1 ); + my $f1 = substr( $result, 0, 1 ); $f1 = wrapper( $f1 ) if $f1; my $f2 = substr( $result, 1, 3 ); - my $f3 = substr( $result, 4, 1 ); - my $f4 = substr( $result, 5, 1 ); - my $f5 = substr( $result, 6, 1 ); - my $f6 = substr( $result, 7, 1 ); - my $f7 = substr( $result, 8, 1 ); - my $f8 = substr( $result, 9, 1 ); - my $f9 = substr( $result, 10, 1 ); - my $f10 = substr( $result, 11, 1 ); - my $f11 = substr( $result, 12, 1 ); - my $f12 = substr( $result, 13, 1 ); - my $f13 = substr( $result, 14, 1 ); - my $f14 = substr( $result, 15, 1 ); - my $f15 = substr( $result, 16, 1 ); - my $f16 = substr( $result, 17, 1 ); - my $f17 = substr( $result, 18, 1 ); - my $f18 = substr( $result, 19, 1 ); + my $f3 = substr( $result, 4, 1 ); $f3 = wrapper( $f3 ) if $f3; + my $f4 = substr( $result, 5, 1 ); $f4 = wrapper( $f4 ) if $f4; + my $f5 = substr( $result, 6, 1 ); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr( $result, 7, 1 ); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr( $result, 8, 1 ); $f7 = wrapper( $f7 ) if $f7; + my $f8 = substr( $result, 9, 1 ); $f8 = wrapper( $f8 ) if $f8; + my $f9 = substr( $result, 10, 1 ); $f9 = wrapper( $f9 ) if $f9; + my $f10 = substr( $result, 11, 1 ); $f10 = wrapper( $f10 ) if $f10; + my $f11 = substr( $result, 12, 1 ); $f11 = wrapper( $f11 ) if $f11; + my $f12 = substr( $result, 13, 1 ); $f12 = wrapper( $f12 ) if $f12; + my $f13 = substr( $result, 14, 1 ); $f13 = wrapper( $f13 ) if $f13; + my $f14 = substr( $result, 15, 1 ); $f14 = wrapper( $f14 ) if $f14; + my $f15 = substr( $result, 16, 1 ); $f15 = wrapper( $f15 ) if $f15; + my $f16 = substr( $result, 17, 1 ); $f16 = wrapper( $f16 ) if $f16; + my $f17 = substr( $result, 18, 1 ); $f17 = wrapper( $f17 ) if $f17; + my $f18 = substr( $result, 19, 1 ); $f18 = wrapper( $f18 ) if $f18; $template->param( index => $index, diff --git a/cataloguing/value_builder/unimarc_field_115b.pl b/cataloguing/value_builder/unimarc_field_115b.pl index 7582e7494b..919b1fa7d5 100755 --- a/cataloguing/value_builder/unimarc_field_115b.pl +++ b/cataloguing/value_builder/unimarc_field_115b.pl @@ -63,6 +63,13 @@ function Clic$field_number() { return ( $field_number, $res ); } +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index = $input->param('index'); @@ -80,15 +87,15 @@ sub plugin { debug => 1, } ); - my $f1 = substr( $result, 0, 1 ); - my $f2 = substr( $result, 1, 1 ); - my $f3 = substr( $result, 2, 1 ); - my $f4 = substr( $result, 3, 1 ); - my $f5 = substr( $result, 4, 1 ); - my $f6 = substr( $result, 5, 1 ); - my $f7 = substr( $result, 6, 1 ); - my $f8 = substr( $result, 7, 1 ); - my $f9 = substr( $result, 8, 1 ); + my $f1 = substr( $result, 0, 1 ); $f1 = wrapper( $f1 ) if $f1; + my $f2 = substr( $result, 1, 1 ); $f2 = wrapper( $f2 ) if $f2; + my $f3 = substr( $result, 2, 1 ); $f3 = wrapper( $f3 ) if $f3; + my $f4 = substr( $result, 3, 1 ); $f4 = wrapper( $f4 ) if $f4; + my $f5 = substr( $result, 4, 1 ); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr( $result, 5, 1 ); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr( $result, 6, 1 ); $f7 = wrapper( $f7 ) if $f7; + my $f8 = substr( $result, 7, 1 ); $f8 = wrapper( $f8 ) if $f8; + my $f9 = substr( $result, 8, 1 ); $f9 = wrapper( $f9 ) if $f9; my $f10 = substr( $result, 9, 4 ); my $f11 = substr( $result, 13, 2 ); diff --git a/cataloguing/value_builder/unimarc_field_116.pl b/cataloguing/value_builder/unimarc_field_116.pl index 21e236883b..67f6875de8 100755 --- a/cataloguing/value_builder/unimarc_field_116.pl +++ b/cataloguing/value_builder/unimarc_field_116.pl @@ -63,6 +63,15 @@ function Clic$field_number(i) { return ( $field_number, $res ); } +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "dblspace" if $char eq " "; + return "pipe" if $char eq "|"; + return "dblpipe" if $char eq "||"; + return $char; +} + sub plugin { my ($input) = @_; my $index = $input->param('index'); @@ -79,20 +88,20 @@ sub plugin { debug => 1, } ); - my $f1 = substr( $result, 0, 1 ); - my $f2 = substr( $result, 1, 1 ); - my $f3 = substr( $result, 2, 1 ); - my $f4 = substr( $result, 3, 1 ); + my $f1 = substr( $result, 0, 1 ); $f1 = wrapper( $f1 ) if $f1; + my $f2 = substr( $result, 1, 1 ); $f2 = wrapper( $f2 ) if $f2; + my $f3 = substr( $result, 2, 1 ); $f3 = wrapper( $f3 ) if $f3; + my $f4 = substr( $result, 3, 1 ); $f4 = wrapper( $f4 ) if $f4; - my $f5 = substr( $result, 4, 2 ); - my $f6 = substr( $result, 6, 2 ); - my $f7 = substr( $result, 8, 2 ); + my $f5 = substr( $result, 4, 2 ); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr( $result, 6, 2 ); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr( $result, 8, 2 ); $f7 = wrapper( $f7 ) if $f7; - my $f8 = substr( $result, 10, 2 ); - my $f9 = substr( $result, 12, 2 ); - my $f10 = substr( $result, 14, 2 ); + my $f8 = substr( $result, 10, 2 ); $f8 = wrapper( $f8 ) if $f8; + my $f9 = substr( $result, 12, 2 ); $f9 = wrapper( $f9 ) if $f9; + my $f10 = substr( $result, 14, 2 ); $f10 = wrapper( $f10 ) if $f10; - my $f11 = substr( $result, 16, 2 ); + my $f11 = substr( $result, 16, 2 ); $f11 = wrapper( $f11 ) if $f11; $template->param( index => $index, diff --git a/cataloguing/value_builder/unimarc_field_117.pl b/cataloguing/value_builder/unimarc_field_117.pl index ff206f7524..fcbb18f71a 100755 --- a/cataloguing/value_builder/unimarc_field_117.pl +++ b/cataloguing/value_builder/unimarc_field_117.pl @@ -62,6 +62,16 @@ function Clic$field_number(i) { return ($field_number,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "dblspace" if $char eq " "; + return "pipe" if $char eq "|"; + return "dblpipe" if $char eq "||"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -76,12 +86,12 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {editcatalogue => '*'}, debug => 1, }); - my $f1 = substr($result,0,2); - my $f2 = substr($result,2,2); - my $f3 = substr($result,4,2); - my $f4 = substr($result,6,2); + my $f1 = substr($result,0,2); $f1 = wrapper( $f1 ) if $f1; + my $f2 = substr($result,2,2); $f2 = wrapper( $f2 ) if $f2; + my $f3 = substr($result,4,2); $f3 = wrapper( $f3 ) if $f3; + my $f4 = substr($result,6,2); $f4 = wrapper( $f4 ) if $f4; - my $f5 = substr($result,8,1); + my $f5 = substr($result,8,1); $f5 = wrapper( $f5 ) if $f5; $template->param(index => $index, "f1$f1" => 1, diff --git a/cataloguing/value_builder/unimarc_field_120.pl b/cataloguing/value_builder/unimarc_field_120.pl index 3f72c85e71..f140fce9b3 100755 --- a/cataloguing/value_builder/unimarc_field_120.pl +++ b/cataloguing/value_builder/unimarc_field_120.pl @@ -63,6 +63,15 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "dblspace" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -82,13 +91,13 @@ my ($template, $loggedinuser, $cookie) my $f1 = substr($result,0,1); my $f2 = substr($result,1,1); my $f3 = substr($result,2,1); - my $f4 = substr($result,3,1); - my $f5 = substr($result,4,1); - my $f6 = substr($result,5,1); - my $f7 = substr($result,6,1); + my $f4 = substr($result,3,1); $f4 = wrapper( $f4 ) if $f4; + my $f5 = substr($result,4,1); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr($result,5,1); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr($result,6,1); $f7 = wrapper( $f7 ) if $f7; my $f8 = substr($result,7,2); - my $f9 = substr($result,9,2); - my $f10 = substr($result,11,2); + my $f9 = substr($result,9,2); $f9 = wrapper( $f9 ) if $f9; + my $f10 = substr($result,11,2); $f10 = wrapper( $f10 ) if $f10; $template->param(index => $index, "f1$f1" => 1, "f2$f2" => 1, diff --git a/cataloguing/value_builder/unimarc_field_121a.pl b/cataloguing/value_builder/unimarc_field_121a.pl index a855332cad..d40f49c2e7 100755 --- a/cataloguing/value_builder/unimarc_field_121a.pl +++ b/cataloguing/value_builder/unimarc_field_121a.pl @@ -63,6 +63,14 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -80,8 +88,8 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); my $f1 = substr($result,0,1); - my $f2 = substr($result,1,1); - my $f3 = substr($result,2,1); + my $f2 = substr($result,1,1); $f2 = wrapper( $f2 ) if $f2; + my $f3 = substr($result,2,1); $f3 = wrapper( $f3 ) if $f3; my $f4 = substr($result,3,2); my $f5 = substr($result,5,1); my $f6 = substr($result,6,1); diff --git a/cataloguing/value_builder/unimarc_field_125b.pl b/cataloguing/value_builder/unimarc_field_125b.pl index b3569567ab..8c661611a4 100755 --- a/cataloguing/value_builder/unimarc_field_125b.pl +++ b/cataloguing/value_builder/unimarc_field_125b.pl @@ -60,6 +60,14 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -76,7 +84,7 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {editcatalogue => '*'}, debug => 1, }); - my $f1 = substr($result,0,1); + my $f1 = substr($result,0,1); $f1 = wrapper( $f1 ) if $f1; $template->param(index => $index, "f1$f1" => 1); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/cataloguing/value_builder/unimarc_field_126a.pl b/cataloguing/value_builder/unimarc_field_126a.pl index 2f85f9e407..e3d47b55f2 100755 --- a/cataloguing/value_builder/unimarc_field_126a.pl +++ b/cataloguing/value_builder/unimarc_field_126a.pl @@ -60,6 +60,14 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -83,12 +91,12 @@ my ($template, $loggedinuser, $cookie) my $f5 = substr($result,4,1); my $f6 = substr($result,5,1); my $f7 = substr($result,6,1); - my $f8 = substr($result,7,1); - my $f9 = substr($result,8,1); - my $f10 = substr($result,9,1); - my $f11 = substr($result,10,1); - my $f12 = substr($result,11,1); - my $f13 = substr($result,12,1); + my $f8 = substr($result,7,1); $f8 = wrapper( $f8 ) if $f8; + my $f9 = substr($result,8,1); $f9 = wrapper( $f9 ) if $f9; + my $f10 = substr($result,9,1); $f10 = wrapper( $f10 ) if $f10; + my $f11 = substr($result,10,1); $f11 = wrapper( $f11 ) if $f11; + my $f12 = substr($result,11,1); $f12 = wrapper( $f12 ) if $f12; + my $f13 = substr($result,12,1); $f13 = wrapper( $f13 ) if $f13; my $f14 = substr($result,13,1); my $f15 = substr($result,14,1); $template->param(index => $index, diff --git a/cataloguing/value_builder/unimarc_field_128b.pl b/cataloguing/value_builder/unimarc_field_128b.pl index b44bd218e3..1f196ac31b 100755 --- a/cataloguing/value_builder/unimarc_field_128b.pl +++ b/cataloguing/value_builder/unimarc_field_128b.pl @@ -60,6 +60,13 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "dblpipe" if $char eq "||"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -76,7 +83,7 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {editcatalogue => '*'}, debug => 1, }); - my $f1 = substr($result,0,2); + my $f1 = substr($result,0,2); $f1 = wrapper( $f1 ) if $f1; $template->param(index => $index, "f1$f1" => 1); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/cataloguing/value_builder/unimarc_field_130.pl b/cataloguing/value_builder/unimarc_field_130.pl index caf6ba3f6c..d0eb5c924c 100755 --- a/cataloguing/value_builder/unimarc_field_130.pl +++ b/cataloguing/value_builder/unimarc_field_130.pl @@ -61,6 +61,14 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -79,7 +87,7 @@ my ($template, $loggedinuser, $cookie) }); my $f1 = substr($result,0,1); my $f2 = substr($result,1,1); - my $f3 = substr($result,2,1); + my $f3 = substr($result,2,1); $f3 = wrapper( $f3 ) if $f3; my $f4 = substr($result,3,1); my $f5 = substr($result,4,3); my $f6 = substr($result,7,1); diff --git a/cataloguing/value_builder/unimarc_field_135a.pl b/cataloguing/value_builder/unimarc_field_135a.pl index de631c25ab..93454aadd7 100755 --- a/cataloguing/value_builder/unimarc_field_135a.pl +++ b/cataloguing/value_builder/unimarc_field_135a.pl @@ -60,6 +60,14 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -76,7 +84,7 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {editcatalogue => '*'}, debug => 1, }); - my $f1 = substr($result,0,1); + my $f1 = substr($result,0,1); $f1 = wrapper( $f1 ) if $f1; my $f2 = substr($result,1,1); my $f3 = substr($result,2,1); my $f4 = substr($result,3,1); diff --git a/cataloguing/value_builder/unimarc_field_140.pl b/cataloguing/value_builder/unimarc_field_140.pl index ac50f32a87..201e31afb2 100755 --- a/cataloguing/value_builder/unimarc_field_140.pl +++ b/cataloguing/value_builder/unimarc_field_140.pl @@ -60,6 +60,15 @@ function Clic$function_name(i) { return ($function_name,$res); } + +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "dblspace" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index= $input->param('index'); @@ -76,23 +85,23 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {editcatalogue => '*'}, debug => 1, }); - my $f1 = substr($result,0,1); - my $f2 = substr($result,1,1); - my $f3 = substr($result,2,1); - my $f4 = substr($result,3,1); - my $f5 = substr($result,4,1); - my $f6 = substr($result,5,1); - my $f7 = substr($result,6,1); - my $f8 = substr($result,7,1); - my $f9 = substr($result,8,1); - my $f10 = substr($result,9,2); - my $f11 = substr($result,11,2); - my $f12 = substr($result,13,2); - my $f13 = substr($result,15,2); - my $f14 = substr($result,17,2); - my $f15 = substr($result,19,1); - my $f16 = substr($result,20,1); - my $f17 = substr($result,21,1); + my $f1 = substr($result,0,1); $f1 = wrapper( $f1 ) if $f1; + my $f2 = substr($result,1,1); $f2 = wrapper( $f2 ) if $f2; + my $f3 = substr($result,2,1); $f3 = wrapper( $f3 ) if $f3; + my $f4 = substr($result,3,1); $f4 = wrapper( $f4 ) if $f4; + my $f5 = substr($result,4,1); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr($result,5,1); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr($result,6,1); $f7 = wrapper( $f7 ) if $f7; + my $f8 = substr($result,7,1); $f8 = wrapper( $f8 ) if $f8; + my $f9 = substr($result,8,1); $f9 = wrapper( $f9 ) if $f9; + my $f10 = substr($result,9,2); $f10 = wrapper( $f10 ) if $f10; + my $f11 = substr($result,11,2); $f11 = wrapper( $f11 ) if $f11; + my $f12 = substr($result,13,2); $f12 = wrapper( $f12 ) if $f12; + my $f13 = substr($result,15,2); $f13 = wrapper( $f13 ) if $f13; + my $f14 = substr($result,17,2); $f14 = wrapper( $f14 ) if $f14; + my $f15 = substr($result,19,1); $f15 = wrapper( $f15 ) if $f15; + my $f16 = substr($result,20,1); $f16 = wrapper( $f16 ) if $f16; + my $f17 = substr($result,21,1); $f17 = wrapper( $f17 ) if $f17; my $f18 = substr($result,22,1); my $f19 = substr($result,23,1); my $f20 = substr($result,24,1); diff --git a/cataloguing/value_builder/unimarc_leader.pl b/cataloguing/value_builder/unimarc_leader.pl index 05748a2c31..af4d808633 100755 --- a/cataloguing/value_builder/unimarc_leader.pl +++ b/cataloguing/value_builder/unimarc_leader.pl @@ -66,6 +66,13 @@ function Clic$function_name(i) { return ( $function_name, $res ); } +sub wrapper { + my ($char) = @_; + return "space" if $char eq " "; + return "pipe" if $char eq "|"; + return $char; +} + sub plugin { my ($input) = @_; my $index = $input->param('index'); @@ -83,13 +90,13 @@ sub plugin { } ); $result = " nam 3 " unless $result; - my $f5 = substr( $result, 5, 1 ); - my $f6 = substr( $result, 6, 1 ); - my $f7 = substr( $result, 7, 1 ); - my $f8 = substr( $result, 8, 1 ); + my $f5 = substr( $result, 5, 1 ); $f5 = wrapper( $f5 ) if $f5; + my $f6 = substr( $result, 6, 1 ); $f6 = wrapper( $f6 ) if $f6; + my $f7 = substr( $result, 7, 1 ); $f7 = wrapper( $f7 ) if $f7; + my $f8 = substr( $result, 8, 1 ); $f8 = wrapper( $f8 ) if $f8; my $f9 = substr( $result, 9, 1 ); - my $f17 = substr( $result, 17, 1 ); - my $f18 = substr( $result, 18, 1 ); + my $f17 = substr( $result, 17, 1 ); $f17 = wrapper( $f17 ) if $f17; + my $f18 = substr( $result, 18, 1 ); $f18 = wrapper( $f18 ) if $f18; my $f19 = substr( $result, 19, 1 ); $template->param( diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_100.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_100.tt index d186dfab1f..46861486f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_100.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_100.tt @@ -14,7 +14,7 @@ - [% IF ( f13 ) %] + [% IF ( f13dblspace ) %] [% ELSE %] @@ -578,10 +578,10 @@ languages and obsolete typography) - [% IF ( f1pipe ) %] + [% IF ( f9pipe ) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_110.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_110.tt index ccb7624540..b6618983e6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_110.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_110.tt @@ -198,7 +198,7 @@ [% END %] - [% IF ( f4 ) %] + [% IF ( f4space ) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_115a.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_115a.tt index 03a94e1f0c..8a7b2ebb4d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_115a.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_115a.tt @@ -48,7 +48,7 @@ - [% IF ( f5pipe ) %] - + [% IF ( f5dblpipe ) %] + [% ELSE %] - + [% END %] - [% IF ( f5 ) %] + [% IF ( f5dblspace ) %] [% ELSE %] @@ -484,12 +484,12 @@ - [% IF ( f7pipe ) %] - + [% IF ( f7dblpipe ) %] + [% ELSE %] - + [% END %] - [% IF ( f7 ) %] + [% IF ( f7dblspace ) %] [% ELSE %] @@ -889,12 +889,12 @@ - [% IF ( f9pipe ) %] - + [% IF ( f9dblpipe ) %] + [% ELSE %] - + [% END %] - [% IF ( f9 ) %] + [% IF ( f9dblspace ) %] [% ELSE %] @@ -1278,13 +1278,13 @@ - [% IF ( f11pipe ) %] - + [% IF ( f11dblpipe ) %] + [% ELSE %] - + [% END %] [% IF ( f11aa ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_117.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_117.tt index b42650f7d0..376641af88 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_117.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_117.tt @@ -10,10 +10,10 @@ - [% IF ( f2pipe ) %] - + [% IF ( f2dblpipe ) %] + [% ELSE %] - + [% END %] - [% IF ( f2 ) %] + [% IF ( f2dblspace ) %] [% ELSE %] @@ -399,13 +399,13 @@ - [% IF ( f4pipe ) %] - + [% IF ( f4dblpipe ) %] + [% ELSE %] - + [% END %] - [% IF ( f4 ) %] + [% IF ( f4dblspace ) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_120.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_120.tt index d072701a53..09ac0dfa04 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_120.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_120.tt @@ -71,7 +71,7 @@ - [% IF ( f5 ) %] + [% IF ( f5space ) %] [% ELSE %] @@ -226,7 +226,7 @@ - [% IF ( f7 ) %] + [% IF ( f7space ) %] [% ELSE %] @@ -661,7 +661,7 @@ - [% IF ( f10 ) %] + [% IF ( f10dblspace ) %] [% ELSE %] - + [% END %] [% IF ( f10aa ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_121a.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_121a.tt index f43bea8f5b..827c506bac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_121a.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_121a.tt @@ -27,7 +27,7 @@ - [% IF ( f3 ) %] + [% IF ( f3space ) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_125b.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_125b.tt index c8612de01b..7bee0bf818 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_125b.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_125b.tt @@ -10,7 +10,7 @@ - [% IF ( f8 ) %] + [% IF ( f8space ) %] [% ELSE %] @@ -502,7 +502,7 @@ - [% IF ( f10 ) %] + [% IF ( f10space ) %] [% ELSE %] @@ -676,7 +676,7 @@ - [% IF ( f12 ) %] + [% IF ( f12space ) %] [% ELSE %] @@ -848,7 +848,7 @@ - [% IF ( f1pipe ) %] - + [% IF ( f1dblpipe ) %] + [% ELSE %] - + [% END %] [% IF ( f1ba ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_130.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_130.tt index 8e66d827f7..6edba012ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_130.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_130.tt @@ -89,7 +89,7 @@ - [% IF ( f1 ) %] + [% IF ( f1space ) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_140.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_140.tt index 0201d045fc..689e775280 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_140.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_140.tt @@ -10,7 +10,7 @@ - [% IF ( f2 ) %] + [% IF ( f2space ) %] [% ELSE %] @@ -201,7 +201,7 @@ - [% IF ( f4 ) %] + [% IF ( f4space ) %] [% ELSE %] @@ -394,7 +394,7 @@ - [% IF ( f6 ) %] + [% IF ( f6space ) %] [% ELSE %] @@ -537,7 +537,7 @@ - [% IF ( f8 ) %] + [% IF ( f8space ) %] [% ELSE %] @@ -679,7 +679,7 @@ - [% IF ( f10 ) %] + [% IF ( f10dblspace ) %] [% ELSE %] @@ -888,7 +888,7 @@ - [% IF ( f12 ) %] + [% IF ( f12dblspace ) %] [% ELSE %] @@ -1202,7 +1202,7 @@ - [% IF ( f14 ) %] + [% IF ( f14dblspace ) %] [% ELSE %] @@ -1527,7 +1527,7 @@ - [% IF ( f16 ) %] + [% IF ( f16space ) %] [% ELSE %] @@ -1611,7 +1611,7 @@