$tax_cat_id = $_POST['taxCatId']; } $custTax = \Pasteque\CustTaxCat::__build($_POST['id'], $_POST['label'], $tax_cat_id); if (\Pasteque\CustTaxCatsService::update($custTax)) { $message = \i18n("Changes saved"); } else { $error = \i18n("Unable to save changes"); } } else { if (isset($_POST['label'])) { $tax_cat_id = NULL; if ($_POST['taxCatId'] !== "") { $tax_cat_id = $_POST['taxCatId']; } $custTax = new \Pasteque\CustTaxCat($_POST['label'], $tax_cat_id); $id = \Pasteque\CustTaxCatsService::create($custTax); if ($id !== FALSE) { $message = \i18n("Tax saved. <a href=\"%s\">Go to the tax page</a>.", PLUGIN_NAME, \Pasteque\get_module_url_action(PLUGIN_NAME, 'cust_tax_edit', array('id' => $id))); } else { $error = \i18n("Unable to save changes"); } } } $custTax = NULL; if (isset($_GET['id'])) { $custTax = \Pasteque\CustTaxCatsService::get($_GET['id']); } ?> <h1><?php \pi18n("Edit a customer tax", PLUGIN_NAME); ?>