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


PHP CCrmDeal::LoadProductRows方法代码示例

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


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

示例1: doubleval

 if (isset($arDeal['EXCH_RATE'])) {
     $arFields['~EXCH_RATE'] = $arFields['EXCH_RATE'] = doubleval($arDeal['EXCH_RATE']);
 }
 if (isset($arDeal['CURRENCY_ID'])) {
     $arFields['~CURRENCY_ID'] = $arDeal['CURRENCY_ID'];
     $arFields['CURRENCY_ID'] = htmlspecialcharsbx($arFields['~CURRENCY_ID']);
 }
 if (isset($arDeal['ACCOUNT_CURRENCY_ID'])) {
     $arFields['~ACCOUNT_CURRENCY_ID'] = $arDeal['ACCOUNT_CURRENCY_ID'];
     $arFields['ACCOUNT_CURRENCY_ID'] = htmlspecialcharsbx($arFields['~ACCOUNT_CURRENCY_ID']);
 }
 if (isset($arDeal['COMMENTS'])) {
     $arFields['~COMMENTS'] = $arDeal['COMMENTS'];
     $arFields['COMMENTS'] = htmlspecialcharsbx($arFields['~COMMENTS']);
 }
 $arDealProducts = CCrmDeal::LoadProductRows($dealId);
 if (is_array($arDealProducts) && count($arDealProducts) > 0) {
     foreach ($arDealProducts as $dealProduct) {
         $dealProduct['ID'] = 0;
     }
     unset($dealProduct);
     $arFields['PRODUCT_ROWS'] = $arResult['PRODUCT_ROWS'] = $arDealProducts;
 }
 unset($arDealProducts);
 // read product row settings
 $productRowSettings = array();
 $arDealProductRowSettings = CCrmProductRow::LoadSettings('D', $dealId);
 if (is_array($arDealProductRowSettings)) {
     $productRowSettings['ENABLE_DISCOUNT'] = isset($arDealProductRowSettings['ENABLE_DISCOUNT']) ? $arDealProductRowSettings['ENABLE_DISCOUNT'] : false;
     $productRowSettings['ENABLE_TAX'] = isset($arDealProductRowSettings['ENABLE_TAX']) ? $arDealProductRowSettings['ENABLE_TAX'] : false;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例2: foreach

         $baseCurrencyID = "EUR";
     }
 }
 $arProducts = CCrmStatus::GetStatusList('PRODUCT', true);
 foreach ($arProducts as $prodCode => $prodName) {
     CCrmProduct::Add(array('NAME' => $prodName, 'ACTIVE' => 'Y', 'CURRENCY_ID' => $baseCurrencyID, 'PRICE' => 1, 'ORIGIN_ID' => 'CRM_PROD_' . $prodCode, 'ORIGINATOR_ID' => 'CRM_PRODUCT_REFERENCE'));
 }
 $rsDeals = CCrmDeal::GetListEx(array('ID' => 'ASC'), array("CHECK_PERMISSIONS" => "N"), false, false, array('ID', 'PRODUCT_ID', 'OPPORTUNITY', 'CURRENCY_ID'));
 while ($arDeal = $rsDeals->Fetch()) {
     $ID = isset($arDeal['ID']) ? intval($arDeal['ID']) : 0;
     if ($ID <= 0) {
         continue;
     }
     $productID = isset($arDeal['PRODUCT_ID']) ? $arDeal['PRODUCT_ID'] : '';
     if (isset($productID[0])) {
         $arProductRows = CCrmDeal::LoadProductRows($ID);
         if (count($arProductRows) > 0) {
             // Already converted
             continue;
         }
         $arProduct = CCrmProduct::GetByOriginID('CRM_PROD_' . $productID);
         if (!is_array($arProduct)) {
             continue;
         }
         $productID = isset($arProduct['ID']) ? $arProduct['ID'] : 0;
         if ($productID <= 0) {
             continue;
         }
         $arProductRows = array(array('PRODUCT_ID' => $productID, 'PRICE' => isset($arDeal['OPPORTUNITY']) ? doubleval($arDeal['OPPORTUNITY']) : 0.0, 'QUANTITY' => 1));
         CCrmDeal::SaveProductRows($ID, $arProductRows);
     }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:include.php

示例3: array

    $arDeal['PATH_TO_DEAL_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => $iDealId));
    $arDeal['PATH_TO_CONTACT_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $arDeal['CONTACT_ID']));
    $arDeal['PATH_TO_COMPANY_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $arDeal['COMPANY_ID']));
    $arDeal['CONTACT_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('NAME' => $arDeal['NAME'], 'LAST_NAME' => $arDeal['LAST_NAME'], 'SECOND_NAME' => $arDeal['SECOND_NAME']), true, false);
    $strCard = '
<div class="bx-user-info-data-cont-video bx-user-info-fields" id="bx_user_info_data_cont_1">
	<div class="bx-user-info-data-name">
		<a href="' . $arDeal['PATH_TO_DEAL_SHOW'] . '">' . htmlspecialcharsbx($arDeal['TITLE']) . '</a>
	</div>
	<div class="bx-user-info-data-info">';
    if (!empty($arDeal['STAGE_ID'])) {
        $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_STAGE_ID') . '</span>:
		<span class="fields enumeration">' . $arResult['STAGE_LIST'][$arDeal['STAGE_ID']] . '</span>
		<br />';
    }
    $arProductRows = CCrmDeal::LoadProductRows($arDeal['ID']);
    if (count($arProductRows) > 0) {
        $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_PRODUCTS') . '</span>:<span class="fields enumeration">' . htmlspecialcharsbx(CCrmProductRow::RowsToString($arProductRows)) . '</span><br />';
    }
    if (!empty($arDeal['OPPORTUNITY'])) {
        $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_OPPORTUNITY') . '</span>:
		<span class="fields enumeration"><nobr>' . number_format($arDeal['OPPORTUNITY'], 2, ',', ' ') . ' ' . htmlspecialcharsbx(CCrmCurrency::GetCurrencyName($arDeal['CURRENCY_ID'])) . '</nobr></span>
		<br />';
    }
    if (!empty($arDeal['PROBABILITY'])) {
        $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_PROBABILITY') . '</span>:
		<span class="fields enumeration">' . intval($arDeal['PROBABILITY']) . '%</span>
		<br />';
    }
    $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_DATE_MODIFY') . '</span>:
		<span class="fields enumeration">' . FormatDate('x', MakeTimeStamp($arDeal['DATE_MODIFY']), time() + CTimeZone::GetOffset()) . '</span>
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:card.ajax.php

示例4: map

 public function map(EntityConversionMap $map, array $options = null)
 {
     $srcFields = $this->getSourceFields();
     if (empty($srcFields)) {
         return array();
     }
     $dstFields = array();
     $dstEntityTypeID = $map->getDestinationEntityTypeID();
     foreach ($map->getItems() as $item) {
         $dstFieldID = $item->getDestinationField();
         //Skip empty binding
         if ($dstFieldID === '-') {
             continue;
         }
         $srcFieldID = $item->getSourceField();
         if ((!isset($srcFields[$srcFieldID]) || $srcFields[$srcFieldID] === '') && $srcFieldID !== 'PRODUCT_ROWS') {
             $altSrcFieldID = '';
             foreach ($item->getAlternativeSourceFields() as $fieldID) {
                 if (isset($srcFields[$fieldID])) {
                     $altSrcFieldID = $fieldID;
                     break;
                 }
             }
             if ($altSrcFieldID !== '') {
                 $srcFieldID = $altSrcFieldID;
             }
         }
         if ($dstFieldID === '') {
             $dstFieldID = $srcFieldID;
         }
         if (strpos($srcFieldID, 'UF_') === 0 && strpos($dstFieldID, 'UF_') === 0) {
             self::mapUserField(\CCrmOwnerType::Deal, $srcFieldID, $srcFields, $dstEntityTypeID, $dstFieldID, $dstFields, $options);
         } elseif ($srcFieldID === 'PRODUCT_ROWS') {
             $productRows = \CCrmDeal::LoadProductRows($this->srcEntityID);
             if (count($productRows) > 0) {
                 if ($dstEntityTypeID === \CCrmOwnerType::Invoice) {
                     $currencyID = isset($srcFields['CURRENCY_ID']) ? $srcFields['CURRENCY_ID'] : '';
                     if ($currencyID === '' || !\CCrmCurrency::IsExists($currencyID)) {
                         $currencyID = \CCrmCurrency::GetBaseCurrencyID();
                     }
                     $actualRows = \CCrmInvoice::ProductRows2BasketItems($productRows, $currencyID, \CCrmInvoice::GetCurrencyID());
                     if (count($actualRows) > 0) {
                         foreach ($actualRows as &$productRow) {
                             unset($productRow['ID']);
                         }
                         unset($productRow);
                         $dstFields[$dstFieldID] = $actualRows;
                     }
                 } else {
                     foreach ($productRows as &$productRow) {
                         unset($productRow['ID']);
                     }
                     unset($productRow);
                     $dstFields[$dstFieldID] = $productRows;
                 }
             }
         } elseif (isset($srcFields[$srcFieldID])) {
             $dstFields[$dstFieldID] = $srcFields[$srcFieldID];
         }
     }
     if (!empty($dstFields)) {
         if ($dstEntityTypeID === \CCrmOwnerType::Invoice) {
             $dstFields['UF_DEAL_ID'] = $this->srcEntityID;
             //region Prepare Invoice Properties
             $dstFields['INVOICE_PROPERTIES'] = array();
             $invoiceEntity = new \CCrmInvoice(false);
             $companyID = isset($dstFields['UF_COMPANY_ID']) ? (int) $dstFields['UF_COMPANY_ID'] : 0;
             $contactID = isset($dstFields['UF_CONTACT_ID']) ? (int) $dstFields['UF_CONTACT_ID'] : 0;
             $personTypeID = 0;
             $personTypes = \CCrmPaySystem::getPersonTypeIDs();
             if ($companyID > 0 && isset($personTypes['COMPANY'])) {
                 $personTypeID = $personTypes['COMPANY'];
             } elseif (isset($personTypes['CONTACT'])) {
                 $personTypeID = $personTypes['CONTACT'];
             }
             $properties = $invoiceEntity->GetProperties(0, $personTypeID);
             if (is_array($properties)) {
                 \CCrmInvoice::__RewritePayerInfo($companyID, $contactID, $invoiceProperties);
                 foreach ($properties as $property) {
                     $dstFields['INVOICE_PROPERTIES'][$property['FIELDS']['ID']] = $property['VALUE'];
                 }
             }
             //endregion
         } elseif ($dstEntityTypeID === \CCrmOwnerType::Quote) {
             $dstFields['DEAL_ID'] = $this->srcEntityID;
         }
     }
     return $dstFields;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:89,代码来源:dealconversionmapper.php

示例5: foreach

    if ($bInternal && isset($arParams['INTERNAL_CONTEXT']) && is_array($arParams['INTERNAL_CONTEXT'])) {
        $internalContext = $arParams['INTERNAL_CONTEXT'];
        if (isset($internalContext['CONTACT_ID'])) {
            $addParams['contact_id'] = $internalContext['CONTACT_ID'];
        }
        if (isset($internalContext['COMPANY_ID'])) {
            $addParams['company_id'] = $internalContext['COMPANY_ID'];
        }
    }
    if (!empty($addParams)) {
        $arResult['PATH_TO_DEAL_ADD'] = CHTTP::urlAddParams($arResult['PATH_TO_DEAL_ADD'], $addParams);
    }
}
if (isset($arResult['DEAL_ID']) && !empty($arResult['DEAL_ID'])) {
    // try to load product rows
    $arProductRows = CCrmDeal::LoadProductRows(array_keys($arResult['DEAL_ID']));
    foreach ($arProductRows as $arProductRow) {
        $ownerID = $arProductRow['OWNER_ID'];
        if (!isset($arResult['DEAL'][$ownerID])) {
            continue;
        }
        $arEntity =& $arResult['DEAL'][$ownerID];
        if (!isset($arEntity['PRODUCT_ROWS'])) {
            $arEntity['PRODUCT_ROWS'] = array();
        }
        $arEntity['PRODUCT_ROWS'][] = $arProductRow;
    }
    // checkig access for operation
    $arDealAttr = CCrmPerms::GetEntityAttr('DEAL', $arResult['DEAL_ID']);
    foreach ($arResult['DEAL_ID'] as $iDealId) {
        $arResult['DEAL'][$iDealId]['EDIT'] = $CCrmPerms->CheckEnityAccess('DEAL', 'WRITE', $arDealAttr[$iDealId]);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例6: elseif

    $arResult['TAX_INFOS'] = $taxInfo['ITEMS'];
    $sum = $arFields['~PRICE'];
    $arResult['SUM_BRUTTO'] = $sum;
    $arResult['SUM_NETTO'] = $sum - $taxInfo['SUM_EXCLUDED_FROM_PRICE'];
} elseif ($dealID > 0) {
    $recalculateData = array('ID' => 0, 'PAY_SYSTEM_ID' => $paySystemID, 'PERSON_TYPE_ID' => $personTypeID, 'INVOICE_PROPERTIES' => array(), 'PRODUCT_ROWS' => array());
    foreach ($properties as $propertyKey => &$propertyData) {
        $propertyFields = isset($propertyData['FIELDS']) ? $propertyData['FIELDS'] : null;
        $propertyID = is_array($propertyFields) && isset($propertyFields['ID']) ? $propertyFields['ID'] : '';
        if ($propertyID === '') {
            continue;
        }
        $recalculateData['INVOICE_PROPERTIES'][$propertyID] = isset($propertyData['VALUE']) ? $propertyData['VALUE'] : '';
    }
    unset($propertyData);
    $rows = CCrmDeal::LoadProductRows($dealID);
    $rowQty = count($rows);
    for ($i = 0; $i < $rowQty; $i++) {
        $row = $rows[$i];
        $price = isset($row['PRICE']) ? round(doubleval($row['PRICE']), 2) : 0.0;
        if ($dealCurrencyID !== $currencyID) {
            $price = CCrmCurrency::ConvertMoney($price, $dealCurrencyID, $currencyID);
        }
        $qty = isset($row['QUANTITY']) ? intval($row['QUANTITY']) : 0;
        $sum = $item['SUM'] = $price * $qty;
        $item = array('ID' => 0, 'PRODUCT_ID' => isset($row['PRODUCT_ID']) ? intval($row['PRODUCT_ID']) : 0, 'PRODUCT_NAME' => isset($row['PRODUCT_NAME']) ? $row['PRODUCT_NAME'] : '', 'PRICE' => $price, 'QUANTITY' => $qty, 'SUM' => $sum, 'IDX' => $i);
        $item['FORMATTED_PRICE'] = CCrmCurrency::MoneyToString($price, $currencyID);
        $item['FORMATTED_SUM'] = CCrmCurrency::MoneyToString($sum, $currencyID);
        $item['CURRENCY_ID'] = $currencyID;
        $recalculateData['PRODUCT_ROWS'][] =& $item;
        unset($item);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例7: getProductRows

 public function getProductRows($ID)
 {
     $ID = intval($ID);
     if ($ID <= 0) {
         throw new RestException('The parameter id is invalid or not defined.');
     }
     if (!CCrmDeal::CheckReadPermission($ID)) {
         throw new RestException('Access denied.');
     }
     return CCrmDeal::LoadProductRows($ID);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:11,代码来源:restservice.php


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