public function load() { $this->initErrorMessages(); $this->initSuccessMessages(); $manufacturerManager = ManufacturerManager::getInstance(); $manufacturers = $manufacturerManager->selectAll(); $this->addParam('manufacturers', $manufacturers); }
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')); }
public function service() { try { list($name, $link) = $this->getFormData(); } catch (RedirectException $exc) { $_SESSION['error_message'] = $exc->getMessage(); $_SESSION['action_request'] = $_REQUEST; $this->redirect($exc->getRedirectTo()); } $manufacturerId = ManufacturerManager::getInstance()->createManufacturer($name, $link); unset($_SESSION['action_request']); $_SESSION['success_message'] = 'Manufacturer Successfully created!'; $this->redirect('manufacturer/list'); }
public function load() { $this->initErrorMessages(); $this->initSuccessMessages(); $id = intval(NGS()->args()->id); $manufacturer = ManufacturerManager::getInstance()->selectByPK($id); if (isset($manufacturer)) { if (!isset($_SESSION['action_request'])) { $_SESSION['action_request'] = ['name' => $manufacturer->getName(), 'link' => $manufacturer->getLink()]; } $this->addParam("manufacturer", $manufacturer); $this->addParam('req', $_SESSION['action_request']); unset($_SESSION['action_request']); } }
public function service() { if (isset(NGS()->args()->id)) { $manufacturerId = NGS()->args()->id; } else { $_SESSION['error_message'] = 'Manufacturer ID is missing'; $this->redirect('manufacturer/list'); } $manufacturerManager = ManufacturerManager::getInstance(); $partnerDto = $manufacturerManager->selectByPK($manufacturerId); if (!isset($partnerDto)) { $_SESSION['error_message'] = 'Manufacturer with ID ' . NGS()->args()->id . ' does not exists.'; $this->redirect('manufacturer/list'); } $manufacturerManager->deletePartnerFull($manufacturerId); $_SESSION['success_message'] = 'Manufacturer Successfully deleted!'; $this->redirect('manufacturer/list'); }
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; }
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')); } }