Пример #1
0
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array();
$lAdmin->InitFilter($arFilterFields);
$arFilter = array();
if ($lAdmin->EditAction() && !$bReadOnly) {
    foreach ($_POST['FIELDS'] as $ID => $arFields) {
        $DB->StartTransaction();
        $ID = IntVal($ID);
        $arFields['ID'] = $ID;
        if (isset($arFields["IMAGE_ID"])) {
            unset($arFields["IMAGE_ID"]);
        }
        if (!$lAdmin->IsUpdated($ID)) {
            continue;
        }
        if (!CCatalogStore::Update($ID, $arFields)) {
            if ($ex = $APPLICATION->GetException()) {
                $lAdmin->AddUpdateError($ex->GetString(), $ID);
            } else {
                $lAdmin->AddUpdateError(GetMessage("ERROR_UPDATING_REC") . " (" . $arFields["ID"] . ", " . $arFields["TITLE"] . ", " . $arFields["SORT"] . ")", $ID);
            }
            $DB->Rollback();
        }
        $DB->Commit();
    }
}
if (($arID = $lAdmin->GroupAction()) && !$bReadOnly) {
    if ($_REQUEST['action_target'] == 'selected') {
        $arID = array();
        $dbResultList = CCatalogStore::GetList(array($_REQUEST["by"] => $_REQUEST["order"]));
        while ($arResult = $dbResultList->Fetch()) {
Пример #2
0
 function ImportStores($XML_STORES_PARENT)
 {
     $ID = 0;
     $arXMLStores = $this->_xml_file->GetAllChildrenArray($XML_STORES_PARENT);
     foreach ($arXMLStores as $arXMLStore) {
         $arStore = array("TITLE" => $arXMLStore[$this->mess["IBLOCK_XML2_NAME"]], "XML_ID" => $arXMLStore[$this->mess["IBLOCK_XML2_ID"]]);
         if (isset($arXMLStore[$this->mess["IBLOCK_XML2_STORE_ADDRESS"]])) {
             $arStore["ADDRESS"] = $arXMLStore[$this->mess["IBLOCK_XML2_STORE_ADDRESS"]][$this->mess["IBLOCK_XML2_VIEW"]];
         }
         if (isset($arXMLStore[$this->mess["IBLOCK_XML2_STORE_DESCRIPTION"]])) {
             $arStore["DESCRIPTION"] = $arXMLStore[$this->mess["IBLOCK_XML2_STORE_DESCRIPTION"]];
         }
         if (isset($arXMLStore[$this->mess["IBLOCK_XML2_STORE_CONTACTS"]]) && is_array($arXMLStore[$this->mess["IBLOCK_XML2_STORE_CONTACTS"]])) {
             $storeContact = array();
             foreach ($arXMLStore[$this->mess["IBLOCK_XML2_STORE_CONTACTS"]] as $arContact) {
                 if (is_array($arContact)) {
                     $storeContact[] = $arContact[$this->mess["IBLOCK_XML2_VALUE"]];
                 }
             }
             if ($storeContact) {
                 $arStore["PHONE"] = implode(", ", $storeContact);
             }
         }
         $rsStore = CCatalogStore::GetList(array(), array("XML_ID" => $arXMLStore[$this->mess["IBLOCK_XML2_ID"]]));
         $arIDStore = $rsStore->Fetch();
         if (!$arIDStore) {
             $ID = CCatalogStore::Add($arStore);
         } else {
             $ID = CCatalogStore::Update($arIDStore["ID"], $arStore);
         }
     }
     if (!$ID) {
         return false;
     }
     return true;
 }
Пример #3
0
 if (strlen($isImage) == 0 && (strlen($arPREVIEW_PICTURE["name"]) > 0 || strlen($arPREVIEW_PICTURE["del"]) > 0)) {
     $fileId = CFile::SaveFile($arPREVIEW_PICTURE, "catalog");
 } elseif (strlen($isImage) > 0) {
     $errorMessage .= $isImage . "<br>";
 }
 $arFields = array("TITLE" => isset($_POST['TITLE']) ? $_POST['TITLE'] : '', "SORT" => isset($_POST['CSTORE_SORT']) ? (int) $_POST['CSTORE_SORT'] : 0, "ACTIVE" => isset($_POST['ACTIVE']) && $_POST['ACTIVE'] == 'Y' ? 'Y' : 'N', "ADDRESS" => isset($_POST['ADDRESS']) ? $_POST['ADDRESS'] : '', "DESCRIPTION" => isset($_POST['DESCRIPTION']) ? $_POST['DESCRIPTION'] : '', "GPS_N" => isset($_POST['GPS_N']) ? $_POST['GPS_N'] : '', "GPS_S" => isset($_POST['GPS_S']) ? $_POST['GPS_S'] : '', "PHONE" => isset($_POST['PHONE']) ? $_POST['PHONE'] : '', "SCHEDULE" => isset($_POST['SCHEDULE']) ? $_POST['SCHEDULE'] : '', "XML_ID" => isset($_POST['XML_ID']) ? $_POST['XML_ID'] : '', "USER_ID" => $userId, "MODIFIED_BY" => $userId, "EMAIL" => isset($_POST["EMAIL"]) ? $_POST["EMAIL"] : '', "ISSUING_CENTER" => $ISSUING_CENTER, "SHIPPING_CENTER" => $SHIPPING_CENTER, "SITE_ID" => $_POST["SITE_ID"]);
 $USER_FIELD_MANAGER->EditFormAddFields($entityId, $arFields);
 if (intval($fileId) > 0) {
     $arFields["IMAGE_ID"] = intval($fileId);
 } elseif ($fileId === "NULL") {
     $arFields["IMAGE_ID"] = "null";
 }
 $DB->StartTransaction();
 if ($errorMessage == '') {
     if ($id > 0) {
         $res = CCatalogStore::Update($id, $arFields);
     } else {
         $res = CCatalogStore::Add($arFields);
         if ($res) {
             $id = (int) $res;
         }
     }
     if (!$res) {
         if ($ex = $APPLICATION->GetException()) {
             $errorMessage .= $ex->GetString() . "<br>";
         } else {
             $errorMessage .= GetMessage('STORE_SAVE_ERROR') . '<br>';
         }
     } else {
         $ufUpdated = $USER_FIELD_MANAGER->Update($entityId, $id, $arFields);
     }
Пример #4
0
	function ImportStores($XML_STORES_PARENT)
	{
		$this->next_step["XML_STORES_PARENT"] = $XML_STORES_PARENT;
		$ID = 0;
		$arXMLStores = $this->_xml_file->GetAllChildrenArray($XML_STORES_PARENT);
		foreach($arXMLStores as $arXMLStore)
		{
			$storeTitle = $arXMLStore[GetMessage("IBLOCK_XML2_NAME")];
			$storeAddress = (isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")])) ? $arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")] : "";
			$storeDescription = (isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")])) ? $arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")] : "";
			$storeContacts = (isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")])) ? $arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")] : "";
			$rsStore = CCatalogStore::GetList(array(), array("XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")]));

			$arStore = array(
				"TITLE" => $storeTitle,
				"XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")],
				"ADDRESS" => $storeAddress,
				"DESCRIPTION" => $storeDescription,
				"PHONE" => $storeContacts,
			);
			$arIDStore = $rsStore->Fetch();
			if(!$arIDStore)
			{
				$ID = CCatalogStore::Add($arStore);
			}
			else
			{
				$ID = CCatalogStore::Update($arIDStore["ID"],$arStore);
			}
		}
		if(!$ID)
			return false;
		return true;
	}
