From: <tu...@us...> - 2018-01-02 19:18:58
|
Revision: 7899 http://sourceforge.net/p/web-erp/reponame/7899 Author: turbopt Date: 2018-01-02 19:18:56 +0000 (Tue, 02 Jan 2018) Log Message: ----------- SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). [Reported in forums by Paul Becker] Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. Modified Paths: -------------- trunk/SelectSalesOrder.php trunk/doc/Change.log Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2018-01-02 05:27:00 UTC (rev 7898) +++ trunk/SelectSalesOrder.php 2018-01-02 19:18:56 UTC (rev 7899) @@ -29,6 +29,13 @@ unset($SelectedCustomer); } +if ( isset($_GET['Quotations']) ) { + $_POST['Quotations'] = $_GET['Quotations']; +} +else { + $_POST['Quotations'] = ''; +} + if (isset($_POST['PlacePO'])){ /*user hit button to place PO for selected orders */ /*Note the button would not have been displayed if the user had no authority to create purchase orders */ @@ -505,15 +512,11 @@ echo '</select></td> <td><select name="Quotations">'; - if (isset($_GET['Quotations']) AND $_GET['Quotations']=='Quotes_Only'){ - $_POST['Quotations']='Quotes_Only'; - } - - if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Quotes_Only'){ + if ( $_POST['Quotations'] == 'Quotes_Only' ){ echo '<option selected="selected" value="Quotes_Only">' . _('Quotations Only') . '</option>'; echo '<option value="Orders_Only">' . _('Orders Only') . '</option>'; echo '<option value="Overdue_Only">' . _('Overdue Only') . '</option>'; - } elseif (isset($_POST['Quotations']) AND $_POST['Quotations'] == 'Overdue_Only'){ + } elseif ( $_POST['Quotations'] == 'Overdue_Only' ){ echo '<option selected="selected" value="Overdue_Only">' . _('Overdue Only') . '</option>'; echo '<option value="Quotes_Only">' . _('Quotations Only') . '</option>'; echo '<option value="Orders_Only">' . _('Orders Only') . '</option>'; @@ -522,6 +525,7 @@ echo '<option value="Quotes_Only">' . _('Quotations Only') . '</option>'; echo '<option value="Overdue_Only">' . _('Overdue Only') . '</option>'; } + if (!isset($_POST['DueDateFrom'])) { $_POST['DueDateFrom'] = ''; } @@ -643,15 +647,14 @@ } //figure out the SQL required from the inputs available - if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Orders_Only'){ - $Quotations = 0; - } elseif(isset($_POST['Quotations']) AND $_POST['Quotations'] == 'Quotes_Only') { - $Quotations =1; - } elseif(isset($_POST['Quotations']) AND $_POST['Quotations'] == 'Overdue_Only') { + if( $_POST['Quotations'] == 'Quotes_Only' ) { + $Quotations = 1; + } elseif( $_POST['Quotations'] == 'Overdue_Only' ) { $Quotations = "0 AND itemdue<'" . Date('Y-m-d') . "'"; } else { $Quotations = 0; } + if (isset($_POST['DueDateFrom']) AND is_date($_POST['DueDateFrom'])) { $DueDateFrom = " AND itemdue>='" . FormatDateForSQL($_POST['DueDateFrom']) . "' "; } else { @@ -777,8 +780,7 @@ $SQL .= " AND salesorders.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; } - if (isset($OrderNumber) - AND $OrderNumber !='') { + if (isset($OrderNumber) AND $OrderNumber !='') { $SQL .= "AND salesorders.orderno=". $OrderNumber ." AND salesorders.quotation=" .$Quotations; @@ -788,7 +790,6 @@ AND salesorders.quotation=" . $Quotations; } else { - /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ if (isset($SelectedCustomer)) { @@ -847,7 +848,7 @@ echo '<table cellpadding="2" width="95%" class="selection">'; - if (isset($_POST['Quotations']) AND ($_POST['Quotations']=='Orders_Only' OR $_POST['Quotations'] == 'Overdue_Only')){ + if ( $_POST['Quotations'] == 'Orders_Only' OR $_POST['Quotations'] == 'Overdue_Only' ){ $TableHeader = '<tr> <th class="ascending" >' . _('Modify') . '</th> <th>' . _('Invoice') . '</th> @@ -1012,13 +1013,16 @@ </tr> </tfoot>'; } - echo '<tfoot><tr><td colspan="9" class="number">'; + + echo '<tfoot><tr><td colspan="9" class="number"><b>'; + if ($_POST['Quotations']=='Orders_Only'){ - echo '<b>' . _('Total Order(s) Value in'); + echo _('Total Order(s) Value in'); } else { - echo '<b>' . _('Total Quotation(s) Value in'); + echo _('Total Quotation(s) Value in'); } - echo ' ' . $_SESSION['CompanyRecord']['currencydefault'] . ' :</b></td> + + echo ' ' . $_SESSION['CompanyRecord']['currencydefault'] . ':</b></td> <td class="number"><b>' . locale_number_format($OrdersTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> </tr></tfoot> </table>'; @@ -1031,11 +1035,13 @@ } //end StockID already selected include('includes/footer.php'); + function GetSearchItems ($SQLConstraint='') { - global $db; + if ($_POST['Keywords'] AND $_POST['StockCode']) { echo _('Stock description keywords have been used in preference to the Stock code extract entered'); } + $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.decimalplaces, @@ -1045,6 +1051,7 @@ ON salesorderdetails.stkcode = stockmaster.stockid AND completed=0 INNER JOIN locstock ON stockmaster.stockid=locstock.stockid"; + if (isset($_POST['StockCat']) AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ $WhereStockCat = ''; @@ -1051,14 +1058,13 @@ } else { $WhereStockCat = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "' "; } + if ($_POST['Keywords']) { //insert wildcard characters in spaces $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - $SQL .= " WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' - " . $WhereStockCat ; + $SQL .= " WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' " . $WhereStockCat; - } elseif (isset($_POST['StockCode'])){ $SQL .= " WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%'" . $WhereStockCat; @@ -1066,6 +1072,7 @@ $SQL .= " WHERE stockmaster.categoryid='" . $_POST['StockCat'] ."'"; } + $SQL .= $SQLConstraint; $SQL .= " GROUP BY stockmaster.stockid, stockmaster.description, @@ -1076,7 +1083,7 @@ $ErrMsg = _('No stock items were returned by the SQL because'); $DbgMsg = _('The SQL used to retrieve the searched parts was'); $StockItemsResult = DB_query($SQL,$ErrMsg,$DbgMsg); + return $StockItemsResult; - } ?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-02 05:27:00 UTC (rev 7898) +++ trunk/doc/Change.log 2018-01-02 19:18:56 UTC (rev 7899) @@ -1,5 +1,6 @@ webERP Change Log +2/1/18: PaulT: SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums by Paul Becker) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. 2/1/18: PaulT: css/default/default.css: Add text alignment in a couple of styles to match the same use in other CSS to avoid formatting issues when the default theme is used. Also, set several property names to lowercase. 20/12/17 PaulT: FormMaker.php, ReportMaker.php, WriteForm.inc: A few more PHP 7.1 array compatibility changes. 20/12/17 PaulT: RCFunctions.inc, FormMaker.php: PHP 7.1 array compatibility change. |