}
if ($adherent['activite_adh'] == 1) {
    $adherent['activite_adh'] = _T("Active");
} else {
    $adherent['activite_adh'] = _T("Inactive");
}
$adherent['info_adh'] = nl2br($adherent['info_adh']);
$adherent['info_public_adh'] = nl2br($adherent['info_public_adh']);
$requete = "SELECT libelle_statut\n\t\t    FROM " . PREFIX_DB . "statuts\n\t\t    WHERE id_statut=" . $adherent['id_statut'] . "\n\t\t    ORDER BY priorite_statut";
$result =& $DB->Execute($requete);
if (!$result->EOF) {
    $adherent['libelle_statut'] = _T($result->fields['libelle_statut']);
}
$result->Close();
// declare dynamic field values
$adherent['dyn'] = get_dynamic_fields($DB, 'adh', $adherent["id_adh"], true);
// - declare dynamic fields for display
$disabled['dyn'] = array();
$dynamic_fields = prepare_dynamic_fields_for_display($DB, 'adh', $_SESSION["admin_status"], $adherent['dyn'], $disabled['dyn'], 0);
$adherent['pref_lang_img'] = 'lang/' . $adherent['pref_lang'] . '.gif';
$adherent['pref_lang'] = ucfirst(_T($adherent['pref_lang']));
// picture size
$picture = new picture($id_adh);
$adherent['picture_height'] = $picture->getOptimalHeight();
$adherent['picture_width'] = $picture->getOptimalWidth();
if (isset($error_detected)) {
    $tpl->assign("error_detected", $error_detected);
}
$tpl->assign("data", $adherent);
$tpl->assign("dynamic_fields", $dynamic_fields);
$tpl->assign("time", time());
        $sql = "SELECT * " . "FROM " . PREFIX_DB . "cotisations " . "WHERE id_cotis=" . $contribution["id_cotis"];
        $result =& $DB->Execute($sql);
        if ($result->EOF) {
            header("location: index.php");
        } else {
            // plain info
            $contribution = $result->fields;
            // reformat dates
            $contribution['date_debut_cotis'] = date_db2text($contribution['date_debut_cotis']);
            $contribution['date_fin_cotis'] = date_db2text($contribution['date_fin_cotis']);
            $contribution['duree_mois_cotis'] = distance_months($contribution['date_debut_cotis'], $contribution['date_fin_cotis']);
            $request = "SELECT cotis_extension\n\t\t\t\t\t    FROM " . PREFIX_DB . "types_cotisation\n\t\t\t\t\t    WHERE id_type_cotis = " . $contribution['id_type_cotis'];
            $cotis_extension =& $DB->GetOne($request);
        }
        // dynamic fields
        $contribution['dyn'] = get_dynamic_fields($DB, 'contrib', $contribution["id_cotis"], false);
    }
}
// template variable declaration
$tpl->assign("required", $required);
$tpl->assign("data", $contribution);
$tpl->assign("error_detected", $error_detected);
// contribution types
$requete = "SELECT DISTINCT cotis_extension\n\t\t    FROM " . PREFIX_DB . "types_cotisation";
$exval = $DB->GetOne($requete);
$requete = "SELECT id_type_cotis, libelle_type_cotis\n\t\t   FROM " . PREFIX_DB . "types_cotisation ";
if ($type_selected == 1) {
    $requete .= "WHERE cotis_extension IS " . ($cotis_extension ? "NOT " : "") . " NULL ";
}
$requete .= "ORDER BY libelle_type_cotis";
$result =& $DB->Execute($requete);
        // initialiser la structure transaction à vide (nouvelle transaction)
        $transaction['trans_date'] = date("d/m/Y", time());
    } else {
        // initialize coontribution structure with database values
        $sql = "SELECT * " . "FROM " . PREFIX_DB . "transactions " . "WHERE trans_id=" . $transaction["trans_id"];
        $result =& $DB->Execute($sql);
        if ($result->EOF) {
            header("location: index.php");
        } else {
            // plain info
            $transaction = $result->fields;
            // reformat dates
            $transaction['trans_date'] = date_db2text($transaction['trans_date']);
        }
        // dynamic fields
        $transaction['dyn'] = get_dynamic_fields($DB, 'trans', $transaction["trans_id"], false);
    }
}
// template variable declaration
$tpl->assign("required", $required);
$tpl->assign("data", $transaction);
$tpl->assign("error_detected", $error_detected);
// members
$requete = "SELECT id_adh, nom_adh, prenom_adh\n\t\tFROM " . PREFIX_DB . "adherents\n\t\tORDER BY nom_adh, prenom_adh";
$result =& $DB->Execute($requete);
if ($result->EOF) {
    $adh_options = array('' => _T("You must first register a member"));
} else {
    while (!$result->EOF) {
        $adh_options[$result->fields[0]] = htmlentities(stripslashes(strtoupper($result->fields[1]) . " " . $result->fields[2]), ENT_QUOTES);
        $result->MoveNext();