1
0
mirror of synced 2024-11-22 05:16:09 +03:00

corrected lang files; added groups of statuses;

This commit is contained in:
Grisha Pomadchin 2013-07-25 15:30:00 +04:00
parent e8b1a78cdf
commit 73ef894431
11 changed files with 2275 additions and 37 deletions

View File

@ -146,7 +146,7 @@ class ICrmOrderActions
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastOrderId);
return true; //all ok!
}
}
/**
*

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,414 @@
<?
//<title>CRM</title>
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/export_setup_templ.php"));
global $APPLICATION, $USER;
ClearVars();
$strYandexError = "";
if (($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
{
if (isset($arOldSetupVars['IBLOCK_ID']))
$IBLOCK_ID = $arOldSetupVars['IBLOCK_ID'];
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
$SETUP_FILE_NAME = str_replace(COption::GetOptionString("catalog", "export_default_path", "/bitrix/catalog_export/"),'',$arOldSetupVars['SETUP_FILE_NAME']);
if (isset($arOldSetupVars['SETUP_PROFILE_NAME']))
$SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME'];
if (isset($arOldSetupVars['V']))
$V = $arOldSetupVars['V'];
if (isset($arOldSetupVars['XML_DATA']))
{
if (get_magic_quotes_gpc())
{
$XML_DATA = base64_encode(stripslashes($arOldSetupVars['XML_DATA']));
}
else
{
$XML_DATA = base64_encode($arOldSetupVars['XML_DATA']);
}
}
if (isset($arOldSetupVars['SETUP_SERVER_NAME']))
$SETUP_SERVER_NAME = $arOldSetupVars['SETUP_SERVER_NAME'];
}
if ($STEP>1)
{
$IBLOCK_ID = intval($IBLOCK_ID);
$rsIBlocks = CIBlock::GetByID($IBLOCK_ID);
if ($IBLOCK_ID<=0 || !($arIBlock = $rsIBlocks->Fetch()))
{
$strYandexError .= GetMessage("CET_ERROR_NO_IBLOCK1")." #".$IBLOCK_ID." ".GetMessage("CET_ERROR_NO_IBLOCK2")."<br>";
}
else
{
$bRightBlock = !CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_admin_display");
if ($bRightBlock)
{
$strYandexError .= str_replace('#IBLOCK_ID#',$IBLOCK_ID,GetMessage("CET_ERROR_IBLOCK_PERM"))."<br>";
}
}
if (strlen($SETUP_FILE_NAME)<=0)
{
$strYandexError .= GetMessage("CET_ERROR_NO_FILENAME")."<br>";
}
elseif (preg_match(BX_CATALOG_FILENAME_REG,$SETUP_FILE_NAME))
{
$strYandexError .= GetMessage("CES_ERROR_BAD_EXPORT_FILENAME")."<br>";
}
elseif ($APPLICATION->GetFileAccessPermission($SETUP_FILE_NAME) < "W")
{
$strYandexError .= str_replace("#FILE#", $SETUP_FILE_NAME, GetMessage('CET_YAND_RUN_ERR_SETUP_FILE_ACCESS_DENIED'))."<br>";
}
$SETUP_SERVER_NAME = trim($SETUP_SERVER_NAME);
if (strlen($strYandexError)<=0)
{
$bAllSections = false;
$arSections = array();
if (is_array($V) && !empty($V))
{
foreach ($V as $key => $value)
{
if (trim($value)=="0")
{
$bAllSections = true;
break;
}
$value = intval($value);
if ($value>0)
{
$arSections[] = $value;
}
}
}
if (!$bAllSections && !empty($arSections))
{
$arCheckSections = array();
$rsSections = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'ID' => $arSections), false, array('ID'));
while ($arOneSection = $rsSections->Fetch())
{
$arCheckSections[] = $arOneSection['ID'];
}
$arSections = $arCheckSections;
}
if (!$bAllSections && empty($arSections))
{
$strYandexError .= GetMessage("CET_ERROR_NO_GROUPS")."<br>";
$V = array();
}
}
if (is_array($V))
{
$V = array_unique(array_values($V));
$_REQUEST['V'] = $V;
}
$arCatalog = CCatalog::GetByIDExt($IBLOCK_ID);
if ('P' == $arCatalog['CATALOG_TYPE'] || 'X' == $arCatalog['CATALOG_TYPE'])
{
if (strlen($XML_DATA) <= 0)
{
$strYandexError .= GetMessage('YANDEX_ERR_SKU_SETTINGS_ABSENT').'<br>';
}
}
if (($ACTION=="EXPORT_SETUP" || $ACTION=="EXPORT_EDIT" || $ACTION=="EXPORT_COPY") && strlen($SETUP_PROFILE_NAME)<=0)
$strYandexError .= GetMessage("CET_ERROR_NO_PROFILE_NAME")."<br>";
if (strlen($strYandexError)>0)
{
$STEP = 1;
}
}
echo ShowError($strYandexError);
if ($STEP==1)
{
if (CModule::IncludeModule("iblock"))
{
?>
<form method="post" action="<?echo $APPLICATION->GetCurPage() ?>" name="yandex_setup_form" id="yandex_setup_form">
<?=bitrix_sessid_post()?>
<?if ($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY')
{
?><input type="hidden" name="PROFILE_ID" value="<? echo intval($PROFILE_ID); ?>"><?
}
?>
<script type="text/javascript">
var TreeSelected = new Array();
<?
$intCountSelected = 0;
if (isset($V) && is_array($V) && !empty($V))
{
foreach ($V as $oneKey)
{
?>TreeSelected[<? echo $intCountSelected ?>] = <? echo intval($oneKey); ?>;
<?
$intCountSelected++;
}
}
?>
function ClearSelected()
{
TreeSelected = new Array();
}
</script>
<?
if ($intCountSelected)
{
foreach ($V as &$oneKey)
{
?><input type="hidden" value="<? echo intval($oneKey); ?>" name="V[]" id="oldV<? echo intval($oneKey); ?>"><?
}
}
?>
<table width="100%" class="edit-table">
<tr>
<td width="100%" valign="top"><font class="text"><b><? echo GetMessage('CET_SELECT_IBLOCK_EXT'); ?></b></font><br>
<? echo GetIBlockDropDownListEx(
$IBLOCK_ID, 'IBLOCK_TYPE_ID', 'IBLOCK_ID',
array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W'),
"ClearSelected(); document.getElementById('id_ifr').src='/bitrix/tools/catalog_export/yandex_util.php?IBLOCK_ID=0&'+'".bitrix_sessid_get()."';",
"ClearSelected(); document.getElementById('id_ifr').src='/bitrix/tools/catalog_export/yandex_util.php?IBLOCK_ID='+this[this.selectedIndex].value+'&'+'".bitrix_sessid_get()."';",
'class="adm-detail-iblock-types"',
'class="adm-detail-iblock-list"'
); ?>
<br><br>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<font class="text"><b><?echo GetMessage("CET_SELECT_GROUP");?></b></font><br>
<table border="0">
<tr>
<td><div id="tree"></div></td>
</tr>
</table>
<script type="text/javascript">
clevel = 0;
function delOldV(obj)
{
if (obj)
{
if (obj.checked == false)
{
var objOldVal = BX('oldV'+obj.value);
if (objOldVal)
{
objOldVal.parentNode.removeChild(objOldVal);
objOldVal = null;
}
}
}
}
function buildNoMenu()
{
var buffer;
buffer = '<br><table border="0" cellspacing="0" cellpadding="0">';
buffer += '<tr><td><font class="text" style="color: #A9A9A9;"><?echo CUtil::JSEscape(GetMessage("CET_FIRST_SELECT_IBLOCK"));?></font></td></tr>';
buffer += '</table>';
document.getElementById('tree').innerHTML = buffer;
}
function buildMenu()
{
var i;
var buffer;
var imgSpace;
buffer = '<br><table border="0" cellspacing="0" cellpadding="0">';
buffer += '<tr>';
buffer += '<td colspan="2" valign="top" align="left"><input type="checkbox" name="V[]" value="0" id="v0"'+(BX.util.in_array(0,TreeSelected) ? ' checked' : '')+' onclick="delOldV(this);"><label for="v0"><font class="text"><b><?echo CUtil::JSEscape(GetMessage("CET_ALL_GROUPS"));?></b></font></label></td>';
buffer += '</tr>';
for (i in Tree[0])
{
if (!Tree[i])
{
space = '<input type="checkbox" name="V[]" value="'+i+'" id="V'+i+'"'+(BX.util.in_array(i,TreeSelected) ? ' checked' : '')+' onclick="delOldV(this);"><label for="V'+i+'"><font class="text">' + Tree[0][i][0] + '</font></label>';
imgSpace = '';
}
else
{
space = '<input type="checkbox" name="V[]" value="'+i+'"'+(BX.util.in_array(i,TreeSelected) ? ' checked' : '')+' onclick="delOldV(this);"><a href="javascript: collapse(' + i + ')"><font class="text"><b>' + Tree[0][i][0] + '</b></font></a>';
imgSpace = '<img src="/bitrix/images/catalog/load/plus.gif" width="13" height="13" id="img_' + i + '" OnClick="collapse(' + i + ')">';
}
buffer += '<tr>';
buffer += '<td width="20" valign="top" align="center">' + imgSpace + '</td>';
buffer += '<td id="node_' + i + '">' + space + '</td>';
buffer += '</tr>';
}
buffer += '</table>';
document.getElementById('tree').innerHTML = buffer;
BX.adminPanel.modifyFormElements('yandex_setup_form');
}
function collapse(node)
{
if (document.getElementById('table_' + node) == null)
{
var i;
var buffer;
var imgSpace;
buffer = '<table border="0" id="table_' + node + '" cellspacing="0" cellpadding="0">';
for (i in Tree[node])
{
if (!Tree[i])
{
space = '<input type="checkbox" name="V[]" value="'+i+'" id="V'+i+'"'+(BX.util.in_array(i,TreeSelected) ? ' checked' : '')+' onclick="delOldV(this);"><label for="V'+i+'"><font class="text">' + Tree[node][i][0] + '</font></label>';
imgSpace = '';
}
else
{
space = '<input type="checkbox" name="V[]" value="'+i+'"'+(BX.util.in_array(i,TreeSelected) ? ' checked' : '')+' onclick="delOldV(this);"><a href="javascript: collapse(' + i + ')"><font class="text"><b>' + Tree[node][i][0] + '</b></font></a>';
imgSpace = '<img src="/bitrix/images/catalog/load/plus.gif" width="13" height="13" id="img_' + i + '" OnClick="collapse(' + i + ')">';
}
buffer += '<tr>';
buffer += '<td width="20" align="center" valign="top">' + imgSpace + '</td>';
buffer += '<td id="node_' + i + '">' + space + '</td>';
buffer += '</tr>';
}
buffer += '</table>';
document.getElementById('node_' + node).innerHTML += buffer;
document.getElementById('img_' + node).src = '/bitrix/images/catalog/load/minus.gif';
}
else
{
var tbl = document.getElementById('table_' + node);
tbl.parentNode.removeChild(tbl);
document.getElementById('img_' + node).src = '/bitrix/images/catalog/load/plus.gif';
}
BX.adminPanel.modifyFormElements('yandex_setup_form');
}
function changeStyle(node,action)
{
docStyle = document.getElementById('node_' + node).style;
with (docStyle)
{
if (action == 'to')
{
backgroundColor= '#e5e5e5';
}
else
{
backgroundColor = '#ffffff';
}
}
}
</script>
<iframe src="/bitrix/tools/catalog_export/yandex_util.php?IBLOCK_ID=<?=intval($IBLOCK_ID)?>&<? echo bitrix_sessid_get(); ?>" id="id_ifr" name="ifr" style="display:none"></iframe>
<br><br>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<script type="text/javascript">
function showDetailPopup()
{
if (null == obDetailWindow)
{
var s = BX('IBLOCK_ID');
var dat = BX('XML_DATA');
var obDetailWindow = new BX.CAdminDialog({
'content_url': '/bitrix/tools/catalog_export/yandex_detail.php?lang=<?=LANGUAGE_ID?>&bxpublic=Y&IBLOCK_ID=' + s[s.selectedIndex].value,
'content_post': 'XML_DATA='+BX.util.urlencode(dat.value)+'&'+'<?echo bitrix_sessid_get(); ?>',
'width': 900, 'height': 550,
'resizable': true
});
obDetailWindow.Show();
}
}
function setDetailData(data)
{
BX('XML_DATA').value = data;
}
</script>
<font class="text"><b><?=GetMessage('CAT_DETAIL_PROPS')?>:</b> </font>
<button onclick="showDetailPopup(); return false;"><?=GetMessage('CAT_DETAIL_PROPS_RUN')?></button>
<input type="hidden" id="XML_DATA" name="XML_DATA" value="<? echo (strlen($XML_DATA) > 0 ? $XML_DATA : ''); ?>" />
</td>
</td>
<tr>
<td width="100%" valign="top">
<font class="text"><b>
<?echo GetMessage("CET_SERVER_NAME");?> <input type="text" name="SETUP_SERVER_NAME" value="<?echo (strlen($SETUP_SERVER_NAME)>0) ? htmlspecialcharsbx($SETUP_SERVER_NAME) : '' ?>" size="50" /> <input type="button" onclick="this.form['SETUP_SERVER_NAME'].value = window.location.host;" value="<?echo htmlspecialcharsbx(GetMessage('CET_SERVER_NAME_SET_CURRENT'))?>" />
</b></font>
<br><br>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<font class="text"><b>
<?echo GetMessage("CET_SAVE_FILENAME");?> <b><? echo htmlspecialcharsbx(COption::GetOptionString("catalog", "export_default_path", "/bitrix/catalog_export/"));?></b><input type="text" name="SETUP_FILE_NAME" value="<?echo (strlen($SETUP_FILE_NAME)>0) ? htmlspecialcharsbx($SETUP_FILE_NAME) : "yandex_".mt_rand(0, 999999).".php" ?>" size="50" />
</b></font>
<br><br>
</td>
</tr>
<?if ($ACTION=="EXPORT_SETUP" || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'):?>
<tr>
<td width="100%" valign="top">
<font class="text"><b>
<?echo GetMessage("CET_PROFILE_NAME");?> <input type="text" name="SETUP_PROFILE_NAME" value="<?echo htmlspecialcharsbx($SETUP_PROFILE_NAME) ?>" size="30">
</b></font>
<br><br>
</td>
</tr>
<?endif;?>
<tr>
<td width="100%" valign="top">
<input type="hidden" name="lang" value="<?echo LANGUAGE_ID ?>">
<input type="hidden" name="ACT_FILE" value="<?echo htmlspecialcharsbx($_REQUEST["ACT_FILE"]) ?>">
<input type="hidden" name="ACTION" value="<?echo htmlspecialcharsbx($ACTION) ?>">
<input type="hidden" name="STEP" value="<?echo intval($STEP) + 1 ?>">
<input type="hidden" name="SETUP_FIELDS_LIST" value="V,IBLOCK_ID,SETUP_SERVER_NAME,SETUP_FILE_NAME,XML_DATA">
<input type="submit" value="<?echo ($ACTION=="EXPORT")?GetMessage("CET_EXPORT"):GetMessage("CET_SAVE")?>">
</td>
</tr>
</table>
</form>
<?
}
}
elseif ($STEP==2)
{
$SETUP_FILE_NAME = COption::GetOptionString("catalog", "export_default_path", "/bitrix/catalog_export/").$SETUP_FILE_NAME;
if (strlen($XML_DATA) > 0)
{
$XML_DATA = base64_decode($XML_DATA);
}
$SETUP_SERVER_NAME = htmlspecialcharsbx($SETUP_SERVER_NAME);
$_POST['SETUP_SERVER_NAME'] = htmlspecialcharsbx($_POST['SETUP_SERVER_NAME']);
$_REQUEST['SETUP_SERVER_NAME'] = htmlspecialcharsbx($_REQUEST['SETUP_SERVER_NAME']);
$FINITE = true;
}

View File

@ -141,6 +141,7 @@ class intaro_intarocrm extends CModule
$arResult['paymentTypesList'] = $this->INTARO_CRM_API->paymentTypesList();
$arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses
$arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList();
$arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups
//bitrix orderTypesList -- personTypes
$dbOrderTypesList = CSalePersonType::GetList(
@ -359,25 +360,6 @@ class intaro_intarocrm extends CModule
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize($paymentArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
/*RegisterModule($this->MODULE_ID);
//agent
$dateAgent = new DateTime();
$intAgent = new DateInterval('PT600S'); // PT60S - 60 sec; 600 - 600 sec
$dateAgent->add($intAgent);
CAgent::AddAgent(
"ICrmOrderActions::uploadOrdersAgent();",
$this->MODULE_ID,
"N",
600, // interval - 10 mins
$dateAgent->format('d.m.Y H:i:s'), // date of first check
"Y", // агент активен
$dateAgent->format('d.m.Y H:i:s'), // date of first start
30
);
$this->CopyFiles(); */
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'),

