[open-ils-commits] r16597 - in trunk: Open-ILS/src/perlmods/OpenILS Open-ILS/src/perlmods/OpenILS/SIP Open-ILS/src/perlmods/OpenILS/Utils Open-ILS/src/sql/Pg/upgrade Open-ILS/src/support-scripts build/tools (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jun 4 16:53:29 EDT 2010


Author: erickson
Date: 2010-06-04 16:53:23 -0400 (Fri, 04 Jun 2010)
New Revision: 16597

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Event.pm
   trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm
   trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm
   trunk/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm
   trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/Cronscript.pm
   trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql
   trunk/Open-ILS/src/support-scripts/settings-tester.pl
   trunk/build/tools/script_x_check.sh
Log:
Lots of cleanup, logging improvements, and comments.

One arrayref accessor updated to recommended style

Removed unused dependency.

Removed never-possible return statement.

Trying to use an arrayref in the log message results in a string like "ARRAY(0x2541870)".
I added a prebuilt string representation of the array for use in those messages.

More whitespace cleanup.
More flexible to_bool, extra comments;
Also added institution_id method.

Note: OpenILS::Event->new returns a hash, not a true object.

script_x_check.sh is executable.
Irony: this script could have been used to detect itself.

Typo in Cronscript POD.

Signed-off-by: Joe Atzberger <atz at esilibrary.com>

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Event.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Event.pm	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Event.pm	2010-06-04 20:53:23 UTC (rev 16597)
@@ -7,7 +7,7 @@
 my $logger = "OpenSRF::Utils::Logger";
 
 
-# Creates a new Event object.  
+# Returns a new Event data hash (not a blessed object)
 # The first param is the event name
 # Following the first param is an optional hash of params:
 #		perm => the name of the permission error for permimssion errors
@@ -16,37 +16,38 @@
 
 
 my $events = undef;
-my $descs = undef;
+my $descs  = undef;
 
 sub new {
-	my( $class, $event, %params ) = @_;
-	_load_events() unless $events;
+    my( $class, $event, %params ) = @_;
+    _load_events() unless $events;
 
-	throw OpenSRF::EX ("Bad event name: $event") unless $event;
-	my $e = $events->{$event} || '';
+    throw OpenSRF::EX ("Bad event name: $event") unless $event;
+    my $e = $events->{$event} || '';
 
-	my( $m, $f, $l ) = caller(0);
-	my( $mm, $ff, $ll ) = caller(1);
-	my( $mmm, $fff, $lll ) = caller(2);
+    my(   $m,   $f,   $l ) = caller(0);
+    my(  $mm,  $ff,  $ll ) = caller(1);
+    my( $mmm, $fff, $lll ) = caller(2);
 
-	$f  ||= "";
-	$l  ||= "";
-	$ff ||= "";
-	$ll ||= "";
-	$fff ||= "";
-	$lll ||= "";
+    $f   ||= "";
+    $l   ||= "";
+    $ff  ||= "";
+    $ll  ||= "";
+    $fff ||= "";
+    $lll ||= "";
 
-	my $lang = 'en-US'; # assume english for now
+    my $lang = 'en-US'; # assume english for now
 
-	my $t = CORE::localtime();
+    my $t = CORE::localtime();
 
-	return { 
-		ilsevent		=> $e, 
-		textcode		=> $event, 
-		stacktrace	=> "$f:$l $ff:$ll $fff:$lll", 
-		desc			=> $descs->{$lang}->{$e} || '',
-		servertime	=> $t,
-		pid			=> $$, %params };
+    return { 
+        ilsevent   => $e, 
+        textcode   => $event, 
+        stacktrace => "$f:$l $ff:$ll $fff:$lll", 
+        desc       => $descs->{$lang}->{$e || ''} || '',
+        servertime => $t,
+        pid        => $$, %params
+    };
 }
 
 sub _load_events {
@@ -86,6 +87,4 @@
 }
 
 
-
-
 1;

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm	2010-06-04 20:53:23 UTC (rev 16597)
@@ -7,7 +7,7 @@
 use OpenILS::SIP::Transaction;
 use OpenILS::Application::AppUtils;
 use OpenILS::Application::Circ::ScriptBuilder;
-use Data::Dumper;
+# use Data::Dumper;
 use OpenILS::Const qw/:const/;
 use OpenSRF::Utils qw/:datetime/;
 use DateTime::Format::ISO8601;
@@ -21,12 +21,12 @@
     my $type = ref($class) || $class;
     my $self = bless( {}, $type );
 
-	syslog('LOG_DEBUG', "OILS: Loading item $item_id...");
-	return undef unless $item_id;
+    syslog('LOG_DEBUG', "OILS: Loading item $item_id...");
+    return undef unless $item_id;
 
-	my $e = OpenILS::SIP->editor();
+    my $e = OpenILS::SIP->editor();
 
-	my $copy = $e->search_asset_copy(
+    my $copy = $e->search_asset_copy(
 		[
 			{ barcode => $item_id, deleted => 'f' },
 			{
@@ -37,10 +37,10 @@
 				}
 			}
 		]
-	);
+    );
 
 
-	$copy = $$copy[0];
+    $copy = $copy->[0];
 
 	if(!$copy) {
 		syslog("LOG_DEBUG", "OILS: Item '%s' : not found", $item_id);
@@ -57,20 +57,20 @@
 			]
 		);
 