Пример #5
0
 if (trim($ADDRESS) == '') {
     $errorMessage .= GetMessage("ADDRESS_EMPTY") . "\n";
 }
 if (strlen($isImage) == 0 && (strlen($arPREVIEW_PICTURE["name"]) > 0 || strlen($arPREVIEW_PICTURE["del"]) > 0)) {
     $fileId = CFile::SaveFile($arPREVIEW_PICTURE, "catalog");
 } elseif (strlen($isImage) > 0) {
     $errorMessage .= $isImage . "\n";
 }
 $arFields = array("TITLE" => $TITLE, "ACTIVE" => $ACTIVE, "ADDRESS" => $ADDRESS, "DESCRIPTION" => $DESCRIPTION, "GPS_N" => $GPS_N, "GPS_S" => $GPS_S, "PHONE" => $PHONE, "SCHEDULE" => $SCHEDULE, "XML_ID" => $XML_ID, "USER_ID" => $userId, "MODIFIED_BY" => $userId);
 if (intval($fileId) > 0) {
     $arFields["IMAGE_ID"] = intval($fileId);
 } else {
     $arFields["IMAGE_ID"] = "null";
 }
 $DB->StartTransaction();
 if (strlen($errorMessage) == 0 && $ID > 0 && ($res = CCatalogStore::Update($ID, $arFields))) {
     $ID = $res;
     $DB->Commit();
     if (strlen($_REQUEST["apply"]) <= 0) {
         LocalRedirect("/bitrix/admin/cat_store_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
     } else {
         LocalRedirect("/bitrix/admin/cat_store_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
     }
 } elseif (strlen($errorMessage) == 0 && $ID == 0 && ($res = CCatalogStore::Add($arFields))) {
     $ID = $res;
     $DB->Commit();
     if (strlen($_REQUEST["apply"]) <= 0) {
         LocalRedirect("/bitrix/admin/cat_store_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
     } else {
         LocalRedirect("/bitrix/admin/cat_store_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
     }
Пример #6
0
	public function ImportStores($XML_STORES_PARENT)
	{
		$this->next_step["XML_STORES_PARENT"] = $XML_STORES_PARENT;
		$ID = 0;
		$storeContact = array();
		$arXMLStores = $this->_xml_file->GetAllChildrenArray($XML_STORES_PARENT);
		foreach($arXMLStores as $arXMLStore)
		{
			$arStore = array(
				"TITLE" => $arXMLStore[GetMessage("IBLOCK_XML2_NAME")],
				"XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")],
			);
			if(isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")]))
				$arStore["ADDRESS"] = $arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")][GetMessage("IBLOCK_XML2_VIEW")];
			if(isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")]))
				$arStore["DESCRIPTION"] = $arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")];

			if(isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")]) && is_array($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")]))
			{
				foreach($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")] as $arContact)
				{
					if(is_array($arContact))
					{
						$storeContact[] = $arContact[GetMessage("IBLOCK_XML2_VALUE")];
					}
				}
			}
			if(!empty($storeContact))
				$arStore["PHONE"] = implode(", ", $storeContact);

			$rsStore = CCatalogStore::GetList(array(), array("XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")]));
			$arIDStore = $rsStore->Fetch();
			if(!$arIDStore)
			{
				$ID = CCatalogStore::Add($arStore);
			}
			else
			{
				$ID = CCatalogStore::Update($arIDStore["ID"], $arStore);
			}
		}
		if(!$ID)
			return false;
		return true;
	}
Пример #7
0
		"EMAIL" => $_POST["EMAIL"],
		"ISSUING_CENTER" => $ISSUING_CENTER,
		"SHIPPING_CENTER" => $SHIPPING_CENTER,
		"SITE_ID" => $_POST["SITE_ID"]
	);

	$USER_FIELD_MANAGER->EditFormAddFields($entityId, $arFields);

	if (intval($fileId) > 0)
		$arFields["IMAGE_ID"] = intval($fileId);
	elseif ($fileId === "NULL")
		$arFields["IMAGE_ID"] = "null";

	$DB->StartTransaction();

	if (strlen($errorMessage) == 0 && ($res = CCatalogStore::Update($id, $arFields) || ($id == 0 && $res = CCatalogStore::Add($arFields))))
	{
		$id = $res;

		$ufUpdated = $USER_FIELD_MANAGER->Update($entityId, $id, $arFields);
		if ($ufUpdated)
			$DB->Query("UPDATE b_catalog_store SET DATE_MODIFY = ".$DB->CurrentTimeFunction()." WHERE ID = ".$id);

		$DB->Commit();

		if (strlen($_REQUEST["apply"]) <= 0)
			LocalRedirect("/bitrix/admin/cat_store_list.php?lang=".LANG."&".GetFilterParams("filter_", false));
		else
			LocalRedirect("/bitrix/admin/cat_store_edit.php?lang=".LANG."&ID=".$id."&".GetFilterParams("filter_", false));
	}
	else