184 $fieldsInfo = empty($fieldsInfo)? $this->
getFields():$fieldsInfo;
188 if(isset($fields[
'ORDER'][
'ID']))
189 $result[
'ORDER'][
'ID'] = (int)$fields[
'ORDER'][
'ID'];
191 if(isset($fields[
'ORDER'][
'SHIPMENTS']))
193 foreach ($fields[
'ORDER'][
'SHIPMENTS'] as $k=>$item)
196 $this->
isNewItem($item)? $listFieldsInfoAdd:$listFieldsInfoUpdate
199 if(isset($item[
'SHIPMENT_ITEMS']))
201 $result[
'ORDER'][
'SHIPMENTS'][$k][
'SHIPMENT_ITEMS'] = $shipmentItem->internalizeFieldsModify([
'SHIPMENT'=>[
'SHIPMENT_ITEMS'=>$item[
'SHIPMENT_ITEMS']]])[
'SHIPMENT'][
'SHIPMENT_ITEMS'];
273 foreach ($fields[
'ORDER'][
'SHIPMENTS'] as $k=>$item)
276 $this->
isNewItem($item)? $listFieldsInfoAdd:$listFieldsInfoUpdate
278 if(!$required->isSuccess())
280 $r->addError(
new Error(
'[shipments]['.$k.
'] - '.implode(
', ', $required->getErrorMessages()).
'.'));
283 if(isset($item[
'SHIPMENT_ITEMS']))
285 $requiredShipmentItems = $shipmentItem->checkRequiredFieldsModify([
'SHIPMENT'=>[
'SHIPMENT_ITEMS'=>$item[
'SHIPMENT_ITEMS']]]);
286 if(!$requiredShipmentItems->isSuccess())
288 $requiredPShipmentItemsFields = [];
289 foreach ($requiredShipmentItems->getErrorMessages() as $errorMessage)
291 $requiredPShipmentItemsFields[] =
'[shipments]['.$k.
']'.$errorMessage;
293 $r->addError(
new Error(implode(
' ', $requiredPShipmentItemsFields)));