$response = executeSQL("DELETE stockmaster.* FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid WHERE stockcategory.stocktype='A'", $db, False); if ($response == 0) { OutputResult(_('The fixed assets have been removed from stockmaster table'), 'success'); } else { OutputResult(_('The fixed assets could not be removed from stockmaster table'), 'error'); } } else { OutputResult(_('The fixed assets have already been removed from stockmaster table'), 'info'); } ChangeColumnName('id', 'fixedassets', 'int(11)', 'NOT NULL', 0, 'assetid', $db, 'AUTO_INCREMENT'); $sql = "SELECT categoryid FROM stockcategory WHERE stocktype='A'"; $result = DB_query($sql, $db); if (DB_num_rows($result) != 0) { $response = executeSQL("DELETE FROM stockcategory WHERE stocktype='A'", $db, False); if ($response == 0) { OutputResult(_('The fixed assets have been removed from stockmaster table'), 'success'); } else { OutputResult(_('The fixed assets could not be removed from stockmaster table'), 'error'); } } else { OutputResult(_('The fixed assets have already been removed from stockmaster table'), 'info'); } DropColumn('stockid', 'fixedassets', $db); InsertRecord('systypes', array('typeid', 'typename'), array('41', 'Asset Addition'), array('typeid', 'typename', 'typeno'), array('41', 'Asset Addition', '1'), $db); InsertRecord('systypes', array('typeid', 'typename'), array('42', 'Asset Category Change'), array('typeid', 'typename', 'typeno'), array('42', 'Asset Category Change', '1'), $db); InsertRecord('systypes', array('typeid', 'typename'), array('43', 'Delete w/down asset'), array('typeid', 'typename', 'typeno'), array('43', 'Delete w/down asset', '1'), $db); InsertRecord('systypes', array('typeid', 'typename'), array('44', 'Depreciation'), array('typeid', 'typename', 'typeno'), array('44', 'Depreciation', '1'), $db); CreateTable('fixedassettrans', "CREATE TABLE fixedassettrans(\nid INT( 11 ) NOT NULL AUTO_INCREMENT ,\nassetid INT( 11 ) NOT NULL ,\ntranstype TINYINT( 4 ) NOT NULL ,\ntransdate DATE NOT NULL,\ntransno INT NOT NULL ,\nperiodno SMALLINT( 6 ) NOT NULL ,\ninputdate DATE NOT NULL ,\nfixedassettranstype varchar(8) NOT NULL ,\namount DOUBLE NOT NULL ,\nPRIMARY KEY ( id ) ,\nINDEX ( assetid, transtype, transno ) ,\nINDEX ( inputdate ),\nINDEX (transdate)\n) ENGINE = InnoDB DEFAULT CHARSET = utf8", $db); AddColumn('assetid', 'purchorderdetails', 'int(11)', 'NOT NULL', 0, 'total_amount', $db); InsertRecord('systypes', array('typeid', 'typename'), array('49', 'Import Fixed Assets'), array('typeid', 'typename', 'typeno'), array('49', 'Import Fixed Assets', '1'), $db); UpdateDBNo(42, $db);
<?php /* Include the new script for printing quotations in Portrait */ AddColumn('pagewidth', 'labels', 'float', 'NOT NULL', '0', 'description', $db); AddColumn('pageheight', 'labels', 'float', 'NOT NULL', '0', 'pagewidth', $db); DropColumn('papersize', 'labels', $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
<?php ChangeConfigName('DefaultTaxLevel', 'DefaultTaxCategory', $db); ChangeConfigValue('part_pics_dir', 'companies/kwamoja/part_pics', $db); ChangeConfigValue('EDI_Incoming_Orders', 'companies/kwamoja/EDI_Incoming_Orders', $db); ChangeConfigValue('EDI_MsgPending', 'companies/kwamoja/EDI_MsgPending', $db); ChangeConfigValue('EDI_Sent', 'companies/kwamoja/EDI_Sent', $db); ChangeConfigValue('companies/kwamoja/reports', 'reports_dir', $db); DropColumn('pinno', 'www_users', $db); DropColumn('swipecard', 'www_users', $db); ChangeColumnType('bankact', 'suppliers', 'VARCHAR( 30 )', 'NOT NULL', '', $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
ChangeConfigValue('VersionNumber', '3.12.31', $db); NewConfigValue('AutoAuthorisePO', '1', $db); ChangeConfigValue('VersionNumber', '4.03', $db); AddColumn('poplaced', 'salesorders', 'TINYINT', 'NOT NULL', '0', 'quotedate', $db); AddIndex(array('poplaced'), 'salesorders', 'poplaced', $db); ChangeConfigValue('VersionNumber', '4.03.1', $db); ChangeConfigValue('VersionNumber', '4.03.2', $db); AddColumn('cashsalebranch', 'locations', 'VARCHAR(10)', 'NOT NULL', "Default ''", 'managed', $db); ChangeColumnType('cashsalecustomer', 'locations', 'VARCHAR(10)', 'NOT NULL', '', $db); ChangeConfigValue('VersionNumber', '4.03.3', $db); NewScript('Z_ChangeSupplierCode.php', '15', $db); ChangeConfigValue('VersionNumber', '4.03.5', $db); NewScript('ReprintGRN.php', '11', $db); ChangeConfigValue('VersionNumber', '4.03.6', $db); AddColumn('usepreprintedstationery', 'paymentmethods', 'TINYINT', 'NOT NULL', '0', 'receipttype', $db); RemoveScript('PDFStockTransListing.php', $db); NewScript('PDFPeriodStockTransListing.php', '3', $db); ChangeConfigValue('VersionNumber', '4.03.7', $db); DropColumn('itemno', 'purchorderdetails', $db); DropColumn('subtotal_amount', 'purchorderdetails', $db); DropColumn('package', 'purchorderdetails', $db); DropColumn('pcunit', 'purchorderdetails', $db); DropColumn('kgs', 'purchorderdetails', $db); DropColumn('cuft', 'purchorderdetails', $db); DropColumn('total_quantity', 'purchorderdetails', $db); DropColumn('netweight', 'purchorderdetails', $db); DropColumn('total_amount', 'purchorderdetails', $db); DropColumn('uom', 'purchorderdetails', $db); ChangeConfigValue('VersionNumber', '4.03.8', $db); ChangeColumnType('stockcheckdate', 'stockcheckfreeze', 'DATE', 'NOT NULL', '0000-00-00', $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
<?php NewConfigValue('ExchangeRateFeed', 'ECB', $db); AddColumn('salesperson', 'salesorders', 'VARCHAR(4)', 'NOT NULL', '', 'poplaced', $db); ChangeColumnType('salesmancode', 'salesman', 'VARCHAR(4)', 'NOT NULL', '', $db); DropColumn('commissionrate', 'salesorderdetails', $db); DropColumn('commissionearned', 'salesorderdetails', $db); NewScript('CounterReturns.php', '5', $db); ChangeColumnType('initiator', 'purchorders', 'VARCHAR(20)', 'NOT NULL', '', $db); CreateTable('jobcards', "CREATE TABLE `jobcards` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `debtorno` varchar(255) DEFAULT NULL,\n `description` varchar(500) DEFAULT NULL,\n `task1` varchar(500) DEFAULT NULL,\n `task2` varchar(500) DEFAULT NULL,\n `task3` varchar(500) DEFAULT NULL,\n `task4` varchar(500) DEFAULT NULL,\n `task5` varchar(500) DEFAULT NULL,\n `task6` varchar(500) DEFAULT NULL,\n `createdate` date DEFAULT NULL,\n `completedate` date DEFAULT NULL,\n `invoice` varchar(255) DEFAULT NULL,\n PRIMARY KEY (`id`)\n)", $db); InsertRecord('securitytokens', array('tokenid', 'tokenname'), array('1000', 'User can view and alter sales prices'), array('tokenid', 'tokenname'), array('1000', 'User can view and alter sales prices'), $db); InsertRecord('securitytokens', array('tokenid', 'tokenname'), array('1001', 'User can bypass purchasing security and go straight from order to invoice'), array('tokenid', 'tokenname'), array('1001', 'User can bypass purchasing security and go straight from order to invoice'), $db); UpdateField('securitytokens', 'tokenname', 'Unknown', 'tokenid=12', $db); AddColumn('fontsize', 'www_users', 'TINYINT(2)', 'NOT NULL', '0', 'department', $db); NewScript('CustomerPurchases.php', '5', $db); NewScript('GoodsReceivedButNotInvoiced.php', '15', $db); NewScript('ItemsWithoutPicture.php', '15', $db); UpdateField('scripts', 'pagesecurity', '2', "script='GoodsReceivedButNotInvoiced.php'", $db); DeleteRecords('scripts', "script='Z_ItemsWithoutPicture.php'", $db); UpdateField('scripts', 'script', 'Z_ItemsWithoutPicture.php', "script='ItemsWithoutPicture.php'", $db); ChangeColumnType('description', 'taxauthorities', 'VARCHAR(40)', 'NOT NULL', '', $db); NewScript('MaterialsNotUsed.php', '4', $db); ChangeConfigValue('VersionNumber', '4.10', $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
AddColumn($db, "offers_photos", "foto_id", "INT"); AddColumn($db, "offers", "description_synonim", "TEXT NULL"); AddIndex($db, "offers", "offers_province", '`province`', '`id_lng`'); AddIndex($db, "offers", "offers_location", '`location`', '`id_lng`'); AddIndex($db, "offers", "offers_quarter", '`quarter`', '`id_lng`'); AddIndex($db, "offers", "offers_object_province", '`object`', '`province`', '`id_lng`'); AddIndex($db, "offers", "offers_object_location", '`object`', '`location`', '`id_lng`'); AddIndex($db, "offers", "offers_province_location", '`province`', '`location`', '`id_lng`'); AddIndex($db, "properties", "name", '`name`'); AddIndex($db, "offers_properties", "value", "`value` ( 100 )"); DropColumn($db, "offers_rooms_sets", "id"); AddColumn($db, "offers", "display_number", "INT NOT", "DEFAULT 0"); DropColumn($db, "offers", "field_destiny"); DropColumn($db, "offers", "local_destiny"); DropColumn($db, "offers", "hall_destiny"); DropColumn($db, "offers", "category"); AddColumn($db, "offers", "expiration_date", "DATE NULL"); AddColumn($db, "offers_photos", "LinkFilmYouTube", "VARCHAR( 500 )"); AddColumn($db, "offers_photos", "LinkMiniaturkaYouTube", "VARCHAR( 500 )"); AddColumn($db, "offers", "loc_as_commune", "BOOL NOT", "DEFAULT 0"); //optymalizacja dodanie kolumn flagowych do oferty $s2_result = $db->ExecuteQuery("SHOW columns FROM offers WHERE field='has_swfs'"); $s2_row = $db->FetchArray($s2_result); $s2_add = $s2_row == null; //$s2_add=true; if ($s2_add) { //dodanie flag na istnienie zdjec, swf, dokumentow, panoram, rzutow AddColumn($db, "offers", "has_swfs", "BOOL NOT", "DEFAULT 0"); AddColumn($db, "offers", "has_movs", "BOOL NOT", "DEFAULT 0"); AddColumn($db, "offers", "has_photos", "BOOL NOT", "DEFAULT 0"); AddColumn($db, "offers", "has_pans", "BOOL NOT", "DEFAULT 0");
<?php DropColumn('lastcurcostdate', 'stockmaster', $db); AddColumn('lastcostupdate', 'stockmaster', 'DATE', 'NOT NULL', "0000-00-00", 'netweight', $db); NewConfigValue('InventoryManagerEmail', '*****@*****.**', $db); AddIndex(array('ref'), 'banktrans', 'ref', $db); AddColumn('tag', 'pcexpenses', 'TINYINT( 4 )', 'NOT NULL', "0", 'glaccount', $db); DropConstraint('debtotrans', 'debtortrans_ibfk_1', $db); ChangeConfigValue('VersionNumber', '4.06.6', $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
InsertRecord('taxcategories', array('taxcatid', 'taxcatname'), array('0', 'Exempt'), array('taxcatid', 'taxcatname'), array('0', 'Exempt'), $db); AddConstraint('taxauthlevels', 'taxcatid_ibfk_1', 'taxcatid', 'taxcategories', 'taxcatid', $db); CreateTable('taxprovinces', "CREATE TABLE taxprovinces(\n taxprovinceid tinyint( 4 ) AUTO_INCREMENT NOT NULL ,\n taxprovincename varchar( 30 ) NOT NULL ,\n PRIMARY KEY ( taxprovinceid )\n)", $db); ChangeColumnName('taxauthority', 'locations', 'TINYINT(4)', 'NOT NULL', '1', 'taxprovinceid', $db); AddIndex(array('taxprovinceid'), 'locations', 'taxprovinceid', $db); //InsertRecord('taxprovinces', array('taxprovinceid', 'taxprovincename'), array(NULL, 'Default Tax province'), array('taxprovinceid', 'taxprovincename'), array(NULL, 'Default Tax province'), $db); AddConstraint('locations', 'locations_ibfk_1', 'taxprovinceid', 'taxprovinces', 'taxprovinceid', $db); CreateTable('taxgroups', "CREATE TABLE taxgroups (\n taxgroupid tinyint(4) auto_increment NOT NULL,\n taxgroupdescription varchar(30) NOT NULL,\n PRIMARY KEY(taxgroupid)\n)", $db); CreateTable('taxgrouptaxes', "CREATE TABLE taxgrouptaxes (\n taxgroupid tinyint(4) NOT NULL,\n taxauthid tinyint(4) NOT NULL,\n calculationorder tinyint(4) NOT NULL,\n taxontax tinyint(4) DEFAULT 0 NOT NULL,\n PRIMARY KEY(taxgroupid, taxauthid )\n)", $db); AddIndex(array('taxgroupid'), 'taxgrouptaxes', 'taxgroupid', $db); AddIndex(array('taxauthid'), 'taxgrouptaxes', 'taxauthid', $db); AddConstraint('taxgrouptaxes', 'taxgrouptaxes_ibfk_1', 'taxgroupid', 'taxgroups', 'taxgroupid', $db); AddConstraint('taxgrouptaxes', 'taxgrouptaxes_ibfk_2', 'taxauthid', 'taxauthorities', 'taxid', $db); CreateTable('stockmovestaxes', "CREATE TABLE stockmovestaxes (\n\tstkmoveno int NOT NULL,\n\ttaxauthid tinyint NOT NULL,\n\ttaxontax TINYINT DEFAULT 0 NOT NULL,\n\ttaxcalculationorder TINYINT NOT NULL,\n\ttaxrate double DEFAULT 0 NOT NULL,\n\tPRIMARY KEY (stkmoveno,taxauthid),\n\tKEY (taxauthid),\n\tKEY (taxcalculationorder)\n)", $db); AddConstraint('stockmovestaxes', 'stockmovestaxes_ibfk_1', 'taxauthid', 'taxauthorities', 'taxid', $db); DropColumn('taxrate', 'stockmoves', $db); CreateTable('debtortranstaxes', "CREATE TABLE debtortranstaxes (\n\t`debtortransid` INT NOT NULL ,\n\t`taxauthid` TINYINT NOT NULL ,\n\t`taxamount` DOUBLE NOT NULL,\n\tPRIMARY KEY(debtortransid, taxauthid),\n\tKEY (taxauthid)\n)", $db); AddConstraint('debtortranstaxes', 'debtortranstaxes_ibfk_1', 'taxauthid', 'taxauthorities', 'taxid', $db); AddConstraint('debtortranstaxes', 'debtortranstaxes_ibfk_2', 'debtortransid', 'debtortrans', 'id', $db); DropConstraint('custbranch', 'custbranch_ibfk_5', $db); ChangeColumnName('taxauthority', 'custbranch', 'TINYINT(4)', 'NOT NULL', '1', 'taxgroupid', $db); DropIndex('custbranch', 'area_2', $db); DropIndex('custbranch', 'taxauthority', $db); AddIndex(array('taxgroupid'), 'custbranch', 'taxgroupid', $db); //InsertRecord('taxgroups', array('taxgroupid', 'taxgroupdescription'), array(NULL,'Default tax group'), array('taxgroupid', 'taxgroupdescription'), array(NULL,'Default tax group'), $db); AddConstraint('custbranch', 'custbranch_ibfk_7', 'taxgroupid', 'taxgroups', 'taxgroupid', $db); RenameTable('taxauthlevels', 'taxauthrates', $db); AddConstraint('taxauthrates', 'taxauthrates_ibfk_1', 'dispatchtaxprovince', 'taxprovinces', 'taxprovinceid', $db); ChangeColumnName('taxlevel', 'stockmaster', 'TINYINT(4)', 'NOT NULL', '1', 'taxcatid', $db); AddIndex(array('taxcatid'), 'stockmaster', 'stockmaster_ibix_1', $db); AddConstraint('stockmaster', 'stockmaster_ibfk_2', 'taxcatid', 'taxcategories', 'taxcatid', $db);
<?php CreateTable('custcontacts', "CREATE TABLE `custcontacts` (\n `contid` int(11) NOT NULL auto_increment,\n `debtorno` varchar(10) NOT NULL,\n `contactname` varchar(40) NOT NULL,\n `role` varchar(40) NOT NULL,\n `phoneno` varchar(20) NOT NULL,\n `notes` varchar(255) NOT NULL,\n PRIMARY KEY (`contid`)\n)", $db); AddColumn('taxref', 'suppliers', 'VARCHAR(20)', 'NOT NULL', '', 'factorcompanyid', $db); CreateTable('tags', "CREATE TABLE `tags` (\n`tagref` tinyint(4) NOT NULL auto_increment,\n`tagdescription` varchar(50) NOT NULL,\nPRIMARY KEY (`tagref`)\n)", $db); AddColumn('tag', 'gltrans', 'TINYINT(4)', 'NOT NULL', "0", 'jobref', $db); DropColumn('vtiger_accountid', 'custbranch', $db); DropColumn('vtiger_accountid', 'salesorders', $db); DropColumn('vtiger_productid', 'stockmaster', $db); DeleteConfigValue('vtiger_integration', $db); AddColumn('lat', 'custbranch', 'FLOAT( 10, 6 )', 'NOT NULL', "0.0", 'braddress6', $db); AddColumn('lng', 'custbranch', 'FLOAT( 10, 6 )', 'NOT NULL', "0.0", 'lat', $db); AddColumn('lat', 'suppliers', 'FLOAT( 10, 6 )', 'NOT NULL', "0.0", 'address6', $db); AddColumn('lng', 'suppliers', 'FLOAT( 10, 6 )', 'NOT NULL', "0.0", 'lat', $db); CreateTable('geocode_param', "CREATE TABLE `geocode_param` (\n `geocodeid` varchar(4) NOT NULL default '',\n `geocode_key` varchar(200) NOT NULL default '',\n `center_long` varchar(20) NOT NULL default '',\n `center_lat` varchar(20) NOT NULL default '',\n `map_height` varchar(10) NOT NULL default '',\n `map_width` varchar(10) NOT NULL default '',\n `map_host` varchar(50) NOT NULL default ''\n)", $db); NewConfigValue('geocode_integration', '0', $db); NewConfigValue('DefaultCustomerType', '1', $db); CreateTable('debtortype', "CREATE TABLE `debtortype` (\n`typeid` tinyint(4) NOT NULL auto_increment,\n`typename` varchar(100) NOT NULL,\nPRIMARY KEY (`typeid`)\n)", $db); InsertRecord('debtortype', array('typeid', 'typename'), array(NULL, 'Default'), array('typeid', 'typename'), array(NULL, 'Default'), $db); AddColumn('typeid', 'debtorsmaster', 'TINYINT(4)', 'NOT NULL', "1", 'customerpoline', $db); AddConstraint('debtorsmaster', 'debtorsmaster_ibfk_5', 'typeid', 'debtortype', 'typeid', $db); AddColumn('effectivefrom', 'purchdata', 'DATE', 'NOT NULL', "0000-00-00", 'preferred', $db); CreateTable('debtortypenotes', "CREATE TABLE `debtortypenotes` (\n`noteid` tinyint(4) NOT NULL auto_increment,\n`typeid` tinyint(4) NOT NULL default '0',\n`href` varchar(100) NOT NULL,\n`note` varchar(200) NOT NULL,\n`date` date NOT NULL default '0000-00-00',\n`priority` varchar(20) NOT NULL,\nPRIMARY KEY (`noteid`)\n)", $db); CreateTable('custnotes', "CREATE TABLE `custnotes` (\n`noteid` tinyint(4) NOT NULL auto_increment,\n`debtorno` varchar(10) NOT NULL default '0',\n`href` varchar(100) NOT NULL,\n`note` varchar(200) NOT NULL,\n`date` date NOT NULL default '0000-00-00',\n`priority` varchar(20) NOT NULL,\nPRIMARY KEY (`noteid`)\n)", $db); NewConfigValue('Extended_CustomerInfo', '0', $db); NewConfigValue('Extended_SupplierInfo', '0', $db); ChangeColumnType('area', 'salesglpostings', 'VARCHAR(3)', 'NOT NULL', '', $db); ChangeColumnType('area', 'salesanalysis', 'VARCHAR(3)', 'NOT NULL', '', $db); ChangeColumnType('trandate', 'debtortrans', 'DATE', 'NOT NULL', '0000-00-00', $db); UpdateDBNo(basename(__FILE__, '.php'), $db);