first commit
This commit is contained in:
96
upgrade/list/upgrade.2018-05-24.php
Normal file
96
upgrade/list/upgrade.2018-05-24.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
class Upgrade41 extends UpgradeNew
|
||||
{
|
||||
public function check_delivery_zip_codes()
|
||||
{
|
||||
return $this->checkTableExists('delivery_zip_codes', 'kupshop_shared');
|
||||
}
|
||||
|
||||
/** Create column for delivery_balik_na_postu*/
|
||||
public function upgrade_delivery_zip_codes()
|
||||
{
|
||||
sqlQuery('CREATE TABLE kupshop_shared.delivery_zip_codes
|
||||
(
|
||||
zip INT(5) PRIMARY KEY,
|
||||
time_zone TINYINT(1),
|
||||
country VARCHAR(10)
|
||||
);'
|
||||
);
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
|
||||
public function check_EanToProductOfSuppliers()
|
||||
{
|
||||
return (findModule(Modules::PRODUCTS_SUPPLIERS)
|
||||
|| findModule(Modules::SUPPLIERS)
|
||||
|| findModule(Modules::STOCK_IN)
|
||||
|| findModule('automatic_import'))
|
||||
&& $this->checkColumnExists('products_of_suppliers', 'ean');
|
||||
}
|
||||
|
||||
/** Add ean to products of suppliers */
|
||||
public function upgrade_EanToProductOfSuppliers()
|
||||
{
|
||||
sqlQuery('ALTER TABLE products_of_suppliers ADD COLUMN ean bigint null AFTER code;');
|
||||
}
|
||||
|
||||
public function check_ImportMultiplierProductsOfSuppliers()
|
||||
{
|
||||
return findModule(Modules::PRODUCTS_SUPPLIERS) && findModule(Modules::STOCK_IN)
|
||||
&& ($this->checkColumnType('products_of_suppliers', 'import_multiplier', 'float')
|
||||
|| $this->checkColumnDefault('products_of_suppliers', 'import_multiplier', '1'));
|
||||
}
|
||||
|
||||
/** Change column import_multiplier from integer to float */
|
||||
public function upgrade_ImportMultiplierProductsOfSuppliers()
|
||||
{
|
||||
sqlQuery('ALTER TABLE products_of_suppliers CHANGE import_multiplier import_multiplier FLOAT DEFAULT 1');
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
|
||||
/** Increase orders zip length to 50 */
|
||||
public function check_zipField()
|
||||
{
|
||||
$row = sqlFetch(sqlQuery("SELECT COLUMN_TYPE
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA='".$GLOBALS['cfg']['Connection']['database']."'
|
||||
AND TABLE_NAME='orders'
|
||||
AND COLUMN_NAME='invoice_zip'
|
||||
LIMIT 1"));
|
||||
|
||||
return $row['COLUMN_TYPE'] === 'varchar(5)';
|
||||
}
|
||||
|
||||
public function upgrade_zipField()
|
||||
{
|
||||
sqlQuery("ALTER TABLE orders MODIFY COLUMN invoice_zip VARCHAR(50) DEFAULT '' NOT NULL;");
|
||||
sqlQuery("ALTER TABLE orders MODIFY COLUMN delivery_zip VARCHAR(50) DEFAULT '' NOT NULL;");
|
||||
}
|
||||
|
||||
public function check_stockInCodeAndData()
|
||||
{
|
||||
return findModule(Modules::STOCK_IN) && $this->checkColumnExists('stock_in', 'data');
|
||||
}
|
||||
|
||||
public function upgrade_stockInCodeAndData()
|
||||
{
|
||||
sqlQuery('ALTER TABLE stock_in MODIFY COLUMN code VARCHAR(50);
|
||||
ALTER TABLE stock_in ADD COLUMN data TEXT;');
|
||||
}
|
||||
|
||||
public function check_stockInFlags()
|
||||
{
|
||||
return findModule(Modules::STOCK_IN) && $this->checkColumnExists('stock_in', 'flags');
|
||||
}
|
||||
|
||||
/** Add column 'flags' to 'stock_in' table */
|
||||
public function upgrade_stockInFlags()
|
||||
{
|
||||
sqlQuery('ALTER TABLE stock_in ADD COLUMN flags SET(\'O\') DEFAULT NULL AFTER closed');
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user