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


PHP isId函数代码示例

本文整理汇总了PHP中isId函数的典型用法代码示例。如果您正苦于以下问题:PHP isId函数的具体用法?PHP isId怎么用?PHP isId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: xmlrevert

 protected function xmlrevert()
 {
     $this->xml2string($xml);
     $record = new StdClass();
     $record->name = (string) $xml->Name;
     $record->desc = (string) $xml->Desc;
     if (isset($xml->IsActive)) {
         $record->isactive = (int) $xml->IsActive;
     }
     if (isset($xml->IsTaxable)) {
         $record->istaxable = (int) $xml->IsTaxable;
     }
     if (isset($xml->ListID)) {
         $record->listid = (string) $xml->ListID;
         $record->edit_sequence = (string) $xml->EditSequence;
     }
     /**
      * We also need the sales tax code id (the misc id)
      */
     $record->salestaxcodeid = null;
     if ($xml->ListID !== '' && isId($salestaxcodeid = $this->quickbooks->getAccountingReference($ref, array('ListID' => (string) $xml->ListID), 'salestaxcode'))) {
         $record->salestaxcodeid = $salestaxcodeid;
     }
     return $record;
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:25,代码来源:entity.salestaxcode.php

示例2: importFiles

 public static function importFiles($folderStr, $mode = 0, $debug = 0)
 {
     self::$debug = $debug;
     self::$mode = $mode;
     // Get file root
     $fileRoot = Config::get('file_root');
     import('dao.Folder');
     $folder = new Folder();
     if ($folderStr == 0 || $folderStr == $fileRoot) {
         self::syncFolders(array('path' => $fileRoot, 'fd_id' => 0, 'locked' => 0));
         return;
     }
     // If folderStr is not integer (fd_id)
     // and not a sub-folder of file-root and not exist physically, exit.
     if (!isId($folderStr) && !is_dir($folderStr) || !isId($folderStr) && !strstr($fileRoot, $folderStr)) {
         echo 'Invalid folder!' . $enclose;
         return;
     }
     // Get the folder in DB, based on folderId or folderFullName from parameter
     $theFolder = $folder->getFolder($folderStr);
     // If the folder row is not empty, we need to update the folder, otherwise
     // we need to add a folder if the folderFullName is a sub-folder of file root
     if (is_null($theFolder)) {
         list($newFolderFullName, $newFolderParentId) = locateNewFolder($theFolder['path']);
         self::addForder($newFolderFullName, $newFolderParentId);
     } else {
         self::syncFolders($theFolder);
     }
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:29,代码来源:SyncFiles.class.php

示例3: getMoreDiscounts

		private function getMoreDiscounts()
		{
			if(!isset($_POST["lastSortOrder"]) || !isId($_POST["lastSortOrder"])) {
				exit;
			}

			$items = "";
			$query = "SELECT SQL_CALC_FOUND_ROWS *
						FROM [|PREFIX|]discounts
						WHERE sortorder > " . (int)$_POST["lastSortOrder"] . "
						ORDER BY sortorder ASC
						LIMIT " . ISC_DISCOUNTS_PER_SHOW;

			$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
			$row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result);
			$more = 0;

			if ($row) {
				if ($GLOBALS["ISC_CLASS_DB"]->FetchOne("SELECT FOUND_ROWS()") > ISC_DISCOUNTS_PER_SHOW) {
					$more = 1;
				}

				do {
					$items .= $GLOBALS["ISC_CLASS_ADMIN_DISCOUNTS"]->BuildDiscountGridRow($row);
				} while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result));
			}

			$tags[] = $this->MakeXMLTag("status", 1);
			$tags[] = $this->MakeXMLTag("items", $items, true);
			$tags[] = $this->MakeXMLTag("more", $more);
			$this->SendXMLHeader();
			$this->SendXMLResponse($tags);
			exit;
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:34,代码来源:class.remote.discounts.php

