-
Notifications
You must be signed in to change notification settings - Fork 2
/
setStatusColors.php
68 lines (60 loc) · 1.6 KB
/
setStatusColors.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
class Migration
{
public function commit()
{
\Bitrix\Main\Loader::includeModule('sale');
$arStatusCodes = [
"C" => "6798c4",
"CG" => "a50019",
"CV" => "ff0229",
"F" => "7bb4e7",
"L" => "9f9f9f",
"N" => "f1f1f1",
"O" => "f9506a",
"U" => "a0c8eb",
"W" => "b1d898",
];
$rs = \Bitrix\Sale\Internals\StatusTable::getList([
'filter'=>[ 'ID'=>array_keys($arStatusCodes) ],
'select'=>['ID']
]);
while ($res = $rs->fetch())
{
\Bitrix\Sale\Internals\StatusTable::update(
$res['ID'],
[
'COLOR'=>'#'.$arStatusCodes[$res['ID']]
]
);
}
}
public function rollback()
{
\Bitrix\Main\Loader::includeModule('sale');
$arStatusCodes = [
"C" => "Y",
"CG" => "Y",
"CV" => "Y",
"F" => "Y",
"L" => "Y",
"N" => "Y",
"O" => "Y",
"U" => "Y",
"W" => "Y",
];
$rs = \Bitrix\Sale\Internals\StatusTable::getList([
'filter'=>[ 'ID'=>array_keys($arStatusCodes) ],
'select'=>['ID']
]);
while ($res = $rs->fetch())
{
\Bitrix\Sale\Internals\StatusTable::update(
$res['ID'],
[
'COLOR'=>$arStatusCodes[$res['ID']]
]
);
}
}
}