-		my $bc = ($user) ? $user->card->barcode : "";
-		$self->{patron} = $bc;
-		$self->{patron_object} = $user;
+        my $bc = ($user) ? $user->card->barcode : "";
+        $self->{patron} = $bc;
+        $self->{patron_object} = $user;
 
-		syslog('LOG_DEBUG', "OILS: Open circulation exists on $item_id : user = $bc");
-	}
+        syslog('LOG_DEBUG', "OILS: Open circulation exists on $item_id : user = $bc");
+    }
 
-	$self->{id}			= $item_id;
-	$self->{copy}		= $copy;
-	$self->{volume}	= $copy->call_number;
-	$self->{record}	= $copy->call_number->record;
-	$self->{mods}		= $U->record_to_mvr($self->{record}) if $self->{record}->marc;
+    $self->{id}     = $item_id;
+    $self->{copy}   = $copy;
+    $self->{volume} = $copy->call_number;
+    $self->{record} = $copy->call_number->record;
+    $self->{mods}   = $U->record_to_mvr($self->{record}) if $self->{record}->marc;
 
-	syslog("LOG_DEBUG", "OILS: Item('$item_id'): found with title '%s'", $self->title_id);
+    syslog("LOG_DEBUG", "OILS: Item('$item_id'): found with title '%s'", $self->title_id);
 
     my $config = OpenILS::SIP->config();
 
@@ -83,7 +83,7 @@
                 apps => 'open-ils.circ' => app_settings => 'legacy_script_support')
     }
 
-	return $self;
+    return $self;
 }
 
 sub run_attr_script {
@@ -94,28 +94,26 @@
     if($self->{legacy_script_support}){
 
         my $config = OpenILS::SIP->config();
-        my $path = $config->{implementation_config}->{scripts}->{path};
+        my $path               = $config->{implementation_config}->{scripts}->{path};
         my $item_config_script = $config->{implementation_config}->{scripts}->{item_config};
 
         $path = ref($path) eq 'ARRAY' ? $path : [$path];
+        my $path_str = join(", ", @$path);
 
-        syslog('LOG_DEBUG', "OILS: Script path = $path, Item config script = $item_config_script");
+        syslog('LOG_DEBUG', "OILS: Script path = [$path_str], Item config script = $item_config_script");
 
-        my $runner = 
-            OpenILS::Application::Circ::ScriptBuilder->build(
-                {
-                    copy => $self->{copy},
-                    editor => OpenILS::SIP->editor(),
-                }
-            );
+        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 ) {
+        unless( $self->{item_config_result} = $runner->run ) {      # assignment, not comparison
             $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: $@");
+            warn "Item config script [$path_str : $item_config_script] failed to run: $@\n";
+            syslog('LOG_ERR', "OILS: Item config script [$path_str : $item_config_script] failed to run: $@");
             return undef;
         }
 
@@ -124,14 +122,14 @@
     } else {
 
         # use the in-db circ modifier configuration 
-        my $config = {magneticMedia => 'f', SIPMediaType => '001'};
+        my $config = {magneticMedia => 'f', SIPMediaType => '001'};     # defaults
         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;
+                $config->{SIPMediaType}  = $mod_obj->sip2_media_type;
             }
         }
 
