From db3f3f72c26361a3a99dfe4189977ff109768065 Mon Sep 17 00:00:00 2001 From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Fri, 7 May 2010 18:53:45 +0000 Subject: [PATCH] patch from James Fournie to repair some faulty assumptions in the previous legacy script SIP fix; additionally, I added legacy_script_support override option to oils_sip.xml.exmple to allow use of in-db circ-mod configs even if the circ code is still using circ scritps git-svn-id: svn://svn.open-ils.org/ILS/trunk@16404 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/oils_sip.xml.example | 5 +++++ Open-ILS/src/perlmods/OpenILS/SIP/Item.pm | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example index 3a54aacce7..16d0c3c714 100644 --- a/Open-ILS/examples/oils_sip.xml.example +++ b/Open-ILS/examples/oils_sip.xml.example @@ -101,6 +101,11 @@ <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 diff --git a/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm b/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm index 53c1fbb25e..14b34132fd 100644 --- a/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm +++ b/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm @@ -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; -- 2.11.0