当前位置: 首页>>代码示例>>PHP>>正文


PHP Address::setCountry方法代码示例

本文整理汇总了PHP中Address::setCountry方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::setCountry方法的具体用法?PHP Address::setCountry怎么用?PHP Address::setCountry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Address的用法示例。


在下文中一共展示了Address::setCountry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fromArray

 public static function fromArray($data)
 {
     $address = new Address();
     if (isset($data['street'])) {
         $address->setStreet($data['street']);
     }
     if (isset($data['street2'])) {
         $address->setStreet2($data['street2']);
     }
     if (isset($data['zip'])) {
         $address->setZip($data['zip']);
     }
     if (isset($data['city'])) {
         $address->setCity($data['city']);
     }
     if (isset($data['country'])) {
         $address->setCountry($data['country']);
     }
     if (isset($data['state'])) {
         $address->setState($data['state']);
     }
     if (isset($data['tel'])) {
         $address->setTel($data['tel']);
     }
     if (isset($data['fax'])) {
         $address->setFax($data['fax']);
     }
     if (isset($data['email'])) {
         $address->setEmail($data['email']);
     }
     return $address;
 }
开发者ID:tomaj,项目名称:invoice-client,代码行数:32,代码来源:Address.php

示例2: _convertRequestAddress

 /**
  * Sets attributes from the Mage address on the AvaTax Request address.
  *
  * @return $this
  */
 protected function _convertRequestAddress()
 {
     if (!$this->_requestAddress) {
         $this->_requestAddress = new Address();
     }
     $this->_requestAddress->setLine1($this->_mageAddress->getStreet(1));
     $this->_requestAddress->setLine2($this->_mageAddress->getStreet(2));
     $this->_requestAddress->setCity($this->_mageAddress->getCity());
     $this->_requestAddress->setRegion($this->_mageAddress->getRegionCode());
     $this->_requestAddress->setCountry($this->_mageAddress->getCountry());
     $this->_requestAddress->setPostalCode($this->_mageAddress->getPostcode());
     return $this;
 }
开发者ID:shabirm,项目名称:avatax,代码行数:18,代码来源:Address.php

示例3: initializeWithRawData

 /**
  * Initialize the object with raw data
  *
  * @param $data
  * @return Address
  */
 public static function initializeWithRawData($data)
 {
     $item = new Address();
     if (isset($data['full_address'])) {
         $item->setFullAddress($data['full_address']);
     }
     if (isset($data['country'])) {
         $item->setCountry($data['country']);
     }
     if (isset($data['country_name'])) {
         $item->setCountryName($data['country_name']);
     }
     return $item;
 }
开发者ID:sumocoders,项目名称:factr,代码行数:20,代码来源:Address.php

