<?
	#---------------------------------------------------------------------#
	# This source code is (c)2000 White Pajamas, Inc                      #
	# see http://www.stonekeep.com/license.html for licensing information #
	#---------------------------------------------------------------------#

	#---------------------------------------------------------------------#
	# $Id: postfoll.php3,v 1.23 2000/12/14 19:13:55 shevett Exp $
	#---------------------------------------------------------------------#
	
	# post followup.  should be called after 'addfoll'.

	$now=time();
	
	$f_text = addslashes($f_text);
	if (empty($f_time)) {
		$f_time = 0;
	}
 
	# 
	# Figure out the next sequence number.
	#

	$highseq = CalcHighSeq($f_sid) + 1;

	#
	# Right, got that.  lets gather the data.
	#
	
	$flist = "f_sid,f_date,f_tech,f_text,f_seq,f_public,f_usergen,f_time";

	$vlist = "$f_sid,$f_date,'$f_tech','$f_text',$highseq,$f_public,$f_usergen,$f_time";
	

	if ($f_flag == "add" && (!empty($f_text) || $f_time != "0")) {
		$result = db_query("insert into followups ($flist) values ($vlist)");
		$lastresult[1]= "Added followup number $highseq to Slip # $f_sid.";

		$f_time = $f_oldtimespent + $f_time;
		#
		# update the parent's 'last activity' stuff.
		#
		$result = db_query("update slips set l_activity=$now, l_tech='$curruser', timespent='$f_time' where sid=$f_sid");

		#
		# okay, post the bulk data...
		#

		$browref = "$f_sid";
		$counter = InsertExtras("followups",$f_sid);
		RecalcSlip($f_sid);

		#
		# now generate mail if requested...
		#
		
		$sid=$f_sid;
		$f_process="sendmail";
		include "./genmail.php3";
		
	} 
?>

