View | Details | Raw Unified | Return to bug 27461
Collapse All | Expand All

(-)a/cataloguing/value_builder/marc21_field_008.pl (-1 / +3 lines)
Lines 67-74 my $launcher = sub { Link Here
67
    my ( $params ) = @_;
67
    my ( $params ) = @_;
68
    my $input = $params->{cgi};
68
    my $input = $params->{cgi};
69
69
70
    my $default008 = biblio_008();
70
    my $index   = $input->param('index');
71
    my $index   = $input->param('index');
71
    my $result  = $input->param('result') || biblio_008();
72
    my $result  = $input->param('result') || $default008;
72
    my $leader  = $input->param('leader');
73
    my $leader  = $input->param('leader');
73
74
74
    my $material_configuration;
75
    my $material_configuration;
Lines 148-153 my $launcher = sub { Link Here
148
            result => $result,
149
            result => $result,
149
            errorXml => $errorXml,
150
            errorXml => $errorXml,
150
            material_configuration => $material_configuration,
151
            material_configuration => $material_configuration,
152
            default008 => $default008,
151
    );
153
    );
152
    output_html_with_http_headers $input, $cookie, $template->output;
154
    output_html_with_http_headers $input, $cookie, $template->output;
153
};
155
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt (-1 / +16 lines)
Lines 62-67 Link Here
62
        var h4_result;
62
        var h4_result;
63
63
64
        function loadXmlValues(){
64
        function loadXmlValues(){
65
            $("#result").val( fix_field_008( $("#result").val() ) ); // fix field before loading elements
66
65
            [% IF ( errorXml ) %]
67
            [% IF ( errorXml ) %]
66
                alert("[% errorXml | html %]");
68
                alert("[% errorXml | html %]");
67
            [% ELSE %]
69
            [% ELSE %]
Lines 94-99 Link Here
94
            return false;
96
            return false;
95
        }
97
        }
96
98
99
        function fix_field_008( myfield ) {
100
            // If field length < 40, append from default008 starting at last complete data element
101
102
            var j, position = [ 6, 7, 11, 15, 18, 35, 38, 39, 40 ], defaultvalue = '[% default008 | $raw %]';
103
            for( j=0; j<position.length; j++ ) {
104
                if( myfield.length < position[j] ) break;
105
            }
106
            if( j == 0 ) {
107
                return defaultvalue;
108
            } else if( j < position.length ) {
109
                return myfield.substring( 0, position[j-1] ) + defaultvalue.substring( position[j-1] );
110
            }
111
            return myfield;
112
        }
97
    </script>
113
    </script>
98
[% END %]
114
[% END %]
99
115
100
- 

Return to bug 27461