示例4: deleteFolder

 public function deleteFolder($id)
 {
     if (!isId($id)) {
         ZDebug::my_echo('Param error in deleteFolder!');
         return FALSE;
     }
     $res = DB::$dbInstance->query("DELETE FROM folders WHERE fd_id = " . $id . "");
     $res = DB::$dbInstance->query("DELETE FROM folders WHERE parent_id = " . $id . "");
     $res = DB::$dbInstance->query("DELETE FROM files WHERE fd_id = " . $id . "");
     return $res;
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:11,代码来源:Folder.class.php

示例5: deleteFile

 public function deleteFile($key)
 {
     if (isId($key)) {
         $field = 'fid';
     } else {
         $field = 'path';
     }
     $key = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $key);
     $sql = 'DELETE FROM files WHERE ' . $field . ' = \'' . $key . '\'';
     return DB::$dbInstance->query($sql);
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:11,代码来源:File.class.php

示例6: execSpoolImport

 /**
  * Executed a spool
  *
  * Method will execute a spool and return the output
  *
  * @access private
  * @param int $spoolId The spool ID
  * @return string The spool XML string if the spool was executed successfully, FALSE otherwise
  */
 private function execSpoolImport($spoolId)
 {
     if (!isId($spoolId)) {
         return false;
     }
     $service = $this->quickbooks->getSpoolService($spoolId);
     if (!$service) {
         return false;
     }
     if ($this->service->exec($xml, $service, 'run', array('spoolId' => $spoolId))) {
         return $xml;
     }
     return false;
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:23,代码来源:handler.sendrequestxml.php

示例7: add_country_regions

 public function add_country_regions()
 {
     $query = "CREATE TABLE `[|PREFIX|]country_regions` (\n\t\t `couregid` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t `couregname` VARCHAR(255) NOT NULL DEFAULT '',\n\t\t `couregiso2` CHAR(2) NOT NULL DEFAULT '',\n\t\t `couregiso3` CHAR(3) NOT NULL DEFAULT '',\n\t\t PRIMARY KEY(`couregid`)\n\t\t)ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\t\t";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $data = array("couregname" => "European Union", "couregiso2" => "EU", "couregiso3" => "EUR");
     if (!isId($regionid = $GLOBALS['ISC_CLASS_DB']->InsertQuery("country_regions", $data))) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $query = "ALTER TABLE `[|PREFIX|]currencies` MODIFY `currencycountryid` INT(11) UNSIGNED DEFAULT NULL";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $query = "ALTER TABLE `[|PREFIX|]currencies` ADD `currencycouregid` INT(11) UNSIGNED DEFAULT NULL AFTER `currencycountryid`";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $query = "ALTER TABLE `[|PREFIX|]currencies` DROP KEY `u_currencies_currencycode_currencycountryid`";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $query = "ALTER TABLE `[|PREFIX|]currencies` ADD UNIQUE KEY `u_currencies_currencycode_currencycountryid_currencycouregid` (`currencycode`,`currencycountryid`, `currencycouregid`)";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $query = "ALTER TABLE `[|PREFIX|]countries` ADD `countrycouregid` INT(11) UNSIGNED DEFAULT NULL AFTER `countryid`";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $query = "ALTER TABLE `[|PREFIX|]countries` ADD KEY `i_regions_countrycouregid` (`countrycouregid`)";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     $query = "\n\t\tUPDATE `[|PREFIX|]countries`\n\t\tSET `countrycouregid` = " . $regionid . "\n\t\tWHERE LOWER(countryname) IN ('austria', 'belgium', 'bulgaria', 'finland', 'france', 'germany', 'greece', 'ireland', 'italy', 'luxembourg', 'netherlands', 'portugal', 'spain')";
     if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
         $this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
         return false;
     }
     return true;
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:49,代码来源:3110.php

示例8: addAccessCategories

	private function addAccessCategories($groupId, $categories)
	{
		$categories = @array_filter($categories, "isId");

		if (!isId($groupId) || !is_array($categories) || empty($categories)) {
			return false;
		}

		$GLOBALS["ISC_CLASS_DB"]->DeleteQuery("customer_group_categories", "WHERE customergroupid = " . (int)$groupId);

		foreach ($categories as $category) {
			$insert = array(
				"customergroupid" => $groupId,
				"categoryid" => $category
			);

			$GLOBALS["ISC_CLASS_DB"]->InsertQuery("customer_group_categories", $insert);
		}

		return true;
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:21,代码来源:entity.customergroup.php

示例9: CustomerHashCheck

/**
 * Check to see if customer salt string matches
 *
 * Function will check to see if the unsalted customer hash string $customerString and the customer id $customerID match against the salted
 * customer hash string $saltedString
 *
 * @access public
 * @param string $saltedString The salted customer hash string to compare to
 * @param string $customerString The unsalted customer hash string
 * @param int $customerId The customer ID
 * @return bool TRUE if the salted and unsalted strings match, FALSE if no match or if any of the arguments are invalid/empty
 */
function CustomerHashCheck($saltedString, $customerString, $customerId)
{
    if ($saltedString == '' || $customerString == '' || !isId($customerId)) {
        return false;
    }
    $customerString = CustomerHashCreate($customerString, $customerId);
    if ($customerString === $saltedString) {
        return true;
    }
    return false;
}
开发者ID:nirvana-info,项目名称:old_bak,代码行数:23,代码来源:general.php

示例10: __construct

	public function __construct($customerId = null)
	{
		// use the same settings as orders by default
		$this->setDoubleOptIn(GetConfig('EmailIntegrationOrderDoubleOptin'));
		$this->setSendWelcome(GetConfig('EmailIntegrationOrderSendWelcome'));

		if (!$customerId) {
			return;
		}

		$entity = new ISC_ENTITY_CUSTOMER();

		$data = $entity->get($customerId);
		if (!$data) {
			throw new Interspire_EmailIntegration_Subscription_Exception();
		}

		unset($data['custpassword']);

		$this->_data = $data;
		unset($data);

		$this->setSubscriptionIP($this->_data['custregipaddress']);

		// customer custom form fields

		/** @var ISC_FORM */
		$form = $GLOBALS["ISC_CLASS_FORM"];

		// populate empty form fields as a starting point -- this makes exports of imported customers work OK because they may not have a custformsessionid, or this ensures that export data is current with configured form fields even if the stored form fields are out of date
		$formFields = $form->getFormFields(FORMFIELDS_FORM_ACCOUNT);
		foreach ($formFields as /** @var ISC_FORMFIELD_BASE */$formField) {
			if ($formField->getFieldPrivateId()) {
				continue;
			}
			$this->_data[$formField->getFieldId()] = '';
		}

		// load saved data for this customer
		if (isId($this->_data['custformsessionid'])) {
			$customFields = $form->getSavedSessionData($this->_data['custformsessionid']);
			foreach ($customFields as $fieldId => $value) {
				$this->_data['FormField_' . $fieldId] = $value;
			}
		}

		// for email integration purposes, money values must be stored in an array as both numeric and formatted to allow for translation to both number fields and text fields, while maintaining currency information
		SetupCurrency();
		$moneyFields = array('custstorecredit');
		foreach ($moneyFields as $moneyFieldId) {
			$this->_data[$moneyFieldId] = array(
				'numeric' => $this->_data[$moneyFieldId],
				'formatted' => FormatPriceInCurrency($this->_data[$moneyFieldId]),
			);
		}

		unset($this->_data['addresses']); // the addresses provided by entity class are mixed billing/shipping addresses, can't be sure so discard them
		// find last used _billing_ address for this customer by non-deleted orders
		$order = $GLOBALS['ISC_CLASS_DB']->FetchRow("SELECT ordformsessionid, ordbillstreet1, ordbillstreet2, ordbillsuburb, ordbillstate, ordbillzip, ordbillcountryid FROM `[|PREFIX|]orders` WHERE ordcustid = " . (int)$customerId . " AND deleted = 0 ORDER BY orddate DESC LIMIT 1");
		if (is_array($order)) {
			// create fields specifically for email integration based on customer data

			if (isId($order['ordformsessionid'])) {
				$customFields = $form->getSavedSessionData($order['ordformsessionid']);
				foreach ($customFields as $fieldId => $value) {
					$this->_data['CustomerSubscription_Address_FormField_' . $fieldId] = $value;
				}
			}

			$this->_data['CustomerSubscription_Address'] = array(
				'addr1' => $order['ordbillstreet1'],
				'addr2' => $order['ordbillstreet2'],
				'city' => $order['ordbillsuburb'],
				'state' => $order['ordbillstate'],
				'zip' => $order['ordbillzip'],
				'country' => GetCountryById($order['ordbillcountryid']),
				'countryiso2' => GetCountryISO2ById($order['ordbillcountryid']),
				'countryiso3' => GetCountryISO3ById($order['ordbillcountryid']),
			);

			$this->_data['CustomerSubscription_Address_address1'] = $this->_data['CustomerSubscription_Address']['addr1'];
			$this->_data['CustomerSubscription_Address_address2'] = $this->_data['CustomerSubscription_Address']['addr2'];
			$this->_data['CustomerSubscription_Address_city'] = $this->_data['CustomerSubscription_Address']['city'];
			$this->_data['CustomerSubscription_Address_state'] = $this->_data['CustomerSubscription_Address']['state'];
			$this->_data['CustomerSubscription_Address_zip'] = $this->_data['CustomerSubscription_Address']['zip'];
			$this->_data['CustomerSubscription_Address_country'] = $this->_data['CustomerSubscription_Address']['country'];
			$this->_data['CustomerSubscription_Address_countryiso2'] = $this->_data['CustomerSubscription_Address']['countryiso2'];
			$this->_data['CustomerSubscription_Address_countryiso3'] = $this->_data['CustomerSubscription_Address']['countryiso3'];
		}

		// transform customer group data if available
		if ($this->_data['customergroup']) {
			$this->_data['customergroupid'] = $this->_data['customergroup']['customergroupid'];
			$this->_data['groupname'] = $this->_data['customergroup']['groupname'];
		}
		else
		{
			$this->_data['customergroupid'] = '';
			$this->_data['groupname'] = '';
		}
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:Customer.php

示例11: SetPanelSettings

		public function SetPanelSettings()
		{
			$GLOBALS['ISC_CLASS_CATEGORY'] = GetClass('ISC_CATEGORY');

			// Should we hide the comparison button?
			if(GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() < 2) {
				$GLOBALS['HideCompareItems'] = "none";
			}

			// Load the products into the reference array
			$GLOBALS['ISC_CLASS_CATEGORY']->GetProducts($products);
			$GLOBALS['CategoryProductListing'] = "";

			if(GetConfig('ShowProductRating') == 0) {
				$GLOBALS['HideProductRating'] = "display: none";
			}

			$display_mode = ucfirst(GetConfig("CategoryDisplayMode"));
			if ($display_mode == "Grid") {
				$display_mode = "";
			}
			$GLOBALS['DisplayMode'] = $display_mode;

			if ($display_mode == "List") {
				if (GetConfig('ShowAddToCartLink') && $GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() > 0) {
					$GLOBALS['HideAddButton'] = '';
				} else {
					$GLOBALS['HideAddButton'] = 'none';
				}

				$GLOBALS['ListJS'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ListCheckForm");
			}

			$GLOBALS['CompareButton'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton" . $display_mode);

			if ($display_mode == "List" && $GLOBALS['ISC_CLASS_CATEGORY']->GetNumPages() > 1) {
				$GLOBALS['CompareButtonTop'] = $GLOBALS['CompareButton'];
			}

			$GLOBALS['AlternateClass'] = '';
			foreach($products as $row) {
				$this->setProductGlobals($row);

				// for list style
				if ($display_mode == "List") {
					// get a small chunk of the product description
					$desc = isc_substr(strip_tags($row['proddesc']), 0, 225);
					if (isc_strlen($row['proddesc']) > 225) {
						// trim the description back to the last period or space so words aren't cut off
						$period_pos = isc_strrpos($desc, ".");
						$space_pos = isc_strrpos($desc, " ");
						// find the character that we should trim back to. -1 on space pos for a space that follows a period, so we dont end up with 4 periods
						if ($space_pos - 1 > $period_pos) {
							$pos = $space_pos;
						}
						else {
							$pos = $period_pos;
						}
						$desc = isc_substr($desc, 0, $pos);
						$desc .= "...";
					}

					$GLOBALS['ProductDescription'] = $desc;

					$GLOBALS['AddToCartQty'] = "";

					if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {
						if (isId($row['prodvariationid']) || trim($row['prodconfigfields'])!='' || $row['prodeventdaterequired']) {
							$GLOBALS['AddToCartQty'] = '<a href="' . $GLOBALS["ProductURL"] . '">' . $GLOBALS['ProductAddText'] . "</a>";
						}
						else {
							$GLOBALS['CartItemId'] = $GLOBALS['ProductId'];
							// If we're using a cart quantity drop down, load that
							if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
								$GLOBALS['Quantity0'] = "selected=\"selected\"";
								$GLOBALS['QtyOptionZero'] = '<option %%GLOBAL_Quantity0%% value="0">Quantity</option>';
								$GLOBALS['QtySelectStyle'] = 'width: auto;';
								$GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
							// Otherwise, load the textbox
							} else {
								$GLOBALS['ProductQuantity'] = 0;
								$GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
							}
						}
					}
				} // for grid style
				else {
					$GLOBALS["CompareOnSubmit"] = "onsubmit=\"return compareProducts(config.CompareLink)\"";
				}

				$GLOBALS['CategoryProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryProductsItem" . $display_mode);
			}

			if($GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() == 0) {
				// There are no products in this category
				$GLOBALS['CategoryProductListing'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryNoProductsMessage");
				$GLOBALS['HideOtherProductsIn'] = 'none';

				$GLOBALS['ExtraCategoryClass'] = "Wide WideWithLeft";
				if($GLOBALS['SNIPPETS']['SubCategories'] != '') {
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:CategoryContent.php

示例12: DelQValueAssociationImage

 private function DelQValueAssociationImage($file)
 {
     if (isId($file)) {
         if (!($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($GLOBALS["ISC_CLASS_DB"]->Query("SELECT * FROM [|PREFIX|]qvalue_associations WHERE qvalueassocid='" . (int) $file . "'")))) {
             return false;
         }
         if ($row['hoverimage'] == '') {
             return true;
         } else {
             $file = $row['hoverimage'];
         }
     }
     $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $file);
     if ($file == '') {
         return false;
     }
     if (file_exists($file)) {
         @unlink($file);
         clearstatcache();
     }
     return !file_exists($file);
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:22,代码来源:class.qvalue.associations_oct12.php

示例13: MapFormFieldSection

		public function MapFormFieldSection($formId)
		{
			if (!isId($formId)) {
				return false;
			}

			switch ($formId) {
				case FORMFIELDS_FORM_ACCOUNT:
					return GetLang('FormFieldsSectionAccount');
					break;

				case FORMFIELDS_FORM_ADDRESS:
					return GetLang('FormFieldsSectionAddress');
					break;
			}

			return false;
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:18,代码来源:class.formfields.php

示例14: _ImportRecord

 /**
  * Imports an actual product record in to the database.
  *
  * @param array Array of record data
  */
 protected function _ImportRecord($record)
 {
     if (!$record['custconemail']) {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportCustomersMissingEmail');
         return;
     }
     if (!is_email_address($record['custconemail'])) {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportCustomersInvalidEmail');
         return;
     }
     $fillin = array('custconcompany', 'custconfirstname', 'custconlastname', 'custconphone');
     foreach ($fillin as $fillkey) {
         if (!isset($record[$fillkey])) {
             $record[$fillkey] = '';
         }
     }
     // Is there an existing customer with the same email?
     $customerId = 0;
     $existingFormSessionId = 0;
     $query = sprintf("select customerid from [|PREFIX|]customers where lower(custconemail)='%s'", $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtolower($record['custconemail'])));
     $result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
     if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
         // Overriding existing products, set the product id
         if (isset($this->ImportSession['OverrideDuplicates']) && $this->ImportSession['OverrideDuplicates'] == 1) {
             $customerId = $row['customerid'];
             $this->ImportSession['Results']['Updates'][] = $record['custconfirstname'] . " " . $record['custconlastname'] . " (" . $record['custconemail'] . ")";
         } else {
             $this->ImportSession['Results']['Duplicates'][] = $record['custconfirstname'] . " " . $record['custconlastname'] . " (" . $record['custconemail'] . ")";
             return;
         }
         if (isId($row['custformsessionid'])) {
             $existingFormSessionId = $row['custformsessionid'];
         }
     }
     $customerData = array('company' => $record['custconcompany'], 'firstname' => $record['custconfirstname'], 'lastname' => $record['custconlastname'], 'email' => $record['custconemail'], 'phone' => $record['custconphone']);
     if (isset($record['custpassword']) && $record['custpassword'] !== '') {
         $customerData['password'] = $record['custpassword'];
     }
     if (isset($record['custstorecredit'])) {
         $customerData['storecredit'] = DefaultPriceFormat($record['custstorecredit']);
     }
     if (isId($customerId)) {
         $customerData['customerid'] = $customerId;
     }
     // Are we placing the customer in a customer group?
     $groupId = 0;
     if (!empty($record['custgroup'])) {
         static $customerGroups;
         $groupName = strtolower($record['custgroup']);
         if (isset($customerGroups[$groupName])) {
             $groupId = $customerGroups[$groupName];
         } else {
             $query = "\n\t\t\t\t\tSELECT customergroupid\n\t\t\t\t\tFROM [|PREFIX|]customer_groups\n\t\t\t\t\tWHERE LOWER(groupname)='" . $GLOBALS['ISC_CLASS_DB']->Quote($groupName) . "'\n\t\t\t\t";
             $groupId = $GLOBALS['ISC_CLASS_DB']->FetchOne($query, 'customergroupid');
             // Customer group doesn't exist, create it
             if (!$groupId) {
                 $newGroup = array('name' => $record['custgroup'], 'discount' => 0, 'isdefault' => 0, 'categoryaccesstype' => 'all');
                 $entity = new ISC_ENTITY_CUSTOMERGROUP();
                 $groupId = $entity->add($newGroup);
             }
             if ($groupId) {
                 $customerGroups[$groupName] = $groupId;
             }
         }
     }
     $customerData['customergroupid'] = $groupId;
     // Do we have a shipping address?
     $shippingData = array();
     if (isset($record['shipfullname']) || isset($record['shipfirstname']) || isset($record['shipaddress1']) || isset($record['shipaddress2']) || isset($record['shipcity']) || isset($record['shipstate']) || isset($record['shipzip']) || isset($record['shipcountry'])) {
         $fillin = array('shipaddress1', 'shipaddress2', 'shipcity', 'shipstate', 'shipzip', 'shipcountry');
         foreach ($fillin as $fillkey) {
             if (!isset($record[$fillkey])) {
                 $record[$fillkey] = '';
             }
         }
         $shippingData['shipfirstname'] = '';
         $shippingData['shiplastname'] = '';
         $shippingData['shipaddress1'] = $record['shipaddress1'];
         $shippingData['shipaddress2'] = $record['shipaddress2'];
         $shippingData['shipcity'] = $record['shipcity'];
         $shippingData['shipstate'] = $record['shipstate'];
         $shippingData['shipzip'] = $record['shipzip'];
         $shippingData['shipcountry'] = $record['shipcountry'];
         $shippingData['shipstateid'] = 0;
         $shippingData['shipcountryid'] = 0;
         $shippingData['shipdestination'] = '';
         // Find the country and state
         $shippingData['shipcountryid'] = (int) GetCountryByName($record['shipcountry']);
         if (!$shippingData['shipcountryid']) {
             $shippingData['shipcountryid'] = (int) GetCountryIdByISO2($record['shipcountry']);
         }
         // Still nothing? 0 for the shipping country ID
         if (!$shippingData['shipcountryid']) {
             $shippingData['shipcountryid'] = 0;
         }
//.........这里部分代码省略.........
开发者ID:nirvana-info,项目名称:old_bak,代码行数:101,代码来源:class.batch.importer_29_3.php

示例15: CommitOrder

 /**
  * Actually save a new order or an updated existing order in the database
  * after it's been validated.
  *
  * @param array An array of details about the order to save.
  * @param int The ID of the existing order if we're updating an order.
  * @return boolean True if successful, false if not.
  */
 private function CommitOrder($data, $orderId = 0)
 {
     $GLOBALS['ISC_CLASS_DB']->StartTransaction();
     /**
      * We need to find our billing/shipping details from the form fields first as it is
      * also used in creating the customer
      */
     $billingDetails = array();
     $shippingDetails = array();
     $billingFields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_BILLING, true);
     $shippingFields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_SHIPPING, true);
     $fields = $billingFields + $shippingFields;
     $addressMap = array('FirstName' => 'firstname', 'LastName' => 'lastname', 'CompanyName' => 'company', 'AddressLine1' => 'address1', 'AddressLine2' => 'address2', 'City' => 'city', 'State' => 'state', 'Zip' => 'zip', 'State' => 'state', 'Country' => 'country', 'Phone' => 'phone');
     foreach (array_keys($fields) as $fieldId) {
         $privateName = $fields[$fieldId]->record['formfieldprivateid'];
         if ($privateName == '' || !array_key_exists($privateName, $addressMap)) {
             continue;
         }
         if ($fields[$fieldId]->record['formfieldformid'] == FORMFIELDS_FORM_BILLING) {
             $detailsVar =& $billingDetails;
         } else {
             $detailsVar =& $shippingDetails;
         }
         /**
          * Find the country
          */
         if (isc_strtolower($privateName) == 'country') {
             $detailsVar['shipcountry'] = $fields[$fieldId]->getValue();
             $detailsVar['shipcountryid'] = GetCountryByName($fields[$fieldId]->getValue());
             if (!isId($detailsVar['shipcountryid'])) {
                 $detailsVar['shipcountryid'] = 0;
             }
             /**
              * Else find the state
              */
         } else {
             if (isc_strtolower($privateName) == 'state') {
                 $detailsVar['shipstate'] = $fields[$fieldId]->getValue();
                 $stateInfo = GetStateInfoByName($detailsVar['shipstate']);
                 if ($stateInfo && isId($stateInfo['stateid'])) {
                     $detailsVar['shipstateid'] = $stateInfo['stateid'];
                 } else {
                     $detailsVar['shipstateid'] = 0;
                 }
                 /**
                  * Else the rest
                  */
             } else {
                 $detailsVar['ship' . $addressMap[$privateName]] = $fields[$fieldId]->getValue();
             }
         }
     }
     // If we're creating an account for this customer, create it now
     if ($data['ordcustid'] == 0 && $data['customerType'] == 'new') {
         $customerData = array('email' => $data['custconemail'], 'password' => $data['custpassword'], 'firstname' => $billingDetails['shipfirstname'], 'lastname' => $billingDetails['shiplastname'], 'company' => $billingDetails['shipcompany'], 'phone' => $billingDetails['shipphone'], 'token' => GenerateCustomerToken(), 'customergroupid' => $data['custgroupid']);
         $GLOBALS['CusFirstname'] = $billingDetails['shipfirstname'];
         # Baskaran
         /* Added the store credit as seperate as it may be disabled while add/edit order - vikas  */
         if (isset($data['custstorecredit'])) {
             $customerData['storecredit'] = DefaultPriceFormat($data['custstorecredit']);
         }
         /**
          * Save the customer custom fields
          */
         if (gzte11(ISC_MEDIUMPRINT)) {
             $formSessionId = $GLOBALS['ISC_CLASS_FORM']->saveFormSession(FORMFIELDS_FORM_ACCOUNT);
             if (isId($formSessionId)) {
                 $customerData['custformsessionid'] = $formSessionId;
             }
         }
         $entity = new ISC_ENTITY_CUSTOMER();
         $data['ordcustid'] = $entity->add($customerData);
         if (!$data['ordcustid']) {
             $GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
             return false;
         }
     }
     //2010-11-08 Ronnie add When calculating the ship infomation corresponding to no
     $GLOBALS['BCK_shipcountryid'] = $detailsVar['shipcountry'];
     $GLOBALS['BCK_shipstateid'] = $detailsVar['shipstate'];
     if ($GLOBALS['BCK_shipstateid'] == '') {
         $GLOBALS['BCK_shipcountryid'] = $billingDetails['shipcountry'];
         $GLOBALS['BCK_shipstateid'] = $billingDetails['shipstate'];
     }
     foreach ($this->GetCartApi()->GetProductsInCart() as $rowId => $product) {
         if (!isset($product['exists_order_coupon']) && isset($product['discount'])) {
             // Now workout the discount amount
             if ($product['coupontype'] == 0) {
                 // It's a dollar discount
                 $newPrice = $product['product_price'] - $product['discount'];
             } else {
                 // It's a percentage discount
//.........这里部分代码省略.........
开发者ID:nirvana-info,项目名称:old_bak,代码行数:101,代码来源:class.orders.php


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