Exemple #1
0
    }
    if ($error === null) {
        $message = \i18n("Tax saved", PLUGIN_NAME);
    }
} else {
    if (isset($_POST['label'])) {
        // Create tax category
        if (!isset($_POST['new-startDate'])) {
            $start = \time();
        } else {
            $start = \i18nRevDate($_POST['new-startDate']);
        }
        $taxCat = new \Pasteque\TaxCat($_POST['label']);
        $tax = new \Pasteque\Tax(null, $_POST['label-new'], $start, floatval($_POST['rate-new']));
        $taxCat->addTax($tax);
        $taxCatId = \Pasteque\TaxesService::createCat($taxCat);
        if ($taxCatId === false) {
            $error = \i18n("Unable to save tax.", PLUGIN_NAME);
        } else {
            $message = \i18n("Tax saved", PLUGIN_NAME);
        }
    }
}
$taxCat = null;
if (isset($_GET['id'])) {
    $taxCat = \Pasteque\TaxesService::get($_GET['id']);
}
?>
<h1><?php 
\pi18n("Edit tax", PLUGIN_NAME);
?>