break;
                        case MappingDetail::$MAPPING_AMOUNT:
                            // We may have Credit / Debit Column, so at one time there is one column have value one doesn't
                            if (trim($data[$map->getCsvColumnNumber()])) {
                                $activity->setAmount(trim($data[$map->getCsvColumnNumber()]));
                            }
                            break;
                        case MappingDetail::$MAPPING_NAME:
                            $activity->setName($data[$map->getCsvColumnNumber()]);
                            break;
                    }
                }
            }
            fclose($handle);
        }
        $transaction->commit();
        $smarty->assign('message', "Imported CSV successfully");
    }
    $smarty->assign('left_menu', true);
    $smarty->assign('mappingTypes', Mapping::getOptions(array('USER_ID' => $user->getId())) + Mapping::getOptions());
    $smarty->display('process.tpl');
} catch (AccessDeniedException $e) {
    header('HTTP/1.1 401 Access Denied');
    echo "AccessDeniedException: " . $e->getMessage();
} catch (Exception $e) {
    if ($transaction && !$transaction->isComplete()) {
        $transaction->rollback();
    }
    header('HTTP/1.1 500 Internal Server Error');
    echo "Exception: " . $e->getMessage();
}