<?php /* Move the version number to the database from the config.php file */ NewConfigValue('VersionNumber', '4.00-RC1', $db); UpdateDBNo(34, $db);
<?php /* Include the new script for printing quotations in Portrait */ AddColumn('tag', 'pcexpenses', 'TINYINT( 4 )', 'not null', 0, 'glaccount', $db); UpdateDBNo(100, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('ConfirmProForma_Invoice.php', 2), array('script', 'security'), array('ConfirmProForma_Invoice.php', 2), $db); InsertRecord('systypes', array('typeid'), array('13'), array('typeid', 'typename', 'typeno'), array('13', 'Proforma Invoices', '0'), $db); CreateTable('proformatrans', "CREATE TABLE `proformatrans` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `transno` int(11) NOT NULL DEFAULT '0',\n `type` smallint(6) NOT NULL DEFAULT '0',\n `stockid` varchar(20) NOT NULL DEFAULT '',\n `debtorno` varchar(10) NOT NULL DEFAULT '',\n `branchcode` varchar(10) NOT NULL DEFAULT '',\n `trandate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n `inputdate` datetime NOT NULL,\n `prd` smallint(6) NOT NULL DEFAULT '0',\n `settled` tinyint(4) NOT NULL DEFAULT '0',\n `reference` varchar(20) NOT NULL DEFAULT '',\n `tpe` char(2) NOT NULL DEFAULT '',\n `order_` int(11) NOT NULL DEFAULT '0',\n `rate` double NOT NULL DEFAULT '0',\n `ovamount` double NOT NULL DEFAULT '0',\n `ovgst` double NOT NULL DEFAULT '0',\n `ovfreight` double NOT NULL DEFAULT '0',\n `ovdiscount` double NOT NULL DEFAULT '0',\n `diffonexch` double NOT NULL DEFAULT '0',\n `alloc` double NOT NULL DEFAULT '0',\n `invtext` text,\n `shipvia` int(11) NOT NULL DEFAULT '0',\n `edisent` tinyint(4) NOT NULL DEFAULT '0',\n `consignment` varchar(15) NOT NULL DEFAULT '',\n PRIMARY KEY (`id`),\n KEY `DebtorNo` (`debtorno`,`branchcode`),\n KEY `Order_` (`order_`),\n KEY `Prd` (`prd`),\n KEY `Tpe` (`tpe`),\n KEY `Type` (`type`),\n KEY `Settled` (`settled`),\n KEY `TranDate` (`trandate`),\n KEY `TransNo` (`transno`),\n KEY `Type_2` (`type`,`transno`),\n KEY `EDISent` (`edisent`),\n CONSTRAINT `proformatrans_ibfk_2` FOREIGN KEY (`type`) REFERENCES `systypes` (`typeid`),\n CONSTRAINT `proformatrans_ibfk_3` FOREIGN KEY (`prd`) REFERENCES `periods` (`periodno`),\n CONSTRAINT `proformatrans_ibfk_4` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`)\n) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8", $db); UpdateDBNo(108, $db);
<?php /* Ensure that all tablse use the utf8_general_cli * character set */ $sql = 'SHOW TABLES'; $result = DB_Query($sql, $db); while ($table = DB_fetch_array($result)) { if (CharacterSet($table[0], $db) != 'utf8_general_ci') { $response = executeSQL('ALTER TABLE ' . $table[0] . ' CONVERT TO CHARACTER SET utf8', $db); if ($response == 0) { OutputResult(_('The character set of') . ' ' . $table[0] . ' ' . _('has been changed to utf8_general_ci'), 'success'); } else { OutputResult(_('The character set of') . ' ' . $table[0] . ' ' . _('could not be changed to utf8_general_ci'), 'error'); } } else { OutputResult(_('The character set of') . ' ' . $table[0] . ' ' . _('is already utf8_general_ci'), 'info'); } } UpdateDBNo(1, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('doc/Manual/ManualContents.php', 1), array('script', 'security'), array('doc/Manual/ManualContents.php', 1), $db); RenameTable('dispatch', 'stockrequest', $db); RenameTable('dispatchitems', 'stockrequestitems', $db); AddColumn('decimalplaces', 'stockrequestitems', 'int', 'not null', 0, 'quantity', $db); AddColumn('uom', 'stockrequestitems', 'varchar(20)', 'not null', '', 'decimalplaces', $db); ChangeColumnType('dispatchid', 'stockrequest', 'INT (11)', 'NOT NULL', 0, $db); InsertRecord('systypes', array('typeid'), array('38'), array('typeid', 'typename', 'typeno'), array('38', 'Stock Requests', '0'), $db); UpdateDBNo(97, $db);
<?php /* Remove foreign key from debtortrans table */ DropConstraint('debtortrans', 'debtortrans_ibfk_1', $db); UpdateDBNo(53, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('GLJournalInquiry.php', 10), array('script', 'security'), array('GLJournalInquiry.php', 10), $db); InsertRecord('pagesecurity', array('script', 'security'), array('PDFGLJournal.php', 10), array('script', 'security'), array('PDFGLJournal.php', 10), $db); UpdateDBNo(90, $db);
<?php AddColumn('uomdecimalplaces', 'purchdata', 'tinyint( 4 )', 'NOT NULL', '0', 'conversionfactor', $db); UpdateDBNo(105, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('Departments.php', 11), array('script', 'security'), array('Departments.php', 11), $db); InsertRecord('pagesecurity', array('script', 'security'), array('StockTransfers_departments.php', 11), array('script', 'security'), array('StockTransfers_departments.php', 11), $db); InsertRecord('pagesecurity', array('script', 'security'), array('PDFStockTransfer_departments.php', 11), array('script', 'security'), array('PDFStockTransfer_departments.php', 11), $db); CreateTable('departments', "CREATE TABLE departments (\n`departmentid` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n`description` VARCHAR (100) NOT NULL DEFAULT '',\n`authoriser` varchar (20) NOT NULL DEFAULT ''\n) ENGINE=InnoDB DEFAULT CHARSET=utf8", $db); CreateTable('dispatch', "CREATE TABLE dispatch (\n`dispatchid` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n`loccode` VARCHAR (5) NOT NULL DEFAULT '',\n`departmentid` INT NOT NULL DEFAULT 0,\n`despatchdate` DATE NOT NULL DEFAULT '0000-00-00',\n`authorised` TINYINT NOT NULL DEFAULT 0,\n`narrative` TEXT NOT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8", $db); CreateTable('dispatchitems', "CREATE TABLE dispatchitems (\n`dispatchitemsid` INT NOT NULL DEFAULT 0,\n`dispatchid` INT NOT NULL DEFAULT 0,\n`stockid` VARCHAR (20) NOT NULL DEFAULT '',\n`quantity` DOUBLE NOT NULL DEFAULT 0\n) ENGINE=InnoDB DEFAULT CHARSET=utf8", $db); UpdateDBNo(95, $db);
<?php /* Include the new script for printing quotations in Portrait */ AddColumn('email', 'custcontacts', 'varchar(55)', 'not null', '', 'notes', $db); UpdateDBNo(107, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('KCMCUnbilledItems.php', 1), array('script', 'security'), array('KCMCUnbilledItems.php', 1), $db); UpdateDBNo(120, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('SalesByTypePeriodInquiry.php', 1), array('script', 'security'), array('SalesByTypePeriodInquiry.php', 1), $db); UpdateDBNo(104, $db);
<?php /* Ensure the correct conversion factor is stored in the purchase * order line record */ if (!isset($SQLFile)) { $sql = "SELECT podetailitem,\n\t\t\titemcode,\n\t\t\tpurchorders.supplierno\n\t\tFROM purchorderdetails\n\t\tLEFT JOIN purchorders\n\t\t\tON purchorders.orderno=purchorderdetails.orderno\n\t\tWHERE conversionfactor=0"; $result = DB_query($sql, $db); while ($myrow = DB_fetch_array($result)) { $ConversionFactorSQL = "SELECT conversionfactor\n\t\t\t\t\t\t\tFROM purchdata\n\t\t\t\t\t\t\tWHERE supplierno='" . $myrow['supplierno'] . "'\n\t\t\t\t\t\t\t\tAND stockid='" . $myrow['itemcode'] . "'"; $ConversionFactorResult = DB_query($ConversionFactorSQL, $db); if (DB_num_rows($ConversionFactorResult) > 0) { $ConversionFactorRow = DB_fetch_array($ConversionFactorResult); $ConversionFactor = $ConversionFactorRow['conversionfactor']; } else { $ConversionFactor = 1; } $UpdateSQL = "UPDATE purchorderdetails\n\t\t\t\tSET conversionfactor='" . $ConversionFactor . "'\n\t\t\t\tWHERE podetailitem='" . $myrow['podetailitem'] . "'"; $UpdateResult = executeSQL($UpdateSQL, $db); } OutputResult(_('Purchase order details have been correctly updated'), 'success'); } UpdateDBNo(57, $db);
<?php AddColumn('defaulttag', 'www_users', 'VARCHAR( 20 )', 'NOT NULL', '', 'defaultlocation', $db); AddColumn('defaulttag', 'gltrans', 'VARCHAR( 20 )', 'NOT NULL', '', 'jobref', $db); UpdateDBNo(83, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('PDFQuotationPortrait.php', 2), array('script', 'security'), array('PDFQuotationPortrait.php', 2), $db); UpdateDBNo(63, $db); ?> ~
<?php /* Database updates for latest version */ $response = executeSQL("UPDATE config SET confvalue = '4.0' WHERE confname='VersionNumber'", $db, false); UpdateDBNo(61, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('Z_ChangeSupplierCode.php', 15), array('script', 'security'), array('Z_ChangeSupplierCode.php', 15), $db); UpdateDBNo(72, $db);
<?php /* Mods to select fixed asset for disposal */ AddColumn('disposaldate', 'fixedassets', 'date', 'NOT NULL', '0000-00-00', 'barcode', $db); ChangeColumnName('disposalvalue', 'fixedassets', 'double', 'NOT NULL', 0.0, 'disposalproceeds', $db); UpdateDBNo(48, $db);
<?php ChangeColumnName('forpreprint', 'paymentmethods', 'tinyint(1)', 'NOT NULL', '0', 'usepreprintedstationery', $db); UpdateDBNo(87, $db);
<?php /* Include the new script for printing quotations in Portrait */ AddColumn('email', 'custcontacts', 'varchar(55)', 'not null', '', 'notes', $db); UpdateDBNo(115, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('SalesCategoryPeriodInquiry.php', 1), array('script', 'security'), array('SalesCategoryPeriodInquiry.php', 1), $db); UpdateDBNo(109, $db);
InsertRecord('pagesecurity', array('script', 'security'), array('Z_index.php', 15), array('script', 'security'), array('Z_index.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_MakeNewCompany.php', 15), array('script', 'security'), array('Z_MakeNewCompany.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_MakeStockLocns.php', 15), array('script', 'security'), array('Z_MakeStockLocns.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_poAddLanguage.php', 15), array('script', 'security'), array('Z_poAddLanguage.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_poAdmin.php', 15), array('script', 'security'), array('Z_poAdmin.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_poEditLangHeader.php', 15), array('script', 'security'), array('Z_poEditLangHeader.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_poEditLangModule.php', 15), array('script', 'security'), array('Z_poEditLangModule.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_poEditLangRemaining.php', 15), array('script', 'security'), array('Z_poEditLangRemaining.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_poRebuildDefault.php', 15), array('script', 'security'), array('Z_poRebuildDefault.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_PriceChanges.php', 15), array('script', 'security'), array('Z_PriceChanges.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_ReApplyCostToSA.php', 15), array('script', 'security'), array('Z_ReApplyCostToSA.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_RePostGLFromPeriod.php', 15), array('script', 'security'), array('Z_RePostGLFromPeriod.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_ReverseSuppPaymentRun.php', 15), array('script', 'security'), array('Z_ReverseSuppPaymentRun.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_SalesIntegrityCheck.php', 15), array('script', 'security'), array('Z_SalesIntegrityCheck.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_UpdateChartDetailsBFwd.php', 15), array('script', 'security'), array('Z_UpdateChartDetailsBFwd.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.01-3.02.php', 15), array('script', 'security'), array('Z_Upgrade_3.01-3.02.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.04-3.05.php', 15), array('script', 'security'), array('Z_Upgrade_3.04-3.05.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.05-3.06.php', 15), array('script', 'security'), array('Z_Upgrade_3.05-3.06.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.07-3.08.php', 15), array('script', 'security'), array('Z_Upgrade_3.07-3.08.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.08-3.09.php', 15), array('script', 'security'), array('Z_Upgrade_3.08-3.09.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.09-3.10.php', 15), array('script', 'security'), array('Z_Upgrade_3.09-3.10.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.10-3.11.php', 15), array('script', 'security'), array('Z_Upgrade_3.10-3.11.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade3.10.php', 15), array('script', 'security'), array('Z_Upgrade3.10.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_Upgrade_3.11-4.00.php', 15), array('script', 'security'), array('Z_Upgrade_3.11-4.00.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_UploadForm.php', 15), array('script', 'security'), array('Z_UploadForm.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('Z_UploadResult.php', 15), array('script', 'security'), array('Z_UploadResult.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('ReportletContainer.php', 1), array('script', 'security'), array('ReportletContainer.php', 1), $db); InsertRecord('pagesecurity', array('script', 'security'), array('PageSecurity.php', 15), array('script', 'security'), array('PageSecurity.php', 15), $db); InsertRecord('pagesecurity', array('script', 'security'), array('UpgradeDatabase.php', 15), array('script', 'security'), array('UpgradeDatabase.php', 15), $db); UpdateDBNo(45, $db);
<?php /* Include the new script for printing quotations in Portrait */ InsertRecord('pagesecurity', array('script', 'security'), array('Z_ChangeInsuranceCompanyCode.php', 1), array('script', 'security'), array('Z_ChangeInsuranceCompanyCode.php', 1), $db); UpdateDBNo(121, $db);
<?php AddColumn('chequeno', 'banktrans', 'int( 11 )', 'NOT NULL', '0', 'ref', $db); UpdateDBNo(88, $db);
<?php /* Add input date to transaction tables so that transactions can be * reported on by their input date */ AddColumn('inputdate', 'supptrans', 'datetime', 'NOT NULL', '0000-00-00', 'duedate', $db); AddColumn('inputdate', 'debtortrans', 'datetime', 'NOT NULL', '0000-00-00', 'trandate', $db); UpdateDBNo(16, $db);
<?php /* Add the field in the currencies that shows the number of decimal places to be shown for each currency */ AddColumn('decimalplaces', 'currencies', 'tinyint(3)', 'NOT NULL', '2', 'hundredsname', $db); UpdateDBNo(9, $db);
<?php AddColumn('userid', 'banktrans', 'varchar(20)', 'NOT NULL', '', 'currcode', $db); UpdateDBNo(106, $db);
<?php DropConstraint('recurringsalesorders', 'recurrsalesorderdetails_ibfk_1', $db); AddConstraint('recurrsalesorderdetails', 'recurrsalesorderdetails_ibfk_1', 'recurrorderno', 'recurringsalesorders', 'recurrorderno', $db); UpdateDBNo(59, $db);
<?php AddColumn('active', 'salescat', 'INT (1)', 'NOT NULL', 1, 'salescatname', $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
<?php AddColumn('current', 'salesman', 'tinyint(4)', 'NOT NULL', '1', 'commissionrate2', $db); UpdateDBNo(103, $db);