/**
  * Return REST description of sostatus and invoicestatus
  * @return array
  */
 protected function generateStatuses()
 {
     $restData = array();
     if ($this->cmlSalesOrder->getPropValue("Номер оплаты по 1С") != null) {
         $restData['invoicestatus'] = 'Paid';
     } else {
         $restData['invoicestatus'] = 'AutoCreated';
     }
     /* One Es generate values as strings true or false */
     if ($this->cmlSalesOrder->getPropValue("Проведен") === 'true') {
         $restData['sostatus'] = 'Delivered';
     } elseif ($this->cmlSalesOrder->getPropValue("ПометкаУдаления") === 'true') {
         $restData['sostatus'] = 'Cancelled';
     } else {
         $restData['sostatus'] = 'Created';
     }
     return $restData;
 }
예제 #2
0
 /**
  * Initilizate order props
  * @param CmlSalesOrder $salesOrder
  * @param SimpleXmlElement $xmlOrder
  * @return CmlSalesOrder
  */
 private function initilizateOrderProps($salesOrder, $xmlOrder)
 {
     if ($this->isChildExists($xmlOrder, 'ЗначенияРеквизитов')) {
         $xmlProps = $xmlOrder->ЗначенияРеквизитов;
         foreach ($xmlProps->ЗначениеРеквизита as $prop) {
             $propName = $this->getChildContent($prop, 'Наименование');
             $propValue = $this->getChildContent($prop, 'Значение');
             $salesOrder->addProp($propName, $propValue);
         }
     }
     return $salesOrder;
 }