[open-ils-commits] r16382 - in branches/rel_1_6/Open-ILS: examples src/perlmods/OpenILS/SIP (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon May 3 15:02:34 EDT 2010
Author: erickson
Date: 2010-05-03 15:02:30 -0400 (Mon, 03 May 2010)
New Revision: 16382
Modified:
branches/rel_1_6/Open-ILS/examples/oils_sip.xml.example
branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm
Log:
backporting 16381: updated SIP server to pull item config info from the new circ_modifier table when legacy script support is disabled
Modified: branches/rel_1_6/Open-ILS/examples/oils_sip.xml.example
===================================================================
--- branches/rel_1_6/Open-ILS/examples/oils_sip.xml.example 2010-05-03 19:00:31 UTC (rev 16381)
+++ branches/rel_1_6/Open-ILS/examples/oils_sip.xml.example 2010-05-03 19:02:30 UTC (rev 16382)
@@ -100,7 +100,13 @@
-->
<option name='msg64_summary_datatype' value='barcode' />
</options>
+
<scripts>
+ <!--
+ When legacy script support is disabled, the <script> configuration
+ is ignored. The SIP server pulls item configuration information
+ from the database instead (config.circ_modifier).
+ -->
<path>LOCALSTATEDIR/</path>
<path>LOCALSTATEDIR/catalog/</path>
<item_config>circ/circ_item_config.js</item_config>
Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm 2010-05-03 19:00:31 UTC (rev 16381)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm 2010-05-03 19:02:30 UTC (rev 16382)
@@ -79,33 +79,56 @@
return 1 if $self->{ran_script};
$self->{ran_script} = 1;
- my $config = OpenILS::SIP->config();
- my $path = $config->{implementation_config}->{scripts}->{path};
- my $item_config_script = $config->{implementation_config}->{scripts}->{item_config};
- $path = ref($path) eq 'ARRAY' ? $path : [$path];
+ if($self->{osrf_config}->config_value(
+ apps => 'open-ils.circ' => app_settings => 'legacy_script_support')) {
- syslog('LOG_DEBUG', "OILS: Script path = $path, Item config script = $item_config_script");
- my $runner =
- OpenILS::Application::Circ::ScriptBuilder->build(
- {
- copy => $self->{copy},
- editor => OpenILS::SIP->editor(),
- }
- );
+ my $config = OpenILS::SIP->config();
+ my $path = $config->{implementation_config}->{scripts}->{path};
+ my $item_config_script = $config->{implementation_config}->{scripts}->{item_config};
- $runner->add_path($_) for @$path;
- $runner->load($item_config_script);
+ $path = ref($path) eq 'ARRAY' ? $path : [$path];
- unless( $self->{item_config_result} = $runner->run ) {
- $runner->cleanup;
- warn "Item config script [$path : $item_config_script] failed to run: $@\n";
- syslog('LOG_ERR', "OILS: Item config script [$path : $item_config_script] failed to run: $@");
- return undef;
- }
+ syslog('LOG_DEBUG', "OILS: Script path = $path, Item config script = $item_config_script");
- $runner->cleanup;
+ my $runner =
+ OpenILS::Application::Circ::ScriptBuilder->build(
+ {
+ copy => $self->{copy},
+ editor => OpenILS::SIP->editor(),
+ }
+ );
+
+ $runner->add_path($_) for @$path;
+ $runner->load($item_config_script);
+
+ unless( $self->{item_config_result} = $runner->run ) {
+ $runner->cleanup;
+ warn "Item config script [$path : $item_config_script] failed to run: $@\n";
+ syslog('LOG_ERR', "OILS: Item config script [$path : $item_config_script] failed to run: $@");
+ return undef;
+ }
+
+ $runner->cleanup;
+
+ } else {
+
+ # use the in-db circ modifier configuration
+ my $config = {magneticMedia => 'f', SIPMediaType => '001'};
+ my $mod = $self->{copy}->circ_modifier;
+
+ if($mod) {
+ my $mod_obj = OpenILS::SIP->editor()->search_config_circ_modifier($mod);
+ if($mod_obj) {
+ $config->{magneticMedia} = $mod_obj->magnetic_media;
+ $config->{SIPMediaType} = $mod_obj->sip2_media_type;
+ }
+ }
+
+ $self->{item_config_result} = $config;
+ }
+
return 1;
}
More information about the open-ils-commits
mailing list