Example #1
0
        $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);
?>
</h1>

<?php 
\Pasteque\tpl_msg_box($message, $error);
?>

<form class="edit" action="<?php 
echo \Pasteque\get_current_url();
?>
" method="post">
Example #2
0
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Pastèque is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
namespace BaseCustomers;

if (isset($_POST['delete-custtax'])) {
    \Pasteque\CustTaxCatsService::delete($_POST['delete-custtax']);
}
$custTaxCats = \Pasteque\CustTaxCatsService::getAll();
?>
<h1><?php 
\pi18n("Customer's tax categories", PLUGIN_NAME);
?>
</h1>

<p><a class="btn" href="<?php 
echo \Pasteque\get_module_url_action(PLUGIN_NAME, 'cust_tax_edit');
?>
"><img src="<?php 
echo \Pasteque\get_template_url();
?>
img/btn_add.png" /><?php 
\pi18n("Add a tax category", PLUGIN_NAME);
?>