Example #1
0
	$actions["EDIT"]="edit.php?CODE=#ID#";
	echo "<!-- admin or distibbuter \n";
		var_dump( in_array( 1, $arGroupsCheck ));
		var_dump( in_array( 5, $arGroupsCheck ));
		var_dump( in_array( 6, $arGroupsCheck ));
		print_r( $arGroupsCheck );
		print_r( $Client_ID );
		print_r( $arrFilter_ff );
	echo " -->";

}*/?>
<?
	$arFilterName = "CLIENT_FILTER";
	$CLIENT_FILTER = array();

	$Client_ID = IBlockClientHandler::GetAvailableClientID();
	if( is_array( $Client_ID ) && ( count( $Client_ID ) > 0 ) ){
		$CLIENT_FILTER["ID"] = $Client_ID;
		$GLOBALS[ $arFilterName ] = $CLIENT_FILTER;
	}else{
	
	}
?>
<?$APPLICATION->IncludeComponent(
	"bitrix:news",
	"contract-list-test",
	Array(
		"IBLOCK_TYPE" => "service_contract",
		"IBLOCK_ID" => "22",
		"NEWS_COUNT" => "20",
		"USE_SEARCH" => "N",
Example #2
0
function FormationName(&$arFields) {
	
	if ( $arFields['IBLOCK_ID'] == 24 ){
		// if iBLOCK_ID SK_CONTRACT
		try{

			global $APPLICATION;
			$include_file = __DIR__ .'/../templates/work_copy/class/class_contract.php';
			include_once ( $include_file );

			$no_errors = IBlockContractHandler::OnBeforeIBlockElementAddHandler( $arFields );

			if( is_array( $no_errors ) != true && $no_errors === true ){
				return true;
			}else{
				$APPLICATION->throwException( implode ("\n", $no_errors ));
				return false;
			}
		}catch( Exception $e ){

			ob_start();
				echo "\n ". __FILE__ ."\n";
				print_r ( $e->getMessage() );
				echo "\n ";
				$toLog = ob_get_contents();
			ob_end_clean();
			AddMessage2Log("$toLog", "my_module_id");
		}
	}elseif( $arFields['IBLOCK_ID'] == 23 ){
		try{
			global $APPLICATION;
			$include_file = __DIR__ .'/../templates/work_copy/class/class_chassis.php';
			include_once ( $include_file );

			$no_errors = IBlockChassisHandler::OnBeforeIBlockElementAddHandler( $arFields );

			if( is_array( $no_errors ) != true && $no_errors === true ){
				return true;
			}else{
				$APPLICATION->throwException( implode ("\n", $no_errors ));
				return false;
			}
		}catch( Exception $e ){
			echo $e->getMessage();
		}
	}elseif( $arFields['IBLOCK_ID'] == 22 ){
		try{

			global $APPLICATION;
			$include_file = __DIR__ .'/../templates/work_copy/class/class_client.php';
			include_once ( $include_file );

			$no_errors = IBlockClientHandler::OnBeforeIBlockElementAddHandler( $arFields );
		
			if( is_array( $no_errors ) != true && $no_errors === true ){
				return true;
			}else{
				$APPLICATION->throwException( implode ("\n", $no_errors ));
				return false;
			}
		}catch( Exception $e ){
			echo $e->getMessage();
		}
	}elseif( $arFields['IBLOCK_ID'] == 6  ){
		try{
			global $USER;
			CModule::IncludeModule('iblock');
			$dbEl = CIBlockElement::GetByID( $arFields["ID"] );
			if( $obEl = $dbEl->GetNextElement() ){

				$CurrentVal = $obEl->GetFields();
				$CurrentVal["PROPERTIES"] = $obEl->GetProperties();
				
				// ob_start();
				// echo "\n ". __FILE__ ."\n";
				// print_r ( $arFields );
				// print_r ( $CurrentVal );
				// echo "\n ";
				// $toLog = ob_get_contents();
				// ob_end_clean();
				// AddMessage2Log("$toLog", __METHOD__ . __LINE__);
				
				$log_mess = "";
				$newService_code = $arFields["PROPERTY_VALUES"][106] [ $CurrentVal ["PROPERTIES"]["service_code"]["PROPERTY_VALUE_ID"] ]["VALUE"];
				if( $CurrentVal ["PROPERTIES"]["service_code"]["VALUE"] !==  $newService_code ){
					$log_mess.= "Значение свойства «". $CurrentVal ["PROPERTIES"]["service_code"]["NAME"]."» изменено ".$CurrentVal["PROPERTIES"]["service_code"]["VALUE"]." => ".$newService_code." ;";
				}
				$newService_price = $arFields["PROPERTY_VALUES"][107] [ $CurrentVal ["PROPERTIES"]["service_price"]["PROPERTY_VALUE_ID"] ]["VALUE"];
				if( $CurrentVal ["PROPERTIES"]["service_price"]["VALUE"] !== $newService_price ){
					$log_mess.= "Значение свойства «". $CurrentVal ["PROPERTIES"]["service_price"]["NAME"]."» изменено ".$CurrentVal["PROPERTIES"]["service_price"]["VALUE"]." => ".$newService_price." ;";
				}
				
				if( $log_mess!="" ){
					CEventLog::Add(array(
						"SEVERITY"=>"SECURITY",
						"AUDIT_TYPE_ID"=>"SERVICE_CALC_ITEM_PRICE_CHANGE",
						"MODULE_ID"=>"IBLOCK",
						"ITEM_ID"=>$arFields["ID"],
						"USER_ID"=>$USER->GetID(),
						"DESCRIPTION"=>"$log_mess",
					));
				}
			}else{
				throw new Exception("Элемент с ID: ".$arFields["ID"]." не найден.");
			}
		}catch( Exception $e ){
				echo $e->getMessage();
		}			
	}
}