QuickBooks/Callbacks/SQL/Callbacks.php
protected static function _updateRelatives($table, $user, $action, $ID, $object, $extra, $callback_config = array(), $deleteDataExt = false, $fullDelete = false)
	{
		$update_relatives_map = array(
			'account' => array(
				'id_field' => 'ListID',
				'relatives' => array(
					'invoice' => 'ARAccount_ListID'
				)
			),
			'bill' => array(
				'id_field' => 'TxnID',
				'relatives' => array(
					'billpaymentcheck_appliedtotxn' => 'ToTxnID', 
					'billpaymentcreditcard_appliedtotxn' => 'ToTxnID', 
					//'dataext' => 'Txn_TxnID'
				)
			),
			
			/*					
					"billingrate" => array( "id_field" => "ListID",
											"relatives" => array(
												"billingrate_billingrateperitem" => "BillingRate_ListID"
												)
										),
										
					"billpaymentcheck" => array( "id_field" => "ListID",
													"relatives" => array(
															"billpaymentcheck_appliedtotxn" => "FromTxnID",
															"dataext" => "Entity_ListID"
																)
												),
												
					"billpaymentcreditcard" => array( "id_field" => "ListID",
														 "relatives" => array(
																"billpaymentcreditcard_appliedtotxn" => "FromTxnID",
																"dataext" => "Entity_ListID"
															)
												),
												
					"charge" => array( "id_field" => "TxnID",
									  "relatives" => array(
											"dataext" => "Txn_TxnID"
											)
									),
									
					"check" => array( "id_field" => "TxnID",
									  "relatives" => array(
											"check_expenseline" => "Check_TxnID",
											"check_itemgroupline" => "Check_TxnID",
											"check_itemgroupline_itemline" => "Check_TxnID",
											"check_itemline" => "Check_TxnID",
											"check_linkedtxn" => "FromTxnID",
											"dataext" => "Txn_TxnID"
											)
									),
									
					"company" => array( "id_field" => "CompanyName",
									  "relatives" => array(
											"company_subscribedservices_service" => "Company_CompanyName"
											)
									),
									
					"creditcardcharge" => array( "id_field" => "TxnID",
												 "relatives" => array(
														"creditcardcharge_expenseline" => "CreditCardCharge_TxnID",
														"creditcardcharge_itemgroupline" => "CreditCardCharge_TxnID",
														"creditcardcharge_itemgroupline_itemline" => "CreditCardCharge_TxnID",
														"creditcardcharge_itemline" => "CreditCardCharge_TxnID",
														"dataext" => "Txn_TxnID"
													)
												),
												
					"creditcardcredit" => array( "id_field" => "TxnID",
												 "relatives" => array(
														"creditcardcredit_expenseline" => "CreditCardCredit_TxnID",
														"creditcardcredit_itemgroupline" => "CreditCardCredit_TxnID",
														"creditcardcredit_itemgroupline_itemline" => "CreditCardCredit_TxnID",
														"creditcardcredit_itemline" => "CreditCardCredit_TxnID",
														"dataext" => "Txn_TxnID"
													)
												),
												
					"creditmemo" => array( "id_field" => "TxnID",
												 "relatives" => array(
														"creditmemo_creditmemoline" => "CreditMemo_TxnID",
														"creditmemo_creditmemolinegroup" => "CreditMemo_TxnID",
														"creditmemo_creditmemolinegroup_creditmemoline" => "CreditMemo_TxnID",
														"creditmemo_linkedtxn" => "FromTxnID",
														"dataext" => "Txn_TxnID"
													)
												),
												
					"creditmemolinegroup" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"creditmemolinegroup_creditmemoline" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
					*/		
			'customer' => array( 
				'id_field' => 'ListID',
				'relatives' => array(
					'estimate' => 'Customer_ListID',
					'salesorder' => 'Customer_ListID',
					'purchaseorder_purchaseorderline' => 'Customer_ListID',
					'invoice' => 'Customer_ListID',
					'receivepayment' => 'Customer_ListID', 
					'purchaseorder' => 'ShipToEntity_ListID', 
					'salesreceipt' => 'Customer_ListID', 
					)
				),
					/*						
					"deposit" => array( "id_field" => "TxnID",
												 "relatives" => array(
												"deposit_depositline" => "Deposit_TxnID",
													"dataext" => "Txn_TxnID"
													)
												),
												*/
					"employee" => array( "id_field" => "ListID",
												 "relatives" => array(
														"salesrep" => "SalesRepEntity_ListID"
													)
												),
												/*
					"estimate" => array( "id_field" => "TxnID",
										"relatives" => array(
												"estimate_estimateline" => "Estimate_TxnID", 
												"estimate_estimatelinegroup" => "Estimate_TxnID", 
												"estimate_estimatelinegroup_estimateline" => "Estimate_TxnID",
												"invoice_linkedtxn" => "FromTxnID",
													"dataext" => "Entity_ListID"
												)
									),
									
					"estimate_estimatelinegroup" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"estimate_estimateline" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"estimate_estimatelinegroup" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"estimate_estimatelinegroup_estimateline" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"inventoryadjustment" => array( "id_field" => "TxnID",
										"relatives" => array(
												"inventoryadjustment_inventoryadjustmentline" => "InventoryAdjustment_TxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									*/
			'invoice' => array( 
				'id_field' => 'TxnID',
				'relatives' => array(
					'estimate_linkedtxn' => 'ToTxnID',
					'salesorder_linkedtxn' => 'ToTxnID',
					'receivepayment_appliedtotxn' => 'ToTxnID', // 'ToTxnID:Type=Invoice', 
					)
				),
								/*	
					"invoice_invoiceline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
									
					"invoice_invoicelinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"invoice_invoicelinegroup_invoiceline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"itemgroup" => array( "id_field" => "ListID",
										"relatives" => array(
												"itemgroup_itemgroupline" => "ItemGroup_ListID",
													"dataext" => "Entity_ListID"
												)
									),
						*/			
					"iteminventory" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
								/*	
					"iteminventoryassembly" => array( "id_field" => "ListID",
										"relatives" => array(
												"iteminventoryassembly_iteminventoryassemblyline" => "ItemInventoryAssembly_ListID",
													"dataext" => "Txn_TxnID"
												)
									),
							*/		
					"itemnoninventory" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itemdiscount" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itemfixedasset" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itemothercharge" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itempayment" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
							/*		
					"itemreceipt" => array( "id_field" => "TxnID",
										"relatives" => array(
												"itemreceipt_expenseline" => "ItemReceipt_TxnID",
												"itemreceipt_itemgroupline" => "ItemReceipt_TxnID",
												"itemreceipt_itemgroupline_itemline" => "ItemReceipt_TxnID",
												"itemreceipt_itemline" => "ItemReceipt_TxnID",
												"itemreceipt_linkedtxn" => "FromTxnID",
													"dataext" => "Entity_ListID"
												)
										),
								*/		
					"itemsalestax" => array( "id_field" => "ListID",
										"relatives" => array(
												"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
										),
								/*		
					"itemsalestaxgroup" => array( "id_field" => "ListID",
										"relatives" => array(
												"itemsalestaxgroup_itemsalestax" => "ItemSalesTaxGroup_ListID",
													"dataext" => "Entity_ListID"
												)
										),
							*/			
					"itemservice" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
										),
										
					"itemsubtotal" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
										),
								/*		
					"journalentry" => array( "id_field" => "TxnID",
												"relatives" => array(
												"journalentry_journalcreditline" => "JournalEntry_TxnID",
												"journalentry_journaldebitline" => "JournalEntry_TxnID",
													"dataext" => "Entity_ListID"
												)
									),
									
					"pricelevel" => array( "id_field" => "ListID",
												"relatives" => array(
												"pricelevel_pricelevelperitem" => "PriceLevel_ListID"
												)
									),
								*/	
					"purchaseorder" => array( 
						"id_field" => 'TxnID',
						"relatives" => array(
							//"estimate" => "PONumber", 
							//"salesorder" => "PONumber"
							'bill_linkedtxn' => 'ToTxnID', 
						),
					),
								/*	
					"purchaseorder_purchaseorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"purchaseorder_purchaseorderlinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"purchaseorder_purchaseorderlinegroup_purchaseorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"receievepayment" => array( "id_field" => "TxnID",
										"relatives" => array(
												"receivepayment_appliedtotxn" => "FromTxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesorder" => array( "id_field" => "TxnID",
										"relatives" => array(
												"salesorder_salesorderline" => "SalesOrder_TxnID", 
												"salesorder_salesorderlinegroup" => "SalesOrder_TxnID", 
												"salesorder_salesorderlinegroup_salesorderline" => "SalesOrder_TxnID",
												"salesorder_linkedtxn" => "FromTxnID",
													"dataext" => "Entity_ListID"
												)
									),
									
					"salesorder_salesorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesorder_salesorderlinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesorder_salesorderlinegroup_salesorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesreceipt" => array( "id_field" => "TxnID",
										"relatives" => array(
												"salesreceipt_salesreceiptline" => "SalesReceipt_TxnID", 
												"salesreceipt_salesreceiptlinegroup" => "SalesReceipt_TxnID", 
												"salesreceipt_salesreceiptlinegroup_salesreceiptline" => "SalesReceipt_TxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesreceipt_salesreceiptline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salereceipt_salesreceiptlinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesreceipt_salesreceiptlinegroup_salesreceiptline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									*/
					"salesrep" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate" => "SalesRep_ListID",
													"salesorder" => "SalesRep_ListID",
													"invoice" => "SalesRep_ListID"
												)
									),
									
					"salestaxcode" => array( "id_field" => "ListID",
										"relatives" => array(
													"iteminventory" => "SalesTaxCode_ListID",
													"iteminventoryassembly" => "SalesTaxCode_ListID",
													"itemnoninventory" => "SalesTaxCode_ListID",
													"itemothercharge" => "SalesTaxCode_ListID",
													"itemservice" => "SalesTaxCode_ListID",
													"customer" => "SalesTaxCode_ListID",
													"estimate" => "CustomerSalesTaxCode_ListID",
													"salesorder" => "CustomerSalesTaxCode_ListID",
													"invoice" => "CustomerSalesTaxCode_ListID"
												)
									),
								/*	
					"unitofmeasureset" => array( "id_field" => "ListID",
										"relatives" => array(
												"unitofmeasureset_defaultunit" => "UnitOfMeasureSet_ListID", 
												"unitofmeasureset_relatedunit" => "UnitOfMeasureSet_ListID"
												)
									),
									*/
					"vendor" => array( "id_field" => "ListID",
										"relatives" => array(
													"purchaseorder" => "Vendor_ListID"
												)
									),
							/*		
					"vendorcredit" => array( "id_field" => "TxnID",
										"relatives" => array(
												"vendorcredit_expenseline" => "VendorCredit_TxnID", 
												"vendorcredit_itemline" => "VendorCredit_TxnID", 
												"vendorcredit_itemgroupline" => "VendorCredit_TxnID", 
												"vendorcredit_itemgroupline_itemline" => "VendorCredit_TxnID",
												"vendorcredit_linkedtxn" => "FromTxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									
					"workerscompcode" => array( "id_field" => "ListID",
										"relatives" => array(
												"workerscompcode_ratehistory" => "WorkersCompCode_ListID"
												)
									)
					*/
				);
				
		$Driver = QuickBooks_Driver_Singleton::getInstance();
		
		if (!isset($update_relatives_map[$table]))
		{
			//$Driver->log('Record has no RELATIVES...?', null, QUICKBOOKS_LOG_NORMAL);
			return false;
		}
		
		if (!isset($extra['AddResponse_OldKey']))
		{
			//$Driver->log('Missing key for RELATIVE update...?', null, QUICKBOOKS_LOG_NORMAL);
			return false;
		}
			
		$TxnID_or_ListID = $object->get($update_relatives_map[$table]['id_field']);
		foreach ($update_relatives_map[$table]['relatives'] as $relative_table => $relative_field)
		{
			//$Driver->log('Now updating [' . $relative_table . '] for field [' . $relative_field . '] with value [' . $TxnID_or_ListID . ']', null, QUICKBOOKS_LOG_DEBUG);
			
			$multipart = array( $relative_field => $extra['AddResponse_OldKey'] );
			$tmp = new QuickBooks_SQL_Object($relative_table, null);
			
			//@todo Make the Boolean TRUE value used in the QUICKBOOKS_DRIVER_SQL_FIELD_DELETED_FLAG field a constant,
			//      in case the sql driver used uses something other than 1 and 0.
			$tmp->set($relative_field, $TxnID_or_ListID);
			$Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $relative_table, $tmp, array( $multipart ), false);
		}
	}
