From: <dai...@us...> - 2011-09-04 10:10:20
|
Revision: 4677 http://web-erp.svn.sourceforge.net/web-erp/?rev=4677&view=rev Author: daintree Date: 2011-09-04 10:10:14 +0000 (Sun, 04 Sep 2011) Log Message: ----------- 4/9/11 Phil: Removed the stock code from form entities in SelectOrderItems.php and PO_Items.php to prevent issues with some characters in stock codes as suggested by Tim Modified Paths: -------------- trunk/GLTransInquiry.php trunk/PO_Items.php trunk/Payments.php trunk/SelectOrderItems.php Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2011-09-04 03:12:20 UTC (rev 4676) +++ trunk/GLTransInquiry.php 2011-09-04 10:10:14 UTC (rev 4677) @@ -66,7 +66,7 @@ $Posted = _('Yes'); $CreditTotal = $DebitTotal = 0; - + $j=1; while ( $TransRow = DB_fetch_array($TransResult) ) { $TranDate = ConvertSQLDate($TransRow['trandate']); $DetailResult = false; @@ -120,7 +120,7 @@ if ( $TransRow['posted']==0 ) { $Posted = _('No'); } - $j=0; + if ($j==1) { echo '<tr class="OddTableRows">'; $j=0; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-09-04 03:12:20 UTC (rev 4676) +++ trunk/PO_Items.php 2011-09-04 10:10:14 UTC (rev 4677) @@ -524,10 +524,11 @@ */ foreach ($_POST as $FormVariableName => $Quantity) { - + /*The form entity name is of the format NewQtyX where X is the index number that identifies the stock item code held in the hidden StockIDX form variable + * */ if (mb_substr($FormVariableName, 0, 6)=='NewQty' AND $Quantity!=0) { //if the form variable represents a Qty to add to the order - $ItemCode = mb_substr($FormVariableName, 6, mb_strlen($FormVariableName)-6); + $ItemCode = $_POST['StockID' . mb_substr($FormVariableName, 6)]; $AlreadyOnThisOrder = 0; if ($_SESSION['PO_AllowSameItemMultipleTimes'] ==false){ @@ -1123,9 +1124,10 @@ <td class="number">' . $ConversionFactor .'</td> <td>' . $OrderUnits . '</td> <td>' . $ImageSource . '</td> - <td><input class="number" type="text" size="6" value="0" name="NewQty' . $myrow['stockid'] . '"></td> + <td><input class="number" type="text" size="6" value="0" name="NewQty' . $j . '"></td> + <input type="hidden" name="StockID' . $j .'" . value="' . $myrow['stockid'] . '" /> </tr>'; - + $j++; $PartsDisplayed++; if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ break; Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-09-04 03:12:20 UTC (rev 4676) +++ trunk/Payments.php 2011-09-04 10:10:14 UTC (rev 4677) @@ -112,10 +112,14 @@ $_SESSION['PaymentDetail']->Account=$_POST['BankAccount']; /*Get the bank account currency and set that too */ $ErrMsg = _('Could not get the currency of the bank account'); - $result = DB_query("SELECT currcode, decimalplaces + $result = DB_query("SELECT currcode, + decimalplaces FROM bankaccounts INNER JOIN currencies - ON bankaccounts.currcode=currencies.currabrev - WHERE accountcode ='" . $_POST['BankAccount'] . "'",$db,$ErrMsg); + ON bankaccounts.currcode = currencies.currabrev + WHERE accountcode ='" . $_POST['BankAccount'] . "'", + $db, + $ErrMsg); + $myrow = DB_fetch_array($result); $_SESSION['PaymentDetail']->AccountCurrency=$myrow['currcode']; $_SESSION['PaymentDetail']->CurrDecimalPlaces=$myrow['decimalplaces']; @@ -710,11 +714,11 @@ echo '<tr><th colspan="4"><font size="3" color="blue">' . _('Payment'); -if ($_SESSION['PaymentDetail']->SupplierID!=""){ +if ($_SESSION['PaymentDetail']->SupplierID!=''){ echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail']->SuppName; } -if ($_SESSION['PaymentDetail']->BankAccountName!=""){ +if ($_SESSION['PaymentDetail']->BankAccountName!=''){ echo ' ' . _('from the') . ' ' . $_SESSION['PaymentDetail']->BankAccountName; } @@ -752,7 +756,6 @@ echo '</select></td></tr>'; } - echo '<tr><td>' . _('Date Paid') . ':</td> <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength=10 size=11 onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail']->DatePaid . '"></td> </tr>'; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-09-04 03:12:20 UTC (rev 4676) +++ trunk/SelectOrderItems.php 2011-09-04 10:10:14 UTC (rev 4677) @@ -22,10 +22,10 @@ unset($_POST['PartSearch']); } -if (isset($_POST['order_items'])){ - foreach ($_POST as $key => $value) { - if (mb_strstr($key,'itm')) { - $NewItem_array[mb_substr($key,3)] = trim($value); +if (isset($_POST['SelectingOrderItems'])){ + foreach ($_POST as $FormVariable => $Quantity) { + if (mb_strpos($FormVariable,'OrderQty')!==false) { + $NewItem_array[$_POST['StockID' . mb_substr($FormVariable,8)]] = trim($Quantity); } } } @@ -859,7 +859,7 @@ if (!isset($Offset) or $Offset<0) { $Offset=0; } - $SQL = $SQL . " LIMIT " . $_SESSION['DefaultDisplayRecordsMax'] . " OFFSET " . number_format($_SESSION['DefaultDisplayRecordsMax']*$Offset); + $SQL = $SQL . " LIMIT " . $_SESSION['DefaultDisplayRecordsMax'] . " OFFSET " . strval($_SESSION['DefaultDisplayRecordsMax']*$Offset); $ErrMsg = _('There is a problem selecting the part records to display because'); $DbgMsg = _('The SQL used to get the part selection was'); @@ -900,7 +900,7 @@ /*Process Quick Entry */ /* If enter is pressed on the quick entry screen, the default button may be Recalculate */ - if (isset($_POST['order_items']) + if (isset($_POST['SelectingOrderItems']) OR isset($_POST['QuickEntry']) OR isset($_POST['Recalculate'])){ @@ -1268,7 +1268,7 @@ } /*end of if its a new item */ - if (isset($NewItem_array) AND isset($_POST['order_items'])){ + if (isset($NewItem_array) AND isset($_POST['SelectingOrderItems'])){ /* get the item details from the database and hold them in the cart object make the quantity 1 by default then add it to the cart */ /*Now figure out if the item is a kit set - the field MBFlag='K'*/ $AlreadyWarnedAboutCredit = false; @@ -1524,7 +1524,8 @@ <th>' . _('Quantity') . '</th> </tr>'; echo $TableHeader; - $j = 1; + $i=0; + $j=1; $k=0; //row colour counter while ($myrow=DB_fetch_array($result2)) { @@ -1610,7 +1611,8 @@ <td class="number">%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td><font size=1><input class="number" tabindex='. number_format($j+7).' type="textbox" size=6 name="itm'.$myrow['stockid'].'" value=0> + <td><font size=1><input class="number" tabindex='. strval($j+7).' type="textbox" size=6 name="OrderQty' . $i . '" value=0 /> + <input type="hidden" name="StockID' . $i . '" value="' . $myrow['stockid'] . '" /> </td> </tr>', $myrow['stockid'], @@ -1627,7 +1629,7 @@ #end of page full new headings if } #end of while loop for Frequently Ordered Items - echo '<td style="text-align:center" colspan=8><input type="hidden" name="order_items" value=1><input tabindex='.number_format($j+8).' type="submit" value="'._('Add to Sales Order').'"></td>'; + echo '<td style="text-align:center" colspan=8><input type="hidden" name="SelectingOrderItems" value=1><input tabindex='.strval($j+8).' type="submit" value="'._('Add to Sales Order').'"></td>'; echo '</table>'; } //end of if Frequently Ordered Items > 0 echo '<p><div class="centre"><b><p>' . $msg . '</b></p>'; @@ -1692,9 +1694,9 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method=post name="orderform">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="table1">'; - echo '<tr><td colspan=><input type="hidden" name="previous" value='.number_format($Offset-1).'><input tabindex='.number_format($j+8).' type="submit" name="Prev" value="'._('Prev').'"></td>'; - echo '<td style="text-align:center" colspan=6><input type="hidden" name="order_items" value=1><input tabindex='.number_format($j+9).' type="submit" value="'._('Add to Sales Order').'"></td>'; - echo '<td colspan=><input type="hidden" name="nextlist" value='.number_format($Offset+1).'><input tabindex='.number_format($j+10).' type="submit" name="Next" value="'._('Next').'"></td></tr>'; + echo '<tr><td colspan=><input type="hidden" name="previous" value='.strval($Offset-1).'><input tabindex='.strval($j+8).' type="submit" name="Prev" value="'._('Prev').'"></td>'; + echo '<td style="text-align:center" colspan=6><input type="hidden" name="SelectingOrderItems" value=1><input tabindex='.strval($j+9).' type="submit" value="'._('Add to Sales Order').'"></td>'; + echo '<td colspan=><input type="hidden" name="nextlist" value='.strval($Offset+1).'><input tabindex='.strval($j+10).' type="submit" name="Next" value="'._('Next').'"></td></tr>'; $TableHeader = '<tr> <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> @@ -1707,7 +1709,7 @@ </tr>'; echo $TableHeader; $ImageSource = _('No Image'); - + $i=0; $k=0; //row colour counter while ($myrow=DB_fetch_array($SearchResult)) { @@ -1793,7 +1795,8 @@ <td class="number">%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td><font size=1><input class="number" tabindex='.number_format($j+7).' type="textbox" size=6 name="itm'.$myrow['stockid'].'" value=0> + <td><font size=1><input class="number" tabindex='.strval($j+7).' type="textbox" size=6 name="OrderQty'. $i . '" value=0 /> + <input type="hidden" name="StockID'. $i . '" value="' . $myrow['stockid']. '" /> </td> </tr>', $myrow['stockid'], @@ -1803,6 +1806,7 @@ locale_number_format($DemandQty,$QOHRow['decimalplaces']), locale_number_format($OnOrder,$QOHRow['decimalplaces']), locale_number_format($Available,$QOHRow['decimalplaces']) ); + $i++; if ($j==1) { $jsCall = '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.itm'.$myrow['stockid'].');}</script>'; } @@ -1810,9 +1814,9 @@ #end of page full new headings if } #end of while loop - echo '<tr><td><input type="hidden" name="previous" value='. number_format($Offset-1).'><input tabindex='. number_format($j+7).' type="submit" name="Prev" value="'._('Prev').'"></td>'; - echo '<td style="text-align:center" colspan=6><input type="hidden" name="order_items" value=1><input tabindex='. number_format($j+8).' type="submit" value="'._('Add to Sales Order').'"></td>'; - echo '<td><input type="hidden" name="nextlist" value='.number_format($Offset+1).'><input tabindex='.number_format($j+9).' type="submit" name="Next" value="'._('Next').'"></td></tr>'; + echo '<tr><td><input type="hidden" name="previous" value='. strval($Offset-1).'><input tabindex='. strval($j+7).' type="submit" name="Prev" value="'._('Prev').'"></td>'; + echo '<td style="text-align:center" colspan=6><input type="hidden" name="SelectingOrderItems" value=1><input tabindex='. strval($j+8).' type="submit" value="'._('Add to Sales Order').'"></td>'; + echo '<td><input type="hidden" name="nextlist" value='.strval($Offset+1).'><input tabindex='.strval($j+9).' type="submit" name="Next" value="'._('Next').'"></td></tr>'; echo '</table></form>'; echo $jsCall; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |