|
From: <dai...@us...> - 2010-12-30 05:46:55
|
Revision: 4456
http://web-erp.svn.sourceforge.net/web-erp/?rev=4456&view=rev
Author: daintree
Date: 2010-12-30 05:46:48 +0000 (Thu, 30 Dec 2010)
Log Message:
-----------
Upgrade changes
Modified Paths:
--------------
trunk/MRP.php
trunk/PageSecurity.php
trunk/UpgradeDatabase.php
trunk/includes/ConnectDB.inc
trunk/includes/GetConfig.php
trunk/includes/session.inc
trunk/sql/mysql/upgrade3.11.1-4.00.sql
Modified: trunk/MRP.php
===================================================================
--- trunk/MRP.php 2010-12-29 23:18:49 UTC (rev 4455)
+++ trunk/MRP.php 2010-12-30 05:46:48 UTC (rev 4456)
@@ -24,17 +24,15 @@
$result = DB_query('DROP TABLE IF EXISTS bomlevels',$db);
$result = DB_query('DROP TABLE IF EXISTS levels',$db);
- $sql = 'CREATE TEMPORARY TABLE passbom (
- part char(20),
- sortpart text) DEFAULT CHARSET=utf8';
+ $sql = 'CREATE TEMPORARY TABLE passbom (part char(20),
+ sortpart text) DEFAULT CHARSET=utf8';
$ErrMsg = _('The SQL to to create passbom failed with the message');
$result = DB_query($sql,$db,$ErrMsg);
- $sql = 'CREATE TEMPORARY TABLE tempbom (
- parent char(20),
- component char(20),
- sortpart text,
- level int) DEFAULT CHARSET=utf8';
+ $sql = 'CREATE TEMPORARY TABLE tempbom (parent char(20),
+ component char(20),
+ sortpart text,
+ level int) DEFAULT CHARSET=utf8';
$result = DB_query($sql,$db,_('Create of tempbom failed because'));
// To create levels, first, find parts in bom that are top level assemblies.
// Do this by doing a LEFT JOIN from bom to bom (as bom2), linking
@@ -47,10 +45,10 @@
flush();
// This finds the top level
$sql = 'INSERT INTO passbom (part, sortpart)
- SELECT bom.component AS part,
- CONCAT(bom.parent,"%",bom.component) AS sortpart
- FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component
- WHERE bom2.component IS NULL';
+ SELECT bom.component AS part,
+ CONCAT(bom.parent,"%",bom.component) AS sortpart
+ FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component
+ WHERE bom2.component IS NULL';
$result = DB_query($sql,$db);
$lctr = 2;
@@ -82,9 +80,8 @@
$result = DB_query('ALTER TABLE passbom RENAME AS passbom2',$db);
$result = DB_query('DROP TABLE IF EXISTS passbom',$db);
- $sql = 'CREATE TEMPORARY TABLE passbom (
- part char(20),
- sortpart text) DEFAULT CHARSET=utf8';
+ $sql = 'CREATE TEMPORARY TABLE passbom (part char(20),
+ sortpart text) DEFAULT CHARSET=utf8';
$result = DB_query($sql,$db);
$sql = "INSERT INTO passbom (part, sortpart)
@@ -96,8 +93,8 @@
$sql = 'SELECT COUNT(*) FROM bom
- INNER JOIN passbom ON bom.parent = passbom.part
- GROUP BY bom.parent';
+ INNER JOIN passbom ON bom.parent = passbom.part
+ GROUP BY bom.parent';
$result = DB_query($sql,$db);
$myrow = DB_fetch_row($result);
@@ -144,23 +141,23 @@
eoq double NOT NULL default "0") DEFAULT CHARSET=utf8';
$result = DB_query($sql,$db);
$sql = 'INSERT INTO levels (part,
- level,
- leadtime,
- pansize,
- shrinkfactor,
- eoq)
- SELECT bomlevels.part,
- MAX(bomlevels.level),
- 0,
- pansize,
- shrinkfactor,
- stockmaster.eoq
- FROM bomlevels
- INNER JOIN stockmaster ON bomlevels.part = stockmaster.stockid
- GROUP BY bomlevels.part,
- pansize,
- shrinkfactor,
- stockmaster.eoq';
+ level,
+ leadtime,
+ pansize,
+ shrinkfactor,
+ eoq)
+ SELECT bomlevels.part,
+ MAX(bomlevels.level),
+ 0,
+ pansize,
+ shrinkfactor,
+ stockmaster.eoq
+ FROM bomlevels
+ INNER JOIN stockmaster ON bomlevels.part = stockmaster.stockid
+ GROUP BY bomlevels.part,
+ pansize,
+ shrinkfactor,
+ stockmaster.eoq';
$result = DB_query($sql,$db);
$sql = 'ALTER TABLE levels ADD INDEX part(part)';
$result = DB_query($sql,$db);
@@ -188,15 +185,15 @@
// Update leadtime in levels from purchdata. Do it twice so can make sure leadtime from preferred
// vendor is used
$sql = 'UPDATE levels,purchdata
- SET levels.leadtime = purchdata.leadtime
- WHERE levels.part = purchdata.stockid
- AND purchdata.leadtime > 0';
+ SET levels.leadtime = purchdata.leadtime
+ WHERE levels.part = purchdata.stockid
+ AND purchdata.leadtime > 0';
$result = DB_query($sql,$db);
$sql = 'UPDATE levels,purchdata
- SET levels.leadtime = purchdata.leadtime
- WHERE levels.part = purchdata.stockid
- AND purchdata.preferred = 1
- AND purchdata.leadtime > 0';
+ SET levels.leadtime = purchdata.leadtime
+ WHERE levels.part = purchdata.stockid
+ AND purchdata.preferred = 1
+ AND purchdata.leadtime > 0';
$result = DB_query($sql,$db);
prnMsg(_('Levels table has been created'),'info');
@@ -222,105 +219,100 @@
// requirement left and have to pass that down to the BOM parts using the
// CreateLowerLevelRequirement() function. Mostly do this so can distinguish the type
// of requirements for the MRPShortageReport so don't show double requirements.
- $sql = 'CREATE TABLE mrprequirements (
- part char(20),
- daterequired date,
- quantity double,
- mrpdemandtype varchar(6),
- orderno int(11),
- directdemand smallint,
- whererequired char(20)) DEFAULT CHARSET=utf8';
+ $sql = 'CREATE TABLE mrprequirements ( part char(20),
+ daterequired date,
+ quantity double,
+ mrpdemandtype varchar(6),
+ orderno int(11),
+ directdemand smallint,
+ whererequired char(20)) DEFAULT CHARSET=utf8';
$result = DB_query($sql,$db,_('Create of mrprequirements failed because'));
prnMsg(_('Loading requirements from sales orders'),'info');
flush();
- $sql = 'INSERT INTO mrprequirements
- (part,
- daterequired,
- quantity,
- mrpdemandtype,
- orderno,
- directdemand,
- whererequired)
- SELECT stkcode,
- deliverydate,
- (quantity - qtyinvoiced) AS netqty,
- "SO",
- salesorderdetails.orderno,
- "1",
- stkcode
- FROM salesorders, salesorderdetails
- WHERE salesorders.orderno = salesorderdetails.orderno
- AND (quantity - qtyinvoiced) > 0
- AND salesorderdetails.completed = 0
- AND salesorders.quotation = 0';
+ $sql = 'INSERT INTO mrprequirements (part,
+ daterequired,
+ quantity,
+ mrpdemandtype,
+ orderno,
+ directdemand,
+ whererequired)
+ SELECT stkcode,
+ deliverydate,
+ (quantity - qtyinvoiced) AS netqty,
+ "SO",
+ salesorderdetails.orderno,
+ "1",
+ stkcode
+ FROM salesorders, salesorderdetails
+ WHERE salesorders.orderno = salesorderdetails.orderno
+ AND (quantity - qtyinvoiced) > 0
+ AND salesorderdetails.completed = 0
+ AND salesorders.quotation = 0';
$result = DB_query($sql,$db);
prnMsg(_('Loading requirements from work orders'),'info');
flush();
// Definition of demand from SelectProduct.php
- $sql = 'INSERT INTO mrprequirements
- (part,
- daterequired,
- quantity,
- mrpdemandtype,
- orderno,
- directdemand,
- whererequired)
- SELECT worequirements.stockid,
- workorders.requiredby,
- qtypu*(woitems.qtyreqd - woitems.qtyrecd) AS netqty,
- "WO",
- woitems.wo,
- "1",
- parentstockid
- FROM woitems INNER JOIN worequirements
- ON woitems.stockid=worequirements.parentstockid
- INNER JOIN workorders
- ON woitems.wo=workorders.wo
- AND woitems.wo=worequirements.wo
- WHERE workorders.closed=0';
+ $sql = 'INSERT INTO mrprequirements (part,
+ daterequired,
+ quantity,
+ mrpdemandtype,
+ orderno,
+ directdemand,
+ whererequired)
+ SELECT worequirements.stockid,
+ workorders.requiredby,
+ qtypu*(woitems.qtyreqd - woitems.qtyrecd) AS netqty,
+ "WO",
+ woitems.wo,
+ "1",
+ parentstockid
+ FROM woitems INNER JOIN worequirements
+ ON woitems.stockid=worequirements.parentstockid
+ INNER JOIN workorders
+ ON woitems.wo=workorders.wo
+ AND woitems.wo=worequirements.wo
+ WHERE workorders.closed=0';
$result = DB_query($sql,$db);
- $sql = 'INSERT INTO mrprequirements
- (part,
- daterequired,
- quantity,
- mrpdemandtype,
- orderno,
- directdemand,
- whererequired)
- SELECT stockid,
- duedate,
- quantity,
- mrpdemandtype,
- demandid,
- "1",
- stockid
- FROM mrpdemands';
+ $sql = 'INSERT INTO mrprequirements (part,
+ daterequired,
+ quantity,
+ mrpdemandtype,
+ orderno,
+ directdemand,
+ whererequired)
+ SELECT stockid,
+ duedate,
+ quantity,
+ mrpdemandtype,
+ demandid,
+ "1",
+ stockid
+ FROM mrpdemands';
if ($_POST['usemrpdemands'] == 'y') {
$result = DB_query($sql,$db);
prnMsg(_('Loading requirements based on mrpdemands'),'info');
flush();
}
- $sql = 'INSERT INTO mrprequirements
- (part,
- daterequired,
- quantity,
- mrpdemandtype,
- orderno,
- directdemand,
- whererequired)
- SELECT stockid,
- NOW(),
- (reorderlevel - quantity) AS reordqty,
- "REORD",
- "1",
- "1",
- stockid
- FROM locstock
- WHERE reorderlevel > quantity';
+ $sql = 'INSERT INTO mrprequirements (part,
+ daterequired,
+ quantity,
+ mrpdemandtype,
+ orderno,
+ directdemand,
+ whererequired)
+ SELECT stockid,
+ NOW(),
+ (reorderlevel - quantity) AS reordqty,
+ "REORD",
+ "1",
+ "1",
+ stockid
+ FROM locstock
+ WHERE reorderlevel > quantity';
$result = DB_query($sql,$db);
prnMsg(_('Loading requirements based on reorder level'),'info');
flush();
@@ -334,108 +326,105 @@
$result = DB_query('DROP TABLE IF EXISTS mrpsupplies',$db);
// updateflag is set to 1 in UpdateSupplies if change date when matching requirements to
// supplies. Actually only change update flag in the array created from mrpsupplies
- $sql = 'CREATE TABLE mrpsupplies (
- id int(11) NOT NULL auto_increment,
- part char(20),
- duedate date,
- supplyquantity double,
- ordertype varchar(6),
- orderno int(11),
- mrpdate date,
- updateflag smallint(6),
- PRIMARY KEY (id)) DEFAULT CHARSET=utf8';
+ $sql = 'CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment,
+ part char(20),
+ duedate date,
+ supplyquantity double,
+ ordertype varchar(6),
+ orderno int(11),
+ mrpdate date,
+ updateflag smallint(6),
+ PRIMARY KEY (id)) DEFAULT CHARSET=utf8';
$result = DB_query($sql,$db,_('Create of mrpsupplies failed because'));
prnMsg(_('Loading supplies from purchase orders'),'info');
flush();
- $sql = 'INSERT INTO mrpsupplies
- (id,
- part,
- duedate,
- supplyquantity,
- ordertype,
- orderno,
- mrpdate,
- updateflag)
- SELECT Null,
- purchorderdetails.itemcode,
- purchorderdetails.deliverydate,
- (quantityord - quantityrecd) AS netqty,
- "PO",
- purchorderdetails.orderno,
- purchorderdetails.deliverydate,
- 0
- FROM purchorderdetails,
- purchorders
- WHERE purchorderdetails.orderno = purchorders.orderno
- AND purchorders.status != "Cancelled"
- AND(quantityord - quantityrecd) > 0';
+ $sql = 'INSERT INTO mrpsupplies (id,
+ part,
+ duedate,
+ supplyquantity,
+ ordertype,
+ orderno,
+ mrpdate,
+ updateflag)
+ SELECT Null,
+ purchorderdetails.itemcode,
+ purchorderdetails.deliverydate,
+ (quantityord - quantityrecd) AS netqty,
+ "PO",
+ purchorderdetails.orderno,
+ purchorderdetails.deliverydate,
+ 0
+ FROM purchorderdetails,
+ purchorders
+ WHERE purchorderdetails.orderno = purchorders.orderno
+ AND purchorders.status != "Cancelled"
+ AND purchorders.status != "Rejected"
+ AND(quantityord - quantityrecd) > 0';
$result = DB_query($sql,$db);
prnMsg(_('Loading supplies from inventory on hand'),'info');
flush();
// Set date for inventory already onhand to 0000-00-00 so it is first in sort
if ($_POST['location'][0] == 'All') {
- $whereloc = ' ';
+ $WhereLocation = ' ';
} elseif (sizeof($_POST['location']) == 1) {
- $whereloc = " AND loccode ='" . $_POST['location'][0] . "' ";
+ $WhereLocation = " AND loccode ='" . $_POST['location'][0] . "' ";
} else {
- $whereloc = " AND loccode IN(";
+ $WhereLocation = " AND loccode IN(";
$commactr = 0;
foreach ($_POST['location'] as $key => $value) {
- $whereloc .= "'" . $value . "'";
+ $WhereLocation .= "'" . $value . "'";
$commactr++;
if ($commactr < sizeof($_POST['location'])) {
- $whereloc .= ",";
+ $WhereLocation .= ",";
} // End of if
} // End of foreach
- $whereloc .= ')';
+ $WhereLocation .= ')';
}
- $sql = 'INSERT INTO mrpsupplies
- (id,
- part,
- duedate,
- supplyquantity,
- ordertype,
- orderno,
- mrpdate,
- updateflag)
- SELECT Null,
- stockid,
- "0000-00-00",
- SUM(quantity),
- "QOH",
- 1,
- "0000-00-00",
- 0
- FROM locstock
- WHERE quantity > 0 ' .
- $whereloc .
- 'GROUP BY stockid';
+ $sql = 'INSERT INTO mrpsupplies (id,
+ part,
+ duedate,
+ supplyquantity,
+ ordertype,
+ orderno,
+ mrpdate,
+ updateflag)
+ SELECT Null,
+ stockid,
+ "0000-00-00",
+ SUM(quantity),
+ "QOH",
+ 1,
+ "0000-00-00",
+ 0
+ FROM locstock
+ WHERE quantity > 0 ' .
+ $WhereLocation .
+ 'GROUP BY stockid';
$result = DB_query($sql,$db);
prnMsg(_('Loading supplies from work orders'),'info');
flush();
- $sql = 'INSERT INTO mrpsupplies
- (id,
- part,
- duedate,
- supplyquantity,
- ordertype,
- orderno,
- mrpdate,
- updateflag)
- SELECT Null,
- stockid,
- workorders.requiredby,
- (woitems.qtyreqd-woitems.qtyrecd) AS netqty,
- "WO",
- woitems.wo,
- workorders.requiredby,
- 0
- FROM woitems INNER JOIN workorders
- ON woitems.wo=workorders.wo
- WHERE workorders.closed=0';
+ $sql = 'INSERT INTO mrpsupplies (id,
+ part,
+ duedate,
+ supplyquantity,
+ ordertype,
+ orderno,
+ mrpdate,
+ updateflag)
+ SELECT Null,
+ stockid,
+ workorders.requiredby,
+ (woitems.qtyreqd-woitems.qtyrecd) AS netqty,
+ "WO",
+ woitems.wo,
+ workorders.requiredby,
+ 0
+ FROM woitems INNER JOIN workorders
+ ON woitems.wo=workorders.wo
+ WHERE workorders.closed=0';
$result = DB_query($sql,$db);
$sql = 'ALTER TABLE mrpsupplies ADD INDEX part(part)';
@@ -447,16 +436,15 @@
prnMsg(_('Creating planned orders table'),'info');
flush();
$result = DB_query('DROP TABLE IF EXISTS mrpplannedorders',$db);
- $sql = 'CREATE TABLE mrpplannedorders (
- id int(11) NOT NULL auto_increment,
- part char(20),
- duedate date,
- supplyquantity double,
- ordertype varchar(6),
- orderno int(11),
- mrpdate date,
- updateflag smallint(6),
- PRIMARY KEY (id))';
+ $sql = 'CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment,
+ part char(20),
+ duedate date,
+ supplyquantity double,
+ ordertype varchar(6),
+ orderno int(11),
+ mrpdate date,
+ updateflag smallint(6),
+ PRIMARY KEY (id))';
$result = DB_query($sql,$db,_('Create of mrpplannedorders failed because'));
// Find the highest and lowest level number
@@ -474,7 +462,7 @@
// part, that serves as a gross requirement for a lower level part, so will read down through
// the Bill of Materials to generate those requirements in function LevelNetting().
for ($level = $maxlevel; $level >= $minlevel; $level--) {
- $sql = 'SELECT * FROM levels WHERE level = "' . $level .'" LIMIT 50000'; //should cover most eventualities!!
+ $sql = 'SELECT * FROM levels WHERE level = "' . $level .'" LIMIT 50000'; //should cover most eventualities!! ... yes indeed :-)
prnMsg('</br>------ ' . _('Processing level') .' ' . $level . ' ------','info');
flush();
@@ -509,19 +497,19 @@
} // End of if
} // End of foreach
$sql = "INSERT INTO mrpparameters (runtime,
- location,
- pansizeflag,
- shrinkageflag,
- eoqflag,
- usemrpdemands,
- leeway)
- VALUES (NOW(),
- '" . $locparm . "',
- '" . $_POST['pansizeflag'] . "',
- '" . $_POST['shrinkageflag'] . "',
- '" . $_POST['eoqflag'] . "',
- '" . $_POST['usemrpdemands'] . "',
- '" . $_POST['Leeway'] . "')";
+ location,
+ pansizeflag,
+ shrinkageflag,
+ eoqflag,
+ usemrpdemands,
+ leeway)
+ VALUES (NOW(),
+ '" . $locparm . "',
+ '" . $_POST['pansizeflag'] . "',
+ '" . $_POST['shrinkageflag'] . "',
+ '" . $_POST['eoqflag'] . "',
+ '" . $_POST['usemrpdemands'] . "',
+ '" . $_POST['Leeway'] . "')";
$result = DB_query($sql,$db);
} else { // End of if submit isset
@@ -613,7 +601,7 @@
$sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $part . "'";
$result = DB_query($sql,$db);
$myrow=DB_fetch_row($result);
- $decimalplaces = $myrow[0];
+ $DecimalPlaces = $myrow[0];
// Load mrprequirements into $requirements array
$sql = "SELECT * FROM mrprequirements WHERE part = '" .$part. "' ORDER BY daterequired";
@@ -702,7 +690,7 @@
// Should the quantity be rounded?
if ($_POST['shrinkageflag'] == 'y' and $shrinkfactor > 0) {
$requirement['quantity'] = ($requirement['quantity'] * 100) / (100 - $shrinkfactor);
- $requirement['quantity'] = round($requirement['quantity'],$decimalplaces);
+ $requirement['quantity'] = round($requirement['quantity'],$DecimalPlaces);
}
if ($excessqty >= $requirement['quantity']) {
$plannedqty = 0;
Modified: trunk/PageSecurity.php
===================================================================
--- trunk/PageSecurity.php 2010-12-29 23:18:49 UTC (rev 4455)
+++ trunk/PageSecurity.php 2010-12-30 05:46:48 UTC (rev 4456)
@@ -1,6 +1,5 @@
<?php
-
include('includes/session.inc');
$title = _('Page Security Levels');
@@ -9,23 +8,24 @@
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/security.png" title="' . _('Page Security Levels') . '" alt="" />' . ' ' . $title.'</p><br />';
-if (isset($_POST['update'])) {
- foreach ($_POST as $key => $value) {
- if ($key!='update' and $key!='FormID') {
- $key=substr($key, 0, strlen($key)-4).'.php';
- $sql="UPDATE pagesecurity SET security='".$value."' WHERE script='".$key."'";
- $updateresult=DB_query($sql, $db);
+if (isset($_POST['Update'])) {
+ foreach ($_POST as $ScriptName => $PageSecurityValue) {
+ if ($ScriptName!='Update' and $ScriptName!='FormID') {
+ //$key=substr($key, 0, strlen($key)-4).'.php';
+ $sql="UPDATE scripts SET pagesecurity='".$PageSecurityValue."' WHERE script='".$ScriptName."'";
+ $UpdateResult=DB_query($sql, $db,_('Could not update the page security value for the script because'));
}
}
}
-$sql="SELECT script,
- security
- FROM pagesecurity";
+$sql='SELECT script,
+ pagesecurity,
+ description
+ FROM scripts';
$result=DB_query($sql, $db);
-echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">';
+echo '<br /><form method="post" id="PageSecurity" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<table class="selection">';
@@ -39,7 +39,7 @@
echo '<tr><td>'.$myrow['script'].'</td>';
echo '<td><select name="'.$myrow['script'].'">';
while ($mytokenrow=DB_fetch_array($TokenResult)) {
- if ($mytokenrow['tokenid']==$myrow['security']) {
+ if ($mytokenrow['tokenid']==$myrow['pagesecurity']) {
echo '<option selected="True" value="'.$mytokenrow['tokenid'].'">'.htmlentities($mytokenrow['tokenname']).'</option>';
} else {
echo '<option value="'.$mytokenrow['tokenid'].'">'.htmlentities($mytokenrow['tokenname']).'</option>';
@@ -51,8 +51,7 @@
echo '</table><br />';
-echo '<div class="centre"><input type="submit" name="update" value="'._('Update Security Levels').'" /></div><br /></form>';
+echo '<div class="centre"><input type="submit" name="Update" value="'._('Update Security Levels').'" /></div><br /></form>';
include('includes/footer.inc');
-
?>
\ No newline at end of file
Modified: trunk/UpgradeDatabase.php
===================================================================
--- trunk/UpgradeDatabase.php 2010-12-29 23:18:49 UTC (rev 4455)
+++ trunk/UpgradeDatabase.php 2010-12-30 05:46:48 UTC (rev 4456)
@@ -7,9 +7,12 @@
if (empty($_POST['DoUpgrade'])){
- if (!isset($_SESSION['VersionNumber')){
- prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('the database is a prior version and upgrade scripts are required to be run. Upgrades to the database prior to ')
- prnMsg(_('This script will run perform any modifications to the database since v 3.11 required to allow the additional functionality in later scripts'),'info');
+ if (!isset($_SESSION['VersionNumber'])){
+ prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('and the database version is not actually recorded at this version'),'info');
+ } else {
+ prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('and the database version is') . ' ' . $_SESSION['VersionNumber'],'info');
+ }
+ prnMsg(_('This script will run perform any modifications to the database required to allow the additional functionality in later scripts'),'info');
echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>";
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
@@ -82,6 +85,10 @@
echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '.
_('Entry has already been done').'</td></tr>';
break;
+ case 1064:
+ echo '<tr><td>' . $sql . '</td><td bgcolor="red">'._('Note').' - '.
+ _('SQL syntax error. The SQL error message is'). ' ' . DB_error_msg($db) . '</td></tr>';
+ break;
case 1068:
echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '.
_('Primary key already exists').'</td></tr>';
@@ -92,7 +99,7 @@
break;
default:
echo '<tr><td>' . $sql . '</td><td bgcolor="red">'._('Failure').' - '.
- _('Error number').' - '.DB_error_no($db) .'</td></tr>';
+ _('Error number').' - '.DB_error_no($db) .' ' . DB_error_msg($db) . '</td></tr>';
break;
}
unset($sql);
Modified: trunk/includes/ConnectDB.inc
===================================================================
--- trunk/includes/ConnectDB.inc 2010-12-29 23:18:49 UTC (rev 4455)
+++ trunk/includes/ConnectDB.inc 2010-12-30 05:46:48 UTC (rev 4456)
@@ -4,7 +4,7 @@
* this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run
* if VersionNumber is < $Version then the DB update script is run */
-$Version='4.00'; //must update manually every time there is a DB change
+$Version='3.12.1'; //must update manually every time there is a DB change
require_once ($PathPrefix .'includes/MiscFunctions.php');
if (!isset($_SESSION['DatabaseName'])){
Modified: trunk/includes/GetConfig.php
===================================================================
--- trunk/includes/GetConfig.php 2010-12-29 23:18:49 UTC (rev 4455)
+++ trunk/includes/GetConfig.php 2010-12-30 05:46:48 UTC (rev 4456)
@@ -25,7 +25,7 @@
$sql='SELECT script, pagesecurity FROM scripts';
$ErrMsg = _('Could not get the page security details from the database because');
- $result=DB_query($sql, $db);
+ $result=DB_query($sql, $db,_('Could not get page security details from the scripts table because'));
while ($myrow=DB_fetch_array($result)) {
$_SESSION['PageSecurity'][$myrow['script']]=$myrow['pagesecurity'];
Modified: trunk/includes/session.inc
===================================================================
--- trunk/includes/session.inc 2010-12-29 23:18:49 UTC (rev 4455)
+++ trunk/includes/session.inc 2010-12-30 05:46:48 UTC (rev 4456)
@@ -115,12 +115,11 @@
/*User is logged in so get configuration parameters - save in session*/
include($PathPrefix . 'includes/GetConfig.php');
-if (isset($_SESSION[basename($_SERVER['SCRIPT_NAME'])])) {
- /*The page security variable is now retrieved from the database in GetConfig.php and stored in the $SESSION['PageSecurity'] array
- * the key for the array is the script name - the script name is retrieved from the basename ($_SERVER['SCRIPT_NAME'])
- */
- $PageSecurity = $_SESSION['PageSecurity'][basename($_SERVER['SCRIPT_NAME'])];
-}
+/*The page security variable is now retrieved from the database in GetConfig.php and stored in the $SESSION['PageSecurity'] array
+ * the key for the array is the script name - the script name is retrieved from the basename ($_SERVER['SCRIPT_NAME'])
+ */
+$PageSecurity = $_SESSION['PageSecurity'][basename($_SERVER['SCRIPT_NAME'])];
+
/*If the Code $Version - held in ConnectDB.inc is > than the Database VersionNumber held in config table then do upgrades */
if (($Version>$_SESSION['VersionNumber']) and (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php')) {
header('Location: UpgradeDatabase.php');
@@ -311,12 +310,8 @@
return $Password;
}
}
-if (isset($_SESSION['VersionNumber'])) {
- $Version = $_SESSION['VersionNumber'];
-} else {
- $Version='';
-}
+
if (sizeof($_POST) > 0) {
if (!isset($_POST['FormID']) or ($_POST['FormID'] != $_SESSION['FormID'])) {
$title = _('Error in form verificationm');
Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql
===================================================================
--- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-29 23:18:49 UTC (rev 4455)
+++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-30 05:46:48 UTC (rev 4456)
@@ -440,11 +440,12 @@
`longdescription` text NOT NULL,
`depntype` int(11) NOT NULL DEFAULT '1',
`depnrate` double NOT NULL,
- `disposaldate` date NOT NULL DEFAULT '0000-00-00'
+ `disposaldate` date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (`assetid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('41', 'Asset Addition', '1');
INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('42', 'Asset Category Change', '1');
INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('43', 'Delete w/down asset', '1');
@@ -802,4 +803,6 @@
('Z_UploadForm.php', 15, 'Utility to upload a file to a remote server'),
('Z_UploadResult.php', 15, 'Utility to upload a file to a remote server');
-INSERT INTO config (confname, confvalue) VALUES ('VersionNumber', '4.00');
+INSERT INTO config (confname, confvalue) VALUES ('VersionNumber', '3.12.0');
+UPDATE config SET confvalue='3.12.1' WHERE confname='VersionNumber';
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|