Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sender.php
1<?php
3
7
8Loc::loadMessages(__FILE__);
9
10class Sender
11{
12 protected $fields;
13
14 public function __construct()
15 {
16 $this->fields = new \Bitrix\Sale\Internals\Fields(
17 \Bitrix\Main\Context::getCurrent()->getRequest()->toArray());
18 }
19
23 protected function getFields()
24 {
25 return $this->fields;
26 }
27
28 public function getField($name)
29 {
30 return isset($this->fields[$name]) ? $this->fields[$name]:'';
31 }
32
33 public function checkFields()
34 {
35 $r = new \Bitrix\Sale\Result();
36
37 if(empty($this->getField('orderIds')))
38 {
39 $r->addError(new Error(Loc::getMessage('SALE_ORDER_REQUEST_ORDER_IDS_EMPTY'))) ;
40 }
41
42 if(empty($this->getField('entityId')))
43 {
44 $r->addError(new Error(Loc::getMessage('SALE_ORDER_REQUEST_ENTITY_ID_EMPTY'))) ;
45 }
46
47 if(empty($this->getField('entityTypeId')))
48 {
49 $r->addError(new Error(Loc::getMessage('SALE_ORDER_REQUEST_ENTITY_TYPE_ID_EMPTY')));
50 }
51 elseif(Integration\CRM\EntityType::isDefined($this->getField('entityTypeId')) == false)
52 {
53 $r->addError(new Error(Loc::getMessage('SALE_ORDER_REQUEST_ENTITY_TYPE_ID_UNKNOW'))) ;
54 }
55
56 return $r;
57 }
58}
static getCurrent()
Definition context.php:241
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29