コード例 #1
0
    $code = $reg[1];
    if (dolibarr_del_const($db, $code, 0) > 0) {
        Header("Location: " . $_SERVER["PHP_SELF"]);
        exit;
    } else {
        dol_print_error($db);
    }
}
if ($action == 'add_currency') {
    $code = GETPOST('code', 'alpha');
    $name = GETPOST('name', 'alpha');
    $rate = GETPOST('rate', 'alpha');
    $currency = new MultiCurrency($db);
    $currency->code = $code;
    $currency->name = $name;
    if ($currency->create($user) > 0) {
        if ($currency->addRate($rate)) {
            setEventMessages($langs->trans('SuccessAddRate'), array());
        } else {
            setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
        }
    } else {
        setEventMessages($langs->trans('ErrorAddCurrencyFail'), array());
    }
} elseif ($action == 'update_currency') {
    $submit = GETPOST('submit', 'alpha');
    if ($submit == $langs->trans('Modify')) {
        $fk_multicurrency = GETPOST('fk_multicurrency', 'int');
        $rate = GETPOST('rate', 'float');
        $currency = new MultiCurrency($db);
        if ($currency->fetch($fk_multicurrency) > 0) {