function createAddress() { $address = new Address(); $address->setAddress("Av. Tiradentes"); $address->setNumber("123"); $address->setComplement("Ap. 203"); $address->setNeighborhood("Centro"); $address->setCity("São Paulo"); $address->setState(StateEnum::SAO_PAULO); $address->setZipCode("17500000"); return $address; }
public function validate($street, $zip, $apartment = false, $city = false, $state = false) { $verify = new AddressVerify($this->config['username']); $address = new Address(); $address->setFirmName(null); $address->setApt($apartment); $address->setAddress($street); $address->setCity($city); $address->setState($state); $address->setZip5($zip); $address->setZip4(''); // Add the address object to the address verify class $verify->addAddress($address); // Perform the request and return result $val1 = $verify->verify(); $val2 = $verify->getArrayResponse(); // var_dump($verify->isError()); // See if it was successful if ($verify->isSuccess()) { return ['address' => $val2['AddressValidateResponse']['Address']]; } else { return ['error' => $verify->getErrorMessage()]; } }
/** * @Route("/create_address/{address_data}", methods={"POST"}, name="restaurant_address_create") */ public function create_addressAction($address_data) { $address_info = json_decode($address_data, true); $address = new Address(); $address->setCountryid($address_info['countryid']); $address->setStateid($address_info['stateid']); $address->setCityid($address_info['cityid']); $address->setTownshipid($address_info['townshipid']); $address->setNeighborhoodid($address_info['neighborhoodid']); $address->setAddress($address_info['address']); $this->audit_fields($address, 'create'); $address->save(); $description_info = $this->modelsManager->createBuilder()->columns(array('a.id as addressid', 'c.country as country', 's.state as state', 'c2.city as city', 't.township as township', 'n.neighborhood as neighborhood', 'a.address as address'))->from(array('a' => 'Address'))->join('Country', 'c.id =a.countryid', 'c')->join('State', 's.id =a.stateid', 's')->join('City', 'c2.id =a.cityid', 'c2')->join('Township', 't.id =a.townshipid', 't')->join('Neighborhood', 'n.id =a.neighborhoodid', 'n')->where('a.id =:addressid:')->getQuery()->execute(array("addressid" => $address->id_temp))->toArray(); $addres_description = ""; foreach ($description_info as $info) { $addres_description = $info['country'] . ',' . $info['state'] . ',' . $info['city'] . ',' . $info['township'] . ',' . $info['neighborhood'] . ',' . $info['address']; } $address->setDescription($addres_description); $address->save(); return $address->id_temp; }
<?php if (Input::exists()) { $validate = new Validate(); $validation = $validate->check($_POST, array('fname' => array('name' => 'Full Name', 'required' => true, 'min' => 2, 'max' => 50), 'lname' => array('name' => 'Last Name', 'required' => true, 'min' => 2, 'max' => 50), 'tel' => array('name' => 'Phone Number', 'required' => true, 'min' => 10), 'email' => array('name' => 'Email'), 'address' => array('name' => 'Street Address', 'min' => 2, 'max' => 50), 'city' => array('name' => 'City', 'min' => 2, 'max' => 50), 'state' => array('name' => 'State', 'min' => 2, 'max' => 50), 'postcode' => array('name' => 'PostCode', 'min' => 2, 'max' => 50), 'country' => array('name' => 'Country'), 'pwd' => array('name' => 'New Password', 'min' => 8, 'max' => 50), 'rpassword' => array('name' => 'Confirm password', 'matches' => 'pwd'), 'ccust_pass' => array('name' => 'Current Password', 'required' => true, 'samepassword' => 'tbl_cust'), 'comment' => array('name' => 'Comment', 'max' => 100))); if ($validation->passed()) { $id = Crytion::decryt64(Crytion::decryt64(Input::get('id'))); $user = new Customer(); $address = new Address(); $img = new Image(); $img->checkimage('image', 'update', 'tbl_cust', array('cust_id', '=', $id)); $pwd = $user->updatepass($id, 'pwd'); try { $user->updatecust($id, array('cust_fname' => Input::get('fname'), 'cust_lname' => Input::get('lname'), 'cust_dob' => Input::get('dob'), 'image' => $img->getimage(), 'image_name' => $img->getimagename(), 'image_type' => $img->getimagetype(), 'cust_email' => Input::get('email'), 'cust_tel' => Input::get('tel'), 'cust_gender' => Input::get('gender'), 'cust_pass' => $pwd, 'cust_comment' => Input::get('comment'), 'date_update' => date('d-m-Y H:i:s'))); $user->passed(); $address->setAddress($id, array('add_street' => Input::get('address'), 'add_city' => Input::get('city'), 'add_state' => Input::get('state'), 'add_post' => Input::get('postcode'), 'country_id' => Input::get('country'))); $address->passed(); } catch (Exception $e) { die($e->getMessage()); } } else { Session::put('form-error', $validation->errors()); } } $assign = Crytion::decryt64(Session::get('assign')); $user_id = Crytion::decryt64(Session::get('user_id')); $user = new User(); $user->checkLoggedin(array('assign', 'user_id')); if ($user->isLoggedin()) { if ($assign == "ST_C" || $assign == "ST_IN") { header("Location:../detail%20staff/");
<ul data-role="content" class=""> <ul data-role="listview" data-inset="false" data-icon="false" data-divider-theme="b"> <?php if (Input::exists()) { $validate = new Validate(); $validation = $validate->check($_POST, array('cust_fname' => array('name' => 'First Name', 'required' => true), 'cust_lname' => array('name' => 'Last Name', 'required' => true), 'cust_email' => array('name' => 'Email', 'email' => 'cust_email'), 'cust_tel' => array('name' => 'Tel Number', 'required' => true), 'ccust_pass' => array('name' => 'Current Password', 'required' => true, 'samepassword' => 'tbl_cust'))); if ($validation->passed()) { $update = new Customer(); $address = new Address(); $img = new Image(); $img->checkimage('image', 'update', 'tbl_cust', array('cust_id', '=', $result->cust_id)); $pwd = $update->updatepass($result->cust_id, 'new_pass'); try { $update->updatecust($result->cust_id, array('cust_fname' => Input::get('cust_fname'), 'cust_lname' => Input::get('cust_lname'), 'cust_dob' => Input::get('cust_dob'), 'image' => $img->getimage(), 'image_name' => $img->getimagename(), 'image_type' => $img->getimagetype(), 'cust_email' => Input::get('cust_email'), 'cust_tel' => Input::get('cust_tel'), 'cust_gender' => Input::get('cust_gender'), 'cust_pass' => $pwd, 'date_update' => date('d-m-Y H:i:s'))); $update->passed(); $address->setAddress($result->cust_id, array('add_street' => Input::get('add_street'), 'add_city' => Input::get('add_city'), 'add_state' => Input::get('add_state'), 'add_post' => Input::get('add_post'), 'country_id' => Input::get('country'))); $address->passed(); } catch (Exception $e) { die($e->getMessage()); } if ($update && $address) { Session::put('updated', 'Account Successfully update!'); } } else { Session::put('error-update', $validation->errors()); } } if (Input::get('update') == md5('true')) { $sql = DB::getInstance()->query('Select * from tbl_cust a,tbl_add b,tbl_countries c where b.country_id = c.country_code AND a.cust_id = b.person_id
/** * Tests the `setAddress` method. * * @return void * @access public */ public function testSetAddress() { $this->_object->setAddress('*****@*****.**'); $this->assertIdentical($this->_object->getAddress(), '*****@*****.**'); }