Beispiel #1
0
 public static function Add($arFields)
 {
     global $DB;
     if (!CSaleGroupAccessToSite::CheckFields("ADD", $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_sale_site2group", $arFields);
     $strSql = "INSERT INTO b_sale_site2group(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = IntVal($DB->LastID());
     return $ID;
 }
Beispiel #2
0
 function Update($ID, &$arFields)
 {
     global $DB;
     $ID = IntVal($ID);
     if ($ID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGS_NO_ID"), "NO_ID");
         return false;
     }
     if (!CSaleGroupAccessToSite::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_sale_site2group", $arFields);
     $strSql = "UPDATE b_sale_site2group SET " . $strUpdate . " WHERE ID = " . $ID . " ";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     return True;
 }
Beispiel #3
0
 function CanUserDeleteOrder($ID, $arUserGroups = false, $userID = 0)
 {
     $ID = IntVal($ID);
     $userID = IntVal($userID);
     $userRights = CMain::GetUserRight("sale", $arUserGroups, "Y", "Y");
     if ($userRights >= "W") {
         return True;
     }
     if ($userRights == "U") {
         $arOrder = CSaleOrder::GetByID($ID);
         if ($arOrder) {
             $num = CSaleGroupAccessToSite::GetList(array(), array("SITE_ID" => $arOrder["LID"], "GROUP_ID" => $arUserGroups), array());
             if (IntVal($num) > 0) {
                 $dbStatusPerms = CSaleStatus::GetPermissionsList(array(), array("STATUS_ID" => $arOrder["STATUS_ID"], "GROUP_ID" => $arUserGroups), array("MAX" => "PERM_DELETE"));
                 if ($arStatusPerms = $dbStatusPerms->Fetch()) {
                     if ($arStatusPerms["PERM_DELETE"] == "Y") {
                         return True;
                     }
                 }
             }
         }
     }
     return False;
 }
Beispiel #4
0
$siteName = array();
$serverName = array();
$dbSite = CSite::GetList($b = "sort", $o = "asc", array());
while ($arSite = $dbSite->Fetch()) {
    $serverName[$arSite["LID"]] = $arSite["SERVER_NAME"];
    $siteName[$arSite["LID"]] = $arSite["NAME"];
    if (strlen($serverName[$arSite["LID"]]) <= 0) {
        if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
            $serverName[$arSite["LID"]] = SITE_SERVER_NAME;
        } else {
            $serverName[$arSite["LID"]] = COption::GetOptionString("main", "server_name", "");
        }
    }
}
$arAccessibleSites = array();
$dbAccessibleSites = CSaleGroupAccessToSite::GetList(array(), array("GROUP_ID" => $GLOBALS["USER"]->GetUserGroupArray()), false, false, array("SITE_ID"));
while ($arAccessibleSite = $dbAccessibleSites->Fetch()) {
    if (!in_array($arAccessibleSite["SITE_ID"], $arAccessibleSites)) {
        $arAccessibleSites[] = $arAccessibleSite["SITE_ID"];
    }
}
$lAdmin->InitFilter($arFilterFields);
$arFilter = array("ORDER_ID" => false);
if (IntVal($filter_user_id) > 0) {
    $arFilter["USER_ID"] = IntVal($filter_user_id);
}
if (strlen($filter_login) > 0) {
    $arFilter["USER_LOGIN"] = $filter_login;
}
if (strlen($filter_currency) > 0) {
    $arFilter["CURRENCY"] = $filter_currency;
Beispiel #5
0
 function OnPostForm()
 {
     $wizard =& $this->GetWizard();
     if ($wizard->IsNextButtonClick()) {
         $arResult = $wizard->GetVars(true);
         COption::SetOptionString("sale", "order_email", $arResult["orderEmail"]);
         COption::SetOptionString("sale", "delete_after", $arResult["saveBasket"]);
         COption::SetOptionString("sale", "default_currency", $arResult["currencyID"]);
         $arFields["LID"] = $arResult["siteID"];
         $arFields["CURRENCY"] = $arResult["currencyID"];
         CSaleLang::Update($arResult["siteID"], array("LID" => $arResult["siteID"], "CURRENCY" => $arResult["currencyID"]));
         CSaleGroupAccessToSite::DeleteBySite($arResult["siteID"]);
         foreach ($arResult["groupID"] as $v) {
             CSaleGroupAccessToSite::Add(array("SITE_ID" => $arResult["siteID"], "GROUP_ID" => $v));
         }
         if (!empty($arResult["1C_GROUP_PERMISSIONS"])) {
             COption::SetOptionString("catalog", "1C_GROUP_PERMISSIONS", implode(",", $arResult["1C_GROUP_PERMISSIONS"]));
         }
         COption::SetOptionString("catalog", "1C_ELEMENT_ACTION", $arResult["1C_ELEMENT_ACTION"]);
         COption::SetOptionString("catalog", "1C_SECTION_ACTION", $arResult["1C_SECTION_ACTION"]);
         COption::SetOptionString("catalog", "1C_INTERVAL", $arResult["1C_INTERVAL"]);
         COption::SetOptionString("catalog", "1C_FILE_SIZE_LIMIT", $arResult["1C_FILE_SIZE_LIMIT"]);
         COption::SetOptionString("catalog", "1C_SITE_LIST", $arResult["siteID"]);
         if (!empty($arResult["1C_GROUP_PERMISSIONS"])) {
             COption::SetOptionString("sale", "1C_SALE_GROUP_PERMISSIONS", implode(",", $arResult["1C_GROUP_PERMISSIONS"]));
         }
         COption::SetOptionString("sale", "1C_EXPORT_PAYED_ORDERS", $arResult["1C_EXPORT_PAYED_ORDERS"]);
         COption::SetOptionString("sale", "1C_EXPORT_ALLOW_DELIVERY_ORDERS", $arResult["1C_EXPORT_ALLOW_DELIVERY_ORDERS"]);
         COption::SetOptionString("sale", "1C_EXPORT_FINAL_ORDERS", $arResult["1C_EXPORT_FINAL_ORDERS"]);
         COption::SetOptionString("sale", "1C_FINAL_STATUS_ON_DELIVERY", $arResult["1C_FINAL_STATUS_ON_DELIVERY"]);
         COption::SetOptionString("sale", "1C_SALE_SITE_LIST", $arResult["siteID"]);
         foreach ($arResult["groupID"] as $v) {
             $perm = $GLOBALS["APPLICATION"]->GetGroupRight("sale", $v);
             if ($perm != "W") {
                 $GLOBALS["APPLICATION"]->SetGroupRight("sale", $v, "U");
             }
         }
         $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => $arResult["siteID"]), false, false, array("ID", "LID", "SORT"));
         while ($arStatus = $dbStatus->Fetch()) {
             $arPerms = array();
             foreach ($arResult["groupID"] as $v) {
                 $arPerms[] = array("GROUP_ID" => $v, "PERM_VIEW" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELETE"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_UPDATE"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_PAYMENT"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELIVERY"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_CANCEL"] == "Y" ? "Y" : $arResult["perm"][$arStatus["ID"]][$v]["PERM_VIEW"], "PERM_CANCEL" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_CANCEL"], "PERM_MARK" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_MARK"], "PERM_DEDUCTION" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DEDUCTION"], "PERM_DELIVERY" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELIVERY"], "PERM_PAYMENT" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_PAYMENT"], "PERM_STATUS" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_STATUS"], "PERM_STATUS_FROM" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_STATUS_FROM"], "PERM_UPDATE" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_UPDATE"], "PERM_DELETE" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELETE"]);
             }
             CSaleStatus::Update($arStatus["ID"], array("PERMS" => $arPerms, "SORT" => $arStatus["SORT"]));
         }
         $paySystemID = array();
         $paySystem = array();
         foreach ($arResult["paySystem"] as $pType => $pSystem) {
             if (!empty($pSystem)) {
                 foreach ($pSystem as $v) {
                     $paySystem[$v][] = $pType;
                     if (!in_array($v, $paySystemID)) {
                         $paySystemID[] = $v;
                     }
                 }
             }
         }
         $dbPaySys = CSalePaySystem::GetList(array(), array("ACTIVE" => "Y"), false, false, array("ID", "ACTIVE"));
         while ($arPaySys = $dbPaySys->Fetch()) {
             if (!in_array($arPaySys["ID"], $paySystemID)) {
                 CSalePaySystem::Update($arPaySys["ID"], array("ACTIVE" => "N"));
             }
         }
         foreach ($paySystem as $pID => $value) {
             $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID));
             while ($arPaySysAction = $dbPaySysAction->Fetch()) {
                 if (!in_array($arPaySysAction["PERSON_TYPE_ID"], $value)) {
                     CSalePaySystemAction::Delete($arPaySysAction["ID"]);
                 }
             }
         }
         function LocalGetPSActionParams($fileName)
         {
             $arPSCorrespondence = array();
             if (file_exists($fileName) && is_file($fileName)) {
                 include $fileName;
             }
             return $arPSCorrespondence;
         }
         foreach ($paySystem as $pID => $value) {
             foreach ($value as $personID) {
                 $arFields = array();
                 $arPaySysAction = "";
                 $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID, "PERSON_TYPE_ID" => $personID));
                 if ($arPaySysAction = $dbPaySysAction->Fetch()) {
                     $pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysAction["ACTION_FILE"];
                 } else {
                     $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID));
                     if ($arPaySysActionTmp = $dbPaySysAction->Fetch()) {
                         $pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysActionTmp["ACTION_FILE"];
                     }
                 }
                 if (strlen($pathToAction) > 0) {
                     $arPSCorrespondence = LocalGetPSActionParams($pathToAction . "/.description.php");
                     $arParams = array();
                     foreach ($arPSCorrespondence as $k => $v) {
                         $typeTmp = $arResult[$pID . "_" . $k . "_" . $personID];
                         $valueTmp = $arResult["VALUE1_" . $pID . "_" . $k . "_" . $personID];
                         if (strlen($valueTmp) <= 0) {
                             $valueTmp = $arResult["VALUE2_" . $pID . "_" . $k . "_" . $personID];
                         }
                         $arParams[$k] = array("TYPE" => $typeTmp, "VALUE" => $valueTmp);
                     }
                     $arFields = array("NEW_WINDOW" => $arResult["paySystemPopup"][$pID][$personID], "PARAMS" => CSalePaySystemAction::SerializeParams($arParams));
                     if (IntVal($arPaySysAction["ID"]) > 0) {
                         CSalePaySystemAction::Update($arPaySysAction["ID"], $arFields);
                     } else {
                         $arFields["PAY_SYSTEM_ID"] = $pID;
                         $arFields["PERSON_TYPE_ID"] = $personID;
                         $arFields["NAME"] = $arPaySysActionTmp["NAME"];
                         $arFields["ACTION_FILE"] = $arPaySysActionTmp["ACTION_FILE"];
                         $arFields["HAVE_PREPAY"] = "N";
                         $arFields["HAVE_RESULT"] = "N";
                         $arFields["HAVE_ACTION"] = "N";
                         $arFields["HAVE_PAYMENT"] = "N";
                         $arFields["HAVE_RESULT_RECEIVE"] = "N";
                         if (file_exists($pathToAction)) {
                             if (is_dir($pathToAction)) {
                                 if (file_exists($pathToAction . "/pre_payment.php")) {
                                     $arFields["HAVE_PREPAY"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/result.php")) {
                                     $arFields["HAVE_RESULT"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/action.php")) {
                                     $arFields["HAVE_ACTION"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/payment.php")) {
                                     $arFields["HAVE_PAYMENT"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/result_rec.php")) {
                                     $arFields["HAVE_RESULT_RECEIVE"] = "Y";
                                 }
                             } else {
                                 $arFields["HAVE_PAYMENT"] = "Y";
                             }
                         }
                         CSalePaySystemAction::Add($arFields);
                     }
                 }
             }
         }
         COption::SetOptionInt("sale", "location", $arResult["location"], false, $arResult["siteID"]);
         if (empty($arResult["delivery"])) {
             $arResult["delivery"] = array();
         }
         $dbDelivery = CSaleDeliveryHandler::GetList(array("SORT" => "ASC"), array("SITE_ID" => $arResult["siteID"], "ACTIVE" => "Y"));
         while ($arDelivery = $dbDelivery->Fetch()) {
             if (!in_array($arDelivery["SID"] . "_new", $arResult["delivery"])) {
                 CSaleDeliveryHandler::Set($arDelivery["SID"], array("ACTIVE" => "N"));
             }
         }
         $dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"), array("LID" => $arResult["siteID"], "ACTIVE" => "Y"));
         while ($arDelivery = $dbDelivery->Fetch()) {
             if (!in_array($arDelivery["ID"], $arResult["delivery"])) {
                 CSaleDelivery::Update($arDelivery["ID"], array("ACTIVE" => "N"));
             }
         }
         if (strlen($arResult["login"]) > 0) {
             $arFields = array("LOGIN" => $arResult["login"], "PASSWORD" => $arResult["password"], "CONFIRM_PASSWORD" => $arResult["password_rep"], "EMAIL" => $arResult["email"]);
             $user = new CUser();
             $ID = $user->Add($arFields);
             if (IntVal($ID) > 0) {
                 $sGroups = COption::GetOptionString("main", "new_user_registration_def_group", "");
                 CUser::SetUserGroup($ID, array_merge(explode(",", $sGroups), $arResult["1C_GROUP_PERMISSIONS"]));
             }
         }
     }
 }
