1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
batch.php
См. документацию.
1<?
2namespace Sale\Handlers\Delivery\Additional\DeliveryRequests\RusPost\Requests;
3
4use Bitrix\Main\Error;
5use Bitrix\Main\Localization\Loc;
6use Bitrix\Main\Web\HttpClient;
7use Bitrix\Sale\Delivery\Requests;
8
9Loc::loadMessages(__FILE__);
10
17class Batch extends Base
18{
19 protected $path = "/1.0/batch/{name}";
20 protected $type = HttpClient::HTTP_GET;
21 protected $internalId = 0;
22 protected $externalId = '';
23
29 protected function convertResponse($rawData, $requestData)
30 {
31 $result = new Requests\RequestResult();
32
33 if(isset($rawData['batch-name']))
34 {
35 $result->setExternalId($rawData['batch-name']);
36 $result->setInternalId($this->internalId);
37 $result->setData($rawData);
38 }
39 else
40 {
41 $result->addError(
42 new Error(
43 Loc::getMessage(
44 'SALE_DLVRS_ADD_DREQ_RBATCH_01',
45 array(
46 '#INTERNAL_ID#' => $this->internalId,
47 '#EXTERNAL_ID#' => $this->externalId
48 )
49 ),
51 ));
52 }
53
54 return $result;
55 }
56
62 public function process(array $requestIds, array $additional = array())
63 {
64 $result = new Requests\Result();
65
66 if(count($requestIds) !== 1)
67 {
68 $result->addError(new Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCH_02')));
69 return $result;
70 }
71
72 $requestId = current($requestIds);
73
74 if(intval($requestId) <= 0)
75 {
76 $result->addError(new Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCH_03')));
77 return $result;
78 }
79
80 $res =Requests\RequestTable::getList(array(
81 'filter' => array(
82 '=ID' => $requestId
83 )
84 ));
85
86 $row = $res->fetch();
87
88 if(!$row || $row['EXTERNAL_ID'] == '')
89 {
90 $result->addError(new Error(Loc::getMessage('SALE_DLVRS_ADD_DREQ_RBATCH_04')));
91 return $result;
92 }
93
94 $this->externalId = $row['EXTERNAL_ID'];
95 $this->internalId= $row['INTERNAL_ID'];
96 $this->path = str_replace('{name}', $this->externalId, $this->path);
97 return $this->send(array(), $additional);
98 }
99}
</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