function add_accounting_tab() { include_once _PS_INSTALL_PATH_ . 'upgrade/php/add_new_tab.php'; $id_parent = add_new_tab('AdminAccounting', 'en:Accounting|fr:Comptabilité|es:Accounting|de:Accounting|it:Accounting', 0, true); add_new_tab('AdminAccountingManagement', 'en:Account Number Management|fr:Gestion des numéros de comptes|es:Account Number Management|de:Account Number Management|it:Account Number Management', $id_parent); add_new_tab('AdminAccountingExport', 'en:Export|fr:Export|es:Export|de:Export|it:Export', $id_parent); }
function create_multistore() { $res = true; if (!defined('_THEME_NAME_')) { define('_THEME_NAME_', 'default'); } // @todo : use _PS_ROOT_DIR_ if (defined('__PS_BASE_URI__')) { $INSTALLER__PS_BASE_URI = __PS_BASE_URI__; } else { // note: create_multistore is called for 1.5.0.0 upgrade // so, __PS_BASE_URI__ should be always defined in settings.inc.php // @todo generate __PS_BASE_URI__ using $_SERVER['REQUEST_URI'], just in case return false; } $all_themes_dir = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'themes'; $themes = scandir($all_themes_dir); foreach ($themes as $theme) { if (is_dir($all_themes_dir . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR) && $theme[0] != '.' && $theme != 'prestashop') { $sql = 'INSERT INTO ' . _DB_PREFIX_ . 'theme (`id_theme`, name) VALUES("", "' . Db::getInstance()->escape($theme) . '")'; $res &= Db::getInstance()->execute($sql); } } $res &= Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'shop SET name = (SELECT value FROM ' . _DB_PREFIX_ . 'configuration WHERE name = "PS_SHOP_NAME" ), id_theme = (SELECT id_theme FROM ' . _DB_PREFIX_ . 'theme WHERE name="' . Db::getInstance()->escape(_THEME_NAME_) . '") WHERE id_shop = 1'); $shop_domain = Db::getInstance()->getValue('SELECT `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name`="PS_SHOP_DOMAIN"'); $shop_domain_ssl = Db::getInstance()->getValue('SELECT `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name`="PS_SHOP_DOMAIN_SSL"'); if (empty($shop_domain)) { $shop_domain = create_multistore_getHttpHost(); $shop_domain_ssl = create_multistore_getHttpHost(); } $_PS_DIRECTORY_ = trim(str_replace(' ', '%20', $INSTALLER__PS_BASE_URI), DIRECTORY_SEPARATOR); $_PS_DIRECTORY_ = $_PS_DIRECTORY_ ? '/' . $_PS_DIRECTORY_ . DIRECTORY_SEPARATOR : DIRECTORY_SEPARATOR; $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'shop_url` (`id_shop`, `domain`, `domain_ssl`, `physical_uri`, `virtual_uri`, `main`, `active`) VALUES(1, \'' . pSQL($shop_domain) . '\', \'' . pSQL($shop_domain_ssl) . '\', \'' . pSQL($_PS_DIRECTORY_) . '\', \'\', 1, 1)'); // Stock conversion $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`) VALUES (SELECT p.`id_product`, 0, 1, 1, p.`quantity` FROM `' . _DB_PREFIX_ . 'product` p);'; $res &= Db::getInstance()->execute($sql); $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`) VALUES (SELECT `id_product`, `id_product_attribute`, 1, 1, `quantity` FROM `' . _DB_PREFIX_ . 'product_attribute` p);'; $res &= Db::getInstance()->execute($sql); // Add admin tabs $shopTabId = add_new_tab('AdminShop', 'it:Shops|es:Shops|fr:Boutiques|de:Shops|en:Shops', 0, true); add_new_tab('AdminGroupShop', 'it:Group Shops|es:Group Shops|fr:Groupes de boutique|de:Group Shops|en:Group Shops', $shopTabId); add_new_tab('AdminShopUrl', 'it:Shop Urls|es:Shop Urls|fr:URLs de boutique|de:Shop Urls|en:Shop Urls', $shopTabId); return $res; }
function add_stock_tab() { // Patch for the 1.0.1 sql update Db::getInstance()->query(' DELETE FROM `' . _DB_PREFIX_ . 'tab` WHERE id_parent = 1 AND class_name = "AdminStocks"'); // Create new tabs $id_parent = add_new_tab('AdminStock', 'en:Stock|fr:Stock|es:Stock|de:Stock|it:Stock', 0, true); add_new_tab('AdminWarehouses', 'en:Warehouses|fr:Entrepôts|es:Warehouses|de:Warehouses|it:Warehouses', $id_parent); add_new_tab('AdminStockManagement', 'en:Stock Management|fr:Gestion du stock|es:Stock Management|de:Stock Management|it:Stock Management', $id_parent); add_new_tab('AdminStockMvt', 'en:Stock Movement|fr:Mouvements de Stock|es:Stock Movement|de:Stock Movement|it:Stock Movement', $id_parent); add_new_tab('AdminStockInstantState', 'en:Stock instant state|fr:Etat instantané du stock|es:Stock instant state|de:Stock instant state|it:Stock instant state', $id_parent); add_new_tab('AdminStockCover', 'en:Stock cover|fr:Couverture du stock|es:Stock cover|de:Stock cover|it:Stock cover', $id_parent); add_new_tab('AdminSupplyOrders', 'en:Supply orders|fr:Commandes fournisseurs|es:Supply orders|de:Supply orders|it:Supply orders', $id_parent); add_new_tab('AdminStockConfiguration', 'en:Configuration|fr:Configuration|es:Configuration|de:Configuration|it:Configuration', $id_parent); }
/** * Migrate BO tabs for multi-shop new reorganization */ function migrate_tabs_multi_shop() { include_once _PS_INSTALL_PATH_ . 'upgrade/php/add_new_tab.php'; include_once _PS_INSTALL_PATH_ . 'upgrade/php/migrate_tabs_15.php'; $nbr_shop = Db::getInstance()->getValue('SELECT count(id_shop) FROM ' . _DB_PREFIX_ . 'shop'); $tab_shop_group_active = false; //check if current configuration has more than one shop if ($nbr_shop > 1) { Db::getInstance()->update('configuration', array('value' => true), 'name = \'PS_MULTISHOP_FEATURE_ACTIVE\''); $tab_shop_group_active = true; } // ===== remove AdminParentShop from BO menu ===== $admin_parent_shop_id = get_tab_id('AdminParentShop'); $admin_shop_group_id = get_tab_id('AdminShopGroup'); Db::getInstance()->delete('tab', 'id_tab IN (' . (int) $admin_shop_group_id . ', ' . (int) $admin_parent_shop_id . ')'); Db::getInstance()->delete('tab_lang', 'id_tab IN (' . (int) $admin_shop_group_id . ', ' . (int) $admin_parent_shop_id . ')'); // ===== add AdminShopGroup to parent AdminTools ===== $admin_shop_group_id = add_new_tab('AdminShopGroup', 'en:Multi-shop|fr:Multiboutique|es:Multi-tienda|de:Multi-shop|it:Multi-shop', get_tab_id('AdminTools'), true); Db::getInstance()->update('tab', array('active' => $tab_shop_group_active), 'id_tab = ' . (int) $admin_shop_group_id); // ===== hide AdminShopUrl and AdminShop ===== Db::getInstance()->update('tab', array('id_parent' => '-1'), 'id_tab IN (' . get_tab_id('AdminShop') . ', ' . get_tab_id('AdminShopUrl') . ')'); }
/** * Migrate BO tabs for 1.5 (new reorganization of BO) */ function migrate_tabs_15() { include_once _PS_INSTALL_PATH_ . 'upgrade/php/add_new_tab.php'; // ===== Remove deleted tabs ===== $remove_tabs = array('AdminAliases', 'AdminContact', 'AdminDb', 'AdminGenerator', 'AdminPdf', 'AdminSubDomains', 'AdminStatsConf'); $ids = array(); foreach ($remove_tabs as $tab) { if ($id = get_tab_id($tab)) { $ids[] = $id; } } if ($ids) { Db::getInstance()->delete('tab', 'id_tab IN (' . implode(', ', $ids) . ')'); Db::getInstance()->delete('tab_lang', 'id_tab IN (' . implode(', ', $ids) . ')'); } // ===== Create new parent tabs ===== $parent = array('AdminCatalog' => get_tab_id('AdminCatalog'), 'AdminParentOrders' => add_new_tab('AdminParentOrders', 'en:Orders|fr:Commandes|es:Pedidos|de:Bestellungen|it:Ordini', 0, true), 'AdminParentCustomer' => add_new_tab('AdminParentCustomer', 'en:Customers|fr:Clients|es:Clientes|de:Kunden|it:Clienti', 0, true), 'AdminPriceRule' => add_new_tab('AdminPriceRule', 'en:Price rules|fr:Promotions|es:Price rules|de:Price rules|it:Price rules', 0, true), 'AdminParentShipping' => add_new_tab('AdminParentShipping', 'en:Shipping|fr:Transport|es:Transporte|de:Versandkosten|it:Spedizione', 0, true), 'AdminParentLocalization' => add_new_tab('AdminParentLocalization', 'en:Localization|fr:Localisation|es:Ubicación|de:Lokalisierung|it:Localizzazione', 0, true), 'AdminParentModules' => add_new_tab('AdminParentModules', 'en:Modules|fr:Modules|es:Módulos|de:Module|it:Moduli', 0, true), 'AdminParentPreferences' => add_new_tab('AdminParentPreferences', 'en:Preferences|fr:Préférences|es:Preferencias|de:Voreinstellungen|it:Preferenze', 0, true), 'AdminTools' => get_tab_id('AdminTools'), 'AdminAdmin' => add_new_tab('AdminAdmin', 'en:Administration|fr:Administration|es:Administration|de:Administration|it:Administration', 0, true), 'AdminParentStats' => add_new_tab('AdminParentStats', 'en:Stats|fr:Stats|es:Estadísticas|de:Statistik|it:Stat', 0, true), 'AdminParentShop' => add_new_tab('AdminParentShop', 'en:Shops|fr:Boutiques|es:Shops|de:Shops|it:Shops', 0, true), 'AdminStock' => get_tab_id('AdminStock')); // ===== Move tabs from old parents to new parents ===== $move_association = array('AdminParentOrders' => 'AdminOrders', 'AdminParentCustomer' => 'AdminCustomers', 'AdminParentShipping' => 'AdminShipping', 'AdminParentLocalization' => 'AdminLocalization', 'AdminParentModules' => 'AdminModules', 'AdminParentPreferences' => 'AdminPreferences', 'AdminAdmin' => 'AdminEmployees', 'AdminParentStats' => 'AdminStats', 'AdminParentShop' => 'AdminShop'); foreach ($move_association as $to => $from) { if (empty($parent[$to])) { continue; } $id_parent = get_tab_id($from); if ($id_parent) { Db::getInstance()->execute(' UPDATE ' . _DB_PREFIX_ . 'tab SET id_parent = ' . $parent[$to] . ' WHERE id_parent = ' . $id_parent . ' OR id_tab = ' . $id_parent . ' '); } } // ===== Move tabs to their new parents ===== $move_to = array('AdminContacts' => 'AdminParentCustomer', 'AdminCustomerThreads' => 'AdminParentCustomer', 'AdminCurrencies' => 'AdminParentLocalization', 'AdminTaxes' => 'AdminParentLocalization', 'AdminTaxRulesGroup' => 'AdminParentLocalization', 'AdminLanguages' => 'AdminParentLocalization', 'AdminTranslations' => 'AdminParentLocalization', 'AdminZones' => 'AdminParentLocalization', 'AdminCountries' => 'AdminParentLocalization', 'AdminStates' => 'AdminParentLocalization', 'AdminCartRules' => 'AdminPriceRule', 'AdminSpecificPriceRule' => 'AdminPriceRule', 'AdminQuickAccesses' => 'AdminAdmin', 'AdminPayment' => 'AdminParentModules', 'AdminCmsContent' => 'AdminParentPreferences', 'AdminStores' => 'AdminParentPreferences', 'AdminEmails' => 'AdminTools', 'AdminPerformance' => 'AdminTools', 'AdminAccountingConfiguration' => 'AdminTools', 'AdminAccountingRegisteredNumber' => 'AdminTools', 'AdminAccountingExport' => 'AdminStats'); foreach ($move_to as $from => $to) { if (empty($parent[$to])) { continue; } $id_tab = get_tab_id($from); if ($id_tab) { Db::getInstance()->execute(' UPDATE ' . _DB_PREFIX_ . 'tab SET id_parent = ' . $parent[$to] . ' WHERE id_tab = ' . $id_tab . ' '); } } // ===== Remove AdminThemes from Modules parent ===== $id_tab_theme = Db::getInstance()->getValue('SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab WHERE class_name = \'AdminThemes\' AND id_parent = ' . $parent['AdminParentModules'] . ' '); if ($id_tab_theme) { Db::getInstance()->delete('tab', 'id_tab = ' . $id_tab_theme); } // ===== Create new tabs (but not parents this time) ===== add_new_tab('AdminOrderPreferences', 'en:Orders|fr:Commandes|es:Pedidos|de:Bestellungen|it:Ordini', $parent['AdminParentPreferences']); add_new_tab('AdminCustomerPreferences', 'en:Customers|fr:Clients|es:Clientes|de:Kunden|it:Clienti', $parent['AdminParentPreferences']); add_new_tab('AdminMaintenance', 'en:Maintenance|fr:Maintenance|es:Maintenance|de:Maintenance|it:Maintenance', $parent['AdminParentPreferences']); add_new_tab('AdminAdminPreferences', 'en:Preferences|fr:Préférences|es:Preferencias|de:Voreinstellungen|it:Preferenze', $parent['AdminAdmin']); // ===== Sort parent tabs ===== $position = 0; foreach ($parent as $id) { Db::getInstance()->update('tab', array('position' => $position++), 'id_tab = ' . (int) $id); } $sql = 'SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab WHERE id_tab NOT IN (' . implode(', ', $parent) . ') AND id_parent = 0'; $id_tabs = Db::getInstance()->executeS($sql); if (is_array($id_tabs) && count($id_tabs)) { foreach (Db::getInstance()->executeS($sql) as $row) { Db::getInstance()->update('tab', array('position' => $position++), 'id_tab = ' . $row['id_tab']); } } }
function add_accounting_tab() { $id_parent = add_new_tab('AdminAccounting', 'en:Accounting|fr:Comptabilité|es:Accounting|de:Accounting|it:Accounting', 0, true); add_new_tab('AdminAccountingManagement', 'en:Account Number Management|fr:Gestion des numéros de comptes|es:Account Number Management|de:Account Number Management|it:Account Number Management', $id_parent); add_new_tab('AdminAccountingExport', 'en:Export|fr:Export|es:Export|de:Export|it:Export', $id_parent); }
/** * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function add_quick_access_tab() { include_once _PS_INSTALL_PATH_ . 'upgrade/php/add_new_tab.php'; add_new_tab('AdminQuickAccesses', 'en:Quick access|fr:Accès rapide|es:Quick access|de:Quick access|it:Quick access', -1); }
/** * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function ps_1701_add_payment_preferences_tab() { include_once 'add_new_tab.php'; // TODO: ajouter les trads ? translations/[fr]/tabs.php et autre ? add_new_tab('AdminPaymentPreferences', 'en:Payment preferences|fr:Préférences de paiement|es:Hola|de:Artung|it:Mama mia', 0, false, 'AdminParentModules'); }