@@ -143,26 +141,26 @@
 
 sub magnetic {
     my $self = shift;
-	 return 0 unless $self->run_attr_script;
-	 my $mag = $self->{item_config_result}->{item_config}->{magneticMedia};
-	 syslog('LOG_DEBUG', "OILS: magnetic = $mag");
-	 return ($mag and $mag eq 't') ? 1 : 0;
+    return 0 unless $self->run_attr_script;
+    my $mag = $self->{item_config_result}->{item_config}->{magneticMedia};
+    syslog('LOG_DEBUG', "OILS: magnetic = $mag");
+    return ($mag and $mag eq 't') ? 1 : 0;
 }
 
 sub sip_media_type {
     my $self = shift;
-	 return 0 unless $self->run_attr_script;
-	 my $media = $self->{item_config_result}->{item_config}->{SIPMediaType};
-	 syslog('LOG_DEBUG', "OILS: media type = $media");
-	 return ($media) ? $media : '001';
+    return 0 unless $self->run_attr_script;
+    my $media = $self->{item_config_result}->{item_config}->{SIPMediaType};
+    syslog('LOG_DEBUG', "OILS: media type = $media");
+    return ($media) ? $media : '001';
 }
 
 sub sip_item_properties {
     my $self = shift;
-	 return "";
+    return "";
 }
 