protected static function _updateRelatives($table, $user, $action, $ID, $object, $extra, $callback_config = array(), $deleteDataExt = false, $fullDelete = false)
	{
		$update_relatives_map = array(
			'account' => array(
				'id_field' => 'ListID',
				'relatives' => array(
					'invoice' => 'ARAccount_ListID'
				)
			),
			'bill' => array(
				'id_field' => 'TxnID',
				'relatives' => array(
					'billpaymentcheck_appliedtotxn' => 'ToTxnID', 
					'billpaymentcreditcard_appliedtotxn' => 'ToTxnID', 
					//'dataext' => 'Txn_TxnID'
				)
			),
			
			/*					
					"billingrate" => array( "id_field" => "ListID",
											"relatives" => array(
												"billingrate_billingrateperitem" => "BillingRate_ListID"
												)
										),
										
					"billpaymentcheck" => array( "id_field" => "ListID",
													"relatives" => array(
															"billpaymentcheck_appliedtotxn" => "FromTxnID",
															"dataext" => "Entity_ListID"
																)
												),
												
					"billpaymentcreditcard" => array( "id_field" => "ListID",
														 "relatives" => array(
																"billpaymentcreditcard_appliedtotxn" => "FromTxnID",
																"dataext" => "Entity_ListID"
															)
												),
												
					"charge" => array( "id_field" => "TxnID",
									  "relatives" => array(
											"dataext" => "Txn_TxnID"
											)
									),
									
					"check" => array( "id_field" => "TxnID",
									  "relatives" => array(
											"check_expenseline" => "Check_TxnID",
											"check_itemgroupline" => "Check_TxnID",
											"check_itemgroupline_itemline" => "Check_TxnID",
											"check_itemline" => "Check_TxnID",
											"check_linkedtxn" => "FromTxnID",
											"dataext" => "Txn_TxnID"
											)
									),
									
					"company" => array( "id_field" => "CompanyName",
									  "relatives" => array(
											"company_subscribedservices_service" => "Company_CompanyName"
											)
									),
									
					"creditcardcharge" => array( "id_field" => "TxnID",
												 "relatives" => array(
														"creditcardcharge_expenseline" => "CreditCardCharge_TxnID",
														"creditcardcharge_itemgroupline" => "CreditCardCharge_TxnID",
														"creditcardcharge_itemgroupline_itemline" => "CreditCardCharge_TxnID",
														"creditcardcharge_itemline" => "CreditCardCharge_TxnID",
														"dataext" => "Txn_TxnID"
													)
												),
												
					"creditcardcredit" => array( "id_field" => "TxnID",
												 "relatives" => array(
														"creditcardcredit_expenseline" => "CreditCardCredit_TxnID",
														"creditcardcredit_itemgroupline" => "CreditCardCredit_TxnID",
														"creditcardcredit_itemgroupline_itemline" => "CreditCardCredit_TxnID",
														"creditcardcredit_itemline" => "CreditCardCredit_TxnID",
														"dataext" => "Txn_TxnID"
													)
												),
												
					"creditmemo" => array( "id_field" => "TxnID",
												 "relatives" => array(
														"creditmemo_creditmemoline" => "CreditMemo_TxnID",
														"creditmemo_creditmemolinegroup" => "CreditMemo_TxnID",
														"creditmemo_creditmemolinegroup_creditmemoline" => "CreditMemo_TxnID",
														"creditmemo_linkedtxn" => "FromTxnID",
														"dataext" => "Txn_TxnID"
													)
												),
												
					"creditmemolinegroup" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"creditmemolinegroup_creditmemoline" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
					*/		
			'customer' => array( 
				'id_field' => 'ListID',
				'relatives' => array(
					'estimate' => 'Customer_ListID',
					'salesorder' => 'Customer_ListID',
					'purchaseorder_purchaseorderline' => 'Customer_ListID',
					'invoice' => 'Customer_ListID',
					'receivepayment' => 'Customer_ListID', 
					'purchaseorder' => 'ShipToEntity_ListID', 
					'salesreceipt' => 'Customer_ListID', 
					)
				),
					/*						
					"deposit" => array( "id_field" => "TxnID",
												 "relatives" => array(
												"deposit_depositline" => "Deposit_TxnID",
													"dataext" => "Txn_TxnID"
													)
												),
												*/
					"employee" => array( "id_field" => "ListID",
												 "relatives" => array(
														"salesrep" => "SalesRepEntity_ListID"
													)
												),
												/*
					"estimate" => array( "id_field" => "TxnID",
										"relatives" => array(
												"estimate_estimateline" => "Estimate_TxnID", 
												"estimate_estimatelinegroup" => "Estimate_TxnID", 
												"estimate_estimatelinegroup_estimateline" => "Estimate_TxnID",
												"invoice_linkedtxn" => "FromTxnID",
													"dataext" => "Entity_ListID"
												)
									),
									
					"estimate_estimatelinegroup" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"estimate_estimateline" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"estimate_estimatelinegroup" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"estimate_estimatelinegroup_estimateline" => array( "id_field" => "TxnLineID",
												"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
											),
											
					"inventoryadjustment" => array( "id_field" => "TxnID",
										"relatives" => array(
												"inventoryadjustment_inventoryadjustmentline" => "InventoryAdjustment_TxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									*/
			'invoice' => array( 
				'id_field' => 'TxnID',
				'relatives' => array(
					'estimate_linkedtxn' => 'ToTxnID',
					'salesorder_linkedtxn' => 'ToTxnID',
					'receivepayment_appliedtotxn' => 'ToTxnID', // 'ToTxnID:Type=Invoice', 
					)
				),
								/*	
					"invoice_invoiceline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
									
					"invoice_invoicelinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"invoice_invoicelinegroup_invoiceline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"itemgroup" => array( "id_field" => "ListID",
										"relatives" => array(
												"itemgroup_itemgroupline" => "ItemGroup_ListID",
													"dataext" => "Entity_ListID"
												)
									),
						*/			
					"iteminventory" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
								/*	
					"iteminventoryassembly" => array( "id_field" => "ListID",
										"relatives" => array(
												"iteminventoryassembly_iteminventoryassemblyline" => "ItemInventoryAssembly_ListID",
													"dataext" => "Txn_TxnID"
												)
									),
							*/		
					"itemnoninventory" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itemdiscount" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itemfixedasset" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itemothercharge" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
									
					"itempayment" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
									),
							/*		
					"itemreceipt" => array( "id_field" => "TxnID",
										"relatives" => array(
												"itemreceipt_expenseline" => "ItemReceipt_TxnID",
												"itemreceipt_itemgroupline" => "ItemReceipt_TxnID",
												"itemreceipt_itemgroupline_itemline" => "ItemReceipt_TxnID",
												"itemreceipt_itemline" => "ItemReceipt_TxnID",
												"itemreceipt_linkedtxn" => "FromTxnID",
													"dataext" => "Entity_ListID"
												)
										),
								*/		
					"itemsalestax" => array( "id_field" => "ListID",
										"relatives" => array(
												"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
										),
								/*		
					"itemsalestaxgroup" => array( "id_field" => "ListID",
										"relatives" => array(
												"itemsalestaxgroup_itemsalestax" => "ItemSalesTaxGroup_ListID",
													"dataext" => "Entity_ListID"
												)
										),
							*/			
					"itemservice" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
										),
										
					"itemsubtotal" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate_estimateline" => "Item_ListID",
													"salesorder_salesorderline" => "Item_ListID",
													"purchaseorder_purchaseorderline" => "Item_ListID",
													"invoice_invoiceline" => "Item_ListID"
												)
										),
								/*		
					"journalentry" => array( "id_field" => "TxnID",
												"relatives" => array(
												"journalentry_journalcreditline" => "JournalEntry_TxnID",
												"journalentry_journaldebitline" => "JournalEntry_TxnID",
													"dataext" => "Entity_ListID"
												)
									),
									
					"pricelevel" => array( "id_field" => "ListID",
												"relatives" => array(
												"pricelevel_pricelevelperitem" => "PriceLevel_ListID"
												)
									),
								*/	
					"purchaseorder" => array( 
						"id_field" => 'TxnID',
						"relatives" => array(
							//"estimate" => "PONumber", 
							//"salesorder" => "PONumber"
							'bill_linkedtxn' => 'ToTxnID', 
						),
					),
								/*	
					"purchaseorder_purchaseorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"purchaseorder_purchaseorderlinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"purchaseorder_purchaseorderlinegroup_purchaseorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"receievepayment" => array( "id_field" => "TxnID",
										"relatives" => array(
												"receivepayment_appliedtotxn" => "FromTxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesorder" => array( "id_field" => "TxnID",
										"relatives" => array(
												"salesorder_salesorderline" => "SalesOrder_TxnID", 
												"salesorder_salesorderlinegroup" => "SalesOrder_TxnID", 
												"salesorder_salesorderlinegroup_salesorderline" => "SalesOrder_TxnID",
												"salesorder_linkedtxn" => "FromTxnID",
													"dataext" => "Entity_ListID"
												)
									),
									
					"salesorder_salesorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesorder_salesorderlinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesorder_salesorderlinegroup_salesorderline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesreceipt" => array( "id_field" => "TxnID",
										"relatives" => array(
												"salesreceipt_salesreceiptline" => "SalesReceipt_TxnID", 
												"salesreceipt_salesreceiptlinegroup" => "SalesReceipt_TxnID", 
												"salesreceipt_salesreceiptlinegroup_salesreceiptline" => "SalesReceipt_TxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesreceipt_salesreceiptline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salereceipt_salesreceiptlinegroup" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									
					"salesreceipt_salesreceiptlinegroup_salesreceiptline" => array( "id_field" => "TxnLineID",
										"relatives" => array(
													"dataext" => "Txn_TxnID"
												)
									),
									*/
					"salesrep" => array( "id_field" => "ListID",
										"relatives" => array(
													"estimate" => "SalesRep_ListID",
													"salesorder" => "SalesRep_ListID",
													"invoice" => "SalesRep_ListID"
												)
									),
									
					"salestaxcode" => array( "id_field" => "ListID",
										"relatives" => array(
													"iteminventory" => "SalesTaxCode_ListID",
													"iteminventoryassembly" => "SalesTaxCode_ListID",
													"itemnoninventory" => "SalesTaxCode_ListID",
													"itemothercharge" => "SalesTaxCode_ListID",
													"itemservice" => "SalesTaxCode_ListID",
													"customer" => "SalesTaxCode_ListID",
													"estimate" => "CustomerSalesTaxCode_ListID",
													"salesorder" => "CustomerSalesTaxCode_ListID",
													"invoice" => "CustomerSalesTaxCode_ListID"
												)
									),
								/*	
					"unitofmeasureset" => array( "id_field" => "ListID",
										"relatives" => array(
												"unitofmeasureset_defaultunit" => "UnitOfMeasureSet_ListID", 
												"unitofmeasureset_relatedunit" => "UnitOfMeasureSet_ListID"
												)
									),
									*/
					"vendor" => array( "id_field" => "ListID",
										"relatives" => array(
													"purchaseorder" => "Vendor_ListID"
												)
									),
							/*		
					"vendorcredit" => array( "id_field" => "TxnID",
										"relatives" => array(
												"vendorcredit_expenseline" => "VendorCredit_TxnID", 
												"vendorcredit_itemline" => "VendorCredit_TxnID", 
												"vendorcredit_itemgroupline" => "VendorCredit_TxnID", 
												"vendorcredit_itemgroupline_itemline" => "VendorCredit_TxnID",
												"vendorcredit_linkedtxn" => "FromTxnID",
													"dataext" => "Txn_TxnID"
												)
									),
									
					"workerscompcode" => array( "id_field" => "ListID",
										"relatives" => array(
												"workerscompcode_ratehistory" => "WorkersCompCode_ListID"
												)
									)
					*/
				);
				
		$Driver = QuickBooks_Driver_Singleton::getInstance();
		
		if (!isset($update_relatives_map[$table]))
		{
			//$Driver->log('Record has no RELATIVES...?', null, QUICKBOOKS_LOG_NORMAL);
			return false;
		}
		
		if (!isset($extra['AddResponse_OldKey']))
		{
			//$Driver->log('Missing key for RELATIVE update...?', null, QUICKBOOKS_LOG_NORMAL);
			return false;
		}
			
		$TxnID_or_ListID = $object->get($update_relatives_map[$table]['id_field']);
		foreach ($update_relatives_map[$table]['relatives'] as $relative_table => $relative_field)
		{
			//$Driver->log('Now updating [' . $relative_table . '] for field [' . $relative_field . '] with value [' . $TxnID_or_ListID . ']', null, QUICKBOOKS_LOG_DEBUG);
			
			$multipart = array( $relative_field => $extra['AddResponse_OldKey'] );
			$tmp = new QuickBooks_SQL_Object($relative_table, null);
			
			//@todo Make the Boolean TRUE value used in the QUICKBOOKS_DRIVER_SQL_FIELD_DELETED_FLAG field a constant,
			//      in case the sql driver used uses something other than 1 and 0.
			$tmp->set($relative_field, $TxnID_or_ListID);
			$Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $relative_table, $tmp, array( $multipart ), false);
		}
	}
Update relatives which might be referring to an out-of-date temporary ListID or TxnID

When you initially insert things into the SQL database for insertion
into QuickBooks, you have to make up a unique TxnID or ListID so you can
link other things to it. When QuickBooks then receives that record, the
record is updated with the correct TxnID or ListID. This function also
updates any records that it might be linked to. i.e.:
If a customer is added to QuickBooks, and you receive the real ListID,
then you also want to make sure the temporary ListID is changed to
the real ListID in these places:
invoice.Customer_ListID
estimate.Customer_ListID
receivepayment.Customer_ListID
etc. etc. etc.

@param
@return