/** * Flag product translations as deleted for productList * * @param array $productList Product list * * @return void */ protected function deleteProductTranslationsByProductList(array $productList) { $database = $this->getDatabaseConnection(); $updateValues = array('tstamp' => $GLOBALS['EXEC_TIME'], 'deleted' => 1); $database->exec_UPDATEquery('tx_commerce_products', 'l18n_parent IN (' . implode(',', $productList) . ')', $updateValues); $translatedArticles = array(); foreach ($productList as $productId) { $articlesOfProduct = $this->belib->getArticlesOfProductAsUidList($productId); if (is_array($articlesOfProduct) && count($articlesOfProduct)) { $translatedArticles = array_merge($translatedArticles, $articlesOfProduct); } } $translatedArticles = array_unique($translatedArticles); if (count($translatedArticles)) { $this->deletePricesByArticleList($translatedArticles); $this->deleteArticlesByArticleList($translatedArticles); } }
/** * Make query array * * @param string $table Table * @param int $id Id * @param string $addWhere Additional where * @param string $fieldList Field list * * @return array */ public function makeQueryArray($table, $id, $addWhere = '', $fieldList = '*') { $database = $this->getDatabaseConnection(); $hookObjectsArr = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list.inc']['makeQueryArray'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list.inc']['makeQueryArray'] as $classRef) { $hookObjectsArr[] = GeneralUtility::getUserObj($classRef); } } // Set ORDER BY: $orderBy = $GLOBALS['TCA'][$table]['ctrl']['sortby'] ? 'ORDER BY ' . $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['sortby'] : $GLOBALS['TCA'][$table]['ctrl']['default_sortby']; if ($this->sortField) { if (in_array($this->sortField, $this->makeFieldList($table, 1))) { $orderBy = 'ORDER BY ' . $table . '.' . $this->sortField; if ($this->sortRev) { $orderBy .= ' DESC'; } } } // Set LIMIT: $limit = ''; if ($this->iLimit) { $limit = ($this->firstElementNumber ? $this->firstElementNumber . ',' : '') . ($this->iLimit + 1); } // Filtering on displayable pages (permissions): $pC = $table == 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : ''; if ($id > 0) { $pidWhere = ' AND tx_commerce_orders.pid=' . $id; } else { Tx_Commerce_Utility_FolderUtility::initFolders(); // Find the right pid for the Ordersfolder $orderPid = current(array_unique(Tx_Commerce_Domain_Repository_FolderRepository::initFolders('Orders', 'Commerce', 0, 'Commerce'))); $orderFolders = Tx_Commerce_Utility_BackendUtility::getOrderFolderSelector($orderPid, PHP_INT_MAX); $list = array(); foreach ($orderFolders as $orderFolder) { $list[] = $orderFolder[1]; } $pidWhere = ' AND tx_commerce_orders.pid in (' . implode(',', $list) . ')'; } // Adding search constraints: $search = $this->makeSearchString($table); $queryParts = array('SELECT' => 'DISTINCT tx_commerce_order_articles.order_id, delivery_table.order_id AS order_number, tx_commerce_order_articles.article_type_uid, tx_commerce_order_articles.title AS payment, delivery_table.title AS delivery, tx_commerce_orders.uid, tx_commerce_orders.pid, tx_commerce_orders.crdate, tx_commerce_orders.tstamp, tx_commerce_orders.order_id, tx_commerce_orders.sum_price_gross, tt_address.tx_commerce_address_type_id, tt_address.company, tt_address.name, tt_address.surname, tt_address.address, tt_address.zip, tt_address.city, tt_address.email, tt_address.phone AS phone_1, tt_address.mobile AS phone_2, tx_commerce_orders.cu_iso_3_uid, tx_commerce_orders.tstamp, tx_commerce_orders.uid AS articles, tx_commerce_orders.comment, tx_commerce_orders.internalcomment, tx_commerce_orders.order_type_uid AS order_type_uid_noName, static_currencies.cu_iso_3', 'FROM' => 'tx_commerce_orders, tt_address, tx_commerce_order_articles, tx_commerce_order_articles AS delivery_table, static_currencies', 'WHERE' => 'static_currencies.uid = tx_commerce_orders.cu_iso_3_uid AND delivery_table.order_id = tx_commerce_orders.order_id AND tx_commerce_order_articles.order_id = tx_commerce_orders.order_id AND tx_commerce_order_articles.article_type_uid = ' . PAYMENTARTICLETYPE . ' AND delivery_table.article_type_uid = ' . DELIVERYARTICLETYPE . ' AND tx_commerce_orders.deleted = 0 AND tx_commerce_orders.cust_deliveryaddress = tt_address.uid' . ' ' . $pC . ' ' . $addWhere . $pidWhere . ' ' . $search, 'GROUPBY' => '', 'ORDERBY' => $database->stripOrderBy($orderBy), 'LIMIT' => $limit); // get Module TSConfig $moduleConfig = BackendUtility::getModTSconfig($id, 'mod.txcommerceM1_orders'); if ($moduleConfig['properties']['delProdUid']) { GeneralUtility::deprecationLog('mod.txcommerceM1_orders.delProdUid is deprecated since commerce 1.0.0, this setting will be removed in commerce 1.4.0, please use mod.txcommerceM1_orders.deliveryProductUid instead'); } if ($moduleConfig['properties']['payProdUid']) { GeneralUtility::deprecationLog('mod.txcommerceM1_orders.payProdUid is deprecated since commerce 1.0.0, this setting will be removed in commerce 1.4.0, please use mod.txcommerceM1_orders.paymentProductUid instead'); } $deliveryProductUid = $moduleConfig['properties']['deliveryProductUid'] ? $moduleConfig['properties']['deliveryProductUid'] : 0; $deliveryProductUid = $moduleConfig['properties']['delProdUid'] ? $moduleConfig['properties']['delProdUid'] : $deliveryProductUid; if ($deliveryProductUid > 0) { $deliveryArticles = Tx_Commerce_Utility_BackendUtility::getArticlesOfProductAsUidList($deliveryProductUid); if (count($deliveryArticles)) { $queryParts['WHERE'] .= ' AND delivery_table.article_uid IN (' . implode(',', $deliveryArticles) . ') '; } } $paymentProductUid = $moduleConfig['properties']['paymentProductUid'] ? $moduleConfig['properties']['paymentProductUid'] : 0; $paymentProductUid = $moduleConfig['properties']['payProdUid'] ? $moduleConfig['properties']['payProdUid'] : $paymentProductUid; if ($paymentProductUid > 0) { $paymentArticles = Tx_Commerce_Utility_BackendUtility::getArticlesOfProductAsUidList($paymentProductUid); if (count($paymentArticles)) { $queryParts['WHERE'] .= ' AND delivery_table.article_uid IN (' . implode(',', $paymentArticles) . ') '; } } // Apply hook as requested in http://bugs.typo3.org/view.php?id=4361 foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'makeQueryArray_post')) { $parameter = array('orderBy' => $orderBy, 'limit' => $limit, 'pC' => $pC, 'search' => $search); $hookObj->makeQueryArray_post($queryParts, $this, $table, $id, $addWhere, $fieldList, $parameter); } } return $queryParts; }