Beispiel #1
0
function __get_export_profiles($strItemID)
{
    // this code is copy CCatalogAdmin::OnBuildSaleExportMenu
    global $USER;
    global $adminMenu;
    if (!isset($USER) || !($USER instanceof CUser && 'CUser' == get_class($USER))) {
        return array();
    }
    if (empty($strItemID)) {
        return array();
    }
    $boolRead = $USER->CanDoOperation('catalog_read');
    $boolExportEdit = $USER->CanDoOperation('catalog_export_edit');
    $boolExportExec = $USER->CanDoOperation('catalog_export_exec');
    $arProfileList = array();
    if (($boolRead || $boolExportEdit || $boolExportExec) && method_exists($adminMenu, "IsSectionActive")) {
        if ($adminMenu->IsSectionActive($strItemID)) {
            $rsProfiles = CCatalogExport::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("IN_MENU" => "Y"));
            while ($arProfile = $rsProfiles->Fetch()) {
                $strName = strlen($arProfile["NAME"]) > 0 ? $arProfile["NAME"] : $arProfile["FILE_NAME"];
                if ('Y' == $arProfile['DEFAULT_PROFILE']) {
                    $arProfileList[] = array("text" => htmlspecialcharsbx($strName), "url" => "cat_exec_exp.php?lang=" . LANGUAGE_ID . "&ACT_FILE=" . $arProfile["FILE_NAME"] . "&ACTION=EXPORT&PROFILE_ID=" . $arProfile["ID"] . "&" . bitrix_sessid_get(), "title" => GetMessage("CAM_EXPORT_DESCR_EXPORT") . " "" . htmlspecialcharsbx($strName) . """, "readonly" => !$boolExportExec);
                } else {
                    $arProfileList[] = array("text" => htmlspecialcharsbx($strName), "url" => "cat_export_setup.php?lang=" . LANGUAGE_ID . "&ACT_FILE=" . $arProfile["FILE_NAME"] . "&ACTION=EXPORT_EDIT&PROFILE_ID=" . $arProfile["ID"] . "&" . bitrix_sessid_get(), "title" => GetMessage("CAM_EXPORT_DESCR_EDIT") . " "" . htmlspecialcharsbx($strName) . """, "readonly" => !$boolExportEdit);
                }
            }
        }
    }
    return $arProfileList;
}
Beispiel #2
0
 function DoUninstall()
 {
     global $APPLICATION;
     CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID);
     CAgent::RemoveAgent("ICrmOrderActions::orderHistoryAgent();", $this->MODULE_ID);
     CAgent::RemoveAgent("ICrmOrderActions::orderAgent();", $this->MODULE_ID);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT_TYPES);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_SITES);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_PROPS);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_LEGAL_DETAILS);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_CONTRAGENT_TYPE);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_CUSTOM_FIELDS);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_SITES_LIST);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_HISTORY_DATE);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE);
     COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_IBLOCKS);
     UnRegisterModuleDependences("sale", "OnSalePayOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSalePayOrder");
     UnRegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder");
     UnRegisterModuleDependences("sale", "OnOrderNewSendEmail", $this->MODULE_ID, "ICrmOrderEvent", "onSendOrderMail");
     UnRegisterModuleDependences("sale", "OnOrderUpdate", $this->MODULE_ID, "ICrmOrderEvent", "onUpdateOrder");
     UnRegisterModuleDependences("sale", "OnBeforeOrderAdd", $this->MODULE_ID, "ICrmOrderEvent", "onBeforeOrderAdd");
     UnRegisterModuleDependences("sale", "OnBeforeOrderAccountNumberSet", $this->MODULE_ID, "ICrmOrderEvent", "onBeforeOrderAccountNumberSet");
     UnRegisterModuleDependences("sale", "OnSaleBeforeReserveOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleBeforeReserveOrder");
     UnRegisterModuleDependences("sale", "OnSaleReserveOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleReserveOrder");
     if (CModule::IncludeModule("catalog")) {
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/' . $this->INTARO_CRM_EXPORT . '_run.php')) {
             $dbProfile = CCatalogExport::GetList(array(), array("FILE_NAME" => $this->INTARO_CRM_EXPORT));
             while ($arProfile = $dbProfile->Fetch()) {
                 if ($arProfile["DEFAULT_PROFILE"] != "Y") {
                     CAgent::RemoveAgent("CCatalogExport::PreGenerateExport(" . $arProfile['ID'] . ");", "catalog");
                     CCatalogExport::Delete($arProfile['ID']);
                 }
             }
         }
     }
     $this->DeleteFiles();
     UnRegisterModule($this->MODULE_ID);
     $APPLICATION->IncludeAdminFile(GetMessage('MODULE_UNINSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/unstep1.php');
 }
