$self_name $item_id\n"; echo "
\n" ."\n" ."\n" ."\n" ."\n" ."\n" ."\n" ."\n" ##---------------- ."\n\n" ##---------------- . ($modstr ? "\n" : "" ) ##---------------- . ($comment ? "\n" : "" ) ##---------------- ."\n
\n" ."\n" ."\n" ."\n" ."\n" ."\n" ."\n" ."\n" . $modstr ."
You want to changefromtowork date
\n" ."
". "

Your comment is:

\n"
			 ."$comment

\n" ."
\n" ##---------------- . ($errflag ? "" : "\n" ) ."\n" .' OR Press the Back button of your browser' .' to edit your input
'; ; } else { send_html_header("$self_name $item_id"); echo "

$self_name $item_id

\n"; echo "\n" ."\n" ."\n" ."You didn't modify anything. " ."\n" ; } send_common_trailer(); exit; } ################################################################ if($confirm) { ## HTML-escape all posted data and reset vars in current scope esc_r($HTTP_POST_VARS); extract($HTTP_POST_VARS, EXTR_OVERWRITE); $err = ''; $op = 'edit_generic_cable'; if(!start_transaction($conn,$op,$scriptid,$comment)) { $err .= "Can't start transaction."; } else { ## ---------------------------------------------------------------- $sernum = make_sernum($conn, $item_id, $item_type); ## ---------------------------------------------------------------- if($comment) { $q = pg_exec( $conn, "INSERT INTO item_comment" ." (tn,sernum,workdate)" ." values" ." (currval('tn'),$sernum,'now');" ); if(!$q) { $err .= "Error setting comment.
\n"; } } ## ---------------------------------------------------------------- $res = check_change4('status', $HTTP_POST_VARS); if($res['error']) { $err .= "Error verifying 'status' vars: $res[error].
\n"; } elseif($res['diff']) { $err .= edit_set_selected( $sernum, $status, $status_date, 'status', 'statuses', 'status'); } ## ================================================================ if(!$err) { if(!pg_exec($conn, "COMMIT;")) { $err .= "Error commiting changes."; } } } ################################################################ ## Exit on a error. But, if DB is successfully modified ## just continue to display an updated page. if($err) { pg_exec($conn, "ROLLBACK;"); echo "\n" ."$err
\n" ."Database has not been modified.\n" ."\n" ."\n" ."\n" ."
\n" ; send_common_trailer(); exit; } } ################################################################ # Query DB about current item parameters ## ================================================================ ## Prepare status info $res = edit_get_status($item_id, $item_type); if($statusarr['error']) { echo "$res[error]
"; } $status = $res['status']; $status_date = $res['date']; $status_set = $res['isset']; $status_options = $res['options']; ## ================================================================ ## Is this cable connected? $res = cable_get_bases($item_type, $sernum); if($res['error']) { echo "$res[error]
"; } $cabling_lastdate = $res['last_date']; $cable_bases = $res['data']; #%# $cable_in = array(); #%# $cable_out = array(); #%# reset($cable_bases); #%# while( list($item_point, $dat) = each($cable_bases) ) { #%# if( $item_point > 10 ) { #%# $cable_out[$item_point] = $dat; #%# } #%# else { #%# $cable_in[$item_point] = $dat; #%# } #%# } ## ---------------------------------------------------------------- $comments = get_comments($sernum); ################################################################ # Display a form with current parameters as default values send_html_header("$self_name $item_id"); echo "
\n" ."

$self_name $item_id

\n" ."\n" ."\n" # -------------------------------- ."
\n" ."

Status:" ."\n" ."\n" . ($status_set? "" : "(default) " ) ." Status change date: " ."\n" ."\n" ."\n" ."

\n" # -------------------------------- ."

\n" ; $str = "\n" ."\n" ; reset($cable_bases); while(list($key, $val) = each($cable_bases)) { $str .= "" ."" .( $val['base_id'] == "" ? "" : "" ) ."\n"; } $str .= "
Cable endConnected to
$val[iname](not connected)$val[base_description] " . href2($val['base_id'], format_default_id($val['base_id'])) ."as $val[name]
\n"; echo $str; echo "In:

\n";
print_r($cable_bases);
echo "
\n"; #%# echo "In:
\n";
#%# print_r($cable_in);
#%# echo "
\n"; #%# echo "
out:
\n";
#%# print_r($cable_out);
#%# echo "
\n"; #%# #%# $in_rows = array(); #%# reset($cable_in); #%# while( list($key, $val) = each($cable_in)) { #%# if($val['base_id'] == "") #%# continue; #%# $in_rows[] = "$val[name] at $val[base_description] " #%# . format_default_id($val['base_id']) #%# ."$val[iname]"; #%# } #%# if(count($in_rows) == 0) { #%# $in_rows[] = "not connected"; #%# } #%# #%# $out_rows = array(); #%# reset($cable_out); #%# while( list($key, $val) = each($cable_out)) { #%# if($val['base_id'] == "") #%# continue; #%# $out_rows[] = "$val[name] at $val[base_description] " #%# . format_default_id($val['base_id']) #%# ."$val[iname]"; #%# } #%# if(count($out_rows) == 0) { #%# $out_rows[] = "not connected"; #%# } #%# #%# $str = "\n" #%# ."" #%# ." \n" #%# ; #%# $numrows = max(count($in_rows), count($out_rows)); #%# for($i=0; $i < $numrows; $i++) { #%# $str .= "" #%# .($in_rows[$i] != "" ? $in_rows[$i] : "") #%# .($out_rows[$i] != "" ? $out_rows[$i] : "") #%# ."\n"; #%# } #%# $str .= "
Cable inCable out
  
\n"; #%# #%# echo $str #================================================================ # . ($base_sernum ? # "Installed in " # ."\n" # ."$base_desc " # . format_default_id($base_sernum) # ."" # ." on $base_date" # : "Not installed. " # ) echo "" ."
\n" # -------------------------------- ."
\n" ."

Comment to add
\n" .' ' ."

\n" # ---------------- ."
\n" ."\n" ."\n" ."
\n" # ---------------------------------------------------------------- .( $comments ? "

\n" ."Existing comments about " ."$self_name $item_id:\n" . $comments ."
\n" : "" ) # ---------------------------------------------------------------- ."
\n" ; ################################################################ ?>