示例4: parseForm

 private function parseForm(HTTPRequest $request, Address $address)
 {
     $title = htmlspecialchars($request->postData('title'));
     $address1 = htmlspecialchars($request->postData('address-1'));
     $address2 = htmlspecialchars($request->postData('address-2'));
     $zipCode = htmlspecialchars($request->postData('zip-code'));
     $city = htmlspecialchars($request->postData('city'));
     $country = 'France';
     $address->setTitle($title);
     $address->setAddress1($address1);
     $address->setAddress2($address2);
     $address->setZipCode($zipCode);
     $address->setCity($city);
     $address->setCountry($country);
     $address->setUserId($this->app->user()->getAttribute('id'));
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:16,代码来源:AddressesController.class.php

示例5: buildAtms

 public function buildAtms($xml)
 {
     $pageOffset = (string) $xml->PageOffset;
     $totalCount = (string) $xml->TotalCount;
     $restaurantArray = array();
     foreach ($xml->Restaurant as $restaurant) {
         $tmpRestaurant = new Restaurant();
         $tmpRestaurant->setId((string) $restaurant->Id);
         $tmpRestaurant->setName((string) $restaurant->Name);
         $tmpRestaurant->setWebsiteUrl((string) $restaurant->WebsiteUrl);
         $tmpRestaurant->setPhoneNumber((string) $restaurant->PhoneNumber);
         $tmpRestaurant->setCategory((string) $restaurant->Category);
         $tmpRestaurant->setLocalFavoriteInd((string) $restaurant->LocalFavoriteInd);
         $tmpRestaurant->setHiddenGemInd((string) $restaurant->HiddenGemInd);
         $tmpLocation = new Location();
         $location = $restaurant->Location;
         $tmpLocation->setName((string) $location->Name);
         $tmpLocation->setDistance((string) $location->Distance);
         $tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
         $tmpAddress = new Address();
         $address = $location->Address;
         $tmpAddress->setLine1((string) $address->Line1);
         $tmpAddress->setLine2((string) $address->Line2);
         $tmpAddress->setCity((string) $address->City);
         $tmpAddress->setPostalCode((string) $address->PostCode);
         $tmpCountry = new Country();
         $tmpCountry->setName((string) $address->Country->Name);
         $tmpCountry->setCode((string) $address->Country->Code);
         $tmpCountrySubdivision = new CountrySubdivision();
         $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
         $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
         $tmpAddress->setCountry($tmpCountry);
         $tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
         $tmpPoint = new Point();
         $point = $location->Point;
         $tmpPoint->setLatitude((string) $point->Latitude);
         $tmpPoint->setLongitude((string) $point->Longitude);
         $tmpLocation->setPoint($tmpPoint);
         $tmpLocation->setAddress($tmpAddress);
         $tmpRestaurant->setLocation($tmpLocation);
         array_push($restaurantArray, $tmpRestaurant);
     }
     $restaurants = new Restaurants($pageOffset, $totalCount, $restaurantArray);
     return $restaurants;
 }
开发者ID:vicenteguerra,项目名称:Flashbuy,代码行数:45,代码来源:RestaurantsLocalFavoritesService.php

示例6: buildMerchantIds

 public function buildMerchantIds($xml)
 {
     $merchantArray = array();
     foreach ($xml->ReturnedMerchants->Merchant as $merchant) {
         $xmlAddress = $merchant->Address;
         $xmlCountrySubdivision = $merchant->Address->CountrySubdivision;
         $xmlCountry = $merchant->Address->Country;
         $xmlMerchant = $merchant;
         $address = new Address();
         $address->setLine1((string) $xmlAddress->Line1);
         $address->setLine2((string) $xmlAddress->Line2);
         $address->setCity((string) $xmlAddress->City);
         $address->setPostalCode((string) $xmlAddress->PostalCode);
         $countrySubdivision = new CountrySubdivision();
         $countrySubdivision->setCode((string) $xmlCountrySubdivision->Code);
         $countrySubdivision->setName((string) $xmlCountrySubdivision->Name);
         $country = new Country();
         $country->setCode((string) $xmlCountry->Code);
         $country->setName((string) $xmlCountry->Name);
         $address->setCountrySubdivision($countrySubdivision);
         $address->setCountry($country);
         $tmpMerchant = new Merchant();
         $tmpMerchant->setAddress($address);
         $tmpMerchant->setPhoneNumber((string) $xmlMerchant->PhoneNumber);
         $tmpMerchant->setBrandName((string) $xmlMerchant->BrandName);
         $tmpMerchant->setMerchantCategory((string) $xmlMerchant->MerchantCategory);
         $tmpMerchant->setMerchantDbaName((string) $xmlMerchant->MerchantDbaName);
         $tmpMerchant->setDescriptorText((string) $xmlMerchant->DescriptorText);
         $tmpMerchant->setLegalCorporateName((string) $xmlMerchant->LegalCorporateName);
         $tmpMerchant->setBrickCount((string) $xmlMerchant->BrickCount);
         $tmpMerchant->setComment((string) $xmlMerchant->Comment);
         $tmpMerchant->setLocationId((string) $xmlMerchant->LocationId);
         $tmpMerchant->setOnlineCount((string) $xmlMerchant->OnlineCount);
         $tmpMerchant->setOtherCount((string) $xmlMerchant->OtherCount);
         $tmpMerchant->setSoleProprietorName((string) $xmlMerchant->SoleProprietorName);
         array_push($merchantArray, $tmpMerchant);
     }
     $returnedMerchants = new ReturnedMerchants();
     $returnedMerchants->setMerchant($merchantArray);
     $merchantIds = new MerchantIds();
     $merchantIds->setReturnedMerchants($returnedMerchants);
     $merchantIds->setMessage($xml->Message);
     return $merchantIds;
 }
开发者ID:vicenteguerra,项目名称:Flashbuy,代码行数:44,代码来源:MerchantIdentifierService.php

示例7: create_ecp_PaymentMethod

function create_ecp_PaymentMethod()
{
    $uniqueValue = get_unique_value();
    $merchantAccountId = 'account-' . $uniqueValue;
    $merchantPaymentMethodId = 'pm-' . $uniqueValue;
    $email = get_unique_value() . '@nomail.com';
    $successUrl = 'http://good.com/';
    //need a trailing slash
    $errorUrl = 'http://bad.com/';
    //need a trailing slash
    $name = 'John Vindicia';
    $addr1 = '303 Twin Dolphin Drive';
    $city = 'Redwood City';
    $district = 'CA';
    $postalCode = '94065';
    $country = 'US';
    $address = new Address();
    $address->setName($name);
    $address->setAddr1($addr1);
    $address->setCity($city);
    $address->setDistrict($district);
    $address->setPostalCode($postalCode);
    $address->setCountry($country);
    $paymentmethod = new PaymentMethod();
    $paymentmethod->setType('ECP');
    $paymentmethod->setAccountHolderName($name);
    $paymentmethod->setBillingAddress($address);
    $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId);
    $paymentmethod->setCurrency('USD');
    $ecp = new ECP();
    $ecp->setAccount('495958930');
    $ecp->setRoutingNumber('611111111');
    $ecp->setAllowedTransactionType('Inbound');
    $ecp->setAccountType('ConsumerChecking');
    $paymentmethod->setECP($ecp);
    $account = new Account();
    $account->setMerchantAccountId($merchantAccountId);
    $account->setEmailAddress($email);
    $account->setShippingAddress($address);
    $account->setEmailTypePreference('html');
    $account->setName($name);
    $account->setPaymentMethods(array($paymentmethod));
    return $account;
}
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:44,代码来源:ecpAutoBill.php

