[Weberp-svn] SF.net SVN: weberp:[8861] trunk
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2012-05-09 01:37:47
|
Revision: 8861 http://weberp.svn.sourceforge.net/weberp/?rev=8861&view=rev Author: tim_schofield Date: 2012-05-09 01:37:41 +0000 (Wed, 09 May 2012) Log Message: ----------- Have a unique identifier for each instance of adjustment object Modified Paths: -------------- trunk/StockAdjustments.php trunk/StockAdjustmentsControlled.php trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsKeyed.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/StockAdjustments.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -11,46 +11,53 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +if (empty($_GET['identifier'])) { + /*unique session identifier to ensure that there is no conflict with other order entry sessions on the same machine */ + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; +} + if (isset($_GET['NewAdjustment'])){ - unset($_SESSION['Adjustment']); - $_SESSION['Adjustment'] = new StockAdjustment(); + unset($_SESSION['Adjustment'.$identifier]); + $_SESSION['Adjustment'.$identifier] = new StockAdjustment(); } -if (!isset($_SESSION['Adjustment'])){ - $_SESSION['Adjustment'] = new StockAdjustment(); +if (!isset($_SESSION['Adjustment'.$identifier])){ + $_SESSION['Adjustment'.$identifier] = new StockAdjustment(); } $NewAdjustment = false; if (isset($_GET['StockID'])){ $StockID = trim(mb_strtoupper($_GET['StockID'])); - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($StockID)); - $result = DB_query("SELECT description, controlled, serialised, decimalplaces FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + $_SESSION['Adjustment'.$identifier]->StockID = trim(mb_strtoupper($StockID)); + $result = DB_query("SELECT description, controlled, serialised, decimalplaces FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "'",$db); $myrow = DB_fetch_array($result); - $_SESSION['Adjustment']->ItemDescription = $myrow['description']; - $_SESSION['Adjustment']->Controlled = $myrow['controlled']; - $_SESSION['Adjustment']->Serialised = $myrow['serialised']; - $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; - $_SESSION['Adjustment']->SerialItems = array(); - if (!isset($_SESSION['Adjustment']->Quantity)or !is_numeric($_SESSION['Adjustment']->Quantity)){ - $_SESSION['Adjustment']->Quantity=0; + $_SESSION['Adjustment'.$identifier]->ItemDescription = $myrow['description']; + $_SESSION['Adjustment'.$identifier]->Controlled = $myrow['controlled']; + $_SESSION['Adjustment'.$identifier]->Serialised = $myrow['serialised']; + $_SESSION['Adjustment'.$identifier]->DecimalPlaces = $myrow['decimalplaces']; + $_SESSION['Adjustment'.$identifier]->SerialItems = array(); + if (!isset($_SESSION['Adjustment'.$identifier]->Quantity)or !is_numeric($_SESSION['Adjustment'.$identifier]->Quantity)){ + $_SESSION['Adjustment'.$identifier]->Quantity=0; } $NewAdjustment = true; } elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) and $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + if(isset($_POST['StockID']) and $_POST['StockID'] != $_SESSION['Adjustment'.$identifier]->StockID){ $NewAdjustment = true; - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); + $_SESSION['Adjustment'.$identifier]->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); } - $_SESSION['Adjustment']->tag = $_POST['tag']; - $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; - $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; + $_SESSION['Adjustment'.$identifier]->tag = $_POST['tag']; + $_SESSION['Adjustment'.$identifier]->Narrative = $_POST['Narrative']; + $_SESSION['Adjustment'.$identifier]->StockLocation = $_POST['StockLocation']; if ($_POST['Quantity']==''){ $_POST['Quantity']=0; } else { $_POST['Quantity'] = filter_number_input($_POST['Quantity']); } - $_SESSION['Adjustment']->Quantity = $_POST['Quantity']; + $_SESSION['Adjustment'.$identifier]->Quantity = $_POST['Quantity']; } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>'; @@ -67,9 +74,16 @@ $ErrMsg=_('The stock information cannot be retrieved because'); $DbgMsg=_('The SQL to get the stock description was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class="selection"><tr><th>'._('Stock Code').'</th><th>'._('Stock Description').'</th></tr>'; + echo '<table class="selection"> + <tr> + <th>'._('Stock Code').'</th> + <th>'._('Stock Description').'</th> + </tr>'; while ($myrow = DB_fetch_array($result)) { - echo '<tr><td>'.$myrow['stockid'].'</td><td>'.$myrow['description'].'</td><td><a href="StockAdjustments.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'">'._('Adjust').'</a></tr>'; + echo '<tr> + <td>'.$myrow['stockid'].'</td> + <td>'.$myrow['description'].'</td> + <td><a href="StockAdjustments.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&identifier=' . $identifier . '">'._('Adjust').'</a></tr>'; } echo '</table>'; include('includes/footer.inc'); @@ -79,28 +93,28 @@ if (isset($_POST['EnterAdjustment'])){ $InputError = false; /*Start by hoping for the best */ - $result = DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + $result = DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "'",$db); if (DB_num_rows($result)==0) { prnMsg( _('The entered item code does not exist'),'error'); $InputError = true; - } elseif (!is_numeric($_SESSION['Adjustment']->Quantity)){ + } elseif (!is_numeric($_SESSION['Adjustment'.$identifier]->Quantity)){ prnMsg( _('The quantity entered must be numeric'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Quantity==0){ + } elseif ($_SESSION['Adjustment'.$identifier]->Quantity==0){ prnMsg( _('The quantity entered cannot be zero') . '. ' . _('There would be no adjustment to make'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Controlled==1 AND count($_SESSION['Adjustment']->SerialItems)==0) { + } elseif ($_SESSION['Adjustment'.$identifier]->Controlled==1 AND count($_SESSION['Adjustment'.$identifier]->SerialItems)==0) { prnMsg( _('The item entered is a controlled item that requires the detail of the serial numbers or batch references to be adjusted to be entered'),'error'); $InputError = true; } if ($_SESSION['ProhibitNegativeStock']==1){ $SQL = "SELECT quantity FROM locstock - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "'"; $CheckNegResult=DB_query($SQL,$db); $CheckNegRow = DB_fetch_array($CheckNegResult); - if ($CheckNegRow['quantity']+$_SESSION['Adjustment']->Quantity <0){ + if ($CheckNegRow['quantity']+$_SESSION['Adjustment'.$identifier]->Quantity <0){ $InputError=true; prnMsg(_('The system parameters are set to prohibit negative stocks. Processing this stock adjustment would result in negative stock at this location. This adjustment will not be processed.'),'error'); } @@ -119,8 +133,8 @@ // Need to get the current location quantity will need it later for the stock movement $SQL="SELECT locstock.quantity FROM locstock - WHERE locstock.stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode= '" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE locstock.stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode= '" . $_SESSION['Adjustment'.$identifier]->StockLocation . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result)==1){ $LocQtyRow = DB_fetch_array($Result); @@ -141,15 +155,15 @@ qty, newqoh) VALUES ( - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . "', 17, '" . $AdjustmentNumber . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + '" . $_SESSION['Adjustment'.$identifier]->StockLocation . "', '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', - '" . $_SESSION['Adjustment']->Narrative ."', - '" . $_SESSION['Adjustment']->Quantity . "', - '" . ($QtyOnHandPrior + $_SESSION['Adjustment']->Quantity) . "' + '" . $_SESSION['Adjustment'.$identifier]->Narrative ."', + '" . $_SESSION['Adjustment'.$identifier]->Quantity . "', + '" . ($QtyOnHandPrior + $_SESSION['Adjustment'.$identifier]->Quantity) . "' )"; @@ -163,8 +177,8 @@ /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ - if ($_SESSION['Adjustment']->Controlled ==1){ - foreach($_SESSION['Adjustment']->SerialItems as $Item){ + if ($_SESSION['Adjustment'.$identifier]->Controlled ==1){ + foreach($_SESSION['Adjustment'.$identifier]->SerialItems as $Item){ /*We need to add or update the StockSerialItem record and The StockSerialMoves as well */ @@ -172,8 +186,8 @@ $SQL = "SELECT stockid FROM stockserialitems WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('Unable to determine if the serial item exists'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -183,8 +197,8 @@ $SQL = "UPDATE stockserialitems SET quantity= quantity + " . $Item->BundleQty . " WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); @@ -197,8 +211,8 @@ serialno, qualitytext, quantity) - VALUES ('" . $_SESSION['Adjustment']->StockID . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + VALUES ('" . $_SESSION['Adjustment'.$identifier]->StockID . "', + '" . $_SESSION['Adjustment'.$identifier]->StockLocation . "', '" . $Item->BundleRef . "', '', '" . $Item->BundleQty . "' @@ -217,7 +231,7 @@ serialno, moveqty) VALUES ('" . $StkMoveNo . "', - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . "', '" . $Item->BundleRef . "', '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); @@ -229,18 +243,18 @@ - $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment']->Quantity . "' - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment'.$identifier]->Quantity . "' + WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the stock record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment']->StandardCost > 0){ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment'.$identifier]->StandardCost > 0){ - $StockGLCodes = GetStockGLCode($_SESSION['Adjustment']->StockID,$db); + $StockGLCodes = GetStockGLCode($_SESSION['Adjustment'.$identifier]->StockID,$db); $SQL = "INSERT INTO gltrans (type, typeno, @@ -255,10 +269,10 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity) . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . - $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . $_SESSION['Adjustment'.$identifier]->StandardCost * -($_SESSION['Adjustment'.$identifier]->Quantity) . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . " x " . $_SESSION['Adjustment'.$identifier]->Quantity . " @ " . + $_SESSION['Adjustment'.$identifier]->StandardCost . " " . $_SESSION['Adjustment'.$identifier]->Narrative . "', + '" . $_SESSION['Adjustment'.$identifier]->tag . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -278,9 +292,9 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . $_SESSION['Adjustment'.$identifier]->StandardCost * $_SESSION['Adjustment'.$identifier]->Quantity . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . " x " . $_SESSION['Adjustment'.$identifier]->Quantity . " @ " . $_SESSION['Adjustment'.$identifier]->StandardCost . " " . $_SESSION['Adjustment'.$identifier]->Narrative . "', + '" . $_SESSION['Adjustment'.$identifier]->tag . "' )"; $Errmsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -290,36 +304,36 @@ $Result = DB_Txn_Commit($db); - $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . $_SESSION['Adjustment']->Quantity ; + $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment'.$identifier]->StockID . ' - ' . $_SESSION['Adjustment'.$identifier]->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment'.$identifier]->StockLocation .' '. _('for a quantity of') . ' ' . $_SESSION['Adjustment'.$identifier]->Quantity ; prnMsg( $ConfirmationText,'success'); if ($_SESSION['InventoryManagerEmail']!=''){ $ConfirmationText = $ConfirmationText . ' ' . _('by user') . ' ' . $_SESSION['UserID'] . ' ' . _('at') . ' ' . Date('Y-m-d H:i:s'); - $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID; + $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment'.$identifier]->StockID; mail($_SESSION['InventoryManagerEmail'],$EmailSubject,$ConfirmationText); } - unset ($_SESSION['Adjustment']); + unset ($_SESSION['Adjustment'.$identifier]); } /* end if there was no input error */ }/* end if the user hit enter the adjustment */ -echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; +echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (!isset($_SESSION['Adjustment'])) { +if (!isset($_SESSION['Adjustment'.$identifier])) { $StockID=''; $Controlled= 0; $Quantity = 0; } else { - $StockID = $_SESSION['Adjustment']->StockID; - $Controlled = $_SESSION['Adjustment']->Controlled; - $Quantity = $_SESSION['Adjustment']->Quantity; + $StockID = $_SESSION['Adjustment'.$identifier]->StockID; + $Controlled = $_SESSION['Adjustment'.$identifier]->Controlled; + $Quantity = $_SESSION['Adjustment'.$identifier]->Quantity; $sql="SELECT materialcost, labourcost, overheadcost, units FROM stockmaster WHERE stockid='".$StockID."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); - $_SESSION['Adjustment']->PartUnit=$myrow['units']; - $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $_SESSION['Adjustment'.$identifier]->PartUnit=$myrow['units']; + $_SESSION['Adjustment'.$identifier]->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; } echo '<br /><table class="selection">'; echo '<tr><th colspan="4" class="header">'._('Adjustment Details').'</th></tr>'; @@ -342,10 +356,10 @@ echo '<input type="text" name="StockCode" size="21" value="" maxlength="20" />'; } echo '</td><td><button type="submit" name="CheckCode">'._('Check Part').'</button></td></tr>'; -if (isset($_SESSION['Adjustment']) and mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ - echo '<tr><td colspan="3"><font size="3">' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . - $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . - locale_money_format($_SESSION['Adjustment']->StandardCost,$_SESSION['CompanyRecord']['currencydefault']) . '</font></td></tr>'; +if (isset($_SESSION['Adjustment'.$identifier]) and mb_strlen($_SESSION['Adjustment'.$identifier]->ItemDescription)>1){ + echo '<tr><td colspan="3"><font size="3">' . $_SESSION['Adjustment'.$identifier]->ItemDescription . ' ('._('In Units of').' ' . + $_SESSION['Adjustment'.$identifier]->PartUnit . ' ) - ' . _('Unit Cost').' = ' . + locale_money_format($_SESSION['Adjustment'.$identifier]->StandardCost,$_SESSION['CompanyRecord']['currencydefault']) . '</font></td></tr>'; } echo '<tr><td>'. _('Adjustment to Stock At Location').':</td><td><select name="StockLocation"> '; @@ -353,8 +367,8 @@ $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_SESSION['Adjustment']->StockLocation)){ - if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ + if (isset($_SESSION['Adjustment'.$identifier]->StockLocation)){ + if ($myrow['loccode'] == $_SESSION['Adjustment'.$identifier]->StockLocation){ echo '<option selected="True" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -368,26 +382,26 @@ } echo '</select></td></tr>'; -if (isset($_SESSION['Adjustment']) and !isset($_SESSION['Adjustment']->Narrative)) { - $_SESSION['Adjustment']->Narrative = ''; +if (isset($_SESSION['Adjustment'.$identifier]) and !isset($_SESSION['Adjustment'.$identifier]->Narrative)) { + $_SESSION['Adjustment'.$identifier]->Narrative = ''; } echo '<tr><td>'. _('Comments On Why').':</td> - <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $_SESSION['Adjustment']->Narrative . '" /></td></tr>'; + <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $_SESSION['Adjustment'.$identifier]->Narrative . '" /></td></tr>'; echo '<tr><td>'._('Adjustment Quantity').':</td>'; echo '<td>'; if ($Controlled==1){ - if ($_SESSION['Adjustment']->StockLocation == ''){ - $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; + if ($_SESSION['Adjustment'.$identifier]->StockLocation == ''){ + $_SESSION['Adjustment'.$identifier]->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="hidden" name="Quantity" value="' . locale_number_format($_SESSION['Adjustment']->Quantity , $_SESSION['Adjustment']->DecimalPlaces). '" /> - '.locale_number_format($_SESSION['Adjustment']->Quantity, $_SESSION['Adjustment']->DecimalPlaces).' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; + echo '<input type="hidden" name="Quantity" value="' . locale_number_format($_SESSION['Adjustment'.$identifier]->Quantity , $_SESSION['Adjustment'.$identifier]->DecimalPlaces). '" /> + '.locale_number_format($_SESSION['Adjustment'.$identifier]->Quantity, $_SESSION['Adjustment'.$identifier]->DecimalPlaces).' + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE&identifier=' . $identifier . '">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD&identifier=' . $identifier . '">'._('Add').'</a>]'; } else { - echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity, $_SESSION['Adjustment']->DecimalPlaces) . '" />'; + echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity, $_SESSION['Adjustment'.$identifier]->DecimalPlaces) . '" />'; } echo '</td></tr>'; //Select the tag @@ -401,7 +415,7 @@ $result=DB_query($SQL,$db); echo '<option value=0>0 - None</option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_SESSION['Adjustment']->tag) and $_SESSION['Adjustment']->tag==$myrow['tagref']){ + if (isset($_SESSION['Adjustment'.$identifier]->tag) and $_SESSION['Adjustment'.$identifier]->tag==$myrow['tagref']){ echo '<option selected="True" value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } else { echo '<option value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; Modified: trunk/StockAdjustmentsControlled.php =================================================================== --- trunk/StockAdjustmentsControlled.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/StockAdjustmentsControlled.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -4,13 +4,13 @@ include('includes/DefineStockAdjustment.php'); include('includes/session.inc'); - +$identifier=$_GET['identifier']; $title = _('Adjusting Controlled Items'); /* Session started in header.inc for password checking and authorisation level check */ include('includes/header.inc'); -if (!isset($_SESSION['Adjustment'])) { +if (!isset($_SESSION['Adjustment'.$identifier])) { /* This page can only be called when a stock adjustment is pending */ echo '<div class="centre"><a href="' . $rootpath . '/StockAdjustments.php?NewAdjustment=Yes">'. _('Enter A Stock Adjustment'). '</a><br />'; prnMsg( _('This page can only be opened if a stock adjustment for a controlled item has been entered').'<br />','error'); @@ -18,14 +18,14 @@ include('includes/footer.inc'); exit; } -if (isset($_SESSION['Adjustment'])){ +if (isset($_SESSION['Adjustment'.$identifier])){ if (isset($_GET['AdjType']) and $_GET['AdjType']!=''){ - $_SESSION['Adjustment']->AdjustmentType = $_GET['AdjType']; + $_SESSION['Adjustment'.$identifier]->AdjustmentType = $_GET['AdjType']; } } /*Save some typing by referring to the line item class object in short form */ -$LineItem = $_SESSION['Adjustment']; +$LineItem = $_SESSION['Adjustment'.$identifier]; //Make sure this item is really controlled if ( $LineItem->Controlled != 1 ){ @@ -38,12 +38,12 @@ /***** get the page going now... *****/ echo '<div class="centre">'; -echo '<br /><a href="'.$rootpath.'/StockAdjustments.php">' . _('Back to Adjustment Screen') . '</a>'; +echo '<br /><a href="'.$rootpath.'/StockAdjustments.php?identifier=' . $identifier . '">' . _('Back to Adjustment Screen') . '</a>'; echo '<br /><font size="2"><b>'. _('Adjustment of controlled item').' ' . $LineItem->StockID . ' - ' . $LineItem->ItemDescription ; /** vars needed by InputSerialItem : **/ -$LocationOut = $_SESSION['Adjustment']->StockLocation; +$LocationOut = $_SESSION['Adjustment'.$identifier]->StockLocation; $StockID = $LineItem->StockID; if ($LineItem->AdjustmentType == 'ADD'){ echo '<br />'. _('Adding Items').'...'; @@ -65,7 +65,7 @@ /*TotalQuantity set inside this include file from the sum of the bundles of the item selected for adjusting */ -$_SESSION['Adjustment']->Quantity = $TotalQuantity; +$_SESSION['Adjustment'.$identifier]->Quantity = $TotalQuantity; /*Also a multi select box for adding bundles to the adjustment without keying, showing only when keying */ include('includes/footer.inc'); Modified: trunk/includes/InputSerialItems.php =================================================================== --- trunk/includes/InputSerialItems.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/includes/InputSerialItems.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -48,7 +48,7 @@ $invalid_imports = 0; $valid = true; -echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" enctype="multipart/form-data" >'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier , ENT_QUOTES, 'UTF-8') . '" enctype="multipart/form-data" >'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="LineNo" value="' . $LineNo . '" />'; echo '<input type="hidden" name="StockID" value="'. $StockID. '" />'; Modified: trunk/includes/InputSerialItemsKeyed.php =================================================================== --- trunk/includes/InputSerialItemsKeyed.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/includes/InputSerialItemsKeyed.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -54,7 +54,7 @@ echo '<td class="number">' . $Bundle->ExpiryDate . '</td>'; } - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Delete'). '</a></td></tr>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'&identifier=' . $identifier . '">'. _('Delete'). '</a></td></tr>'; $TotalQuantity += $Bundle->BundleQty; } @@ -79,7 +79,7 @@ echo $tableheader; -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" name="Ga6uF5Wa" method="post"> +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier, ENT_QUOTES, 'UTF-8') . '" name="Ga6uF5Wa" method="post"> <input type="hidden" name=LineNo value="' . $LineNo . '" /> <input type="hidden" name=StockID value="' . $StockID . '" /> <input type="hidden" name=EntryType value="KEYED" />'; @@ -131,7 +131,7 @@ } echo '</table>'; -echo '<br /><div class="centre"><input type="submit" name="AddBatches" value="'. _('Enter'). '" /></div>'; +echo '<br /><div class="centre"><button type="submit" name="AddBatches" value="'. _('Enter'). '">'. _('Enter'). '</button></div>'; echo '</form></td><td valign=top>'; if ($ShowExisting){ include('includes/InputSerialItemsExisting.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |