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

(-)a/cataloguing/value_builder/marc21_field_008.pl (-1 / +57 lines)
Lines 72-78 function Blur$function_name(subfield_managed) { Link Here
72
72
73
function Clic$function_name(i) {
73
function Clic$function_name(i) {
74
	defaultvalue=document.getElementById(\"$field_number\").value;
74
	defaultvalue=document.getElementById(\"$field_number\").value;
75
	newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
75
    //Retrieve full leader string and pass it to the 008 tag editor
76
    var leader_value = \$(\"input[id^='tag_000']\").val();
77
    var leader_parameter = \"\";
78
    if (leader_value){
79
        //Only add the parameter to the URL if there is a value to add
80
        leader_parameter = \"&leader=\"+leader_value;
81
    }
82
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
76
83
77
}
84
}
78
//]]>
85
//]]>
Lines 90-95 sub plugin { Link Here
90
    my ($input) = @_;
97
    my ($input) = @_;
91
    my $index   = $input->param('index');
98
    my $index   = $input->param('index');
92
    my $result  = $input->param('result');
99
    my $result  = $input->param('result');
100
    my $leader  = $input->param('leader');
101
102
    my $material_configuration;
103
    if ($leader && length($leader) == '24') {
104
        #MARC 21 Material Type Configuration
105
        #Field 008/18-34 Configuration
106
        #If Leader/06 = a and Leader/07 = a, c, d, or m: Books
107
        #If Leader/06 = a and Leader/07 = b, i, or s: Continuing Resources
108
        #If Leader/06 = t: Books
109
        #If Leader/06 = c, d, i, or j: Music
110
        #If Leader/06 = e, or f: Maps
111
        #If Leader/06 = g, k, o, or r: Visual Materials
112
        #If Leader/06 = m: Computer Files
113
        #If Leader/06 = p: Mixed Materials
114
        #http://www.loc.gov/marc/bibliographic/bdleader.html
115
        my $material_configuration_mapping = {
116
            a => {
117
                a => 'BKS',
118
                c => 'BKS',
119
                d => 'BKS',
120
                m => 'BKS',
121
                b => 'CR',
122
                i => 'CR',
123
                s => 'CR',
124
            },
125
            t => 'BKS',
126
            c => 'MU',
127
            d => 'MU',
128
            i => 'MU',
129
            j => 'MU',
130
            e => 'MP',
131
            f => 'MP',
132
            g => 'VM',
133
            k => 'VM',
134
            o => 'VM',
135
            r => 'VM',
136
            m => 'CF',
137
            p => 'MX',
138
        };
139
        my $leader06 = substr($leader, 6, 1);
140
        my $leader07 = substr($leader, 7, 1);
141
        #Retrieve material type using leader06
142
        $material_configuration = $material_configuration_mapping->{$leader06};
143
        #If the value returned is a ref (i.e. leader06 is 'a'), then use leader07 to get the actual material type
144
        if ( ($material_configuration) && (ref($material_configuration) eq 'HASH') ){
145
            $material_configuration = $material_configuration->{$leader07};
146
        }
147
    }
93
148
94
    my $dbh = C4::Context->dbh;
149
    my $dbh = C4::Context->dbh;
95
150
Lines 123-128 sub plugin { Link Here
123
            index => $index,
178
            index => $index,
124
            result => $result,
179
            result => $result,
125
            errorXml => $errorXml,
180
            errorXml => $errorXml,
181
            material_configuration => $material_configuration,
126
    );
182
    );
127
    output_html_with_http_headers $input, $cookie, $template->output;
183
    output_html_with_http_headers $input, $cookie, $template->output;
128
}
184
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt (-1 / +4 lines)
Lines 17-22 Link Here
17
        h4_result = document.getElementById("h4_result");
17
        h4_result = document.getElementById("h4_result");
18
        tr_result = document.getElementById("tr_result");
18
        tr_result = document.getElementById("tr_result");
19
        objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang %]', '[% marcflavour %]');
19
        objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang %]', '[% marcflavour %]');
20
        [%# If material type configuration is found using the leader, use that type when rendering. Otherwise, the default of BKS will be used %]
21
        [% IF ( material_configuration ) %]
22
        objXmlControlField.idMaterial = "[% material_configuration %]";
23
        [% END %]
20
        objXmlControlField.loadXmlValues();
24
        objXmlControlField.loadXmlValues();
21
        renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result"));
25
        renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result"));
22
        [% END %]
26
        [% END %]
23
- 

Return to bug 9093