\n"; # print_r($cres); # echo "\n"; if($cres['error']) { $errflag = 1; $parts_str = "" ."$cres[error]" ."\n"; } elseif($cres['steps']) { while(list($i, $step) = each($cres['steps'])) { $parts_str .= "" ."$step[action]" ."$step[part_description] $step[part_id]" ."" . ($step[action]=="install"? "in":"from") . " $step[base_description] $step[base_id]" ."on $step[date]" ."\n"; } } ################################################################ if($modstr || $parts_str || $comment) { send_html_header("$self_name $item_id"); echo "

$self_name $item_id

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

Your comment is:

\n"
			 ."$comment

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

You are: $auth_user

\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_foil'; if(!start_transaction($conn,$op,$scriptid,$comment)) { $err .= "Can't start transaction."; } else { ## ---------------------------------------------------------------- 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"; } } ## ---------------------------------------------------------------- if($old_tmpnum != $tmpnum) { $res = check_change4('tmpnum', $HTTP_POST_VARS); if($res['error']) { $err .= "Error verifying 'tmpnum' vars: $res[error].
\n"; } elseif($res['diff']) { $err .= edit_set_values( $sernum, 'foil_tmpnum', $tmpnum_date, array('num' => $tmpnum) ); } } ## ---------------------------------------------------------------- $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'); } ## ---------------------------------------------------------------- $res = check_change4('leak', $HTTP_POST_VARS); if($res['error']) { $err .= "Error verifying 'leak' vars: $res[error].
\n"; } elseif($res['diff']) { $err .= edit_set_selected( $sernum, $leak, $leak_date, 'foil_leak', 'foil_leaks', 'type'); } ## ---------------------------------------------------------------- $res = check_change4('stretch', $HTTP_POST_VARS); if($res['error']) { $err .= "Error verifying 'stretch' vars: $res[error].
\n"; } elseif($res['diff']) { $err .= edit_set_selected( $sernum, $stretch, $stretch_date, 'foil_stretch', 'foil_stretches', 'type'); } ## ---------------------------------------------------------------- $res = check_change4('tension', $HTTP_POST_VARS); if($res['error']) { $err .= "Error verifying 'tension' vars: $res[error].
\n"; } elseif($res['diff']) { $err .= edit_set_values( $sernum, 'foil_tension', $tension_date, array('tension' => $tension)); } ## ---------------------------------------------------------------- $cres = check_connection_change( 'base_type', 'base_id', 'point', 'part_type', 'part_id', 'base_date', $HTTP_POST_VARS); if($cres['error']) { $err .= "Error verifying 'Installed in' vars: $cres[error].
\n"; } elseif($cres['steps']) { while(list($i, $step) = each($cres['steps'])) { $err .= edit_set_connection($step); } } ## ================================================================ 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 ## ---------------------------------------------------------------- ## Temporary number $res = edit_get_value($sernum, 'foil_tmpnum', 'num'); if($res['error']) { echo "$res[error]
"; } $tmpnum = $res['num']; ## ================================================================ ## 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']; ## ================================================================ ## Where is the item installed? $res = edit_get_base($sernum); if($res['error']) { echo "$res[error]
"; } $base_sernum = $res['base_sernum']; $base_id = ( $res['base_sernum']? format_default_id($res['base_sernum']) : "" ); $base_type = $res['type']; $base_date = $res['date']; $base_desc = $res['description']; $base_opt = $res['options']; ## ================================================================ ## Leak tight $res = edit_get_selected( $sernum, 'foil_leak', 'foil_leaks', 'type'); if($res['error']) { echo "$res[error]
"; } $leak = $res['type']; $leak_date = $res['date']; $leak_options_string = $res['options']; ## ================================================================ ## Stretch $res = edit_get_selected( $sernum, 'foil_stretch', 'foil_stretches', 'type'); if($res['error']) { echo "$res[error]
"; } $old_stretch = $res['type']; $old_stretch_date = $res['date']; $stretch_options_string = $res['options']; ## ---------------------------------------------------------------- ## Measured tension $res = edit_get_value($sernum, 'foil_tension', 'tension'); if($res['error']) { echo "$res[error]
"; } $tension = $res['tension']; $tension_date = $res['date']; ## ---------------------------------------------------------------- $comments = get_comments($sernum); ################################################################ # Display a form with current parameters as default values send_html_header("$self_name $item_id"); echo "

$self_name $item_id

\n"; echo "
\n" ."\n" ."\n" # ---------------------------------------------------------------- ."\n" ."\n" # -------------------------------- ."\n" # -------------------------------- ."\n" # ---------------- ."\n" # ---------------- ."\n" # ---------------- ."\n" # -------------------------------- ."\n" # -------------------------------- ."\n" # ---------------- ."\n" # ---------------------------------------------------------------- .( $comments ? "\n" : "" ) # ---------------------------------------------------------------- ."
" ."Foil thickness is 6.4 um.\n" ."\n" ."Temporary number used: " ."\n" ."\n" ."\n" ## fake vars ."\n" ."\n" ."
\n" ."Status:" ."\n" ."\n" ."\n" . ($status_set? "" : "(default) " ) ."\n" ."Status change date: " ."\n" ."\n" ."\n" ."
\n" . ($base_sernum ? "\n" ."Installed in: " : "Installed in: " ) ."\n" ."\n" ."\n" ."\n" ."\n" # ---- ."\n" ."\n" ."\n" ."\n" ."\n" ."\n" ."\n" # ---- ."Install date: " ."\n" ."\n" ."\n" ."
\n" ."Leak tight: " ."\n" ."\n" ."\n" ."\n" ."Leak test date: " ."\n" ."\n" ."\n" ."
\n" ."Stretch: " ."\n" ."\n" ."\n" ."\n" ." Stretch date: " ."\n" ."\n" ."\n" ."
\n" ."Measured tension (lb/in): " ."\n" ."\n" ."\n" ."\n" ." Date of the measurement" ."\n" ."\n" ."\n" ."
" ."Note: if you enter a field that has " ."corresponding date field the latter is mandatory.
\n" ."Date format examples: " ."\"2001-03-16 15:55\", or " ."\"Mar 16, 2001 15:55\" " ."(time is optional).
\n" ."You can also say \"now\" " ."or \"yesterday\"." ."
" ."Comment to add
\n" .' ' ."
\n" ."\n" ."\n" ."\n" ."
\n" ."

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