} else {
        // initialize adherent structure with database values
        $sql = "SELECT * " . "FROM " . PREFIX_DB . "adherents " . "WHERE id_adh=" . $adherent["id_adh"];
        $result =& $DB->Execute($sql);
        if ($result->EOF) {
            header("location: index.php");
        } else {
            #annoying
            // url_adh is a specific case
            //if ($result->fields['url_adh']=='')
            //	$result->fields['url_adh'] = 'http://';
            // plain info
            $adherent = $result->fields;
            // reformat dates
            $adherent['date_crea_adh'] = date_db2text($adherent['date_crea_adh']);
            $adherent['ddn_adh'] = date_db2text($adherent['ddn_adh']);
            // dynamic fields
            $adherent['dyn'] = get_dynamic_fields($DB, 'adh', $adherent["id_adh"], false);
            // Correct html
            foreach ($adherent as $field => $data) {
                if (is_string($adherent[$field])) {
                    $adherent[$field] = htmlentities($data);
                }
            }
        }
    }
}
// picture data
if ($adherent["id_adh"] != '') {
    $picture = new picture($adherent["id_adh"]);
} else {
        $contribution['date_fin_cotis'] = beg_membership_after($beg_cotis);
        if (is_numeric($contribution['trans_id'])) {
            $contribution['montant_cotis'] = missing_contrib_amount($DB, $contribution['trans_id'], $error_detected);
        }
    } else {
        // initialize coontribution structure with database values
        $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);
    }
} else {
    if ($transaction['trans_id'] == "") {
        // 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 {