3require_once(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/sale/general/auxiliary.php");
17 "SELECT A.ID, A.USER_ID, A.ITEM, A.ITEM_MD5, ".
18 " ".$DB->DateToCharFunction(
"A.TIMESTAMP_X",
"FULL").
" as TIMESTAMP_X, ".
19 " ".$DB->DateToCharFunction(
"A.DATE_INSERT",
"FULL").
" as DATE_INSERT ".
20 "FROM b_sale_auxiliary A ".
21 "WHERE A.ID = ".$ID.
" ";
23 $dbAuxiliary =
$DB->Query($strSql);
24 if ($arAuxiliary = $dbAuxiliary->Fetch())
34 $userID = intval($userID);
38 $itemMD5 = Trim($itemMD5);
42 $itemMD5 = md5($itemMD5);
45 "SELECT A.ID, A.USER_ID, A.ITEM, A.ITEM_MD5, ".
46 " ".$DB->DateToCharFunction(
"A.TIMESTAMP_X",
"FULL").
" as TIMESTAMP_X, ".
47 " ".$DB->DateToCharFunction(
"A.DATE_INSERT",
"FULL").
" as DATE_INSERT ".
48 "FROM b_sale_auxiliary A ".
49 "WHERE A.USER_ID = ".$userID.
" ".
50 " AND A.ITEM_MD5 = '".$DB->ForSql($itemMD5).
"' ";
52 $dbAuxiliary =
$DB->Query($strSql);
53 if ($arAuxiliary = $dbAuxiliary->Fetch())
63 if (
count($arSelectFields) <= 0)
64 $arSelectFields =
array(
"ID",
"USER_ID",
"TIMESTAMP_X",
"ITEM",
"ITEM_MD5",
"DATE_INSERT");
68 "ID" =>
array(
"FIELD" =>
"A.ID",
"TYPE" =>
"int"),
69 "USER_ID" =>
array(
"FIELD" =>
"A.USER_ID",
"TYPE" =>
"int"),
70 "TIMESTAMP_X" =>
array(
"FIELD" =>
"A.TIMESTAMP_X",
"TYPE" =>
"datetime"),
71 "ITEM" =>
array(
"FIELD" =>
"A.ITEM",
"TYPE" =>
"string"),
72 "ITEM_MD5" =>
array(
"FIELD" =>
"A.ITEM_MD5",
"TYPE" =>
"string",
"WHERE" =>
array(
"CSaleAuxiliary",
"PrepareItemMD54Where")),
73 "DATE_INSERT" =>
array(
"FIELD" =>
"A.DATE_INSERT",
"TYPE" =>
"datetime")
79 $arSqls[
"SELECT"] = str_replace(
"%%_DISTINCT_%%",
"", $arSqls[
"SELECT"]);
81 if (is_array($arGroupBy) &&
count($arGroupBy)==0)
84 "SELECT ".$arSqls[
"SELECT"].
" ".
85 "FROM b_sale_auxiliary A ".
86 " ".$arSqls[
"FROM"].
" ";
87 if ($arSqls[
"WHERE"] <>
'')
88 $strSql .=
"WHERE ".$arSqls[
"WHERE"].
" ";
89 if ($arSqls[
"GROUPBY"] <>
'')
90 $strSql .=
"GROUP BY ".$arSqls[
"GROUPBY"].
" ";
102 "SELECT ".$arSqls[
"SELECT"].
" ".
103 "FROM b_sale_auxiliary A ".
104 " ".$arSqls[
"FROM"].
" ";
105 if ($arSqls[
"WHERE"] <>
'')
106 $strSql .=
"WHERE ".$arSqls[
"WHERE"].
" ";
107 if ($arSqls[
"GROUPBY"] <>
'')
108 $strSql .=
"GROUP BY ".$arSqls[
"GROUPBY"].
" ";
109 if ($arSqls[
"ORDERBY"] <>
'')
110 $strSql .=
"ORDER BY ".$arSqls[
"ORDERBY"].
" ";
112 if (is_array($arNavStartParams) && intval($arNavStartParams[
"nTopCount"])<=0)
115 "SELECT COUNT('x') as CNT ".
116 "FROM b_sale_auxiliary A ".
117 " ".$arSqls[
"FROM"].
" ";
118 if ($arSqls[
"WHERE"] <>
'')
119 $strSql_tmp .=
"WHERE ".$arSqls[
"WHERE"].
" ";
120 if ($arSqls[
"GROUPBY"] <>
'')
121 $strSql_tmp .=
"GROUP BY ".$arSqls[
"GROUPBY"].
" ";
127 if ($arSqls[
"GROUPBY"] ==
'')
135 $cnt =
$dbRes->SelectedRowsCount();
142 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
146 if (is_array($arNavStartParams) && intval($arNavStartParams[
"nTopCount"])>0)
147 $strSql .=
"LIMIT ".intval($arNavStartParams[
"nTopCount"]);
161 $periodLength = intval($periodLength);
162 if ($periodLength <= 0)
165 $periodType = Trim($periodType);
166 $periodType = mb_strtoupper($periodType);
167 if ($periodType ==
'')
171 if ($periodType ==
"I")
172 $deleteVal = mktime(date(
"H"), date(
"i") - $periodLength, date(
"s"), date(
"m"), date(
"d"), date(
"Y"));
173 elseif ($periodType ==
"H")
174 $deleteVal = mktime(date(
"H") - $periodLength, date(
"i"), date(
"s"), date(
"m"), date(
"d"), date(
"Y"));
175 elseif ($periodType ==
"D")
176 $deleteVal = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m"), date(
"d") - $periodLength, date(
"Y"));
177 elseif ($periodType ==
"W")
178 $deleteVal = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m"), date(
"d") - 7 * $periodLength, date(
"Y"));
179 elseif ($periodType ==
"M")
180 $deleteVal = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m") - $periodLength, date(
"d"), date(
"Y"));
181 elseif ($periodType ==
"Q")
182 $deleteVal = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m") - 3 * $periodLength, date(
"d"), date(
"Y"));
183 elseif ($periodType ==
"S")
184 $deleteVal = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m") - 6 * $periodLength, date(
"d"), date(
"Y"));
185 elseif ($periodType ==
"Y")
186 $deleteVal = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m"), date(
"d"), date(
"Y") - $periodLength);
191 return $DB->Query(
"DELETE FROM b_sale_auxiliary WHERE DATE_INSERT < '".Date(
"Y-m-d H:i:s", $deleteVal).
"' ",
true);
198 $arFields1 =
array();
201 if (mb_substr(
$key, 0, 1) ==
"=")
203 $arFields1[mb_substr(
$key, 1)] = $value;
211 $arInsert =
$DB->PrepareInsert(
"b_sale_auxiliary",
$arFields);
213 foreach ($arFields1 as
$key => $value)
215 if ($arInsert[0] <>
'') $arInsert[0] .=
", ";
216 $arInsert[0] .=
$key;
217 if ($arInsert[1] <>
'') $arInsert[1] .=
", ";
218 $arInsert[1] .= $value;
222 "INSERT INTO b_sale_auxiliary(".$arInsert[0].
") ".
223 "VALUES(".$arInsert[1].
")";
226 $ID = intval(
$DB->LastID());
239 $arFields1 =
array();
242 if (mb_substr(
$key, 0, 1) ==
"=")
244 $arFields1[mb_substr(
$key, 1)] = $value;
252 $strUpdate =
$DB->PrepareUpdate(
"b_sale_auxiliary",
$arFields);
254 foreach ($arFields1 as
$key => $value)
256 if ($strUpdate <>
'') $strUpdate .=
", ";
257 $strUpdate .=
$key.
"=".$value.
" ";
260 $strSql =
"UPDATE b_sale_auxiliary SET ".$strUpdate.
" WHERE ID = ".
$ID.
" ";
static CheckFields($ACTION, &$arFields, $ID=0)
static PrepareSql(&$arFields, $arOrder, &$arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql=false, $callback=false, $arOptions=array())
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static DeleteByTime($periodLength, $periodType)
static GetByParams($userID, $itemMD5)
static Update($ID, $arFields)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"