default:
                             dblog("A problem happened while sending password for account:" . " \"" . $_POST["email_adh"] . "\"");
                             $error_detected[] = _T("A problem happened while sending password for account:") . " \"" . $_POST["email_adh"] . "\"";
                             break;
                     }
                 }
             } else {
                 $error_detected[] = _T("Sent mail is checked but there is no email address") . " \"" . $_POST["login_adh"] . "\"";
             }
         } elseif ($_POST["mail_confirm"] == "1" && PREF_MAIL_METHOD == 0) {
             //if mail has been disabled in the preferences, we should not be here ; we do not throw an error, just a simple warning that will be show later
             $_SESSION['galette']['mail_warning'] = _T("You asked Galette to send a confirmation mail to the member, but mail has been disabled in the preferences.");
         }
     }
     // dynamic fields
     set_all_dynamic_fields($DB, 'adh', $adherent['id_adh'], $adherent['dyn']);
     // deadline
     $date_fin = get_echeance($DB, $adherent['id_adh']);
     if ($date_fin != "") {
         $date_fin_update = $DB->DBDate($date_fin[2] . '-' . $date_fin[1] . '-' . $date_fin[0]);
     } else {
         $date_fin_update = "NULL";
     }
     $requete = "UPDATE " . PREFIX_DB . "adherents\n\t\t\t\t\tSET date_echeance=" . $date_fin_update . "\n\t\t\t\t\tWHERE id_adh=" . $adherent['id_adh'];
     $DB->Execute($requete);
     if (!isset($_POST['id_adh'])) {
         header('location: ajouter_contribution.php?id_adh=' . $adherent['id_adh']);
     } elseif (!isset($_POST['del_photo']) && count($error_detected) == 0) {
         header('location: voir_adherent.php?id_adh=' . $adherent['id_adh']);
     }
 }
         // to allow the string to be extracted for translation
         $foo = _T("Contribution added");
         // logging
         dblog('Contribution added', strtoupper($login), $requete);
     }
 } else {
     $requete = "UPDATE " . PREFIX_DB . "cotisations\n                                            SET " . substr($update_string, 1) . "\n                                            WHERE id_cotis=" . $contribution['id_cotis'];
     if (db_execute($DB, $requete, $error_detected)) {
         // to allow the string to be extracted for translation
         $foo = _T("Contribution updated");
         // logging
         dblog('Contribution updated', strtoupper($login), $requete);
     }
 }
 // dynamic fields
 set_all_dynamic_fields($DB, 'contrib', $contribution['id_cotis'], $contribution['dyn']);
 // update deadline
 if ($cotis_extension) {
     $date_fin = get_echeance($DB, $contribution['id_adh']);
     if ($date_fin != "") {
         $date_fin_update = date_text2db($DB, implode("/", $date_fin));
     } else {
         $date_fin_update = "NULL";
     }
     $requete = "UPDATE " . PREFIX_DB . "adherents\n\t\t\t\t\t\tSET date_echeance=" . $date_fin_update . "\n\t\t\t\t\t\tWHERE id_adh=" . $contribution['id_adh'];
     $DB->Execute($requete);
 }
 if (count($error_detected) == 0) {
     if ($missing_amount > 0) {
         $url = 'ajouter_contribution.php?trans_id=' . $contribution['trans_id'] . '&id_adh=' . $contribution['id_adh'];
     } else {
            }
            $transaction['trans_id'] = get_last_auto_increment($DB, PREFIX_DB . "transactions", "trans_id");
            // to allow the string to be extracted for translation
            $foo = _T("transaction added");
            // logging
            dblog('transaction added', '', $requete);
        } else {
            $requete = "UPDATE " . PREFIX_DB . "transactions\n\t\t\t\t    SET " . substr($update_string, 1) . "\n\t\t\t\t    WHERE trans_id=" . $transaction['trans_id'];
            $DB->Execute($requete);
            // to allow the string to be extracted for translation
            $foo = _T("transaction updated");
            // logging
            dblog('transaction updated', '', $requete);
        }
        // dynamic fields
        set_all_dynamic_fields($DB, 'trans', $transaction['trans_id'], $transaction['dyn']);
        if ($missing_amount > 0) {
            $url = 'ajouter_contribution.php?trans_id=' . $transaction['trans_id'];
            if (isset($transaction['id_adh'])) {
                $url .= '&id_adh=' . $transaction['id_adh'];
            }
        } else {
            $url = 'gestion_transactions.php';
        }
        header('location: ' . $url);
    }
} else {
    if ($transaction['trans_id'] == "") {
        // initialiser la structure transaction à vide (nouvelle transaction)
        $transaction['trans_date'] = date("d/m/Y", time());
    } else {