Bitrix-D7  20.0.0
Класс BusinessValueHandlers

Открытые статические члены

static getProviders ()
 
static getConsumers ()
 
static getGroups ()
 

Подробное описание

Уст.:

См. определение в файле businessvalue.php строка 655

Методы

◆ getConsumers()

static getConsumers ( )
static

См. определение в файле businessvalue.php строка 1114

1115  {
1116  return array(
1117  /*'DEF' => array(
1118  'SORT' => 100,
1119  'CODES' => array(
1120 // 'BASIC_INDIVIDUAL' => array('GROUP' => 'BASIC', 'SORT' => 10, 'DOMAINS' => array(BusinessValue::INDIVIDUAL_DOMAIN)),
1121 // 'BASIC_ENTITY' => array('GROUP' => 'BASIC', 'SORT' => 20, 'DOMAINS' => array(BusinessValue::ENTITY_DOMAIN )),
1122  'DEFA' => array('GROUP' => 'BASIC', 'SORT' => 5),
1123  'DEF0' => array('GROUP' => 'BASIC', 'SORT' => 10, 'DEFAULT' => array('PROVIDER_KEY' => 'VALUE' , 'PROVIDER_VALUE' => 'default')),
1124  'DEF1' => array('GROUP' => 'BASIC', 'SORT' => 20, 'DEFAULT' => array('PROVIDER_KEY' => 'PROPERTY', 'PROVIDER_VALUE' => '3' )),
1125  'DEF2' => array('GROUP' => 'BASIC', 'SORT' => 30, 'DEFAULT' => array('PROVIDER_KEY' => 'PROPERTY', 'PROVIDER_VALUE' => 'EMAIL' )),
1126  'DEFF' => array('GROUP' => 'BASIC', 'SORT' => 50, 'INPUT' => array('TYPE' => 'FILE')),
1127  ),
1128  ),
1129  'OTHER' => array(
1130  'SORT' => 200,
1131  'CODES' => array(
1132  'OTHER' => array(
1133  'SORT' => 10,
1134  'DESCRIPTION' => 'If some value has a type of, say, IO String, that means that it\'s an I/O action that, when performed, will go out into the real world and get some string for us, which it will yield as a result.',
1135  //'DOMAINS' => array(BusinessValue::INDIVIDUAL_DOMAIN),
1136  ),
1137  'OTHER_INPUT' => array(
1138  'SORT' => 20,
1139  //'DOMAINS' => array(BusinessValue::INDIVIDUAL_DOMAIN),
1140  //'DEFAULT' => array('PROVIDER_KEY' => 'INPUT', 'PROVIDER_VALUE' => '33'),
1141  'INPUT' => array('TYPE' => 'ENUM', 'OPTIONS' => array('a' => 'AAA', 'b' => 'BBB', 'c' => 'CCC', 'd' => 'DDD', 'e' => 'EEE'),
1142  )),
1143  'OTR_YN' => array('SORT' => 40, 'INPUT' => array('TYPE' => 'Y/N'))
1144  ),
1145  'PROVIDERS' => array('VALUE', 'COMPANY', 'PROPERTY'),
1146  ),/*
1147  'BOTH' => array(
1148  'SORT' => 300,
1149  'CODES' => array(
1150  'BASIC_COMMON' => array(),
1151  'OTHER' => array(),//'DEFAULT' => array('PROVIDER_KEY' => 'VALUE', 'PROVIDER_VALUE' => 'def123')),
1152  'OTHER_INPUT' => array(),
1153  'BASIC_ENTITY' => array('DOMAINS' => array(BusinessValue::ENTITY_DOMAIN)),
1154  'BOTH_ENTITY' => array('DOMAINS' => array(BusinessValue::ENTITY_DOMAIN), 'INPUT' => array(
1155  'TYPE' => 'ENUM',
1156  'OPTIONS' => array(
1157  'one',
1158  'two',
1159  'three',
1160  ),
1161  )),
1162  ),
1163  ),*/
1164  );
1165  }

◆ getGroups()

static getGroups ( )
static

См. определение в файле businessvalue.php строка 1167

