Lots of cleanup, logging improvements, and comments.
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Jun 2010 20:53:23 +0000 (20:53 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Jun 2010 20:53:23 +0000 (20:53 +0000)
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@esilibrary.com>

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16597 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Event.pm
Open-ILS/src/perlmods/OpenILS/SIP.pm
Open-ILS/src/perlmods/OpenILS/SIP/Item.pm
Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm
Open-ILS/src/perlmods/OpenILS/SIP/Transaction.pm
Open-ILS/src/perlmods/OpenILS/Utils/Cronscript.pm
Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql
Open-ILS/src/support-scripts/settings-tester.pl
build/tools/script_x_check.sh [changed mode: 0644->0755]

index 5d5708e..64837b0 100644 (file)
@@ -7,7 +7,7 @@ use OpenSRF::Utils::Logger;
 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 $logger = "OpenSRF::Utils::Logger";
 
 
 my $events = undef;
-my $descs = undef;
+my $descs  = undef;
 
 sub new {
-       my( $class, $event, %params ) = @_;
-       _load_events() unless $events;
-
-       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);
-
-       $f  ||= "";
-       $l  ||= "";
-       $ff ||= "";
-       $ll ||= "";
-       $fff ||= "";
-       $lll ||= "";
-
-       my $lang = 'en-US'; # assume english for now
-
-       my $t = CORE::localtime();
-
-       return { 
-               ilsevent                => $e, 
-               textcode                => $event, 
-               stacktrace      => "$f:$l $ff:$ll $fff:$lll", 
-               desc                    => $descs->{$lang}->{$e} || '',
-               servertime      => $t,
-               pid                     => $$, %params };
+    my( $class, $event, %params ) = @_;
+    _load_events() unless $events;
+
+    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);
+
+    $f   ||= "";
+    $l   ||= "";
+    $ff  ||= "";
+    $ll  ||= "";
+    $fff ||= "";
+    $lll ||= "";
+
+    my $lang = 'en-US'; # assume english for now
+
+    my $t = CORE::localtime();
+
+    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 @@ sub _load_events {
 }
 
 
-
-
 1;
index 8afa752..829556e 100644 (file)
@@ -41,12 +41,12 @@ sub new {
        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 @@ sub verify_session {
        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 @@ sub format_date {
                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,7 +206,12 @@ sub find_item {
 
 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 {
@@ -222,12 +222,21 @@ sub supports {
 }
 
 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 {
@@ -236,7 +245,6 @@ sub checkout_ok {
 
 sub checkin_ok {
        return to_bool($config->{policy}->{checkin});
-    return 0;
 }
 
 sub renew_ok {
@@ -267,13 +275,13 @@ sub checkout {
        $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 @@ sub checkin {
 
        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 @@ sub checkin {
        $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!', '');
index 14b3413..3a49237 100644 (file)
@@ -7,7 +7,7 @@ use OpenILS::SIP;
 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 @@ sub new {
     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 @@ sub new {
                                }
                        }
                ]
-       );
+    );
 
 
-       $copy = $$copy[0];
+    $copy = $copy->[0];
 
        if(!$copy) {
                syslog("LOG_DEBUG", "OILS: Item '%s' : not found", $item_id);
@@ -57,20 +57,20 @@ sub new {
                        ]
                );
 
-               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 @@ sub new {
                 apps => 'open-ils.circ' => app_settings => 'legacy_script_support')
     }
 
-       return $self;
+    return $self;
 }
 
 sub run_attr_script {
@@ -94,28 +94,26 @@ sub run_attr_script {
     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 @@ sub run_attr_script {
     } 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 run_attr_script {
 
 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 @@ sub current_location {
 # 12 Lost
 # 13 Missing 
 sub sip_circulation_status {
-       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;
+    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;
 }
 
 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 owner {
 
 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 recall_date {
 
 sub hold_pickup_date {
     my $self = shift;
-        return 0;
+    return 0;
 }
 
 # message to display on console
@@ -302,8 +300,8 @@ sub screen_msg {
 
 # 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 @@ sub print_line {
 # OR
 # 2) It's checked out to the patron and there's no hold queue
 sub available {
-       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 ($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;
 }
 
 
index 9f84e65..c003eb3 100644 (file)
@@ -29,6 +29,11 @@ our (@ISA, @EXPORT_OK);
 
 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 @@ sub new {
                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 __addr_string {
 
 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 @@ sub too_many_overdue {
 # 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 @@ sub fine_items {
 # not currently supported
 sub recall_items {
     my ($self, $start, $end) = @_;
-        return [];
+    return [];
 }
 
 sub unavail_holds {
@@ -567,13 +570,13 @@ sub charge_denied {
 }
 
 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;
 }
 
 
index 3d91dd2..eeb9faf 100644 (file)
@@ -13,20 +13,20 @@ use OpenILS::SIP::Msg qw/:const/;
 
 
 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;
 
index 89b3cd9..4697ec7 100644 (file)
@@ -305,7 +305,7 @@ OpenILS::Utils::Cronscript - Consolidated options handling for any script (not j
 
     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:
     
index 9bc66e4..4f33ce1 100644 (file)
@@ -8,6 +8,9 @@ INSERT INTO config.upgrade_log (version) VALUES ('0264'); -- Scott McKellar
 -- 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;
 
index 3a2c4ac..b3b3f4d 100755 (executable)
@@ -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.
old mode 100644 (file)
new mode 100755 (executable)