Beispiel #6
0
        echo $val["NAME"];
        ?>
				</td>
				<td valign="top">

					<?php 
        $arCurr = CSaleLang::GetByID($val["ID"]);
        echo CCurrency::SelectBox("CURRENCY_" . $val["ID"], $arCurr["CURRENCY"], GetMessage("SALE_NOT_SET"), True, "");
        ?>

				</td>
				<td valign="top">

					<?php 
        $arCurrentGroups = array();
        $dbSiteGroupsList = CSaleGroupAccessToSite::GetList(array(), array("SITE_ID" => $val["ID"]));
        while ($arSiteGroup = $dbSiteGroupsList->Fetch()) {
            $arCurrentGroups[] = IntVal($arSiteGroup["GROUP_ID"]);
        }
        $b = "c_sort";
        $o = "asc";
        $userGroupList = array();
        $dbGroups = CGroup::GetList($b, $o, array("ANONYMOUS" => "N"));
        while ($arGroup = $dbGroups->Fetch()) {
            $arGroup["ID"] = (int) $arGroup["ID"];
            if ($arGroup["ID"] == 1 || $arGroup["ID"] == 2) {
                continue;
            }
            $userGroupList[] = $arGroup;
        }
        ?>
Beispiel #7
0
$LOCAL_PERSON_TYPE_CACHE = array();
$LOCAL_PAYED_USER_CACHE = array();
$LOCAL_PAY_SYSTEM_CACHE = array();
$LOCAL_DELIVERY_CACHE = array();
$LOCAL_STATUS_CACHE = array();