View File

@ -106,12 +106,16 @@ $defaultPayment = array(
<td width="50%" class="adm-detail-content-cell-r">
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
<option value="" selected=""></option>
<?php foreach($arResult['paymentList'] as $payment): ?>
<option value="<?php echo $payment['code']; ?>"
<?php if($defaultPayStatuses[$bitrixPaymentStatus['ID']] == $payment['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($payment['name'], 'utf-8', SITE_CHARSET); ?>
</option>
<?php endforeach; ?>
<?php foreach($arResult['paymentGroupList'] as $orderStatusGroup): if(!empty($orderStatusGroup['statuses'])) : ?>
<optgroup label="<?php echo $orderStatusGroup['name']; ?>">
<?php foreach($orderStatusGroup['statuses'] as $payment): ?>
<option value="<?php echo $arResult['paymentList'][$payment]['code']; ?>"
<?php if ($defaultPayStatuses[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($arResult['paymentList'][$payment]['name'], 'utf-8', SITE_CHARSET); ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php endif; endforeach; ?>
</select>
</td>
</tr>

View File

@ -73,6 +73,10 @@ IncludeModuleLangFile(__FILE__);
$(document).ready(function() {
var globStop = false;
$(window).resize(function(){ // strechin progress bar
$('#percent').width($('.instal-progress-bar-outer').width());
});
// orderUpload function
function orderUpload(finish) {
if(globStop)

View File

@ -1,5 +1,5 @@
<?
$arModuleVersion = array(
'VERSION' => '0.3.5',
'VERSION_DATE' => '2013-07-24 18:27:00',
'VERSION' => '0.3.6',
'VERSION_DATE' => '2013-07-25 15:29:00',
);

View File

@ -7,7 +7,7 @@ $MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
$MESS ['PAYMENT_LIST'] = 'Оплата';
$MESS ['PAYMENT_Y'] = 'Флаг «Отменен»';
$MESS ['PAYMENT_Y'] = 'Оплачен';
$MESS ['PAYMENT_N'] = 'Не оплачен';
$MESS ['CANCELED'] = 'Отменен';
$MESS ['CANCELED'] = 'Флаг «Отменен»';
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';

View File

@ -8,4 +8,4 @@ $MESS ['STOP'] = 'Приостановить выгрузку';
$MESS ['START_1'] = 'Начать выгрузку';
$MESS ['START_2'] = 'Приостановить выгрузку';
$MESS ['START_3'] = 'Вообновить выгрузку';
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
$MESS ['MOD_NEXT_STEP'] = 'Завершить установку';

View File

@ -21,4 +21,4 @@ $MESS ['ERR_404'] = 'Возможно не верно введен адрес CR
$MESS ['ERR_403'] = 'Неверный apiKey.';
$MESS ['ERR_0'] = 'Превышено время ожидания ответа от сервера.';
$MESS ['ICRM_OPTIONS_OK'] = 'Изменения успешно сохранены.';
$MESS ['CANCELED'] = 'Отменен';
$MESS ['CANCELED'] = 'Флаг «Отменен»';

View File

@ -152,6 +152,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$arResult['paymentTypesList'] = $api->paymentTypesList();
$arResult['paymentStatusesList'] = $api->paymentStatusesList(); // --statuses
$arResult['paymentList'] = $api->orderStatusesList();
$arResult['paymentGroupList'] = $api->orderStatusGroupsList(); // -- statuses groups
//check connection & apiKey valid
if ((int) $api->getStatusCode() != 200)
@ -336,11 +337,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<td width="50%" class="adm-detail-content-cell-r">
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
<option value=""></option>
<?php foreach($arResult['paymentList'] as $payment): ?>
<option value="<?php echo $payment['code']; ?>" <?php if ($optionsPayStatuses[$bitrixPaymentStatus['ID']] == $payment['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($payment['name'], 'utf-8', SITE_CHARSET); ?>
</option>
<?php endforeach; ?>
<?php foreach($arResult['paymentGroupList'] as $orderStatusGroup): if(!empty($orderStatusGroup['statuses'])) : ?>
<optgroup label="<?php echo $orderStatusGroup['name']; ?>">
<?php foreach($orderStatusGroup['statuses'] as $payment): ?>
<option value="<?php echo $arResult['paymentList'][$payment]['code']; ?>" <?php if ($optionsPayStatuses[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($arResult['paymentList'][$payment]['name'], 'utf-8', SITE_CHARSET); ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php endif; endforeach; ?>
</select>
</td>
</tr>