Ejemplo n.º 1
0
        }
    }
}
if ($action == 'setremise') {
    //if ($user->rights->societe->creer)
    //if ($user->rights->facture->creer)
    if (price2num($_POST["amount_ht"]) > 0) {
        $error = 0;
        if (empty($_POST["desc"])) {
            $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")) . '</div>';
            $error++;
        }
        if (!$error) {
            $soc = new Societe($db);
            $soc->fetch($_GET["id"]);
            $discountid = $soc->set_remise_except($_POST["amount_ht"], $user, $_POST["desc"], $_POST["tva_tx"]);
            if ($discountid > 0) {
                if (!empty($backtopage)) {
                    header("Location: " . $backtopage . '&discountid=' . $discountid);
                    exit;
                } else {
                    header("Location: remx.php?id=" . $_GET["id"]);
                    exit;
                }
            } else {
                $error++;
                $mesg = '<div class="error">' . $soc->error . '</div>';
            }
        }
    } else {
        $mesg = '<div class="error">' . $langs->trans("ErrorFieldFormat", $langs->trans("NewGlobalDiscount")) . '</div>';