<?php 

	/* 
	** File: UPDATE_IBID
	** Description: Update the contents of one of the records in the 
	**   "invoice_sku" table. 
	** Version: $Revision: 1.4 $
	** Created: 6/29/99
	** Author: Shannon -jj Behrens
	** Email: shannon.behrens@clearink.com
	** CVS Author: $Author: leon $
	** Last Revised: $Date: 1999/12/09 23:23:25 $
	**
	** Log : $Log: UPDATE_IBID,v $
	** Log : Revision 1.4  1999/12/09 23:23:25  leon
	** Log : Changed ActionResults use so that it's an array instead of a
	** Log : continually-growing string.  Note the little function in standard_library
	** Log : for printing out all the action results.
	** Log :
	** Log : Revision 1.3  1999/11/02 19:09:46  leon
	** Log : Localized the UPDATE action modules
	** Log :
	** Log : Revision 1.2  1999/08/18 22:31:54  leon
	** Log : Returning opening PHP tag to XML-friendly tag
	** Log :
	** Log : Revision 1.1  1999/07/28 19:41:05  leon
	** Log : Mass update based on code donation from a live project
	** Log :
	**
	** Copyright (c) 1999 Working Dogs. All rights reserved. 
	**
	** Expected input: $ID, $Quantity, $SalePrice, $Freight, $Notes, $GiftWrap
	*/
	
	/* Make sure the user has admin rights. */
	if( !$UserInfo["Permission"]["Administrate"] )
	{
		print(L_UPDATEIBID_DENIED . "<BR>\n");
	}
	else
	{
		$updateQuery = "UPDATE invoice_sku SET ";
		$updateQuery .= "Quantity = " . intval($Quantity) . ", ";
		$updateQuery .= "SalePrice = " . doubleval($SalePrice) . ", ";
		$updateQuery .= "Freight = " . doubleval($Freight) . ", ";
		$updateQuery .= "Notes = '" . addslashes($Notes) . "', ";
		$updateQuery .= "GiftWrap = '" . 
			addslashes(substr($GiftWrap,0,1)) . "' ";
		$updateQuery .= "WHERE ID = " . intval($ID);

		/* Execute the query. */ 
		if ( !mysql_query($updateQuery, $DatabaseLink) )
		{
			print("<!-- " . mysql_errno() . ": " . mysql_error() . 
				"   Query was: $updateQuery -->\n");
			$ActionResults[] = L_UPDATEIBID_FAILED;
		}
		else
		{
			$ActionResults[] = L_UPDATEIBID_SUCCESS;
		}
	}
	
?>	