-sub status_update {
+sub status_update {     # FIXME: this looks unimplemented
     my ($self, $props) = @_;
     my $status = OpenILS::SIP::Transaction->new;
     $self->{sip_item_properties} = $props;
@@ -210,33 +208,33 @@
 # 12 Lost
 # 13 Missing 
 sub sip_circulation_status {
-	my $self = shift;
-	my $stat = $self->{copy}->status->id;
+    my $self = shift;
+    my $stat = $self->{copy}->status->id;
 
-	return '02' if $stat == OILS_COPY_STATUS_ON_ORDER;
-	return '03' if $stat == OILS_COPY_STATUS_AVAILABLE;
-	return '04' if $stat == OILS_COPY_STATUS_CHECKED_OUT;
-	return '06' if $stat == OILS_COPY_STATUS_IN_PROCESS;
-	return '08' if $stat == OILS_COPY_STATUS_ON_HOLDS_SHELF;
-	return '09' if $stat == OILS_COPY_STATUS_RESHELVING;
-	return '10' if $stat == OILS_COPY_STATUS_IN_TRANSIT;
-	return '12' if $stat == OILS_COPY_STATUS_LOST;
-	return '13' if $stat == OILS_COPY_STATUS_MISSING;
-		
-	return 01;
+    return '02' if $stat == OILS_COPY_STATUS_ON_ORDER;
+    return '03' if $stat == OILS_COPY_STATUS_AVAILABLE;
+    return '04' if $stat == OILS_COPY_STATUS_CHECKED_OUT;
+    return '06' if $stat == OILS_COPY_STATUS_IN_PROCESS;
+    return '08' if $stat == OILS_COPY_STATUS_ON_HOLDS_SHELF;
+    return '09' if $stat == OILS_COPY_STATUS_RESHELVING;
+    return '10' if $stat == OILS_COPY_STATUS_IN_TRANSIT;
+    return '12' if $stat == OILS_COPY_STATUS_LOST;
+    return '13' if $stat == OILS_COPY_STATUS_MISSING;
+        
+    return 01;
 }
 
 sub sip_security_marker {
-    return '02';
+    return '02';    # FIXME? 00-other; 01-None; 02-Tattle-Tape Security Strip (3M); 03-Whisper Tape (3M)
 }
 
 sub sip_fee_type {
-    return '01';
+    return '01';    # FIXME? 01-09 enumerated in spec.  We just use O1-other/unknown.
 }
 
 sub fee {
     my $self = shift;
-	 return 0;
+    return 0;
 }
 
 
@@ -252,35 +250,35 @@
 
 sub hold_queue {
     my $self = shift;
-	 return [];
+    return [];
 }
 
 sub hold_queue_position {
     my ($self, $patron_id) = @_;
-	 return 1;
+    return 1;
 }
 
 sub due_date {
-	my $self = shift;
+    my $self = shift;
 
-	# this should force correct circ fetching
-	require OpenILS::Utils::CStoreEditor;
-	my $e = OpenILS::Utils::CStoreEditor->new(xact => 1);
-	#my $e = OpenILS::SIP->editor();
+    # this should force correct circ fetching
+    require OpenILS::Utils::CStoreEditor;
+    my $e = OpenILS::Utils::CStoreEditor->new(xact => 1);
+    #my $e = OpenILS::SIP->editor();
 
-	my $circ = $e->search_action_circulation(
-		{ target_copy => $self->{copy}->id, checkin_time => undef } )->[0];
+    my $circ = $e->search_action_circulation(
+        { target_copy => $self->{copy}->id, checkin_time => undef } )->[0];
 
-	$e->rollback;
+    $e->rollback;
 
-	if( !$circ ) {
-		syslog('LOG_INFO', "OILS: No open circ found for copy");
-		return 0;
-	}
+    if( !$circ ) {
+        syslog('LOG_INFO', "OILS: No open circ found for copy");
+        return 0;
+    }
 
-	my $due = OpenILS::SIP->format_date($circ->due_date, 'due');
-	syslog('LOG_DEBUG', "OILS: Found item due date = $due");
-	return $due;
+    my $due = OpenILS::SIP->format_date($circ->due_date, 'due');
+    syslog('LOG_DEBUG', "OILS: Found item due date = $due");
+    return $due;
 }
 
 sub recall_date {
@@ -290,7 +288,7 @@
 
 sub hold_pickup_date {
     my $self = shift;
-	 return 0;
+    return 0;
 }
 
 # message to display on console
@@ -302,8 +300,8 @@
 
 # reciept printer
 sub print_line {
-     my $self = shift;
-     return OpenILS::SIP::clean_text($self->{print_line}) || '';
+    my $self = shift;
+    return OpenILS::SIP::clean_text($self->{print_line}) || '';
 }
 
 
@@ -313,14 +311,14 @@
 # OR
 # 2) It's checked out to the patron and there's no hold queue
 sub available {
-	my ($self, $for_patron) = @_;
+    my ($self, $for_patron) = @_;
 
-	my $stat = $self->{copy}->status->id;
-	return 1 if 
-		$stat == OILS_COPY_STATUS_AVAILABLE or
-		$stat == OILS_COPY_STATUS_RESHELVING;
-	
-	return 0;
+    my $stat = $self->{copy}->status->id;
+    return 1 if 
+        $stat == OILS_COPY_STATUS_AVAILABLE or
+        $stat == OILS_COPY_STATUS_RESHELVING;
+
+    return 0;
 }
 
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm	2010-06-04 20:53:23 UTC (rev 16597)
@@ -29,6 +29,11 @@
 
 my $INET_PRIVS;
 
+#
+# OpenILS::SIP::Patron->new($barcode);
+# OpenILS::SIP::Patron->new(barcode => $barcode);   # same as above
+# OpenILS::SIP::Patron->new(    usr => $id);       
+
 sub new {
     my ($class, $patron_id) = @_;
     my $type = ref($class) || $class;
@@ -73,9 +78,9 @@
 		return undef;
 	 }
 
-	$self->{user}		= $user;
-	$self->{id}			= $patron_id;
-	$self->{editor}	= $e;
+	$self->{user}   = $user;
+	$self->{id}     = $patron_id;
+	$self->{editor} = $e;
 
 	syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s): found patron : barred=%s, card:active=%s", 
 		$patron_id, $self->{user}->barred, $self->{user}->card->active );
@@ -118,10 +123,8 @@
 
 sub address {
 	my $self = shift;
-	my $u = $self->{user};
-	my $addr = $u->billing_address;
-	$addr = $u->mailing_address unless $addr;
-	my $str = __addr_string($addr);
+	my $u    = $self->{user};
+	my $str  = __addr_string($u->billing_address || $u->mailing_address);
 	syslog('LOG_DEBUG', "OILS: Patron address: $str");
 	return $str;
 }
@@ -265,19 +268,19 @@
 # not completely sure what this means
 sub too_many_renewal {
     my $self = shift;
-	return 0;
+    return 0;
 }
 
 # not relevant, handled by fines/fees
 sub too_many_claim_return {
     my $self = shift;
-	return 0;
+    return 0;
 }
 
 # not relevant, handled by fines/fees
 sub too_many_lost {
     my $self = shift;
-	return 0;
+    return 0;
 }
 
 sub excessive_fines {
@@ -495,7 +498,7 @@
 # not currently supported
 sub recall_items {
     my ($self, $start, $end) = @_;
-	 return [];
+    return [];
 }
 
 sub unavail_holds {
@@ -567,13 +570,13 @@
 }
 
 sub inet_privileges {
-	my( $self ) = @_;
-	my $e = OpenILS::SIP->editor();
-	$INET_PRIVS = $e->retrieve_all_config_net_access_level() unless $INET_PRIVS;
-	my ($level) = grep { $_->id eq $self->{user}->net_access_level } @$INET_PRIVS;
-	my $name = OpenILS::SIP::clean_text($level->name);
-	syslog('LOG_DEBUG', "OILS: Patron inet_privs = $name");
-	return $name;
+    my( $self ) = @_;
+    my $e = OpenILS::SIP->editor();
+    $INET_PRIVS = $e->retrieve_all_config_net_access_level() unless $INET_PRIVS;
+    my ($level) = grep { $_->id eq $self->{user}->net_access_level } @$INET_PRIVS;
+    my $name = OpenILS::SIP::clean_text($level->name);
+    syslog('LOG_DEBUG', "OILS: Patron inet_privs = $name");
+    return $name;
 }
 
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction.pm	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction.pm	2010-06-04 20:53:23 UTC (rev 16597)
@@ -13,20 +13,20 @@
 
 
 my %fields = (
-	      ok            => 0,
-	      patron        => undef,
-	      item          => undef,
-	      desensitize   => 0,
-	      alert         => '',
-	      transation_id => undef,
-	      sip_fee_type  => '01', # Other/Unknown
-	      fee_amount    => undef,
-	      sip_currency  => 'CAD',
-	      screen_msg    => '',
-	      print_line    => '',
-			editor			=> undef,
-			authtoken		=> '',
-	      );
+      ok            => 0,
+      patron        => undef,
+      item          => undef,
+      desensitize   => 0,
+      alert         => '',
+      transation_id => undef,
+      sip_fee_type  => '01', # Other/Unknown
+      fee_amount    => undef,
+      sip_currency  => 'CAD',
+      screen_msg    => '',
+      print_line    => '',
+      editor        => undef,
+      authtoken     => '',
+);
 
 our $AUTOLOAD;
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm	2010-06-04 20:53:23 UTC (rev 16597)
@@ -41,12 +41,12 @@
 	syslog("LOG_DEBUG", "OILS: new ILS '%s'", $institution->{id});
 	$self->{institution} = $institution;
 
-	my $bsconfig = $institution->{implementation_config}->{bootstrap};
+	my $bsconfig     = $institution->{implementation_config}->{bootstrap};
 	$target_encoding = $institution->{implementation_config}->{encoding} || 'ascii';
 
 	syslog('LOG_DEBUG', "OILS: loading bootstrap config: $bsconfig");
 	
-	local $/ = "\n";
+	local $/ = "\n";    # why?
 	OpenSRF::System->bootstrap_client(config_file => $bsconfig);
 	syslog('LOG_DEBUG', "OILS: bootstrap loaded..");
 
@@ -72,11 +72,6 @@
 	return $self->login( $self->{login}->{id}, $self->{login}->{password} );
 }
 
