From 8e649e575fcdc62d7949a879171cad343d263869 Mon Sep 17 00:00:00 2001
From: Galen Charlton <gmc@esilibrary.com>
Date: Mon, 15 Jul 2013 15:00:57 +0000
Subject: [PATCH] bug 10592: fix MARC21 006/008 cataloging plugins

Move the XML and XSD data files so that access to them
(particularly the XML files) is not blocked by the Apache
configuration change introduced by the patch for bug 9812.

To test, after applying the patch.

[1] Open a MARC21 bibliographic record in the cataloging editor.
[2] Click on the plugin link for the 008 field.  Verify that
    that the form for all of the fixed field positions is displayed,
    and verify that you can change the type of material.
[3] Repeat step 2 for the 006 field.
[4] Verify that there are no entries in the Apache error log that contain

client denied by server configuration: {...}/cataloguing/value_builder/marc21_field_008.xml

or

client denied by server configuration: {...}/cataloguing/value_builder/marc21_field_006.xml

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
---
 cataloguing/value_builder/marc21_field_006.pl                           | 2 +-
 cataloguing/value_builder/marc21_field_008.pl                           | 2 +-
 .../en/{modules/cataloguing/value_builder => data}/marc21_field_006.xml | 0
 .../en/{modules/cataloguing/value_builder => data}/marc21_field_008.xml | 0
 .../en/{modules/cataloguing/value_builder => data}/marc21_field_CF.xsd  | 0
 koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js                   | 2 +-
 6 files changed, 3 insertions(+), 3 deletions(-)
 rename koha-tmpl/intranet-tmpl/prog/en/{modules/cataloguing/value_builder => data}/marc21_field_006.xml (100%)
 rename koha-tmpl/intranet-tmpl/prog/en/{modules/cataloguing/value_builder => data}/marc21_field_008.xml (100%)
 rename koha-tmpl/intranet-tmpl/prog/en/{modules/cataloguing/value_builder => data}/marc21_field_CF.xsd (100%)

diff --git a/cataloguing/value_builder/marc21_field_006.pl b/cataloguing/value_builder/marc21_field_006.pl
index 7b55a0a..bba0c5f 100755
--- a/cataloguing/value_builder/marc21_field_006.pl
+++ b/cataloguing/value_builder/marc21_field_006.pl
@@ -86,7 +86,7 @@ sub plugin {
 
     my $errorXml = '';
     # Check if the xml, xsd exists and is validated
-    my $dir = C4::Context->config('intrahtdocs') . '/prog/' . $template->{lang} . '/modules/cataloguing/value_builder/';
+    my $dir = C4::Context->config('intrahtdocs') . '/prog/' . $template->{lang} . '/data/';
     if (-r $dir . 'marc21_field_006.xml') {
         my $doc = XML::LibXML->new->parse_file($dir . 'marc21_field_006.xml');
         if (-r $dir . 'marc21_field_CF.xsd') {
diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl
index e6e9af1..6fbb3d1 100755
--- a/cataloguing/value_builder/marc21_field_008.pl
+++ b/cataloguing/value_builder/marc21_field_008.pl
@@ -106,7 +106,7 @@ sub plugin {
     $result = "$dateentered" . "b        xxu||||| |||| 00| 0 $lang d" unless $result;
     my $errorXml = '';
     # Check if the xml, xsd exists and is validated
-    my $dir = C4::Context->config('intrahtdocs') . '/prog/' . $template->{lang} . '/modules/cataloguing/value_builder/';
+    my $dir = C4::Context->config('intrahtdocs') . '/prog/' . $template->{lang} . '/data/';
     if (-r $dir . 'marc21_field_008.xml') {
         my $doc = XML::LibXML->new->parse_file($dir . 'marc21_field_008.xml');
         if (-r $dir . 'marc21_field_CF.xsd') {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.xml b/koha-tmpl/intranet-tmpl/prog/en/data/marc21_field_006.xml
similarity index 100%
rename from koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.xml
rename to koha-tmpl/intranet-tmpl/prog/en/data/marc21_field_006.xml
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.xml b/koha-tmpl/intranet-tmpl/prog/en/data/marc21_field_008.xml
similarity index 100%
rename from koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.xml
rename to koha-tmpl/intranet-tmpl/prog/en/data/marc21_field_008.xml
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_CF.xsd b/koha-tmpl/intranet-tmpl/prog/en/data/marc21_field_CF.xsd
similarity index 100%
rename from koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_CF.xsd
rename to koha-tmpl/intranet-tmpl/prog/en/data/marc21_field_CF.xsd
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js
index eccdba4..c02e700 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js
@@ -205,7 +205,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value)
         {
             this.xmlDoc = $.ajax({
                 type: "GET",
-                url: this.themelang + "/modules/cataloguing/value_builder/marc21_field_" + this.tagfield + ".xml",
+                url: this.themelang + "/data/marc21_field_" + this.tagfield + ".xml",
                 dataType: "xml",
                 async: false
             }).responseXML;
-- 
1.8.3.1