|
From: <dai...@us...> - 2011-08-20 05:52:46
|
Revision: 4663
http://web-erp.svn.sourceforge.net/web-erp/?rev=4663&view=rev
Author: daintree
Date: 2011-08-20 05:52:38 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
19/8/11 Phil: Fixed bug in Stocks.php should have used Date($_SESSION['DefaultDateFormat']) instead of Date('Y-m-d') inside GetPeriod function as pointed out by Ricard
Modified Paths:
--------------
trunk/Stocks.php
trunk/UpgradeDatabase.php
trunk/Z_ChangeStockCode.php
trunk/Z_CopyBOM.php
trunk/doc/Change.log
trunk/includes/ConnectDB.inc
Modified: trunk/Stocks.php
===================================================================
--- trunk/Stocks.php 2011-08-19 10:13:15 UTC (rev 4662)
+++ trunk/Stocks.php 2011-08-20 05:52:38 UTC (rev 4663)
@@ -64,7 +64,7 @@
if ($UploadTheFile=='Yes'){
$result = move_uploaded_file($_FILES['ItemPicture']['tmp_name'], $filename);
- $message = ($result)?_('File url') ."<a href='". $filename ."'>" . $filename . '</a>' : _('Something is wrong with uploading a file');
+ $message = ($result)?_('File url') .'<a href="' . $filename .'">' . $filename . '</a>' : _('Something is wrong with uploading a file');
}
}
@@ -307,7 +307,10 @@
/*now check that if it was Manufac, Phantom or Purchased and is being changed to assembly or kitset, it is not a component on an existing BOM */
if (($OldMBFlag=='M' OR $OldMBFlag =='B' OR $OldMBFlag=='D' OR $OldMBFlag=='G') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K')) {
- $sql = "SELECT COUNT(*) FROM bom WHERE component = '".$StockID."' GROUP BY component";
+ $sql = "SELECT COUNT(*)
+ FROM bom
+ WHERE component = '".$StockID."'
+ GROUP BY component";
$result = DB_query($sql,$db);
$ChkBOM = DB_fetch_row($result);
if ($ChkBOM[0]!=0){
@@ -397,7 +400,7 @@
VALUES ( 0,
'" . $JournalNo . "',
'" . Date('Y-m-d') . "',
- '" . GetPeriod(Date('Y-m-d'),$db,true) . "',
+ '" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . "',
'" . $NewStockAccount . "',
'" . $StockID . ' ' . _('Change stock category') . "',
'" . ($UnitCost* $StockQtyRow[0]) . "'";
@@ -414,7 +417,7 @@
VALUES ( 0,
'" . $JournalNo . "',
'" . Date('Y-m-d') . "',
- '" . GetPeriod(Date('Y-m-d'),$db,true) . "',
+ '" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . "',
'" . $OldStockAccount . "',
'" . $StockID . ' ' . _('Change stock category') . "',
'" . (-$UnitCost* $StockQtyRow[0]) . "'";
@@ -452,7 +455,7 @@
VALUES ( 0,
'" . $JournalNo . "',
'" . Date('Y-m-d') . "',
- '" . GetPeriod(Date('Y-m-d'),$db,true) . "',
+ '" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . "',
'" . $NewWIPAct . "',
'" . $StockID . ' ' . _('Change stock category') . "',
'" . $WIPValue . "'";
@@ -469,7 +472,7 @@
VALUES ( 0,
'" . $JournalNo . "',
'" . Date('Y-m-d') . "',
- '" . GetPeriod(Date('Y-m-d'),true) . "',
+ '" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . "',
'" . $OldWIPAccount . "',
'" . $StockID . ' ' . _('Change stock category') . "',
'" . (-$WIPValue) . "'";
Modified: trunk/UpgradeDatabase.php
===================================================================
--- trunk/UpgradeDatabase.php 2011-08-19 10:13:15 UTC (rev 4662)
+++ trunk/UpgradeDatabase.php 2011-08-20 05:52:38 UTC (rev 4663)
@@ -34,7 +34,7 @@
if ($_SESSION['VersionNumber']=='4.00RC1'){
$_SESSION['VersionNumber']='3.12';
}
- if ( $_SESSION['VersionNumber'] == $Version){
+ if (strcmp($Version,$_SESSION['VersionNumber'])==0){
prnMsg(_('The database is up to date, there are no upgrades to perform'),'info');
} else {
prnMsg(_('This script will perform any modifications to the database required to allow the additional functionality in later scripts.') . '<br />' . _('The webERP code is version') . ' ' . $Version . ' ' . _('and the database version is') . ' ' . $_SESSION['VersionNumber'] . '<br /><a target="_blank" href="' . $rootpath . '/BackupDatabase.php">' ._('Click to do a database backup now before proceeding!') . '</a>','info');
@@ -111,6 +111,9 @@
case '4.04.5':
$SQLScripts[] = './sql/mysql/upgrade4.04.5-4.05.sql';
case '4.05':
+ case '4.05.1':
+ $SQLScripts[] = './sql/mysql/upgrade4.05-4.06.sql';
+ case '4.06':
break;
} //end switch
}
Modified: trunk/Z_ChangeStockCode.php
===================================================================
--- trunk/Z_ChangeStockCode.php 2011-08-19 10:13:15 UTC (rev 4662)
+++ trunk/Z_ChangeStockCode.php 2011-08-20 05:52:38 UTC (rev 4663)
@@ -52,7 +52,6 @@
longdescription,
units,
mbflag,
- lastcurcostdate,
actualcost,
lastcost,
materialcost,
@@ -73,7 +72,6 @@
longdescription,
units,
mbflag,
- lastcurcostdate,
actualcost,
lastcost,
materialcost,
Modified: trunk/Z_CopyBOM.php
===================================================================
--- trunk/Z_CopyBOM.php 2011-08-19 10:13:15 UTC (rev 4662)
+++ trunk/Z_CopyBOM.php 2011-08-20 05:52:38 UTC (rev 4663)
@@ -6,33 +6,30 @@
*/
/* $Id$*/
-//$PageSecurity=9;
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
if(isset($_POST['Submit'])) {
- $stkid = $_POST['stkid'];
+ $StkID = $_POST['StkID'];
$type = $_POST['type'];
- $newstkid = '';
+ $newStkID = '';
- if($type == 'N')
- $newstkid = $_POST['tostkid'];
- else
- $newstkid = $_POST['exstkid'];
+ if($type == 'N') {
+ $newStkID = $_POST['toStkID'];
+ } else {
+ $newStkID = $_POST['exStkID'];
+ }
+ $result = DB_query('begin', $db);
- $result = DB_query("begin", $db);
-
- if($type == 'N')
- {
+ if($type == 'N') {
/* duplicate rows into stockmaster */
- $sql = "insert into stockmaster
- select '".$newstkid."' as stockid,
+ $sql = "INSERT INTO stockmaster
+ select '".$newStkID."' as stockid,
categoryid,
description,
longdescription,
units,
mbflag,
- lastcurcostdate,
actualcost,
lastcost,
materialcost,
@@ -51,32 +48,31 @@
appendfile,
perishable,
decimalplaces
- from stockmaster
- where stockid='".$stkid."';";
+ FROM stockmaster
+ WHERE stockid='".$StkID."';";
$result = DB_query($sql, $db);
}
else
{
- $sql = "SELECT lastcurcostdate, actualcost, lastcost, materialcost, labourcost, overheadcost, lowestlevel
- FROM stockmaster WHERE stockid='".$stkid."';";
+ $sql = "SELECT actualcost, lastcost, materialcost, labourcost, overheadcost, lowestlevel
+ FROM stockmaster WHERE stockid='".$StkID."';";
$result = DB_query($sql, $db);
$row = DB_fetch_row($result);
- $sql = "update stockmaster set
- lastcurcostdate = '".$row[0]."',
- actualcost = ".$row[1].",
- lastcost = ".$row[2].",
- materialcost = ".$row[3].",
- labourcost = ".$row[4].",
- overheadcost = ".$row[5].",
- lowestlevel = ".$row[6]."
- where stockid='".$newstkid."';";
+ $sql = "UPDATE stockmaster SET
+ actualcost = ".$row[0].",
+ lastcost = ".$row[1].",
+ materialcost = ".$row[2].",
+ labourcost = ".$row[3].",
+ overheadcost = ".$row[4].",
+ lowestlevel = ".$row[5]."
+ WHERE stockid='".$newStkID."';";
$result = DB_query($sql, $db);
}
- $sql = "insert into bom
- select '".$newstkid."' as parent,
+ $sql = "INSERT INTO bom
+ SELECT '".$newStkID."' as parent,
component,
workcentreadded,
loccode,
@@ -84,25 +80,25 @@
effectiveto,
quantity,
autoissue
- from bom
- where parent='".$stkid."';";
+ FROM bom
+ WHERE parent='".$StkID."';";
$result = DB_query($sql, $db);
if($type == 'N')
{
- $sql = "insert into locstock
- select loccode, '".$newstkid."' as stockid,0 as quantity,
- reorderlevel
- from locstock
- where stockid='".$stkid."';";
+ $sql = "INSERT INTO locstock
+ SELECT loccode, '".$newStkID."' as stockid,0 as quantity,
+ reorderlevel
+ FROM locstock
+ WHERE stockid='".$StkID."';";
$result = DB_query($sql, $db);
}
- $result = DB_query('commit', $db);
+ DB_Txn_Commit($db);
- UpdateCost($db, $newstkid);
+ UpdateCost($db, $newStkID);
- header('Location: BOMs.php?Select='.$newstkid);
+ header('Location: BOMs.php?Select='.$newStkID);
}
else
@@ -110,20 +106,19 @@
$title = _('UTILITY PAGE To Copy a BOM');
include('includes/header.inc');
- echo "<form method=\"post\" action=\"Z_CopyBOM.php\">";
+ echo '<form method="post" action="Z_CopyBOM.php">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
$sql = "SELECT stockid, description FROM stockmaster WHERE stockid IN (SELECT DISTINCT parent FROM bom) AND mbflag IN ('M', 'A', 'K');";
$result = DB_query($sql, $db);
- echo "<p>"._("From Stock ID");
- echo ": <select name=\"stkid\">";
+ echo '<p>'._('From Stock ID') . ': <select name="StkID">';
while($row = DB_fetch_row($result))
{
echo "<option value=\"$row[0]\">".$row[0]." -- ".$row[1]."</option>";
}
echo "</select><br/><input type=\"radio\" name=\"type\" value=\"N\" checked=\"\"/>"._(" To New Stock ID");
- echo ": <input type=\"text\" maxlength=\"20\" name=\"tostkid\"/>";
+ echo ": <input type=\"text\" maxlength=\"20\" name=\"toStkID\"/>";
$sql = "SELECT stockid, description FROM stockmaster WHERE stockid NOT IN (SELECT DISTINCT parent FROM bom) AND mbflag IN ('M', 'A', 'K');";
$result = DB_query($sql, $db);
@@ -131,7 +126,7 @@
if(DB_num_rows($result) > 0)
{
echo "<br/><input type=\"radio\" name=\"type\" value=\"E\"/>"._("To Existing Stock ID");
- echo ": <select name=\"exstkid\">";
+ echo ": <select name=\"exStkID\">";
while($row = DB_fetch_row($result))
{
echo "<option value=\"$row[0]\">".$row[0]." -- ".$row[1]."</option>";
@@ -141,6 +136,6 @@
echo "</p>";
echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\"/></p>";
- include("includes/footer.inc");
+ include('includes/footer.inc');
}
?>
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2011-08-19 10:13:15 UTC (rev 4662)
+++ trunk/doc/Change.log 2011-08-20 05:52:38 UTC (rev 4663)
@@ -1,5 +1,8 @@
webERP Change Log
+19/8/11 Phil: Fixed bug in Stocks.php should have used Date($_SESSION['DefaultDateFormat']) instead of Date('Y-m-d') inside GetPeriod function as pointed out by Ricard
+16/8/11 Tim: SelectCustomer.php fixed selection of customer where the first one was selected needed to kick off count at 0.
+19/8/11 Phil: Remove redundant field stockmaster.lastcurcostdate
19/8/11 Ricard: Fine tuning formatting PDFStockNegatives.php
19/8/11 Carlos Urbieta Cabrera: security.png image was missing now added
14/8/11 Phil: SystemParameters.php default ProhibitPostingsBefore to 1900-01-01 when no default is currently set - can cause errors at the moment as defaults to the latest period if not previously set.
Modified: trunk/includes/ConnectDB.inc
===================================================================
--- trunk/includes/ConnectDB.inc 2011-08-19 10:13:15 UTC (rev 4662)
+++ trunk/includes/ConnectDB.inc 2011-08-20 05:52:38 UTC (rev 4663)
@@ -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.05'; //must update manually every time there is a DB change
+$Version='4.05.1'; //must update manually every time there is a DB change
require_once ($PathPrefix .'includes/MiscFunctions.php');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|