//workflow for audit

//we will only run audit if there are no errors

if (count($WorkFlowReturnArray['Errors']) == 0 && count ($WorkFlowReturnArray['RuleErrors']) == 0)
{
		
		$columnValues = array();
		$CollectionIDFieldName		= $this->_getCollectionFieldName(105, 1);
		$UserIDFieldName			= $this->_getCollectionFieldName(105, 2);
		$RowIDFieldName				= $this->_getCollectionFieldName(105, 3);
		$ActionFieldName			= $this->_getCollectionFieldName(105, 4);
		$TimeFieldName				= $this->_getCollectionFieldName(105, 5);
		
		$columnValues[$CollectionIDFieldName] = $CollectionID;
		$columnValues[$UserIDFieldName] = $UserID;
		
		$columnValues[$ActionFieldName] = $ApplyFor;
		$columnValues[$TimeFieldName] = date(time());
		
		switch ($ApplyFor)
		{
		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:
					
					$columnValues[$RowIDFieldName] = $WorkFlowReturnArray['InsertedID'];
		
		
		  break;  //end admin add specific code
		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:
		  
		  			$columnValues[$RowIDFieldName] = $WorkFlowReturnArray['EditedID'];
		  
		  break; //end admin edit specific code
		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:
		  
		  			$columnValues[$RowIDFieldName] = $DeleteID;
		  
		  break;  //end admin delete specific code
		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:
		
					$columnValues[$RowIDFieldName] = $WorkFlowReturnArray['InsertedID'];
		
		  break;  //end front end add specific code
		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:
		  
		  			$columnValues[$RowIDFieldName] = $WorkFlowReturnArray['EditedID'];
		  
		  break; //end front end edit specific code
		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:
		  
		  			$columnValues[$RowIDFieldName] = $DeleteID;
		  
		  break;   //end front end delete specific code
		default:
		  
		  // we will not run any code here
		  
		} 

		$auditrow = $this->insertCollectionRow_(105, $columnValues , '' , '');
		
		$WorkFlowReturnArray['AuditInsertedID'] = $auditrow;
		
		

} //end workflow for audit