#!/usr/local/bin/perl -w # process_quick_status_update_data.pl # Process the existing status entry given the passed parameters: # 0 - cruiseid # 1 - instrument # 2 - status # 3 - record number of entry in inventory corresponding to this # status, starting at number 1. # Requests new description if necessary (i.e. for status other than # action_required). For action_required status, the description # is left intact and the status is changed to action_taken. # June 22, 1999. V1.20 Replace listgb with list. rcg # February 23, 1999. V1.10 Add link to updated data when completed. rcg # Robert C. Groman $version = "V1.20-June 22, 1999"; # Assumptions: # Only updates to existing projects in the inventory are allowed. $debug = "no"; #set to no if you want this to update the #real thing. print STDOUT <Process Quick Status Update Data

Process Quick Status Update Data

HEADING if ( $debug eq "no" ) { $datadir = "/data/rgroman/Inventory/"; $dataobj = "/globec/gb/inventory"; $webdir = "/inv"; $scriptsdir = "/data/rgroman/Inventory/scripts"; $list = "/data5/globec/bin/list -c -n -b "; } elsif ( $debug eq "yes" ) { $datadir = "/data/rgroman/Inventory/debug"; $dataobj = "/globec/gb/inventory_test"; $webdir = "/invtest"; $scriptsdir = "/data/rgroman/Inventory/scripts/debug"; $list = "/data5/globec/bin/list -c -n -b "; print STDOUT ("

DEBUG VERSION ONLY

\n"); } else { print STDOUT <Perform Quick Update of Inventory Status

I am sorry but the debug flag ($debug) is not set correctly. I cannot continue. Contact the DMO for help.

TROUBLE exit 1; } ($cruiseid,$instrument,$status,$record_number) = split /,/, $ARGV[0]; #print STDOUT ("**debug, cruiseid=$cruiseid, for instrument=", # $instrument, ", status=$status, record number=$record_number

\n"); if ($cruiseid eq "" or $instrument eq "" or $status eq "" or $record_number < 1) { print STDOUT ("

One or more values received by $0 are ", "invalid.
cruiseid=$cruiseid
\n", "instrument=$instrument
\n", "status=$status
\n", "record number=$record_number

. Contact the DMO.\n", "
\n"); exit; } $form_action = $webdir . "/doupdate-level2"; print STDOUT ("

\n"); print STDOUT ("For project/cruiseid: "); print STDOUT ("

\n"); print STDOUT ("For instrument: "); print STDOUT ("

\n"); print STDOUT ("For status: "); print STDOUT ("

\n"); # Ask for new description if status is not action_required # and then execute form, otherwise, modify level 2 data by # changing status to action_taken if ( $status ne "action_required" ) { print STDOUT ("

Enter new description here: "); print STDOUT ("

\n"); print STDOUT ("

\n"); } else { # print STDOUT ("

**debug, processing action required ...\n\n"); #Get level 2 data for specified cruiseid/project $command = $scriptsdir . "/addinventory-level2"; $restriction = "project=" . $cruiseid . ",data_type=" . $instrument . ",status,description"; $list_action = $list . " \"" . $dataobj . "(" . $restriction .")\"|"; # print STDOUT ("
**debug, list_action=$list_action
\n"); unless ( open LEVEL2, $list_action ) { print STDOUT ("

Problem accessing data for ", $cruiseid, " using the following command\n"); print STDOUT ("
$list_action
Must quite.\n"); exit 0; } @status=(); $i=0; while () { chomp; # print STDOUT ("
**debug, level2 record=$_\n"); if ( m/&x/ ) { print STDOUT ("$_
\n"); while () { print STDOUT ("$_
\n"); exit 0; } } $i++; $desc[$i] = ""; ($status[$i],@temp)=split /,/, $_; foreach $a (@temp) { $desc[$i] = $desc[$i] . $a; } $desc[$i] =~ s/^"//; $desc[$i] =~ s/"$//; } close LEVEL2; $continue = "yes"; print STDOUT ("\n

Inventory updated for description: "); for ($j=$record_number; $j<=$#desc; $j=$j+1) { # print STDOUT ("
**debug, status($j)=$status[$j]\n
"); if ($status[$j] eq $status and $continue eq "yes" ) { print STDOUT ("$desc[$j]
\n"); $desc[$j] =~ s/ /%/g; $desc[$j] =~ s/>/]/g; $desc[$j] =~ s/\n"); print STDOUT ("A new status line for \"action taken\" has been", " added with this description.\n"); $url = "/jg/serv" . $dataobj . ".html1?project=$cruiseid"; print STDOUT ("

To verify the updates click here to view $cruiseid data"); } print STDOUT ("

\n"); # Locate proper description based on record number and replace status as # appropriate print STDOUT ("


Last modified: $version\n"); print STDOUT ("\n \n");