From a1fd726157c5857ecde1b66e79284f48142be7e5 Mon Sep 17 00:00:00 2001 From: Jacek Ablewicz Date: Thu, 1 Sep 2016 18:13:50 +0200 Subject: [PATCH] Bug 17072: 006 not filling in with existing values When you use the 006 builder to view the existing values in the 006 tag, Koha is not pulling these existing values into the builder window. Instead, Koha appears to be using defaults. To reproduce: 1. Open a record in the editor 2. Switch from BKS to another material type. 3. Change as many settings as possible. 4. Close plugin. 5. Reopen plugin - notice your selections are not shown. Trivial patch, heavilly inspired by Bug 9093. To test: 1. Apply patch 2. Ensure that issue described above is no longer reproductible Signed-off-by: Hector Castro Works as advertised Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- cataloguing/value_builder/marc21_field_006.pl | 14 +++++++++++++- .../cataloguing/value_builder/marc21_field_006.tt | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cataloguing/value_builder/marc21_field_006.pl b/cataloguing/value_builder/marc21_field_006.pl index a773d9cb3d..aeb5df1949 100755 --- a/cataloguing/value_builder/marc21_field_006.pl +++ b/cataloguing/value_builder/marc21_field_006.pl @@ -66,6 +66,17 @@ my $launcher = sub { } ); $result = "a|||||r|||| 00| 0 " unless $result; + my $material_form_mapping = { + a => 'BKS', t => 'BKS', + c => 'MU', d => 'MU', i => 'MU', j => 'MU', + e => 'MP', f => 'MP', + g => 'VM', k => 'VM', o => 'VM', r => 'VM', + m => 'CF', + p => 'MX', + s => 'CR', + }; + my $material_code = substr(($result // ' '), 0, 1); + my $material_configuration = $material_form_mapping->{$material_code}; my $errorXml = ''; # Check if the xml, xsd exists and is validated @@ -86,8 +97,9 @@ my $launcher = sub { index => $index, result => $result, errorXml => $errorXml, + material_configuration => $material_configuration, ); output_html_with_http_headers $input, $cookie, $template->output; }; -return { builder => $builder, launcher => $launcher }; \ No newline at end of file +return { builder => $builder, launcher => $launcher }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt index 52acf80ec4..2124634efc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt @@ -17,6 +17,9 @@ h4_result = document.getElementById("h4_result"); tr_result = document.getElementById("tr_result"); objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang %]', '[% marcflavour %]'); + [% IF ( material_configuration ) %] + objXmlControlField.idMaterial = "[% material_configuration %]"; + [% END %] objXmlControlField.loadXmlValues(); renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result")); [% END %] -- 2.20.1