1
0
mirror of synced 2025-02-18 07:53:15 +03:00

Changed options for prices and corps

This commit is contained in:
Sergey Chazov 2022-02-03 15:27:44 +04:00
parent f3f27af3a0
commit fb09bf3dbb

View File

@ -212,7 +212,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
//bitrix site list //bitrix site list
$siteListArr = []; $siteListArr = [];
foreach ($arResult['arSites'] as $arSites) { foreach ($arResult['arSites'] as $arSites) {
if (count($arResult['arSites']) > 1) { if (count($arResult['arSites']) > 1) {
if ($_POST['sites-id-' . $arSites['LID']]) { if ($_POST['sites-id-' . $arSites['LID']]) {
@ -414,8 +414,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
function maskPrice($var){ function maskPrice($var){
return preg_match("/^shops-price/", $var); return preg_match("/^shops-price/", $var);
} }
$bitrixPriceShopsArr = str_replace('shops-price-', '', array_filter(array_keys($_POST), 'maskPrice'));
$bitrixPriceShopsArr = array_values(array_filter($_POST, 'maskPrice', ARRAY_FILTER_USE_KEY));
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList(); $arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
foreach($arResult['bitrixIblocksExportList'] as $bitrixIblocks){ foreach($arResult['bitrixIblocksExportList'] as $bitrixIblocks){
if(htmlspecialchars(trim($_POST['iblocks-prices-' . $bitrixIblocks['ID']])) === 'Y'){ if(htmlspecialchars(trim($_POST['iblocks-prices-' . $bitrixIblocks['ID']])) === 'Y'){
@ -486,10 +486,12 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$cc = 'Y'; $cc = 'Y';
$bitrixCorpName = htmlspecialchars(trim($_POST['nickName-corporate'])); $bitrixCorpName = htmlspecialchars(trim($_POST['nickName-corporate']));
$bitrixCorpAdres = htmlspecialchars(trim($_POST['adres-corporate'])); $bitrixCorpAdres = htmlspecialchars(trim($_POST['adres-corporate']));
function maskCorp($var) { function maskCorp($var) {
return preg_match("/^shops-corporate/", $var); return preg_match("/^shops-corporate/", $var);
} }
$bitrixCorpShopsArr = str_replace('shops-corporate-', '', array_filter(array_keys($_POST), 'maskCorp'));
$bitrixCorpShopsArr = array_values(array_filter($_POST, 'maskCorp', ARRAY_FILTER_USE_KEY));
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCc", "add"); RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCc", "add");
} else { } else {
@ -1394,7 +1396,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php foreach ($arResult['sitesList'] as $sitesList): ?> <?php foreach ($arResult['sitesList'] as $sitesList): ?>
<tr class="prices" align="center" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>> <tr class="prices" align="center" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-other-center"> <td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="shops-price-<?echo $sitesList['code'];?>" value="Y" <?php if(in_array($sitesList['code'], $optionPriceShops)) echo "checked"; ?>> <?php echo $sitesList['name'].' ('.$sitesList['code'].')'; ?></label> <label><input class="addr" type="checkbox" name="shops-price-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (in_array($sitesList['code'], $optionPriceShops)) {
echo "checked";
} ?>> <?php echo $sitesList['name'] . ' (' . $sitesList['code'] . ')'; ?>
</label>
</td> </td>
</tr> </tr>
<?php endforeach;?> <?php endforeach;?>
@ -1541,7 +1546,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<td width="50%" class="" name="<?php ?>" align="center"> <td width="50%" class="" name="<?php ?>" align="center">
<?php foreach ($arResult['sitesList'] as $sitesList): ?> <?php foreach ($arResult['sitesList'] as $sitesList): ?>
<td colspan="2" class="option-other-center"> <td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="shops-corporate-<?echo $sitesList['code'];?>" value="Y" <?php if(in_array($sitesList['code'], $optionCorpShops)) echo "checked"; ?>> <?php echo $sitesList['name'].' ('.$sitesList['code'].')'; ?></label> <label><input class="addr" type="checkbox" name="shops-corporate-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (in_array($sitesList['code'], $optionCorpShops)) {
echo "checked";
} ?>> <?php echo $sitesList['name'] . ' (' . $sitesList['code'] . ')'; ?>
</label>
</td> </td>
<?php endforeach;?> <?php endforeach;?>
</td> </td>