if ($terminatecauseid == "ANSWER") {
    if (strlen($HD_Form->FG_TABLE_CLAUSE) > 0) {
        $HD_Form->FG_TABLE_CLAUSE .= " AND ";
    }
    $HD_Form->FG_TABLE_CLAUSE .= " (terminatecauseid=1) ";
}
if ($posted == 1) {
    $_SESSION['ss_calllist'] = '';
    $_SESSION['ss_calllist'] = $HD_Form->FG_TABLE_CLAUSE;
}
if (isset($archive) && !empty($archive)) {
    $condition = $_SESSION['ss_calllist'];
    if (strlen($condition) && strpos($condition, 'WHERE') === false) {
        $condition = " WHERE {$condition}";
    }
    $rec = archive_data($condition, "call");
    if ($rec > 0) {
        $archive_message = "The data has been successfully archived";
    }
}
$smarty->display('main.tpl');
?>

<!-- ** ** ** ** ** Part for the research ** ** ** ** ** -->
<center>
<FORM METHOD=POST name="myForm" ACTION="<?php 
echo $PHP_SELF;
?>
?s=1&t=0&order=<?php 
echo $order;
?>
$HD_Form->AddSearchElement_Select(gettext("SELECT GROUP"), "cc_card_group", "id, name", "", "name", "ASC", "id_group");
$HD_Form->AddSearchElement_Select(gettext("SELECT CURRENCY"), null, null, null, null, null, "currency", 0, $currency_list_r);
$HD_Form->AddSearchElement_Select(gettext("SELECT LANGUAGE"), null, null, null, null, null, "language", 0, $language_list_r);
$HD_Form->prepare_list_subselection('list');
$HD_Form->FG_TABLE_ID = "id";
$HD_Form->FG_TABLE_DEFAULT_SENS = "ASC";
$nb_customer = 0;
/***********************************************************************************/
getpost_ifset(array('archive', 'id'));
if (isset($archive) && !empty($archive)) {
    $condition = $HD_Form->FG_TABLE_CLAUSE;
    if (strlen($condition) && strpos($condition, 'WHERE') === false) {
        $condition = " WHERE {$condition}";
    }
    echo "condition : {$condition}";
    $rec = archive_data($condition, "card");
    if ($rec > 0) {
        $archive_message = "The data has been successfully archived";
    }
}
if (!isset($form_action)) {
    $form_action = "list";
}
//ask-add
if (!isset($action)) {
    $action = $form_action;
}
$list = $HD_Form->perform_action($form_action);
// #### HEADER SECTION
$smarty->display('main.tpl');
echo $CC_help_data_archive;