-sub to_bool {
-	my $val = shift;
-	return ($val and $val =~ /true/io);
-}
-
 sub editor {
 	return $editor = make_editor();
 }
@@ -147,10 +142,10 @@
 		parse_datetime(OpenSRF::Utils::cleanse_ISO8601($date));
 	my @time = localtime($date->epoch);
 
-	my $year = $time[5]+1900;
-	my $mon = $time[4]+1;
-	my $day = $time[3];
- 	my $hour = $time[2];
+	my $year   = $time[5]+1900;
+	my $mon    = $time[4]+1;
+	my $day    = $time[3];
+	my $hour   = $time[2];
  	my $minute = $time[1];
  	my $second = $time[0];
   
@@ -211,9 +206,14 @@
 
 sub institution {
     my $self = shift;
-    return $self->{institution}->{id};
+    return $self->{institution}->{id};  # consider making this return the whole institution
 }
 
+sub institution_id {
+    my $self = shift;
+    return $self->{institution}->{id};  # then use this for just the ID
+}
+
 sub supports {
 	my ($self, $op) = @_;
 	my ($i) = grep { $_->{name} eq $op }  
@@ -222,21 +222,29 @@
 }
 
 sub check_inst_id {
-	my ($self, $id, $whence) = @_;
-	if ($id ne $self->{institution}->{id}) {
-		syslog("LOG_WARNING", 
-			"OILS: %s: received institution '%s', expected '%s'",
-			$whence, $id, $self->{institution}->{id});
-	}
+    my ($self, $id, $whence) = @_;
+    if ($id ne $self->{institution}->{id}) {
+        syslog("LOG_WARNING", "OILS: %s: received institution '%s', expected '%s'", $whence, $id, $self->{institution}->{id});
+        # Just an FYI check, we don't expect the user to change location from that in SIPconfig.xml
+    }
 }
 
