コード例 #1
0
 /**
  * 
  * 
  */
 public function createLandedCostAction()
 {
     $params = $this->getRequest()->getParams();
     $SAPConnector = new SAPConnectorClient();
     $landedCost = new LandedCost();
     $landedCostCosts = new LandedCostCostCollection();
     foreach ($params['landed_cost_costs'] as $landedCostCostParams) {
         $landedCostCost = LandedCostCostFactory::createFromArray($landedCostCostParams);
         $landedCostCosts->append($landedCostCost);
     }
     $landedCost->setDocEntry(1);
     $landedCost->setLandedCostCosts($landedCostCosts);
     $warehouseEntries = WarehouseEntranceQuery::create()->whereAdd(WarehouseEntrance::ID_FOLIO_IMPORT, $params['id'])->find();
     $result = $SAPConnector->createLandedCost($warehouseEntries, $landedCost);
     try {
         if ($result->createLandedCostResult->success) {
             $this->getCatalog('FolioImportlandedCostCatalog')->beginTransaction();
             $folioImportLandedCost = new FolioImportLandedCost();
             $folioImportLandedCost->setIdFolioImport($params['id']);
             $folioImportLandedCost->setIdLandedCost($result->createLandedCostResult->id);
             $this->getCatalog('FolioImportlandedCostCatalog')->create($folioImportLandedCost);
             $folioImport = FolioImportQuery::create()->findByPK($params['id']);
             $this->newLogForCreateLandedCost($folioImport);
             $this->getCatalog('FolioImportlandedCostCatalog')->commit();
             $this->setFlash('ok', $this->i18n->_('The landed cost has been set'));
         } else {
             throw new Exception($this->i18n->_('It cannot be set a Landed Cost for Folio Import ' . $idFolioImport) . $result->createLandedCostResult->message);
         }
     } catch (Exception $e) {
         $this->setFlash('error', $e->getMessage());
     }
     $this->_redirect('folio-import/list');
 }
コード例 #2
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\LandedCostCost
  */
 protected function makeBean($resultset)
 {
     return LandedCostCostFactory::createFromArray($resultset);
 }