示例8: create_paypal_PaymentMethod

function create_paypal_PaymentMethod()
{
    $uniqueValue = get_unique_value();
    $merchantAccountId = 'account-' . $uniqueValue;
    $merchantPaymentMethodId = 'pm-' . $uniqueValue;
    $email = get_unique_value() . '@nomail.com';
    $successUrl = 'http://good.com/';
    //need a trailing slash
    $errorUrl = 'http://bad.com/';
    //need a trailing slash
    $name = 'John Vindicia';
    $addr1 = '303 Twin Dolphin Drive';
    $city = 'Redwood City';
    $district = 'CA';
    $postalCode = '94065';
    $country = 'US';
    $address = new Address();
    $address->setName($name);
    $address->setAddr1($addr1);
    $address->setCity($city);
    $address->setDistrict($district);
    $address->setPostalCode($postalCode);
    $address->setCountry($country);
    $paymentmethod = new PaymentMethod();
    $paymentmethod->setType('PayPal');
    $paymentmethod->setAccountHolderName($name);
    $paymentmethod->setBillingAddress($address);
    $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId);
    $paymentmethod->setCurrency('USD');
    $paypal = new PayPal();
    $paypal->setReturnUrl($successUrl);
    $paypal->setCancelUrl($errorUrl);
    $paymentmethod->setPaypal($paypal);
    $account = new Account();
    $account->setMerchantAccountId($merchantAccountId);
    $account->setEmailAddress($email);
    $account->setShippingAddress($address);
    $account->setEmailTypePreference('html');
    $account->setName($name);
    //$account->setPaymentMethods(array($paymentmethod));
    //return $account;
    return array('account' => $account, 'paymentmethod' => $paymentmethod);
}
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:43,代码来源:paypalAutoBill.php