+
+sub to_bool {
+    my $bool = shift;
+    # If it's defined, and matches a true sort of string, or is
+    # a non-zero number, then it's true.
+    defined($bool) or return;                   # false
+    ($bool =~ /true|y|yes/i) and return 1;      # true
+    return ($bool =~ /^\d+$/ and $bool != 0);   # true for non-zero numbers, false otherwise
+}
+
 sub checkout_ok {
 	return to_bool($config->{policy}->{checkout});
 }
 
 sub checkin_ok {
 	return to_bool($config->{policy}->{checkin});
-    return 0;
 }
 
 sub renew_ok {
@@ -267,13 +275,13 @@
 	$sc_renew = 0;
 
 	$self->verify_session;
-	
+
 	syslog('LOG_DEBUG', "OILS: OpenILS::Checkout attempt: patron=$patron_id, item=$item_id");
-	
-	my $xact		= OpenILS::SIP::Transaction::Checkout->new( authtoken => $self->{authtoken} );
-	my $patron	= $self->find_patron($patron_id);
-	my $item		= $self->find_item($item_id);
-	
+
+    my $xact   = OpenILS::SIP::Transaction::Checkout->new( authtoken => $self->{authtoken} );
+    my $patron = $self->find_patron($patron_id);
+    my $item   = $self->find_item($item_id);
+
 	$xact->patron($patron);
 	$xact->item($item);
 
@@ -332,9 +340,9 @@
 
 	syslog('LOG_DEBUG', "OILS: OpenILS::Checkin on item=$item_id");
 	
-	my $patron;
-	my $xact		= OpenILS::SIP::Transaction::Checkin->new(authtoken => $self->{authtoken});
-	my $item		= $self->find_item($item_id);
+    my $patron;
+    my $xact = OpenILS::SIP::Transaction::Checkin->new(authtoken => $self->{authtoken});
+    my $item = $self->find_item($item_id);
 
 	$xact->item($item);
 
@@ -347,24 +355,23 @@
 	$xact->do_checkin( $trans_date, $return_date, $current_loc, $item_props );
 	
 	if ($xact->ok) {
-
-		$xact->patron($patron = $self->find_patron($item->{patron}));
-		delete $item->{patron};
-		delete $item->{due_date};
-		syslog('LOG_INFO', "OILS: Checkin succeeded");
-		#editor()->commit;
-
-	} else {
-
-		#editor()->xact_rollback;
-		syslog('LOG_WARNING', "OILS: Checkin failed");
-	}
+        $xact->patron($patron = $self->find_patron($item->{patron}));
+        delete $item->{patron};
+        delete $item->{due_date};
+        syslog('LOG_INFO', "OILS: Checkin succeeded");
+        #editor()->commit;
+    } else {
+        #editor()->xact_rollback;
+        syslog('LOG_WARNING', "OILS: Checkin failed");
+    }
 	# END TRANSACTION
 
 	return $xact;
 }
 