1168  {
1169  return array(
1170  'CONSUMER_PAYSYS' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_CONSUMER_PAYSYS'), 'SORT' => 100),
1171  'CODE_PAYSYS' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_CONSUMER_PAYSYS'), 'SORT' => 100),
1172  'BUYER_PERSON' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_BUYER_PERSON'), 'SORT' => 300),
1173  'BUYER_PERSON_COMPANY' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_BUYER_PERSON_COMPANY'), 'SORT' => 305),
1174  'BUYER_COMPANY' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_BUYER_COMPANY'), 'SORT' => 310),
1175  '1C_REKV' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_1C_REKV'), 'SORT' => 320),
1176  'SELLER_PERSON' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_SELLER_PERSON'), 'SORT' => 400),
1177  'SELLER_PERSON_COMPANY' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_SELLER_PERSON_COMPANY'), 'SORT' => 405),
1178  'SELLER_COMPANY' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_SELLER_PERSON'), 'SORT' => 410),
1179  );
1180  }

◆ getProviders()

static getProviders ( )
static

См. определение в файле businessvalue.php строка 657

658  {
659  static $providers = array();
660  if ($providers)
661  return $providers;
662 
663  $providers = array(
664  'VALUE' => array(
665  'NAME' => Loc::getMessage('BIZVAL_PROVIDER_VALUE'),
666  'SORT' => 100,
667  ),
668  'COMPANY' => array(
669  'NAME' => Loc::getMessage('BIZVAL_PROVIDER_COMPANY'),
670  'SORT' => 600,
671  'FIELDS' => call_user_func(function ()
672  {
673  $data = array(
674  'ID' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_COMPANY_ID')),
675  'NAME' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_NAME' )),
676  'LOCATION_ID' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_LOCATION' )),
677  'CODE' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_CODE' )),
678  'XML_ID' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_XML_ID' )),
679  'ACTIVE' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_ACTIVE' )),
680  'DATE_CREATE' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_DATE_CREATE')),
681  'DATE_MODIFY' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_DATE_MODIFY')),
682  'CREATED_BY' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_CREATED_BY' )),
683  'MODIFIED_BY' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_MODIFIED_BY')),
684  'ADDRESS' => array('GROUP' => 'ENTITY', 'NAME' => Loc::getMessage('BIZVAL_CODE_ADDRESS' )),
685  );
686 
687  global $USER_FIELD_MANAGER;
688  $result = $USER_FIELD_MANAGER->GetUserFields(Internals\CompanyTable::getUfId(), null, LANGUAGE_ID);
689 
690  foreach ($result as $name => $row)
691  $data[$name] = array('NAME' => $row['EDIT_FORM_LABEL'] ?: $name, 'GROUP' => 'UF');
692 
693  return $data;
694  }),
695  'FIELDS_GROUPS' => array(
696  'ENTITY' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_CODE_COMPANY_ENTITY')),
697  'UF' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_CODE_COMPANY_UF' )),
698  ),
699  'GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId)
700  {
701  $value = null;
702 
703  if ($providerInstance === null)
704  return $value;
705 
706  if (substr($providerValue, 0, 3) == 'UF_')
707  {
708  global $USER_FIELD_MANAGER;
709  $value = $USER_FIELD_MANAGER->GetUserFieldValue(Internals\CompanyTable::getUfId(), $providerValue, $providerInstance) ?: null;
710  }
711  elseif ($company = Internals\CompanyTable::getById($providerInstance)->fetch())
712  {
713  $value = $company[$providerValue];
714  }
715 
716  return $value;
717  },
718  ),
719  'ORDER' => call_user_func(
720  function ()
721  {
722  $result = array(
723  'NAME' => Loc::getMessage('BIZVAL_PROVIDER_ORDER'),
724  'SORT' => 200,
725  'FIELDS' => array(
726  'ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_ID')),
727  'LID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SITE_ID')),
728  'ACCOUNT_NUMBER' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_ACCOUNT_NUMBER')),
729  'TRACKING_NUMBER' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_TRACKING_NUMBER')),
730  'DATE_INSERT' => array('NAME' => Loc::getMessage('BIZVAL_CODE_DATE_CREATE')),
731  'DATE_INSERT_DATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_DATE_CREATE_DATE')),
732  'DATE_UPDATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_DATE_MODIFY')),
733  'PERSON_TYPE_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PERSON_TYPE_ID')),
734  'USER_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_USER_ID')),
735  'PAYED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAID')),
736  'DATE_PAY_BEFORE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_PAY_BEFORE')),
737  'SHOULD_PAY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_PRICE')),
738  'CURRENCY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_CURRENCY')),
739  'PRICE_DELIVERY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_PRICE_DELIV')),
740  'DISCOUNT_VALUE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_DESCOUNT')),
741  'PAY_SYSTEM_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_PAY_SYSTEM_ID')),
742  'DELIVERY_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_DELIVERY_ID')),
743  'TAX_VALUE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_TAX')),
744  'COMMENTS' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_COMMENTS')),
745  'USER_DESCRIPTION' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_USER_DESCRIPTION')),
746  ),
747  'GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId)
748  {
749  $value = null;
750 
751  if ($providerInstance instanceof Order)
752  {
753  if ($providerValue == 'DATE_INSERT_DATE')
754  {
755  $value = new Date($providerInstance->getField('DATE_INSERT'));
756  }
757  else if ($providerValue == 'DATE_BILL_DATE') // for crm compatibility
758  {
759  $value = new Date($providerInstance->getField('DATE_BILL'));
760  }
761  else
762  {
763  $value = $providerInstance->getField($providerValue);
764  }
765  }
766 
767  return $value;
768  },
769  );
770 
771  if (IsModuleInstalled('crm'))
772  {
773  $result['FIELDS']['ORDER_TOPIC'] = ['NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_ORDER_TOPIC')];
774  $result['FIELDS']['PRICE'] = ['NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_PRICE')];
775  $result['FIELDS']['DATE_BILL'] = ['NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_DATE_BILL')];
776  $result['FIELDS']['DATE_BILL_DATE'] = ['NAME' => Loc::getMessage('BIZVAL_CODE_ORDER_DATE_BILL_DATE')];
777  }
778 
779  return $result;
780  }
781  ),
782  'USER' => array(
783  'NAME' => Loc::getMessage('BIZVAL_PROVIDER_USER'),
784  'SORT' => 110,
785  'FIELDS' => array(
786  'ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_USER_ID'), 'GROUP' => 'CLIENT'),
787  'LOGIN' => array('NAME' => Loc::getMessage('BIZVAL_CODE_LOGIN'), 'GROUP' => 'CLIENT'),
788  'NAME' => array('NAME' => Loc::getMessage('BIZVAL_CODE_FIRST_NAME'), 'GROUP' => 'CLIENT'),
789  'SECOND_NAME' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SECOND_NAME'), 'GROUP' => 'CLIENT'),
790  'LAST_NAME' => array('NAME' => Loc::getMessage('BIZVAL_CODE_LAST_NAME'), 'GROUP' => 'CLIENT'),
791  'EMAIL' => array('NAME' => Loc::getMessage('BIZVAL_CODE_EMAIL'), 'GROUP' => 'CLIENT'),
792  'LID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SITE_ID'), 'GROUP' => 'CLIENT'),
793  'PERSONAL_PROFESSION' => array('NAME' => Loc::getMessage('BIZVAL_CODE_JOB_PROFESSION'), 'GROUP' => 'CLIENT'),
794  'PERSONAL_WWW' => array('NAME' => Loc::getMessage('BIZVAL_CODE_WEBSITE'), 'GROUP' => 'CLIENT'),
795  'PERSONAL_ICQ' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ICQ'), 'GROUP' => 'CLIENT'),
796  'PERSONAL_GENDER' => array('NAME' => Loc::getMessage('BIZVAL_CODE_GENDER'), 'GROUP' => 'CLIENT'),
797  'PERSONAL_FAX' => array('NAME' => Loc::getMessage('BIZVAL_CODE_FAX'), 'GROUP' => 'CLIENT'),
798  'PERSONAL_MOBILE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PHONE'), 'GROUP' => 'CLIENT'),
799  'PERSONAL_STREET' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ADDRESS'), 'GROUP' => 'CLIENT'),
800  'PERSONAL_MAILBOX' => array('NAME' => Loc::getMessage('BIZVAL_CODE_POSTAL_ADDRESS'), 'GROUP' => 'CLIENT'),
801  'PERSONAL_CITY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_CITY'), 'GROUP' => 'CLIENT'),
802  'PERSONAL_STATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_REGION'), 'GROUP' => 'CLIENT'),
803  'PERSONAL_ZIP' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ZIP'), 'GROUP' => 'CLIENT'),
804  'PERSONAL_COUNTRY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_COUNTRY'), 'GROUP' => 'CLIENT'),
805  'PERSONAL_NOTES' => array('NAME' => Loc::getMessage('BIZVAL_CODE_NOTES'), 'GROUP' => 'CLIENT'),
806  'WORK_COMPANY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_NAME'), 'GROUP' => 'CLIENT_COMPANY'),
807  'WORK_DEPARTMENT' => array('NAME' => Loc::getMessage('BIZVAL_CODE_JOB_DEPARTMENT'), 'GROUP' => 'CLIENT_COMPANY'),
808  'WORK_POSITION' => array('NAME' => Loc::getMessage('BIZVAL_CODE_JOB_POSITION' ), 'GROUP' => 'CLIENT_COMPANY'),
809  'WORK_WWW' => array('NAME' => Loc::getMessage('BIZVAL_CODE_WEBSITE'), 'GROUP' => 'CLIENT_COMPANY'),
810  'WORK_PHONE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PHONE'), 'GROUP' => 'CLIENT_COMPANY'),
811  'WORK_FAX' => array('NAME' => Loc::getMessage('BIZVAL_CODE_FAX'), 'GROUP' => 'CLIENT_COMPANY'),
812  'WORK_STREET' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ADDRESS'), 'GROUP' => 'CLIENT_COMPANY'),
813  'WORK_MAILBOX' => array('NAME' => Loc::getMessage('BIZVAL_CODE_POSTAL_ADDRESS'), 'GROUP' => 'CLIENT_COMPANY'),
814  'WORK_CITY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_CITY'), 'GROUP' => 'CLIENT_COMPANY'),
815  'WORK_STATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_REGION'), 'GROUP' => 'CLIENT_COMPANY'),
816  'WORK_ZIP' => array('NAME' => Loc::getMessage('BIZVAL_CODE_ZIP'), 'GROUP' => 'CLIENT_COMPANY'),
817  'WORK_COUNTRY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_COUNTRY'), 'GROUP' => 'CLIENT_COMPANY'),
818  ),
819  'FIELDS_GROUPS' => array(
820  'CLIENT' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_CODE_CLIENT' )),
821  'CLIENT_COMPANY' => array('NAME' => Loc::getMessage('BIZVAL_GROUP_CODE_CLIENT_COMPANY')),
822  ),
823  'GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId)
824  {
825  $value = null;
826 
827  global $USER;
828 
829  if ($user = $USER->GetByID($providerInstance)->Fetch())
830  {
831  $value = $user[$providerValue];
832  }
833  return $value;
834  },
835  ),
836  'PAYMENT' => array(
837  'NAME' => Loc::getMessage('BIZVAL_PROVIDER_PAYMENT'),
838  'SORT' => 400,
839  'FIELDS' => array(
840  'ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_ID')),
841  'ACCOUNT_NUMBER' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_ACCOUNT_NUMBER')),
842  'PAID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAID')),
843  'DATE_PAID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_DATE_PAID')),
844  'PAY_SYSTEM_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAY_SYSTEM_ID')),
845  'PAY_VOUCHER_NUM' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAY_VOUCHER_NUM')),
846  'PAY_VOUCHER_DATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAY_VOUCHER_DATE')),
847  'DATE_PAY_BEFORE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_DATE_PAY_BEFORE')),
848  'DATE_BILL' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_DATE_BILL')),
849  'DATE_BILL_DATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_DATE_BILL_DATE')),
850  'XML_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_XML_ID')),
851  'SUM' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_SUM')),
852  'CURRENCY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_CURRENCY')),
853  'PAY_SYSTEM_NAME' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAY_SYSTEM_NAME')),
854  'COMPANY_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_COMPANY_ID')),
855  'PAY_RETURN_NUM' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAY_RETURN_NUM')),
856  'PAY_RETURN_DATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAY_RETURN_DATE')),
857  'PAY_RETURN_COMMENT' => array('NAME' => Loc::getMessage('BIZVAL_CODE_PAYMENT_PAY_RETURN_COMMENT')),
858  ),
859  'GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId)
860  {
861  $value = null;
862 
863  if ($providerInstance instanceof Payment)
864  {
865  if ($providerValue == 'DATE_BILL_DATE')
866  $value = new Date($providerInstance->getField('DATE_BILL'));
867  else
868  $value = $providerInstance->getField($providerValue);
869  }
870  return $value;
871  },
872  ),
873  'SHIPMENT' => array(
874  'NAME' => Loc::getMessage('BIZVAL_PROVIDER_SHIPMENT'),
875  'SORT' => 500,
876  'FIELDS' => array(
877  'STATUS_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_STATUS_ID')),
878  'PRICE_DELIVERY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_PRICE_DELIVERY')),
879  'ALLOW_DELIVERY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_ALLOW_DELIVERY')),
880  'DATE_ALLOW_DELIVERY' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DATE_ALLOW_DELIVERY')),
881  'EMP_ALLOW_DELIVERY_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_EMP_ALLOW_DELIVERY_ID')),
882  'DEDUCTED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DEDUCTED')),
883  'DATE_DEDUCTED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DATE_DEDUCTED')),
884  'EMP_DEDUCTED_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_EMP_DEDUCTED_ID')),
885  'REASON_UNDO_DEDUCTED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_REASON_UNDO_DEDUCTED')),
886  'DELIVERY_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DELIVERY_ID')),
887  'DELIVERY_DOC_NUM' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DELIVERY_DOC_NUM')),
888  'DELIVERY_DOC_DATE' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DELIVERY_DOC_DATE')),
889  'TRACKING_NUMBER' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_TRACKING_NUMBER')),
890  'XML_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_XML_ID')),
891  'PARAMETERS' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_PARAMETERS')),
892  'DELIVERY_NAME' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DELIVERY_NAME')),
893  'COMPANY_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_COMPANY_ID')),
894  'MARKED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_MARKED')),
895  'DATE_MARKED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DATE_MARKED')),
896  'EMP_MARKED_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_EMP_MARKED_ID')),
897  'REASON_MARKED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_REASON_MARKED')),
898  'CANCELED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_CANCELED')),
899  'DATE_CANCELED' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_DATE_CANCELED')),
900  'EMP_CANCELED_ID' => array('NAME' => Loc::getMessage('BIZVAL_CODE_SHIPMENT_EMP_CANCELED_ID')),
901  ),
902  'GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId)
903  {
904  $value = null;
905 
906  if ($providerInstance instanceof Shipment)
907  $value = $providerInstance->getField($providerValue);
908 
909  return $value;
910  },
911  ),
912  'PROPERTY' => call_user_func(
913  function ()
914  {
915  $getFields = function ($registryType)
916  {
917  static $fields = array();
918 
919  if (isset($fields[$registryType]))
920  {
921  return $fields[$registryType];
922  }
923 
924  $fields[$registryType] = [];
925 
926  $result = Internals\OrderPropsTable::getList(array(
927  'select' => array('ID', 'NAME', 'PERSON_TYPE_ID', 'TYPE', 'CODE'),
928  'filter' => array(
929  '=PERSON_TYPE_ID' => array_keys(BusinessValue::getPersonTypes()),
930  '=ENTITY_REGISTRY_TYPE' => $registryType
931  ),
932  'order' => array('PERSON_TYPE_ID', 'SORT'),
933  ));
934 
935  while ($row = $result->fetch())
936  {
937  $id = $row['ID'];
938  $name = $row['NAME'];
939  $field = array(
940  'NAME' => $name,
941  'CODE' => $row['CODE'],
942  'GROUP' => $row['PERSON_TYPE_ID'],
943  'PERSON_TYPE_ID' => $row['PERSON_TYPE_ID']
944  );
945 
946  $fields[$registryType][$id] = $field;
947 
948  if ($row['TYPE'] == 'LOCATION')
949  {
950  $field['NAME'] = $name.' ('.Loc::getMessage('BIZVAL_CODE_COUNTRY').')';
951  $fields[$registryType][$id.'_COUNTRY'] = $field;
952 
953  $field['NAME'] = $name.' ('.Loc::getMessage('BIZVAL_CODE_REGION').')';
954  $fields[$registryType][$id.'_REGION'] = $field;
955 
956  $field['NAME'] = $name.' ('.Loc::getMessage('BIZVAL_CODE_CITY').')';
957  $fields[$registryType][$id.'_CITY'] = $field;
958  }
959  }
960 
961  return $fields[$registryType];
962  };
963 
964  $parseId = function ($propertyId)
965  {
966  $propertyCode = null;
967  $locationField = null;
968 
969  if (! is_numeric($propertyId)) // TODO is_int
970  {
971  if (($a = explode('_', $propertyId, 2))
972  && is_numeric($a[0])
973  && in_array($a[1], array('CITY', 'COUNTRY', 'REGION'), true))
974  {
975  $propertyId = $a[0];
976  $locationField = $a[1];
977  }
978  else
979  {
980  $propertyCode = $propertyId;
981  $propertyId = null;
982  }
983  }
984 
985  return array($propertyCode, $propertyId, $locationField);
986  };
987 
988  return array(
989  'NAME' => Loc::getMessage('BIZVAL_PROVIDER_PROPERTY'),
990  'SORT' => 300,
991  'FIELDS' => call_user_func($getFields, Registry::REGISTRY_TYPE_ORDER),
992  'FIELDS_GROUPS' => array_map(function ($i) {return array('NAME' => $i['TITLE']);}, BusinessValue::getPersonTypes()),
993  'GET_VALUE' => function ($providerValue, $personTypeId, $options, $provider) use ($parseId, $getFields)
994  {
995  list ($propertyCode, $propertyId, $locationField) = call_user_func($parseId, $providerValue);
996 
997  // for crm invoice compatibility
998  if (method_exists($provider, 'getRegistryType'))
999  {
1000  $registry = $provider::getRegistryType();
1001  }
1002  else
1003  {
1004  $registry = Registry::REGISTRY_TYPE_ORDER;
1005  }
1006 
1007  $fields = $getFields($registry);
1008 
1009  if ($propertyCode)
1010  {
1011  if ($options == 'BY_ID')
1012  {
1013  foreach ($fields as $propertyId => $property)
1014  {
1015  if ($property['PERSON_TYPE_ID'] == $personTypeId && $property['CODE'] == $propertyCode)
1016  {
1017  $providerValue = $propertyId;
1018  break;
1019  }
1020  }
1021  }
1022  }
1023  else
1024  {
1025  if ($options != 'BY_ID' && ($property = $fields[$propertyId]))
1026  {
1027  $providerValue = $property['CODE'];
1028  }
1029  }
1030 
1031  return $providerValue;
1032  },
1033  'GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) use ($parseId)
1034  {
1035  $value = null;
1036 
1037  if ($providerInstance instanceof Order)
1038  {
1039  list ($propertyCode, $propertyId, $locationField) = call_user_func($parseId, $providerValue);
1040 
1041  /** @var PropertyValue $property */
1042  foreach ($providerInstance->getPropertyCollection() as $property)
1043  {
1044  if ($property->getPersonTypeId() == $personTypeId)
1045  {
1046  if ($propertyCode)
1047  {
1048  if ($property->getField('CODE') == $propertyCode)
1049  {
1050  $value = $property->getValue();
1051  break;
1052  }
1053  }
1054  elseif ($property->getPropertyId() == $propertyId)
1055  {
1056  if (($value = $property->getValue())
1057  && ($propertyField = $property->getProperty())
1058  )
1059  {
1060  if($propertyField['TYPE'] == "LOCATION")
1061  {
1062  $limit = -1;
1063  $filter['=CODE'] = $value;
1064  $filter['=PARENTS.NAME.LANGUAGE_ID'] = LANGUAGE_ID;
1065  if(is_set($locationField))
1066  {
1067  $filter['=PARENTS.TYPE.CODE'] = $locationField;
1068  $limit = 1;
1069  }
1070  $row = \Bitrix\Sale\Location\LocationTable::getList(array(
1071  'select' => array('LOCATION_NAME' => 'PARENTS.NAME.NAME'),
1072  'filter' => $filter,
1073  'limit' => $limit,
1074  ));
1075  $locations = array();
1076  while($location = $row->fetch())
1077  $locations[] = $location['LOCATION_NAME'];
1078 
1079  $value = (count($locations) > 0) ? implode('-', $locations) : null;
1080  }
1081  elseif($propertyField['TYPE'] == "ENUM")
1082  {
1083  $multipleValues = $property->getValue();
1084 
1085  if(is_array($multipleValues) && count($multipleValues)>0)
1086  {
1087  $value = [];
1088  foreach($multipleValues as $v)
1089  {
1090  if(isset($propertyField['OPTIONS'][$v]))
1091  $value[] = $propertyField['OPTIONS'][$v];
1092  }
1093  }
1094  else
1095  $value = $propertyField['OPTIONS'][$property->getValue()];
1096  }
1097  }
1098  break;
1099  }
1100  }
1101  }
1102  }
1103 
1104  return $value;
1105  },
1106  );
1107  }
1108  ),
1109  );
1110 
1111  return $providers;
1112  }

Объявления и описания членов класса находятся в файле:
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Returns translation by message code.
Definition: loc.php:29
Bitrix\Sale\Registry\REGISTRY_TYPE_ORDER
const REGISTRY_TYPE_ORDER
Definition: sale/lib/registry.php:16
Bitrix\Forum\Internals\getById
static getById(int $id)
Definition: forum/lib/internals/entityfabric.php:11
Bitrix\Sale\CompanyTable\getUfId
static getUfId()
Definition: company.php:76
Bitrix\Sale\BusinessValue\getPersonTypes
static getPersonTypes($all=false, array $resetAllPersonTypes=null)
Definition: businessvalue.php:585
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Executes the query and returns selection by parameters of the query.
Definition: main/lib/orm/data/datamanager.php:438