/**
* uses tracker db
*/
public function insertNew($goal)
{
$Generic = Factory::getGeneric($this->db);
// pg is throwing error when empty values are given for 'FLOAT' columns
if (empty($goal['revenue'])) {
unset($goal['revenue']);
}
if (empty($goal['revenue_subtotal'])) {
unset($goal['revenue_subtotal']);
}
if (empty($goal['revenue_tax'])) {
unset($goal['revenue_tax']);
}
if (empty($goal['revenue_shipping'])) {
unset($goal['revenue_shipping']);
}
if (empty($goal['revenue_discount'])) {
unset($goal['revenue_discount']);
}
$fields = implode(', ', array_keys($goal));
$bindFields = Common::getSqlStringFieldsArray($goal);
$goal['idvisitor'] = $Generic->bin2db($goal['idvisitor']);
$sql = 'INSERT INTO ' . $this->table . '( ' . $fields . ' ) ' . 'VALUES ( ' . $bindFields . ' ) ';
$bind = array_values($goal);
$result = $Generic->insertIgnore($sql, $bind);
return $result;
}