-## If the ILS caches patron information, this lets it free it up
+## If the ILS caches patron information, this lets it free it up.
+## Also, this could be used for centrally logging session duration.
+## We don't do anything with it.
 sub end_patron_session {
     my ($self, $patron_id) = @_;
     return (1, 'Thank you for using OpenILS!', '');

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/Cronscript.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/Cronscript.pm	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/Cronscript.pm	2010-06-04 20:53:23 UTC (rev 16597)
@@ -305,7 +305,7 @@
 
     my $core = OpenILS::Utils::Cronscript->new(\%defaults);
     my $opts = $core->MyGetOptions();   # options now in, e.g.: $opts->{max}
-    $ocre->bootstrap;
+    $core->bootstrap;
 
 Or if you don't need any additional options and just want to get a session going:
     

Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql	2010-06-04 20:53:23 UTC (rev 16597)
@@ -8,6 +8,9 @@
 -- initialize it with something if the table is not empty.  The initial
 -- value, 'ORDERS', may not always be appropriate.  Massage as needed.
 
+-- For example, if you have already processed responses, this fixes them:
+-- update acq.edi_message set message_type='ORDRSP' where edi LIKE '%ORDRSP%';
+
 ALTER TABLE acq.edi_message
 	ADD COLUMN message_type TEXT;
 

Modified: trunk/Open-ILS/src/support-scripts/settings-tester.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/settings-tester.pl	2010-06-04 20:53:22 UTC (rev 16596)
+++ trunk/Open-ILS/src/support-scripts/settings-tester.pl	2010-06-04 20:53:23 UTC (rev 16597)
@@ -3,6 +3,8 @@
 use strict;
 use warnings;
 
+#FIXME: use Test::More or any kind of Test module instead of eval/die if
+
 BEGIN {
 	eval "use OpenSRF::Utils::Config;";
 	die "Please ensure that /openils/lib/perl5 is in your PERL5LIB environment variable.

Modified: trunk/build/tools/script_x_check.sh
===================================================================


Property changes on: trunk/build/tools/script_x_check.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the open-ils-commits mailing list