Beispiel #1
0
 function ConvertFilesToPost($source, &$target, $field = false)
 {
     if ($field === false) {
         foreach ($source as $field => $sub_source) {
             CAllFile::ConvertFilesToPost($sub_source, $target, $field);
         }
     } else {
         foreach ($source as $id => $sub_source) {
             if (!array_key_exists($id, $target)) {
                 $target[$id] = array();
             }
             if (is_array($sub_source)) {
                 CAllFile::ConvertFilesToPost($sub_source, $target[$id], $field);
             } else {
                 $target[$id][$field] = $sub_source;
             }
         }
     }
 }
Beispiel #2
0
	}
}

if ($boolSKU && 1 < sizeof($arSubQuery))
{
	$arFilter['ID'] = CIBlockElement::SubQuery('PROPERTY_'.$arCatalog['SKU_PROPERTY_ID'], $arSubQuery);
}

if(IntVal($find_section_section)<0 || strlen($find_section_section)<=0)
	unset($arFilter["SECTION_ID"]);

// Handle edit action (check for permission before save!)
if($lAdmin->EditAction())
{
	if(is_array($_FILES['FIELDS']))
		CAllFile::ConvertFilesToPost($_FILES['FIELDS'], $_POST['FIELDS']);

	foreach($_POST['FIELDS'] as $ID=>$arFields)
	{
		if(!$lAdmin->IsUpdated($ID))
			continue;
		$TYPE = substr($ID, 0, 1);
		$ID = (int)substr($ID,1);
		$arFields["IBLOCK_ID"] = $IBLOCK_ID;

		if($TYPE=="S")
		{
			if(CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $ID, "section_edit"))
			{
				$obS = new CIBlockSection;
Beispiel #3
0
// simple filter
$arFilter = array("IBLOCK_ID" => $intSubIBlockID);
if (0 < $intSubPropValue) {
    $arFilter["=PROPERTY_" . $arSubCatalog['SKU_PROPERTY_ID']] = $intSubPropValue;
} else {
    $arFilter["=PROPERTY_" . $arSubCatalog['SKU_PROPERTY_ID']] = $intSubPropValue;
}
$arFilter["CHECK_PERMISSIONS"] = "Y";
$arFilter["MIN_PERMISSION"] = "R";
if (true == defined('B_ADMIN_SUBELEMENTS_LIST') && true == B_ADMIN_SUBELEMENTS_LIST) {
    if ($lAdmin->EditAction()) {
        if (is_array($_FILES['FIELDS'])) {
            CAllFile::ConvertFilesToPost($_FILES['FIELDS'], $_POST['FIELDS']);
        }
        if (is_array($FIELDS_del)) {
            CAllFile::ConvertFilesToPost($FIELDS_del, $_POST['FIELDS'], "del");
        }
        foreach ($_POST['FIELDS'] as $subID => $arFields) {
            if (!$lAdmin->IsUpdated($subID)) {
                continue;
            }
            $subID = IntVal($subID);
            $arRes = CIBlockElement::GetByID($subID);
            $arRes = $arRes->Fetch();
            if (!$arRes) {
                continue;
            }
            $WF_ID = $subID;
            if ($boolSubWorkFlow) {
                $WF_ID = CIBlockElement::WF_GetLast($subID);
                if ($WF_ID != $subID) {
					{
						if(!is_array($val2))
							$PROP[$k1][$k2] = array("VALUE" => $val2);
					}
				}
			}
		}

		//transpose files array
		// [property id] [value id] = file array (name, type, tmp_name, error, size)
		$files = $_FILES["PROP"];
		if(is_array($files))
		{
			if(!is_array($PROP))
				$PROP = array();
			CAllFile::ConvertFilesToPost($_FILES["PROP"], $PROP);
		}

		foreach($arFileProps as $k1)
		{
			if (isset($PROP_del[$k1]) && is_array($PROP_del[$k1]))
			{
				foreach ($PROP_del[$k1] as $prop_value_id => $tmp)
				{
					if (!array_key_exists($prop_value_id, $PROP[$k1]))
						$PROP[$k1][$prop_value_id] = null;
				}
			}

			if (isset($PROP[$k1]) && is_array($PROP[$k1]))
			{
Beispiel #5
0
 }
 $formID = isset($_POST['FORM_ID']) ? $_POST['FORM_ID'] : '';
 if ($formID === '') {
     $formID = 'CRM_' . trim($_POST['ENTITY_TYPE']) . '_' . trim($_POST['FORM_TYPE']) . '_V12';
 }
 $arResult['EVENT_PAGE'] = CHTTP::urlAddParams($eventPage, array($formID . '_active_tab' => !empty($_POST['TAB_ID']) ? $_POST['TAB_ID'] : 'tab_event'));
 if (check_bitrix_sessid()) {
     $entityTypeID = isset($_POST['ENTITY_TYPE']) ? trim($_POST['ENTITY_TYPE']) : '';
     $entityID = isset($_POST['ENTITY_ID']) ? intval($_POST['ENTITY_ID']) : 0;
     $eventID = isset($_POST['EVENT_ID']) ? trim($_POST['EVENT_ID']) : '';
     $eventDesc = isset($_POST['EVENT_DESC']) ? trim($_POST['EVENT_DESC']) : '';
     $eventDate = isset($_POST['EVENT_DATE']) ? trim($_POST['EVENT_DATE']) : '';
     $postFiles = isset($_FILES['ATTACH']) ? $_FILES['ATTACH'] : array();
     $attachedFiles = array();
     if (!empty($postFiles)) {
         CAllFile::ConvertFilesToPost($postFiles, $attachedFiles);
     }
     $CCrmEvent = new CCrmEvent();
     $eventFiles = array();
     foreach ($attachedFiles as &$arFile) {
         if (isset($arFile['tmp_name']) && is_uploaded_file($arFile['tmp_name'])) {
             $eventFiles[] = $arFile;
         }
     }
     unset($arFile);
     if ($eventDate !== '') {
         if (!CheckDateTime($eventDate, FORMAT_DATETIME)) {
             $eventDate = '';
         } else {
             // Check for max database datetime
             $eventTimestamp = MakeTimeStamp($eventDate, FORMAT_DATETIME);
Beispiel #6
0
    }
} elseif ($isCopyingOrderOperation) {
    /** @var \Bitrix\Sale\Order $originalOrder */
    $originalOrder = Bitrix\Sale\Order::load($ID);
    if ($originalOrder) {
        $order = \Bitrix\Sale\Order::create($originalOrder->getSiteId(), $originalOrder->getUserId(), $originalOrder->getCurrency());
        $order->setPersonTypeId($originalOrder->getPersonTypeId());
        $originalPropCollection = $originalOrder->getPropertyCollection();
        $properties['PROPERTIES'] = array();
        $files = array();
        /** @var \Bitrix\Sale\PropertyValue $prop */
        foreach ($originalPropCollection as $prop) {
            if ($prop->getField('TYPE') == 'FILE') {
                $propValue = $prop->getValue();
                if ($propValue) {
                    $files[] = CAllFile::MakeFileArray($propValue['ID']);
                    $properties['PROPERTIES'][$prop->getPropertyId()] = $propValue['ID'];
                }
            } else {
                $properties['PROPERTIES'][$prop->getPropertyId()] = $prop->getValue();
            }
        }
        $propCollection = $order->getPropertyCollection();
        $propCollection->setValuesFromPost($properties, $files);
        $originalBasket = $originalOrder->getBasket();
        $originalBasketItems = $originalBasket->getBasketItems();
        $basket = \Bitrix\Sale\Basket::create($originalOrder->getSiteId(), $originalBasket->getFUserId());
        /** @var \Bitrix\Sale\BasketItem $originalBasketItem */
        foreach ($originalBasketItems as $originalBasketItem) {
            $item = $basket->createItem($originalBasketItem->getField("MODULE"), $originalBasketItem->getProductId());
            $item->setFields(array_intersect_key($originalBasketItem->getFields()->getValues(), array_flip($originalBasketItem->getAvailableFields())));
	$arFilter["WF_STATUS"] = $find_el_status;
if(!empty($find_el_date_active_from_from))
	$arFilter[">=DATE_ACTIVE_FROM"] = $find_el_date_active_from_from;
if(!empty($find_el_date_active_from_to))
	$arFilter["<=DATE_ACTIVE_FROM"] = $find_el_date_active_from_to;
if(!empty($find_el_date_active_to_from))
	$arFilter[">=DATE_ACTIVE_TO"] = $find_el_date_active_to_from;
if(!empty($find_el_date_active_to_to))
	$arFilter["<=DATE_ACTIVE_TO"] = $find_el_date_active_to_to;

if($lAdmin->EditAction())
{
	if(is_array($_FILES['FIELDS']))
		CAllFile::ConvertFilesToPost($_FILES['FIELDS'], $FIELDS);
	if(is_array($FIELDS_del))
		CAllFile::ConvertFilesToPost($FIELDS_del, $FIELDS, "del");

	foreach($FIELDS as $ID=>$arFields)
	{
		if(!$lAdmin->IsUpdated($ID))
			continue;
		$ID = IntVal($ID);

		$arRes = CIBlockElement::GetByID($ID);
		$arRes = $arRes->Fetch();
		if(!$arRes)
			continue;

		$WF_ID = $ID;
		if($bWorkFlow)
		{