示例9: testSetAddressParameters

 /**
  * @group shopobjects
  */
 function testSetAddressParameters()
 {
     // GIVEN
     $incompleteAddressParameter = $this->givenIncompleteAddressParameter();
     // WHEN
     $address = new Address($incompleteAddressParameter);
     $address->setBirthday("01.02.1900");
     $address->setCity("Cologne");
     $address->setCompany("FakeCompany");
     $address->setCountry("England");
     $address->setEmailAddress("a@b.cd");
     $address->setFirstName("Max");
     $address->setLastName("Miller");
     $address->setSalutation("Mr.");
     $address->setState("NRW");
     $address->setStreet("First street 2");
     $address->setStreetDetails("c/o Mister Smith");
     $address->setTitle("Master");
     $address->setVatId("DE1234567890");
     $address->setZipCode("12345");
     // THEN
     $this->assertFalse($address->error());
     $this->thenCompleteAddressInformationIsExisting($address);
 }
开发者ID:ePages-de,项目名称:epages-rest-php,代码行数:27,代码来源:AddressTest.php

示例10: buildInquireMapping

 private function buildInquireMapping($xml)
 {
     $inquireMapping = new InquireMapping();
     $inquireMapping->setRequestId((string) $xml->RequestId);
     $mappings = new Mappings();
     $mappingArray = array();
     foreach ($xml->Mappings->Mapping as $mapping) {
         $tmpMapping = new Mapping();
         $tmpMapping->setMappingId((string) $mapping->MappingId);
         $tmpMapping->setSubscriberId((string) $mapping->SubscriberId);
         $tmpMapping->setAccountUsage((string) $mapping->AccountUsage);
         $tmpMapping->setDefaultIndicator((string) $mapping->DefaultIndicator);
         $tmpMapping->setAlias((string) $mapping->Alias);
         $tmpMapping->setICA((string) $mapping->ICA);
         $tmpMapping->setAccountNumber((string) $mapping->AccountNumber);
         $tmpCardholderFullName = new CardholderFullName();
         $cardholderFullName = $mapping->CardholderFullName;
         $tmpCardholderFullName->setCardholderFirstName((string) $cardholderFullName->CardholderFirstName);
         $tmpCardholderFullName->setCardholderMiddleName((string) $cardholderFullName->CardholderMiddleName);
         $tmpCardholderFullName->setCardholderLastName((string) $cardholderFullName->CardholderLastName);
         $tmpAddress = new Address();
         $address = $mapping->Address;
         $tmpAddress->setLine1((string) $address->line1);
         $tmpAddress->setLine2((string) $address->line2);
         $tmpAddress->setCity((string) $address->City);
         $tmpAddress->setCountrySubdivision((string) $address->CountrySubdivision);
         $tmpAddress->setPostalCode((string) $address->PostalCode);
         $tmpAddress->setCountry((string) $address->Country);
         $tmpReceivingEligibility = new ReceivingEligibility();
         $receivingEligibility = $mapping->ReceivingEligibility;
         $tmpReceivingEligibility->setEligible((string) $receivingEligibility->Eligible);
         $tmpCurrency = new Currency();
         $currency = $receivingEligibility->Currency;
         $tmpCurrency->setAlphaCurrencyCode((string) $currency->AlphaCurrencyCode);
         $tmpCurrency->setNumericCurrencyCode((string) $currency->NumericCurrencyCode);
         $tmpCountry = new Country();
         $country = $receivingEligibility->Country;
         $tmpCountry->setAlphaCountryCode((string) $country->AlphaCountryCode);
         $tmpCountry->setAlphaCountryCode((string) $country->NumericCountryCode);
         $tmpBrand = new Brand();
         $brand = $receivingEligibility->Brand;
         $tmpBrand->setAcceptanceBrandCode((string) $brand->AcceptanceBrandCode);
         $tmpBrand->setProductBrandCode((string) $brand->ProductBrandCode);
         $tmpMapping->setExpiryDate((string) $mapping->ExpiryDate);
         $tmpReceivingEligibility->setCurrency($tmpCurrency);
         $tmpReceivingEligibility->setCountry($tmpCountry);
         $tmpReceivingEligibility->setBrand($tmpBrand);
         $tmpMapping->setCardholderFullName($tmpCardholderFullName);
         $tmpMapping->setAddress($tmpAddress);
         $tmpMapping->setReceivingEligibility($tmpReceivingEligibility);
         array_push($mappingArray, $tmpMapping);
     }
     $mappings->setMapping($mappingArray);
     $inquireMapping->setMappings($mappings);
     return $inquireMapping;
 }
