示例#1
0
    $expireDate = NULL;
    if (isset($_POST['expireDate']) && $_POST['expireDate'] !== "") {
        $expireDate = $_POST['expireDate'];
        $expireDate = \i18nRevDate($expireDate);
    }
    $cust = \Pasteque\Customer::__build($_POST['id'], $number, $key, $_POST['dispName'], $_POST['card'], $taxCatId, $discountProfileId, $tariffAreaId, $prepaid, $maxDebt, $currDebt, $debtDate, $_POST['firstName'], $_POST['lastName'], $_POST['email'], $_POST['phone1'], $_POST['phone2'], $_POST['fax'], $_POST['addr1'], $_POST['addr2'], $_POST['zipCode'], $_POST['city'], $_POST['region'], $_POST['country'], $_POST['note'], $visible, $expireDate);
    if (\Pasteque\CustomersService::update($cust)) {
        $message = \i18n("Changes saved");
    } else {
        $error = \i18n("Unable to save changes");
    }
} else {
    if (isset($_POST['dispName'])) {
        $visible = isset($_POST['visible']) ? 1 : 0;
        if (!isset($_POST['number']) || $_POST['number'] == "") {
            $custSrv = new \Pasteque\CustomersService();
            $number = $custSrv->getNextNumber();
        } else {
            $number = $_POST['number'];
        }
        if (!isset($_POST['key']) || $_POST['key'] == "") {
            $key = $number . "-" . $_POST['dispName'];
        } else {
            $key = $_POST['key'];
        }
        $taxCatId = null;
        if (isset($_POST['custTaxId']) && $_POST['custTaxId'] != "") {
            $taxCatId = $_POST['custTaxId'];
        }
        $discountProfileId = null;
        if ($discounts && $_POST['discountProfileId'] !== "") {
示例#2
0
//
//    Pastèque is free software: you can redistribute it and/or modify
//    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 BaseCustomers;

$srv = new \Pasteque\CustomersService();
if (isset($_GET['delete-customer'])) {
    $srv->delete($_GET['delete-customer']);
}
$customers = $srv->getAll(true);
?>
<h1><?php 
\pi18n("Customers", PLUGIN_NAME);
?>
</h1>

<p><a class="btn" href="<?php 
echo \Pasteque\get_module_url_action(PLUGIN_NAME, 'customer_edit');
?>
"><img src="<?php 
echo \Pasteque\get_template_url();