// it under the terms of the GNU General Public License as published by // 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 CustomerDiscountProfiles; $message = null; $error = null; $srv = new \Pasteque\DiscountProfilesService(); if (isset($_POST['delete-profile'])) { if ($srv->delete($_POST['delete-profile'])) { $message = \i18n("Changes saved"); } else { $error = \i18n("Unable to save changes"); } } $profiles = $srv->getAll(); ?> <h1><?php \pi18n("Discount profiles", PLUGIN_NAME); ?> </h1> <?php
// 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/>. // category_edit action namespace CustomerDiscountProfiles; $message = null; $error = null; $srv = new \Pasteque\DiscountProfilesService(); if (isset($_POST['id']) && isset($_POST['label'])) { // Update profile $profile = \Pasteque\DiscountProfile::__build($_POST['id'], $_POST['label'], $_POST['rate']); if ($srv->update($profile)) { $message = \i18n("Changes saved"); } else { $error = \i18n("Unable to save changes"); } } else { if (isset($_POST['label'])) { // New profile $profile = new \Pasteque\DiscountProfile($_POST['label'], $_POST['rate']); $id = $srv->create($profile); if ($id !== false) { $message = \i18n("Discount profile saved. <a href=\"%s\">Go to the profile page</a>.", PLUGIN_NAME, \Pasteque\get_module_url_action(PLUGIN_NAME, 'discountprofile_edit', array('id' => $id)));