开发者ID:payene,项目名称:mastercard-api-php,代码行数:56,代码来源:CardMappingService.php

示例11: buildFromJSON

 /**
  * 
  * Builds and Returns an Address object based off of the JSON input.
  * 
  * @param vo_json   JSON representation of an address
  * @return  the Address
  * @throws JSONException  if the json is not properly formatted
  */
 static function buildFromJSON($o_data)
 {
     $o_instance = new Address();
     if ($o_data != NULL) {
         if (array_key_exists("address_name", $o_data)) {
             $o_instance->setName($o_data['address_name']);
         }
         if (array_key_exists("address_line1", $o_data)) {
             $o_instance->setLine1($o_data['address_line1']);
         }
         if (array_key_exists("address_line2", $o_data)) {
             $o_instance->setLine2($o_data['address_line2']);
         }
         if (array_key_exists("address_city", $o_data)) {
             $o_instance->setCity($o_data['address_city']);
         }
         if (array_key_exists("address_state", $o_data)) {
             $o_instance->setState($o_data['address_state']);
         }
         if (array_key_exists("address_zipcode", $o_data)) {
             $o_instance->setZipcode($o_data['address_zipcode']);
         }
         if (array_key_exists("address_country", $o_data)) {
             $o_instance->setCountry($o_data['address_country']);
         }
     }
     return $o_instance;
 }
开发者ID:omusico,项目名称:RentSquare,代码行数:36,代码来源:Address.php

示例12: testSetCountry

 /**
  * Tests Address->setCountry()
  */
 public function testSetCountry()
 {
     $this->Address->setCountry('country');
     $this->assertEquals('country', $this->Address->country);
 }
开发者ID:ahmedadham88,项目名称:enhanced-social-network,代码行数:8,代码来源:AddressTest.php

示例13: getUserAddEditForm


