patch from James Fournie to repair some faulty assumptions in the previous legacy...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 7 May 2010 18:53:45 +0000 (18:53 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 7 May 2010 18:53:45 +0000 (18:53 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16404 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/oils_sip.xml.example
Open-ILS/src/perlmods/OpenILS/SIP/Item.pm

index 3a54aac..16d0c3c 100644 (file)
                                        <option name='msg64_summary_datatype' value='barcode' />
                                </options>
 
+                <!-- If uncommented, overrides the legacy_script_support value in opensrf.xml for SIP. -->
+                <!--
+                <legacy_script_support>false</legacy_script_support>
+                -->
+
                                <scripts>
                     <!-- 
                         When legacy script support is disabled, the <script> configuration
index 53c1fbb..14b3413 100644 (file)
@@ -11,6 +11,7 @@ use Data::Dumper;
 use OpenILS::Const qw/:const/;
 use OpenSRF::Utils qw/:datetime/;
 use DateTime::Format::ISO8601;
+use OpenSRF::Utils::SettingsClient;
 my $U = 'OpenILS::Application::AppUtils';
 
 my %item_db;
@@ -71,6 +72,17 @@ sub new {
 
        syslog("LOG_DEBUG", "OILS: Item('$item_id'): found with title '%s'", $self->title_id);
 
+    my $config = OpenILS::SIP->config();
+
+    if( defined $config->{implementation_config}->{legacy_script_support} ) {
+        $self->{legacy_script_support} = 
+            ($config->{implementation_config}->{legacy_script_support} =~ /true/io);
+    } else {
+        $self->{legacy_script_support} = 
+            OpenSRF::Utils::SettingsClient->new->config_value(
+                apps => 'open-ils.circ' => app_settings => 'legacy_script_support')
+    }
+
        return $self;
 }
 
@@ -79,10 +91,7 @@ sub run_attr_script {
        return 1 if $self->{ran_script};
        $self->{ran_script} = 1;
 
-
-    if($self->{osrf_config}->config_value(
-        apps => 'open-ils.circ' => app_settings => 'legacy_script_support')) {
-
+    if($self->{legacy_script_support}){
 
         my $config = OpenILS::SIP->config();
         my $path = $config->{implementation_config}->{scripts}->{path};
@@ -126,7 +135,7 @@ sub run_attr_script {
             }
         }
 
-        $self->{item_config_result} = $config;
+        $self->{item_config_result} = { item_config => $config };
     }
 
        return 1;