Well i do more research it seems the whole code is messed up, al least with serial items i apply the following patches to get it working but i need to confirm they are fine.
StockAdjustments.diff
Code:
@@ -10,7 +10,8 @@
include('includes/header.inc');
include('includes/SQL_CommonFunctions.inc');
-if (empty($_GET['identifier'])) {
+if (isset($_POST['identifier'])) $identifier=$_POST['identifier']; //this fix serial items session when sending the form
+elseif (empty($_GET['identifier'])) {
/*unique session identifier to ensure that there is no conflict with other adjustment sessions on the same machine */
$identifier=date('U');
} else {
@@ -79,10 +80,8 @@
if ($_POST['Quantity']=='' OR !is_numeric(filter_number_format($_POST['Quantity']))){
$_POST['Quantity']=0;
}
-} else {
- $_POST['Quantity']=0;
-}
-$_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']);
+ $_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); //this fix problems when returning form StockAdjustmentsControlled
+}
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>';
@@ -435,10 +434,10 @@
} else {
$Narrative ='';
}
-
+//this enable long comments on why, also need to modify stockmoves table, field reference to varchar(250)
echo '<tr>
<td>'. _('Comments On Why').':</td>
- <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $Narrative . '" /></td>
+ <td><textarea name="Narrative" cols="50" rows="5">'.$_SESSION['Adjustment']->Narrative.'</textarea></td>
</tr>';
echo '<tr><td>'._('Adjustment Quantity').':</td>';
@@ -448,10 +447,13 @@
if ($_SESSION['Adjustment' . $identifier]->StockLocation == ''){
$_SESSION['Adjustment' . $identifier]->StockLocation = $_SESSION['UserStockLocation'];
}
+ //this fix problem with session and serial items in post form
+ echo '<input type="hidden" name="identifier" value="' . $identifier . '" />';
+ //this fix problem with session and serial items in calls to StockAdjustmesControlled.php
echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment' . $identifier]->Quantity . '" />
'.locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$DecimalPlaces) .'
- [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>]
- [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]';
+ [<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,$DecimalPlaces) . '" />';
}
StockAdjustmentsControlled.diff
Code:
@@ -45,7 +45,7 @@
/***** 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>'; //this fix the returning to stock adjustments
echo '<br /><font size="2"><b>'. _('Adjustment of controlled item').' ' . $LineItem->StockID . ' - ' . $LineItem->ItemDescription ;
@@ -72,8 +72,8 @@
/*TotalQuantity set inside this include file from the sum of the bundles
of the item selected for adjusting */
-$_SESSION['Adjustment'.$identifier]->Quantity = $TotalQuantity;
-
+//this is a litle check, if not adjustment then not modify Quantity
+if ($TotalQuantity!=0) $_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');
?>