//.........这里部分代码省略.........
     //31 is the ID of Canada. It should be a SiteConfig variable
     $form->addElement('hidden', 'shipping_country');
     $form->addElement('static', 'shipping_country1', 'Country', 'Canada');
     $form->addElement('header', 'save', 'Save');
     if ($admin) {
         $form->addElement('select', 'a_status', 'Active Status', $statuses);
     }
     $form->addElement('submit', 'a_submit', 'Save');
     $form->addElement('reset', 'a_cancel', 'Cancel');
     if (isset($this->user) && $this->user->hasPerm('assigngroups')) {
         $sql = 'SELECT agp_id, agp_name from auth_groups';
         $groups = Database::singleton()->query_fetch_all($sql);
         $assignableGroup = array();
         foreach ($groups as $group) {
             $assignableGroup[$group['agp_id']] = $group['agp_name'];
         }
         if (@$this) {
             $defaultValues['a_group'] = $this->getAuthGroup();
         }
         $form->addElement('select', 'a_group', 'Member Group', $assignableGroup);
     }
     $defaultValues['a_username'] = $this->getUsername();
     $defaultValues['a_name'] = $this->getName();
     //$defaultValues ['a_email'] = $this->getEmail();
     $defaultValues['a_phone'] = $this->getPhone();
     $defaultValues['a_join_newsletter'] = $this->getJoinNewsletter();
     $defaultValues['a_password'] = null;
     $defaultValues['a_password_confirm'] = null;
     if (@$this->getAddress()) {
         $defaultValues['a_address'] = @$this->getAddress()->getStreetAddress();
         $defaultValues['a_city'] = @$this->getAddress()->getCity();
         $defaultValues['a_postalcode'] = @$this->getAddress()->getPostalCode();
     }
     if (@$this->getShippingAddress()) {
         $defaultValues['shipping_address'] = @$this->getShippingAddress()->getStreetAddress();
         $defaultValues['shipping_city'] = @$this->getShippingAddress()->getCity();
         $defaultValues['shipping_postalcode'] = @$this->getShippingAddress()->getPostalCode();
     }
     if ($admin) {
         $defaultValues['a_status'] = $this->getActiveStatus();
     }
     $form->setDefaults($defaultValues);
     $form->addRule('a_name', 'Please enter the user\'s name', 'required', null, 'client');
     //$form->addRule( 'a_email', 'Please enter an email address', 'required', null, 'client' );
     //$form->addRule( 'a_email', 'Please enter a valid email address', 'email', null, 'client' );
     $form->addRule('a_phone', 'Please enter a phone number', 'required', null, 'client');
     $form->addRule('a_address', 'Please enter a billing address', 'required', null, 'client');
     $form->addRule('a_city', 'Please enter a billing address city', 'required', null, 'client');
     $form->addRule('a_postalcode', 'Please enter a billing address postal code', 'required', null, 'client');
     $form->addRule('shipping_address', 'Please enter a shipping address', 'required', null, 'client');
     $form->addRule('shipping_city', 'Please enter a shipping address city', 'required', null, 'client');
     $form->addRule('shipping_postalcode', 'Please enter a shipping address postal code', 'required', null, 'client');
     if (!isset($_REQUEST['id'])) {
         $form->addRule('a_password', 'Please enter a password', 'required', null, 'client');
         $form->addRule('a_password_confirm', 'Please confirm the passwords match', 'required', null, 'client');
     }
     $form->addRule(array('a_password', 'a_password_confirm'), 'The passwords do not match', 'compare', null, 'client');
     if (isset($_REQUEST['a_submit']) && $form->validate()) {
         $this->setPassword($_REQUEST['a_password']);
         if ($admin || @(!$_REQUEST['id'])) {
             $this->setUsername($_REQUEST['a_username']);
             $this->setEmail($_REQUEST['a_username']);
         }
         $this->setActiveStatus(1);
         $this->setPhone($_REQUEST['a_phone']);
         $this->setName($_REQUEST['a_name']);
         $this->setJoinNewsletter(@$_REQUEST['a_join_newsletter']);
         if (@$this->getAddress()) {
             $billingTemp = new Address(@$this->getAddress()->getId());
         } else {
             $billingTemp = new Address();
         }
         $billingTemp->setStreetAddress($_REQUEST['a_address']);
         $billingTemp->setCity($_REQUEST['a_city']);
         $billingTemp->setPostalCode($_REQUEST['a_postalcode']);
         $billingTemp->setState($_REQUEST['a_state']);
         $billingTemp->setCountry($_REQUEST['a_country']);
         $billingTemp->save();
         $this->setAddress($billingTemp);
         if (@$this->getShippingAddress()) {
             $shippingTemp = new Address(@$this->getShippingAddress()->getId());
         } else {
             $shippingTemp = new Address();
         }
         $shippingTemp->setStreetAddress($_REQUEST['shipping_address']);
         $shippingTemp->setCity($_REQUEST['shipping_city']);
         $shippingTemp->setPostalCode($_REQUEST['shipping_postalcode']);
         $shippingTemp->setState($_REQUEST['shipping_state']);
         $shippingTemp->setCountry($_REQUEST['shipping_country']);
         $shippingTemp->save();
         $this->setShippingAddress($shippingTemp);
         if ($this->save()) {
             $_REQUEST["user_created"] = 1;
         } else {
             $form->addElement('static', 'Message', 'Username already exists');
             $_REQUEST["username_already_exists"] = 1;
         }
     }
     return $form;
 }
