Пример #1
0
 public function load()
 {
     $this->initErrorMessages();
     $this->initSuccessMessages();
     $this->addParam('req', isset($_SESSION['action_request']) ? $_SESSION['action_request'] : []);
     $this->addParam('products', ProductManager::getInstance()->selectAdvance('*', [], ['name']));
     unset($_SESSION['action_request']);
     $this->addParam('uoms', UomManager::getInstance()->selectAdvance('*', [], ['name']));
     $this->addParam('manufacturers', ManufacturerManager::getInstance()->selectAdvance('*', [], ['name']));
     $this->addParam('defaultCurrencyId', SettingManager::getInstance()->getSetting('default_currency_id'));
     $this->addParam('defaultUomId', SettingManager::getInstance()->getSetting('default_uom_id'));
 }
Пример #2
0
 public function getProductListFull($where = [], $orderByFieldsArray = null, $orderByAscDesc = "ASC", $offset = null, $limit = null)
 {
     $rows = $this->selectAdvance('*', $where, $orderByFieldsArray, $orderByAscDesc, $offset, $limit);
     $manufacturerIds = array();
     $uomIds = array();
     foreach ($rows as $row) {
         $manufacturerIds[] = $row->getManufacturerId();
         $uomIds[] = $row->getUomId();
     }
     $manufacturerIds = array_unique($manufacturerIds);
     $uomIds = array_unique($uomIds);
     $manufacturerDtos = ManufacturerManager::getInstance()->selectByPKs($manufacturerIds, true);
     $uomDtos = UomManager::getInstance()->selectByPKs($uomIds, true);
     foreach ($rows as $row) {
         $row->setUomDto($uomDtos[$row->getUomId()]);
         $row->setManufacturerDto($manufacturerDtos[$row->getManufacturerId()]);
     }
     return $rows;
 }
Пример #3
0
 public function load()
 {
     $this->initErrorMessages();
     $this->initSuccessMessages();
     $id = intval(NGS()->args()->id);
     $product = ProductManager::getInstance()->selectByPK($id);
     if ($product) {
         $this->addParam('product', $product);
         if (!isset($_SESSION['action_request'])) {
             $_SESSION['action_request'] = ['name' => $product->getName(), 'model' => $product->getModel(), 'manufacturerId' => $product->getManufacturerId(), 'uomId' => $product->getUomId()];
         }
         $this->addParam('req', $_SESSION['action_request']);
         unset($_SESSION['action_request']);
         $this->addParam('uoms', UomManager::getInstance()->selectAdvance('*', [], ['name']));
         $this->addParam('manufacturers', ManufacturerManager::getInstance()->selectAdvance('*', [], ['name']));
         $this->addParam('defaultCurrencyId', SettingManager::getInstance()->getSetting('default_currency_id'));
         $this->addParam('defaultUomId', SettingManager::getInstance()->getSetting('default_uom_id'));
     }
 }