<?php /* Include the new script for printing quotations in Portrait */ UpdateField('pagesecurity', 'script', 'CopyBOM.php', "script='Z_CopyBOM.php'", $db); UpdateDBNo(114, $db);
<?php /* New security token for petty cash usage */ UpdateField('securitytokens', 'tokenname', 'Petty Cash', 'tokenid=6', $db); UpdateDBNo(15, $db);
<?php /* Correct the MenuAccess.php security level */ UpdateField('pagesecurity', 'script', 'MenuAccess.php', 'script="pagesecurityAccess.php"', $db); UpdateDBNo(52, $db);
<?php InsertRecord('securitytokens', array('tokenid'), array('0'), array('tokenid, tokenname'), array('0', 'Main Index Page'), $db); $result = DB_query("SELECT secroleid FROM securitygroups WHERE tokenid='0'", $db); if (DB_num_rows($result) == 0) { DB_query("INSERT INTO securitygroups (SELECT secroleid, '0' FROM securityroles)", $db); } UpdateField('pagesecurity', 'security', 0, "script='Index.php'", $db); UpdateDBNo(80, $db);
<?php /* Add extra database items needed for supplier only login */ AddColumn('supplierid', 'www_users', 'varchar(10)', 'NOT NULL', '', 'customerid', $db); InsertRecord('securityroles', array('secroleid', 'secrolename'), array(9, 'Supplier Log On Only'), array('secroleid', 'secrolename'), array(9, 'Supplier Log On Only'), $db); UpdateField('securitytokens', 'tokenname', 'Supplier centre - Supplier access only', 'tokenid=9', $db); InsertRecord('securitygroups', array('secroleid', 'tokenid'), array(9, 9), array('secroleid', 'tokenid'), array(9, 9), $db); UpdateDBNo(23, $db);
<?php /* Database updates for security system */ InsertRecord('pagesecurity', array('script', 'security'), array('SupplierTenders.php', 9), array('script', 'security'), array('SupplierTenders.php', 9), $db); UpdateField('securitytokens', 'tokenname', 'Supplier tendering', 'tokenid=9', $db); UpdateField('securitytokens', 'tokenname', 'Prices security', 'tokenid=6', $db); $UpdateSQL = "UPDATE config SET confvalue = '4.0' WHERE confname='VersionNumber'"; UpdateDBNo(60, $db);
<?php /* Database changes required to add start and end dates for sales prices */ AddColumn('startdate', 'prices', 'Date', 'NOT NULL', '0000-00-00', 'branchcode', $db); AddColumn('enddate', 'prices', 'Date', 'NOT NULL', '9999-12-31', 'startdate', $db); DropPrimaryKey('prices', array('stockid', 'typeabbrev', 'currabrev', 'debtorno'), $db); AddPrimaryKey('prices', array('stockid', 'typeabbrev', 'currabrev', 'debtorno', 'branchcode', 'startdate', 'enddate'), $db); UpdateField('prices', 'startdate', '1999-01-01', 'stockid="%"', $db); UpdateField('prices', 'enddate', '', 'stockid="%"', $db); UpdateDBNo(19, $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);
function UpdateFileField(&$filename, &$value_array, &$closetag, $err_message = "", $opentag = "") { $err_message .= "a" . dump_array(&$value_array, TRUE); if (is_writable($filename)) { $openmode = "r"; if ($fp = OpenFile($filename, $openmode, &$err_message)) { $content = GetContentFromFile($fp, $filename); $content_array = explode($closetag, $content); // echo "<br>\n Array count : " . count($content_array) . "<br>\n" ; reset($content_array); if (is_array($value_array)) { while (list($opentag, $value) = each($value_array)) { if (UpdateField($content, $opentag, $closetag, $content_array, $value, &$err_message) == false) { $err_message .= " Could not execute \"UpdateField\" in \"UpdateFileField\". <br>\n "; // Exception has occurred return false; } } } else { if (UpdateField($content, $opentag, $closetag, $content_array, $value_array, &$err_message) == false) { $err_message .= " Could not execute \"UpdateField\" in \"UpdateFileField\". <br>\n "; // Exception has occurred return false; } } // display ( $content_array ) ; $final_text = implode($closetag, $content_array); // echo "<br>\n" . $final_text . "<br>\n" ; $myfile = '../includes/db_connect.inc'; $mymode = 'w'; $fp = OpenFile($myfile, $mymode, &$err_message); // ftruncate ( $fp , 0 ) ; // rewind ( $fp ) ; if (fwrite($fp, $final_text) !== false) { // echo "<br>\n WRITING TO EXISTING FILE SUCCESS<br>\n" ; return true; } else { $err_message .= " Could not execute \"fwrite\" in \"UpdateFileField\". <br>\n "; // Exception has occurred return false; } } else { $err_message .= " Could not execute \"OpenFile\" in \"UpdateFileField\". <br>\n "; // Exception has occurred return false; } } else { $openmode = "r"; if ($fp = OpenFile($filename, $openmode, &$err_message)) { $content = GetContentFromFile($fp, $filename); $content_array = explode($closetag, $content); // echo "<br>\n Array count : " . count($content_array) . "<br>\n" ; reset($content_array); if (is_array($value_array)) { while (list($opentag, $value) = each($value_array)) { if (UpdateField($content, $opentag, $closetag, $content_array, $value, &$err_message) == false) { $err_message .= " Could not execute \"UpdateField\" in \"UpdateFileField\". <br>\n "; // Exception has occurred return false; } } } else { if (UpdateField($content, $opentag, $closetag, $content_array, $value_array, &$err_message) == false) { $err_message .= " Could not execute \"UpdateField\" in \"UpdateFileField\". <br>\n "; // Exception has occurred return false; } } // display ( $content_array ) ; $final_text = implode($closetag, $content_array); // echo "<br>\n" . $final_text . "<br>\n" ; return $final_text; } else { $err_message .= " Could not execute \"OpenFile\" in \"UpdateFileField\". <br>\n "; // Exception has occurred return false; } } }
<?php /* Include the new script for printing quotations in Portrait */ UpdateField('pagesecurity', 'script', 'InternalStockRequest.php', 'script=\'StockTransfers_departments.php\'', $db); UpdateDBNo(98, $db);
<?php /* Changes for factor company code to work */ DropConstraint('suppliers', 'suppliers_ibfk_4', $db); UpdateField('suppliers', 'factorcompanyid', 0, '`factorcompanyid`=1', $db); DeleteRecords('factorcompanies', "coyname='None'", $db); UpdateDBNo(14, $db);