开发者ID:anas,项目名称:feedstore,代码行数:101,代码来源:User.php

示例14: getPeople


//.........这里部分代码省略.........
             }
             $sUtcOffset = isset($row['TimeZone']) ? $row['TimeZone'] : "-00:00";
             $person->setUtcOffset(sprintf('%+03d:00', $sUtcOffset));
             // force "-00:00" utc-offset format
             if (!empty($row['Drinker'])) {
                 $person->setDrinker($row['Drinker']);
             }
             if (!empty($row['Sex'])) {
                 $person->setGender(strtolower($row['Sex']));
             }
             if (!empty($row['Smoker'])) {
                 $person->setSmoker($row['Smoker']);
             }
             /* the following fields require additional queries so are only executed if requested */
             if (isset($fields['activities']) || in_array('@all', $fields)) {
                 $activities = array();
                 //'A' we haven`t activities yet
                 /*$res2 = mysqli_query($this->db, "select activity from person_activities where person_id = " . $person_id);
                   while (list($activity) = @mysqli_fetch_row($res2)) {
                     $activities[] = $activity;
                   }*/
                 $person->setActivities($activities);
             }
             if (isset($fields['addresses']) || in_array('@all', $fields)) {
                 $addresses = array();
                 $sCountry = isset($row['Country']) ? $row['Country'] : '';
                 $sRegion = isset($row['City']) ? $row['City'] : '';
                 //'A'  region -> city
                 $sZip = isset($row['zip']) ? $row['zip'] : '';
                 if (empty($row['unstructured_address'])) {
                     $row['unstructured_address'] = trim($row['street_address'] . " " . $sRegion . " " . $sCountry);
                 }
                 $addres = new Address($row['unstructured_address']);
                 $addres->setCountry($sCountry);
                 if (!empty($row['latitude'])) {
                     $addres->setLatitude($row['latitude']);
                 }
                 if (!empty($row['longitude'])) {
                     $addres->setLongitude($row['longitude']);
                 }
                 if (!empty($row['locality'])) {
                     $addres->setLocality($row['locality']);
                 }
                 $addres->setPostalCode($sZip);
                 $addres->setRegion($sRegion);
                 if (!empty($row['street_address'])) {
                     $addres->setStreetAddress($row['street_address']);
                 }
                 if (!empty($row['street_address'])) {
                     $addres->setType($row['street_address']);
                 }
                 //FIXME quick and dirty hack to demo PC
                 $addres->setPrimary(true);
                 $addresses[] = $addres;
                 $person->setAddresses($addresses);
             }
             if (isset($fields['bodyType']) || in_array('@all', $fields)) {
                 //'A' we haven`t bodyType at all
                 /*$res2 = mysqli_query($this->db, "select * from person_body_type where person_id = " . $person_id);
                   if (@mysqli_num_rows($res2)) {
                     $row = @mysql_fetch_array($res2, MYSQLI_ASSOC);
                     $bodyType = new BodyType();
                     $bodyType->setBuild($row['build']);
                     $bodyType->setEyeColor($row['eye_color']);
                     $bodyType->setHairColor($row['hair_color']);
                     $bodyType->setHeight($row['height']);
开发者ID:dalinhuang,项目名称:shopexts,代码行数:67,代码来源:PartuzaDbFetcher.php

示例15: getTax

 function getTax($calculationHelper, $calc, $price, $sale = false, $committ = false)
 {
     if ($calc->activated == 0) {
         return false;
     }
     $shopperData = $this->getShopperData();
     if (!$shopperData) {
         return false;
     }
     //if(self::$stop) return self::$stop;
     if (!class_exists('TaxServiceSoap')) {
         require VMAVALARA_CLASS_PATH . DS . 'TaxServiceSoap.class.php';
     }
     if (!class_exists('DocumentType')) {
         require VMAVALARA_CLASS_PATH . DS . 'DocumentType.class.php';
     }
     if (!class_exists('DetailLevel')) {
         require VMAVALARA_CLASS_PATH . DS . 'DetailLevel.class.php';
     }
     if (!class_exists('Line')) {
         require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
     }
     if (!class_exists('ServiceMode')) {
         require VMAVALARA_CLASS_PATH . DS . 'ServiceMode.class.php';
     }
     if (!class_exists('Line')) {
         require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
     }
     if (!class_exists('GetTaxRequest')) {
         require VMAVALARA_CLASS_PATH . DS . 'GetTaxRequest.class.php';
     }
     if (!class_exists('GetTaxResult')) {
         require VMAVALARA_CLASS_PATH . DS . 'GetTaxResult.class.php';
     }
     $client = new TaxServiceSoap('Development');
     $request = new GetTaxRequest();
     $origin = new Address();
     //$destination = $this->fillValidateAvalaraAddress($calc);
     //In Virtuemart we have not differenct warehouses, but we have a shipment address
     //So when the vendor has a shipment address, we assume that it is his warehouse
     //Later we can combine products with shipment addresses for different warehouse (yehye, future music)
     //But for now we just use the BT address
     if (!class_exists('VirtueMartModelVendor')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
     }
     $userId = VirtueMartModelVendor::getUserIdByVendorId($calc->virtuemart_vendor_id);
     $userModel = VmModel::getModel('user');
     $virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId);
     // this is needed to set the correct user id for the vendor when the user is logged
     $userModel->getVendor($calc->virtuemart_vendor_id);
     $vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE);
     $vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
     //vmdebug('my vendor fields',$vendorFields);
     $origin->setLine1($vendorFields['fields']['address_1']['value']);
     $origin->setLine2($vendorFields['fields']['address_2']['value']);
     $origin->setCity($vendorFields['fields']['city']['value']);
     $origin->setCountry($vendorFields['fields']['virtuemart_country_id']['country_2_code']);
     $origin->setRegion($vendorFields['fields']['virtuemart_state_id']['state_2_code']);
     $origin->setPostalCode($vendorFields['fields']['zip']['value']);
     $request->setOriginAddress($origin);
     //Address
     if (isset($this->addresses[0])) {
         $destination = $this->addresses[0];
     } else {
         return FALSE;
     }
     $request->setDestinationAddress($destination);
     //Address
     //vmdebug('The date',$origin,$destination);
     $request->setCompanyCode($calc->company_code);
     // Your Company Code From the Dashboard
     if ($calc->committ and $sale) {
         $request->setDocType(DocumentType::$SalesInvoice);
         // Only supported types are SalesInvoice or SalesOrder
         $request->setCommit(true);
         //invoice number, problem is that the invoice number is at this time not known, but the order_number may reachable
         $request->setDocCode($committ);
         vmdebug('Request as SalesInvoice with invoiceNumber ' . $committ);
     } else {
         $request->setDocType(DocumentType::$SalesOrder);
         $request->setCommit(false);
         //invoice number, problem is that the invoice number is at this time not known, neither the order_number
         $request->setDocCode('VM2.0.16_order_request');
         vmdebug('Request as SalesOrder');
     }
     $request->setDocDate(date('Y-m-d'));
     //date
     //$request->setSalespersonCode("");             // string Optional
     $request->setCustomerCode($shopperData['customer_id']);
     //string Required
     if (isset($shopperData['tax_usage_type'])) {
         $request->setCustomerUsageType($shopperData['tax_usage_type']);
         //string   Entity Usage
     }
     $cartPrices = $calculationHelper->getCartPrices();
     //vmdebug('$cartPrices',$cartPrices);
     $request->setDiscount($cartPrices['discountAmount']);
     //decimal
     //$request->setDiscount(0.0);
     //	$request->setPurchaseOrderNo("");     //string Optional
//.........这里部分代码省略.........
开发者ID:romuland,项目名称:khparts,代码行数:101,代码来源:avalara.php


注:本文中的Address::setCountry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。