IncludeModuleLangFile(__FILE__);

$arUserGroups = $USER->GetUserGroupArray();
$intUserID = intval($USER->GetID());

$arAccessibleSites = array();
$dbAccessibleSites = CSaleGroupAccessToSite::GetList(
		array(),
		array("GROUP_ID" => $arUserGroups),
		false,
		false,
		array("SITE_ID")
	);
while ($arAccessibleSite = $dbAccessibleSites->Fetch())
{
	if (!in_array($arAccessibleSite["SITE_ID"], $arAccessibleSites))
		$arAccessibleSites[] = $arAccessibleSite["SITE_ID"];
}

$bExport = false;
if($_REQUEST["mode"] == "excel")
	$bExport = true;

$sTableID = "tbl_sale_order";
Beispiel #8
0
         CSaleUserAccount::Add(array("USER_ID" => 1, "CURRENT_BUDGET" => 100, "CURRENCY" => "USD"));
     }
 }
 //Sale administrators
 $userGroupID = "";
 $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "sale_administrator"));
 if ($arGroup = $dbGroup->Fetch()) {
     $userGroupID = $arGroup["ID"];
 } else {
     $group = new CGroup();
     $arFields = array("ACTIVE" => "Y", "C_SORT" => 800, "NAME" => GetMessage("SALE_WIZARD_ADMIN_SALE"), "DESCRIPTION" => GetMessage("SALE_WIZARD_ADMIN_SALE_DESCR"), "USER_ID" => array(), "STRING_ID" => "sale_administrator");
     $userGroupID = $group->Add($arFields);
 }
 if (IntVal($userGroupID) > 0) {
     DemoSiteUtil::SetFilePermission(array($siteID, "/bitrix/admin"), array($userGroupID => "R"));
     CSaleGroupAccessToSite::Add(array("SITE_ID" => $siteID, "GROUP_ID" => $userGroupID));
 }
 if ($bRus) {
     $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "1c_integration"));
     if ($arGroup = $dbGroup->Fetch()) {
         $user1CGroupID = $arGroup["ID"];
     } else {
         $group = new CGroup();
         $arFields = array("ACTIVE" => "Y", "C_SORT" => 900, "NAME" => GetMessage("SALE_WIZARD_1C_GROUP"), "DESCRIPTION" => GetMessage("SALE_WIZARD_1C_GROUP_DESCR"), "USER_ID" => array(), "STRING_ID" => "1c_integration");
         $user1CGroupID = $group->Add($arFields);
     }
     if (IntVal($user1CGroupID) > 0) {
         DemoSiteUtil::SetFilePermission(array($siteID, "/bitrix/admin"), array($userGroupID => "R"));
     }
 }
 //Set options