1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
batchdateupdate.php
См. документацию.
1<?
2namespace Sale\Handlers\Delivery\Additional\DeliveryRequests\RusPost\Requests;
3
4use Bitrix\Main;
5use Bitrix\Main\Web\HttpClient;
6use Bitrix\Main\Localization\Loc;
7use Bitrix\Sale\Delivery\Requests;
8use Sale\Handlers\Delivery\Additional\DeliveryRequests\RusPost\Reference;
9
10Loc::loadMessages(__FILE__);
11
18class BatchDateUpdate extends Base
19{
20 protected $path = "/1.0/batch/{name}/sending/{year}/{month}/{dayOfMonth}";
21 protected $type = HttpClient::HTTP_POST;
22
28 protected function convertResponse($rawData, $requestData)
29 {
30 $result = new Requests\Result();
31
32 if(!empty($rawData['error-code']))
33 $result->addError(new Main\Error(Reference::getErrorDescription($rawData['error-code'], '/1.0/batch/{name}/checkin')));
34
35 return $result;
36 }
37
43 public function process(array $requestIds, array $additional = array())
44 {
45 $result = new Requests\Result();
46
47 if(empty($additional['DATE']))
48 {
49 $result->addError( new Main\Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCDU_01')));
50 return $result;
51 }
52
53 try
54 {
55 $date = new Main\Type\Date($additional['DATE']);
56 }
57 catch (Main\ObjectException $exception)
58 {
59 $result->addError(new Main\Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCDU_02')));
60 return $result;
61 }
62
63 if(count($requestIds) !== 1)
64 {
65 $result->addError( new Main\Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCDU_03')));
66 return $result;
67 }
68
69 $requestId = current($requestIds);
70
71 if(intval($requestId) <= 0)
72 {
73 $result->addError( new Main\Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCDU_04')));
74 return $result;
75 }
76
77 $res =Requests\RequestTable::getList(array(
78 'filter' => array(
79 '=ID' => $requestId
80 )
81 ));
82
83 $row = $res->fetch();
84
85 if(!$row || $row['EXTERNAL_ID'] == '')
86 {
87 $result->addError( new Main\Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCDU_05')));
88 return $result;
89 }
90
91 $this->path = str_replace(
92 array(
93 '{name}',
94 '{year}',
95 '{month}',
96 '{dayOfMonth}'
97 ),
98 array(
99 $row['EXTERNAL_ID'],
100 $date->format('Y'),
101 $date->format('m'),
102 $date->format('d')
103 ),
104 $this->path
105 );
106
107 return $result = $this->send();
108 }
109
114 public function getFormFields(array $requestIds)
115 {
116 $date = new Main\Type\Date();
117 $date->add('P1D');
118
119 return array(
120 "DATE" => array(
121 "TYPE" => "DATE",
122 "TIME" => "N",
123 "TITLE" => Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCDU_06'),
124 "VALUE" => $date->toString(),
125 "REQUIRED" => "Y"
126 )
127 );
128 }
129}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
send(AbstractCommand $command, Workgroup $entity)
Определения SendInvitationTrait.php:31
trait Error
Определения error.php:11
</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."%"
Определения waybill.php:936
path
Определения template_copy.php:201