/** * Список фолдингов */ public static function listFoldings() { $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst()); $foldings = array(); foreach ($managers as $manager) { if ($manager instanceof RubricsProcessor) { $foldings[] = $manager->getRubricsFolding(); } if ($manager instanceof PostsProcessor) { $foldings[] = $manager->getFolding(); } } //Фолдинги $foldings[] = PopupPagesManager::inst(); $foldings[] = PluginsManager::inst(); $foldings[] = IdentPagesManager::inst(); $foldings[] = TimeLineManager::inst(); $foldings[] = TemplateMessages::inst(); $foldings[] = UserPointsManager::inst(); $foldings[] = StockManager::inst(); $foldings[] = HelpManager::inst(); $foldings[] = EmailManager::inst(); $foldings[] = PSForm::inst(); $foldings[] = DialogManager::inst(); //Библиотеки $foldings[] = PoetsManager::inst(); $foldings[] = ScientistsManager::inst(); //Админские страницы $foldings[] = APagesResources::inst(); //Базовые страницы $foldings[] = BasicPagesManager::inst(); //Построитель страниц $foldings[] = PageBuilder::inst(); //Управление списком предпросмотра постов $foldings[] = ShowcasesCtrlManager::inst(); //Элементы в правой панели навигации $foldings[] = ClientBoxManager::inst(); //Все фолдинги системы return $foldings; }
private function __construct() { PsProfiler::inst(__CLASS__)->start(__FUNCTION__); //Фолдинги $this->foldings[] = PopupPagesManager::inst(); $this->foldings[] = PluginsManager::inst(); $this->foldings[] = TimeLineManager::inst(); $this->foldings[] = UserPointsManager::inst(); $this->foldings[] = StockManager::inst(); $this->foldings[] = HelpManager::inst(); $this->foldings[] = EmailManager::inst(); $this->foldings[] = PSForm::inst(); $this->foldings[] = DialogManager::inst(); //Библиотеки $this->foldings[] = PoetsManager::inst(); $this->foldings[] = ScientistsManager::inst(); //Админские страницы $this->foldings[] = APagesResources::inst(); /* * Выделим различные подклассы фолдингов */ foreach ($this->foldings as $folding) { //Фолдинги библиотек if ($folding instanceof LibResources) { $this->libs[] = $folding; } //Фолдинги для баблов if ($folding instanceof BubbledFolding) { $this->bubbles[] = $folding; } //Фолдинги, предоставляющие панели if ($folding instanceof PanelFolding) { $this->panels[] = $folding; } } PsProfiler::inst(__CLASS__)->stop(); }
public function checkQuantities($return_product = false) { if (Configuration::get('PS_CATALOG_MODE') && !defined('_PS_ADMIN_DIR_')) { return false; } foreach ($this->getProducts() as $product) { if (!$this->allow_seperated_package && !$product['allow_oosp'] && StockAvailable::dependsOnStock($product['id_product']) && $product['advanced_stock_management'] && (bool) Context::getContext()->customer->isLogged() && ($delivery = $this->getDeliveryOption()) && !empty($delivery)) { $product['stock_quantity'] = StockManager::getStockByCarrier((int) $product['id_product'], (int) $product['id_product_attribute'], $delivery); } if (!$product['active'] || !$product['available_for_order'] || !$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']) { return $return_product ? $product : false; } } return true; }
protected final function processImpl(PostArrayAdapter $adapter, $button) { return $this->processStock(StockManager::inst()->assertCanDoAction($adapter, $this->stockType()), $adapter, $button); }
protected function processRequest(\ArrayAdapter $params) { return new IdentPageContent(StockManager::inst()->stockPageHtml()); }
function smarty_function_stock($params, Smarty_Internal_Template &$template) { echo StockManager::inst()->registerStock(ArrayAdapter::inst($params)); }
private function __construct() { PsProfiler::inst(__CLASS__)->start(__FUNCTION__); $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst()); foreach ($managers as $manager) { //Соберём типы постов $this->postTypes[] = $manager->getPostType(); if ($manager instanceof RubricsProcessor) { $this->rubricsProcessors[$manager->getPostType()] = $manager; $this->foldings[] = $manager->getRubricsFolding(); } if ($manager instanceof PostsProcessor) { $this->postsProcessors[$manager->getPostType()] = $manager; $this->foldings[] = $manager->getFolding(); } if ($manager instanceof CommentsProcessor) { $this->commentProcessors[$manager->getPostType()] = $manager; $this->discussionControllers[$manager->getDiscussionController()->getDiscussionUnique()] = $manager->getDiscussionController(); } if ($manager instanceof PagePreloadListener) { $this->pagePreloadListeners[] = $manager; } if ($manager instanceof NewsProvider) { $this->newsProviders[$manager->getNewsEventType()] = $manager; } } //Контроллеры дискуссий $this->discussionControllers[FeedbackManager::inst()->getDiscussionUnique()] = FeedbackManager::inst(); //Фолдинги $this->foldings[] = PopupPagesManager::inst(); $this->foldings[] = PluginsManager::inst(); $this->foldings[] = IdentPagesManager::inst(); $this->foldings[] = TimeLineManager::inst(); $this->foldings[] = TemplateMessages::inst(); $this->foldings[] = UserPointsManager::inst(); $this->foldings[] = StockManager::inst(); $this->foldings[] = HelpManager::inst(); $this->foldings[] = EmailManager::inst(); $this->foldings[] = PSForm::inst(); $this->foldings[] = DialogManager::inst(); //Библиотеки $this->foldings[] = PoetsManager::inst(); $this->foldings[] = ScientistsManager::inst(); //Админские страницы $this->foldings[] = APagesResources::inst(); //Базовые страницы $this->foldings[] = BasicPagesManager::inst(); //Построитель страниц $this->foldings[] = PageBuilder::inst(); //Управление списком предпросмотра постов $this->foldings[] = ShowcasesCtrlManager::inst(); //Элементы в правой панели навигации $this->foldings[] = ClientBoxManager::inst(); /* * Выделим различные подклассы фолдингов */ foreach ($this->foldings as $folding) { //Фолдинги библиотек if ($folding instanceof LibResources) { $this->libs[] = $folding; } //Фолдинги обработчиков постов if ($folding instanceof PostFoldedResources) { $this->postProcessorFoldings[] = $folding; } //Фолдинги для баблов if ($folding instanceof BubbledFolding) { $this->bubbles[] = $folding; } //Фолдинги, предоставляющие панели if ($folding instanceof PanelFolding) { $this->panels[] = $folding; } //Фолдинги, финализирующие контент страницы if ($folding instanceof PageFinalizerFolding) { $this->pageFinaliseFoldings[] = $folding; } //Индексированный список фолдингов $this->folding2unique[$folding->getUnique()] = $folding; //Префиксы smarty к фолдингам $this->folding2smartyPrefix[$folding->getSmartyPrefix()] = $folding; //Префиксы классов к фолдингам if ($folding->getClassPrefix()) { $this->folding2classPrefix[$folding->getClassPrefix()] = $folding; } } PsProfiler::inst(__CLASS__)->stop(); }
/** * @name getDetailReservation($pIdOperation) * @return array(StockVO) * @desc Retourne une liste d'Stock */ public function getDetailReservation($pIdOperation) { return StockManager::recherche(array(StockManager::CHAMP_STOCK_ID_OPERATION), array('='), array($pIdOperation), array(StockManager::CHAMP_STOCK_DATE, StockManager::CHAMP_STOCK_TYPE), array('DESC', 'ASC')); }
/** * Сущность фолдинга для данного типа акций * * @return FoldedEntity */ protected function foldedEntity() { return StockManager::inst()->getFoldedEntity(self::getType()); }
/** * @name recherche( $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri ) * @param string nom de la table * @param string Le type de critère de recherche * @param array(string) champs à récupérer dans la table * @param array(array(string, object)) Dictionnaire(champ, valeur)) contenant les champs à filtrer ainsi que la valeur du filtre * @param array(array(string, string)) Dictionnaire(champ, sens) contenant les tris à appliquer * @return array(StockVO) * @desc Récupères les lignes de la table selon le critère de recherche puis trie et renvoie la liste de résultat sous forme d'une collection de StockVO */ public static function recherche($pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri) { // Initialisation du Logger $lLogger =& Log::singleton('file', CHEMIN_FICHIER_LOGS); $lLogger->setMask(Log::MAX(LOG_LEVEL)); // Préparation de la requète $lChamps = array(StockManager::CHAMP_STOCK_ID . "," . StockManager::CHAMP_STOCK_DATE . "," . StockManager::CHAMP_STOCK_QUANTITE . "," . StockManager::CHAMP_STOCK_TYPE . "," . StockManager::CHAMP_STOCK_ID_COMPTE . "," . StockManager::CHAMP_STOCK_ID_DETAIL_COMMANDE . "," . StockManager::CHAMP_STOCK_ID_MODELE_LOT . "," . StockManager::CHAMP_STOCK_ID_OPERATION . "," . StockManager::CHAMP_STOCK_ID_NOM_PRODUIT . "," . StockManager::CHAMP_STOCK_UNITE); // Préparation de la requète de recherche $lRequete = DbUtils::prepareRequeteRecherche(StockManager::TABLE_STOCK, $lChamps, $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri); $lListeStock = array(); if ($lRequete !== false) { $lLogger->log("Execution de la requete : " . $lRequete, PEAR_LOG_DEBUG); // Maj des logs $lSql = Dbutils::executerRequete($lRequete); if (mysql_num_rows($lSql) > 0) { while ($lLigne = mysql_fetch_assoc($lSql)) { array_push($lListeStock, StockManager::remplirStock($lLigne[StockManager::CHAMP_STOCK_ID], $lLigne[StockManager::CHAMP_STOCK_DATE], $lLigne[StockManager::CHAMP_STOCK_QUANTITE], $lLigne[StockManager::CHAMP_STOCK_TYPE], $lLigne[StockManager::CHAMP_STOCK_ID_COMPTE], $lLigne[StockManager::CHAMP_STOCK_ID_DETAIL_COMMANDE], $lLigne[StockManager::CHAMP_STOCK_ID_MODELE_LOT], $lLigne[StockManager::CHAMP_STOCK_ID_OPERATION], $lLigne[StockManager::CHAMP_STOCK_ID_NOM_PRODUIT], $lLigne[StockManager::CHAMP_STOCK_UNITE])); } } else { $lListeStock[0] = new StockVO(); } return $lListeStock; } $lListeStock[0] = new StockVO(); return $lListeStock; }
/** * Регистрация страниц SDK */ private function registerSdkFoldings() { $this->register(PopupPagesManager::inst()); $this->register(PluginsManager::inst()); $this->register(TimeLineManager::inst()); $this->register(UserPointsManager::inst()); $this->register(StockManager::inst()); $this->register(HelpManager::inst()); $this->register(EmailManager::inst()); $this->register(PSForm::inst()); $this->register(DialogManager::inst()); $this->register(PageBuilder::inst()); //Библиотеки $this->register(PoetsManager::inst()); $this->register(ScientistsManager::inst()); //Админские страницы $this->register(APagesResources::inst()); }
<?php require_once '../../views/_secureHead.php'; require_once '../../libs/simple_html_dom.php'; require_once '../../models/_header.php'; require_once '../../models/_add.php'; require_once '../../models/_table.php'; if (isset($sessionManager) && $sessionManager->isAuthorized()) { $STOCK_ID = request_isset('id'); $ticker = request_isset('ticker'); $stockManager = new StockManager(); if ($sessionManager->getUserType() != 'ADMIN') { switch ($page_action) { case 'update_by_id': $db_update_success = $stockManager->updateRecord($STOCK_ID, $USER_ID, $ticker); break; case 'add_stock': $db_add_success = $stockManager->addRecord($USER_ID, $ticker); break; case 'delete_by_id': $db_delete_success = $stockManager->deleteRecord($STOCK_ID, $USER_ID); break; } } $stock_records = $stockManager->getAllRecords(); // build header view $headerView = new HeaderView(($sessionManager->getUserType() == 'ADMIN' ? 'Indexer | ' : '') . 'Stocks'); $headerView->setLink('<link rel="stylesheet" type="text/css" href="css/styles.css" />'); if ($sessionManager->getUserType() == 'ADMIN') { $headerView->setMeta('<meta http-equiv="refresh" content="1800;url=#" />'); } else {
protected function executeImpl(ArrayAdapter $params) { return StockManager::inst()->executeAjaxAction($params); }
public function get_current_stock() { $PhysicalQuantities = new StockManager(); // Получить список товаров в магазине $all_products = DB::getInstance()->executeS("SELECT `id_product` FROM `" . _DB_PREFIX_ . "product`"); if (!is_null($all_products)) { foreach ($all_products as $product) { $id_product = $product["id_product"]; $id_product_attribute = 0; // к-во товара на первом складе $id_warehouse = 1; $usable = false; //physical $f_quantity = $PhysicalQuantities->getProductPhysicalQuantities($id_product, $id_product_attribute, $id_warehouse, $usable); $usable = true; // usable $u_quantity = $PhysicalQuantities->getProductPhysicalQuantities($id_product, $id_product_attribute, $id_warehouse, $usable); $d_quantity = $f_quantity - $u_quantity; //сохранять в временную таблицу, если есть физ кол-во на этом складе if ($f_quantity > 0) { Db::getInstance()->insert('temp_stock', array('id_product' => $id_product, 'id_warehouse' => $id_warehouse, 'f_quantity' => $f_quantity, 'u_quantity' => $u_quantity, 'd_quantity' => $d_quantity)); } // к-во товароа на втором складе $id_warehouse = 2; $usable = false; //physical $f_quantity = $PhysicalQuantities->getProductPhysicalQuantities($id_product, $id_product_attribute, $id_warehouse, $usable); $usable = true; // usable $u_quantity = $PhysicalQuantities->getProductPhysicalQuantities($id_product, $id_product_attribute, $id_warehouse, $usable); $d_quantity = $f_quantity - $u_quantity; //сохранять в временную таблицу, если есть физ кол-во на этом складе if ($f_quantity > 0) { Db::getInstance()->insert('temp_stock', array('id_product' => $id_product, 'id_warehouse' => $id_warehouse, 'f_quantity' => $f_quantity, 'u_quantity' => $u_quantity, 'd_quantity' => $d_quantity)); } } } }
<?php require_once '../../views/_secureHead.php'; require_once '../../libs/simple_html_dom.php'; require_once '../../models/_edit.php'; if (isset($sessionManager) && $sessionManager->isAuthorized()) { $STOCK_ID = request_isset('id'); $stockManager = new StockManager(); $record = $stockManager->getRecord($STOCK_ID); $page_title = 'Edit | Stocks'; // build edit view $editView = new EditView('Edit', 'update_by_id', $STOCK_ID); $editView->addRow('stock', 'Stock', $record->getStock()); $editView->addRow('ticker', 'Ticker', $record->getSymbol()); $views_to_load = array(); $views_to_load[] = '../../views/_edit.php'; include '../../views/_generic.php'; }
public function doProcess(ArrayAdapter $params) { $this->stock = StockManager::inst()->getStockByIdent($params); $this->data = $this->stock->getFullView(); }