Exemple #1
0
 public function setAddressParam(AddressController $address)
 {
     $this->_id = $address->getId();
     $this->_personId = $address->getPersonId();
     $this->_addressType = $address->getAddressType();
     $this->_countryIso = $address->getCountryIso();
     $this->_state = $address->getState();
     $this->_street = $address->getStreet();
     $this->_city = $address->getCity();
     $this->_postalCode = $address->getPostalCode();
     $this->_note = $address->getNote();
 }
 public function validateAddress($market = 1)
 {
     $verify = new AddressController();
     if ($market == '-1') {
         $result = $verify->validateAddress(1, $this->data['postal']);
         if ($result[0]["state"] == '') {
             $result = $verify->validateAddress(2, $this->data['postal']);
         }
     } else {
         $result = $verify->validateAddress($market, $this->data['postal']);
     }
     $this->sendSuccess($result);
 }
Exemple #3
0
 $addressId = null;
 $firstName = null;
 $surname = null;
 $phoneNumber = null;
 $mobileNumber = null;
 $emailAddress = null;
 $mailingList = null;
 $streetAddress = null;
 $suburb = null;
 $city = null;
 $postcode = null;
 $state = null;
 $addressDate = null;
 $sellerCon = new SellerController();
 $personCon = new PersonController();
 $addressCon = new AddressController();
 function checkSelected($id1, $id2)
 {
     if ($id1 == $id2) {
         echo 'selected';
     }
 }
 if (isset($_GET['id'])) {
     $sellerId = $_GET['id'];
     $seller = $sellerCon->getSeller($sellerId);
     if ($seller->errorInfo()[2] == null) {
         $row = $seller->fetch();
         $rowCount = count($row);
         if ($rowCount > 0) {
             $personId = $row['person_id'];
             $person = $personCon->getPerson($personId);
Exemple #4
0
/**
 * Created by PhpStorm.
 * User: roessler
 * Date: 16/09/15
 * Time: 1:22 PM
 */
/**
 * Backend page for administrators and Staff of Cyril's Classic Cars to add and view buyers
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $addResult = null;
        $custCon = new CustomerController();
        $personCon = new PersonController();
        $addressCon = new AddressController();
        if (isset($_POST['hdnAction'])) {
            if ($_POST['hdnAction'] == 'insert') {
                if (!isset($_POST['chkMailingList'])) {
                    $chkMailingList = 0;
                } else {
                    $chkMailingList = $_POST['chkMailingList'];
                }
                $result = $personCon->insertPerson($_POST['txtFirstName'], $_POST['txtSurname'], $_POST['txtPhone'], $_POST['txtMobile'], $_POST['txtEmail'], $chkMailingList);
                $personId = $result['personId'];
                if ($result['stmt']->errorInfo()[2] == null) {
                    $custResult = $custCon->insertCustomer($personId);
                    if ($custResult->errorInfo()[2] == null) {
                        $addressResult = $addressCon->insertAddress($_POST['txtStreetAddress'], $_POST['txtSuburb'], $_POST['txtCity'], $_POST['txtPostcode'], $_POST['txtState'], $personId);
                        if ($addressResult->errorInfo()[2] == null) {
                            $addResult = true;
/**
 * Backend page for administrators and Staff of Cyril's Classic Cars to add and view models
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $editResult = null;
        $sellId = null;
        $personId = null;
        $firstName = null;
        $surname = null;
        $emailAddress = null;
        $mailingList = null;
        $sellCon = new SellerController();
        $personCon = new PersonController();
        $addressCon = new AddressController();
        function checkSelected($id1, $id2)
        {
            if ($id1 == $id2) {
                echo 'selected';
            }
        }
        if (isset($_GET['id'])) {
            $sellId = $_GET['id'];
            $seller = $sellCon->getSeller($sellId);
            if ($seller->errorInfo()[2] == null) {
                $row = $seller->fetch();
                $rowCount = count($row);
                if ($rowCount > 0) {
                    $personId = $row['person_id'];
                    $person = $personCon->getPerson($personId);
Exemple #6
0
 $addressId = null;
 $firstName = null;
 $surname = null;
 $phoneNumber = null;
 $mobileNumber = null;
 $emailAddress = null;
 $mailingList = null;
 $streetAddress = null;
 $suburb = null;
 $city = null;
 $postcode = null;
 $state = null;
 $addressDate = null;
 $sellerCon = new SellerController();
 $personCon = new PersonController();
 $addressCon = new AddressController();
 function checkSelected($id1, $id2)
 {
     if ($id1 == $id2) {
         echo 'selected';
     }
 }
 if (isset($_GET['id'])) {
     $sellerId = $_GET['id'];
     $seller = $sellerCon->getSeller($sellerId);
     if ($seller->errorInfo()[2] == null) {
         $row = $seller->fetch();
         $rowCount = count($row);
         if ($rowCount > 0) {
             $personId = $row['person_id'];
             $person = $personCon->getPerson($personId);
    public function getNote()
    {
        return $this->_note;
    }
    public function addressFieldValidate()
    {
        $addressFieldValidate = 0;
        if ($this->_countryIso) {
            $addressFieldValidate = 1;
        }
        return $addressFieldValidate;
    }
}
// End AddressController
if (array_key_exists('addAddress', $_POST)) {
    $cAddress = new AddressController((int) $_POST['id'], (int) $_POST['personId'], (int) $_POST['address_type'], $_POST['country_iso'], $_POST['state'], $_POST['street'], $_POST['city'], $_POST['postal_code'], $_POST['note']);
    if ($cAddress->addressFieldValidate()) {
        $model = new AddressPDO();
        if (isset($_GET['action']) && $_GET['action'] === 'create') {
            $model->create($cAddress);
            header("Location: ../profile.php?id=" . $_POST['personId']);
        }
        if (isset($_GET['action']) && $_GET['action'] === 'update') {
            $model->updateById($cAddress);
            header("Location: ../profile.php?id=" . $_POST['personId']);
        }
    } elseif ($_GET['action'] === 'update') {
        header("Location: ../email.php?id={$_POST['personId']}&action=update&validate=error&update={$_POST['id']}");
    } else {
        header("Location: ../email.php?id={$_POST['personId']}&validate=error");
    }