Beispiel #3
0
	function OnBuildSaleExportMenu($strItemID)
	{
		global $adminMenu;

		if (empty($strItemID))
			return array();

		$arProfileList = array();

		if ((self::$catalogRead || self::$catalogExportEdit || self::$catalogExportExec) && method_exists($adminMenu, "IsSectionActive"))
		{
			if ($adminMenu->IsSectionActive($strItemID))
			{
				$rsProfiles = CCatalogExport::GetList(array("NAME"=>"ASC", "ID"=>"ASC"), array("IN_MENU"=>"Y"));
				while ($arProfile = $rsProfiles->Fetch())
				{
					$arProfile['NAME'] = (string)$arProfile['NAME'];
					$strName = ($arProfile["NAME"] != '' ? $arProfile["NAME"] : $arProfile["FILE_NAME"]);
					if ($arProfile['DEFAULT_PROFILE'] == 'Y')
					{
						$arProfileList[] = array(
							"text" => htmlspecialcharsbx($strName),
							"url" => "cat_exec_exp.php?lang=".LANGUAGE_ID."&ACT_FILE=".$arProfile["FILE_NAME"]."&ACTION=EXPORT&PROFILE_ID=".$arProfile["ID"]."&".bitrix_sessid_get(),
							"title" => Loc::getMessage("CAM_EXPORT_DESCR_EXPORT")." "".htmlspecialcharsbx($strName).""",
							"readonly" => !self::$catalogExportExec,
						);
					}
					else
					{
						$arProfileList[] = array(
							"text" => htmlspecialcharsbx($strName),
							"url" => "cat_export_setup.php?lang=".LANGUAGE_ID."&ACT_FILE=".$arProfile["FILE_NAME"]."&ACTION=EXPORT_EDIT&PROFILE_ID=".$arProfile["ID"]."&".bitrix_sessid_get(),
							"title"=>Loc::getMessage("CAM_EXPORT_DESCR_EDIT")." "".htmlspecialcharsbx($strName).""",
							"readonly" => !self::$catalogExportEdit,
						);
					}
				}
			}
		}
		return $arProfileList;
	}
         $arActions[] = array("DEFAULT" => true, "TEXT" => GetMessage("CES_RUN_EXPORT"), "TITLE" => GetMessage("CES_RUN_EXPORT_DESCR"), "ACTION" => $lAdmin->ActionRedirect($APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&ACT_FILE=" . urlencode($strReportFile) . "&" . bitrix_sessid_get() . "&ACTION=EXPORT&PROFILE_ID=0"));
         $arActions[] = array("TEXT" => GetMessage('CES_ADD_PROFILE'), "TITLE" => GetMessage('CES_ADD_PROFILE_DESCR'), "ACTION" => $lAdmin->ActionRedirect($APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&ACT_FILE=" . urlencode($strReportFile) . "&ACTION=EXPORT_SETUP" . "&" . bitrix_sessid_get()));
     }
     if (!empty($arActions)) {
         $arActions[] = array("SEPARATOR" => true);
     }
     if ($bCanEdit) {
         $arActions[] = array("TEXT" => GetMessage("CES_TO_LEFT_MENU"), "TITLE" => GetMessage("CES_TO_LEFT_MENU_DESCR"), "ACTION" => $lAdmin->ActionRedirect($APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&ACT_FILE=" . urlencode($strReportFile) . "&" . bitrix_sessid_get() . "&ACTION=MENU&PROFILE_ID=0"));
     }
     if (empty($arReportParams["FILE_SETUP"]) && $USER->CanDoOperation('edit_php')) {
         $arActions[] = array("TEXT" => GetMessage("CES_TO_AGENT"), "TITLE" => GetMessage("CES_TO_AGENT_DESCR"), "ACTION" => "ShowAgentForm('" . $APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&ACT_FILE=" . $strReportFile . "&" . bitrix_sessid_get() . "&ACTION=AGENT&PROFILE_ID=0');");
         $arActions[] = array("DISABLED" => $bWindowsHosting, "TEXT" => GetMessage("CES_TO_CRON"), "TITLE" => GetMessage("CES_TO_CRON_DESCR"), "ACTION" => $bWindowsHosting ? '' : "ShowCronForm('" . $APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&ACT_FILE=" . $strReportFile . "&" . bitrix_sessid_get() . "&ACTION=CRON&PROFILE_ID=0', true);");
     }
     $row->AddActions($arActions);
 }
 $rsProfiles = CCatalogExport::GetList(array("LAST_USE" => "DESC", "NAME" => "ASC"), array("FILE_NAME" => $strReportFile, '!DEFAULT_PROFILE' => 'Y'));
 while ($arProfile = $rsProfiles->Fetch()) {
     $arProfile['USED'] = $arProfile['LAST_USE_FORMAT'];
     $boolNeedEdit = isset($arProfile['NEED_EDIT']) && 'Y' == $arProfile['NEED_EDIT'];
     $row =& $lAdmin->AddRow($arProfile['ID'], $arProfile);
     $row->AddViewField("NAME", htmlspecialcharsbx($arReportParams["TITLE"]));
     $row->AddViewField("FILE", $strReportFile);
     $strProfileLink = '';
     if ($bCanExec) {
         if ($boolNeedEdit) {
             $strProfileLink = '<a href="' . $APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&amp;ACT_FILE=" . urlencode($strReportFile) . "&amp;ACTION=EXPORT_EDIT&amp;PROFILE_ID=" . $arProfile["ID"] . "&amp;" . bitrix_sessid_get() . '" title="' . GetMessage("CES_EDIT_PROPFILE_DESCR") . '">' . htmlspecialcharsbx($arProfile["NAME"]) . '</a>' . '<br /><i>(' . GetMessage('CES_NEED_EDIT') . ')</i>';
         } else {
             $strProfileLink = '<a href="' . ('Y' == $arProfile["IN_MENU"] ? "/bitrix/admin/cat_exec_exp.php" : $APPLICATION->GetCurPage()) . "?lang=" . LANGUAGE_ID . "&amp;ACT_FILE=" . urlencode($strReportFile) . "&amp;ACTION=EXPORT&amp;PROFILE_ID=" . $arProfile["ID"] . "&amp;" . bitrix_sessid_get() . '" title="' . GetMessage("export_setup_begin") . '">' . htmlspecialcharsbx($arProfile["NAME"]) . '</a>';
         }
     } else {
         $strProfileLink = htmlspecialcharsbx($arProfile["NAME"]);