[Weberp-svn] SF.net SVN: weberp:[9527] trunk
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2012-08-19 20:15:37
|
Revision: 9527 http://weberp.svn.sourceforge.net/weberp/?rev=9527&view=rev Author: tim_schofield Date: 2012-08-19 20:15:31 +0000 (Sun, 19 Aug 2012) Log Message: ----------- Allow filtering of product search by mbflag Modified Paths: -------------- trunk/SelectProduct.php trunk/includes/ProductSearch.php trunk/javascripts/FormFunctions.js Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2012-08-19 20:15:16 UTC (rev 9526) +++ trunk/SelectProduct.php 2012-08-19 20:15:31 UTC (rev 9527) @@ -560,10 +560,9 @@ echo '<form onsubmit="return SubmitForm(this, \'\')" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - -$URLArray=explode('/', $_SERVER['PHP_SELF']); +$AllowedMBFlags='MBAKGD'; echo '<div class="centre"> - <button type="submit" name="Search" onclick="return OpenSearchWindow(\'includes/ProductSearch.php\', \'' . htmlspecialchars(array_pop($URLArray), ENT_QUOTES, 'UTF-8') . '\')"> + <button type="submit" name="Search" onclick="return OpenSearchWindow(\'includes/ProductSearch.php?MBFlags='.$AllowedMBFlags.'\', \'' . htmlspecialchars(basename($_SERVER['PHP_SELF']), ENT_QUOTES, 'UTF-8') . '\')"> <img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Click To Search For Inventory Items') . '" alt="" /> ' . _('Search For Items') . ' </button> @@ -573,6 +572,5 @@ echo '<div id="SearchWindow">'; echo '</div>'; - include ('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/includes/ProductSearch.php =================================================================== --- trunk/includes/ProductSearch.php 2012-08-19 20:15:16 UTC (rev 9526) +++ trunk/includes/ProductSearch.php 2012-08-19 20:15:31 UTC (rev 9527) @@ -10,6 +10,10 @@ include($PathPrefix . 'config.php'); require_once($PathPrefix . 'includes/session.inc'); +if (isset($_GET['MBFlags'])) { + $_SESSION['MBFlags']=$_GET['MBFlags']; +} + if (!isset($_POST['PartialID']) and !isset($_POST['PartialDescription'])) { $_POST['PartialID']=''; $_POST['PartialDescription']=''; @@ -93,23 +97,31 @@ </table></form>'; function ProductSearchSQL($db) { - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.longdescription, - SUM(locstock.quantity) AS qoh, - stockmaster.units, - stockmaster.mbflag, - stockmaster.discontinued, - stockmaster.decimalplaces - FROM stockmaster - LEFT JOIN locstock - ON stockmaster.stockid=locstock.stockid - WHERE stockmaster.description " . LIKE . " '%" . $_POST['PartialDescription'] . "%' - AND stockmaster.stockid " . LIKE . " '%" . $_POST['PartialID'] . "%' - AND stockmaster.categoryid " . LIKE . " '%" . $_POST['Category'] . "%' - GROUP BY stockmaster.stockid - ORDER BY stockmaster.stockid - LIMIT 15"; + $MBFlagText=''; + for ($i=0; $i<strlen($_SESSION['MBFlags']); $i++) { + $MBFlagText .= "stockmaster.mbflag='".$_SESSION['MBFlags'][$i]."'"; + if ($i<strlen($_SESSION['MBFlags'])-1) { + $MBFlagText .= " OR "; + } + } + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.longdescription, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.mbflag, + stockmaster.discontinued, + stockmaster.decimalplaces + FROM stockmaster + LEFT JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.description " . LIKE . " '%" . $_POST['PartialDescription'] . "%' + AND stockmaster.stockid " . LIKE . " '%" . $_POST['PartialID'] . "%' + AND stockmaster.categoryid " . LIKE . " '%" . $_POST['Category'] . "%' + AND (".$MBFlagText.") + GROUP BY stockmaster.stockid + ORDER BY stockmaster.stockid + LIMIT 15"; $result=DB_query($SQL, $db); return $result; } Modified: trunk/javascripts/FormFunctions.js =================================================================== --- trunk/javascripts/FormFunctions.js 2012-08-19 20:15:16 UTC (rev 9526) +++ trunk/javascripts/FormFunctions.js 2012-08-19 20:15:31 UTC (rev 9527) @@ -202,7 +202,7 @@ document.getElementById("SearchWindow").innerHTML=xmlhttp.responseText; } } - xmlhttp.open("GET",TargetURL+'?CallingURL='+CallingURL,true); + xmlhttp.open("GET",TargetURL+'&CallingURL='+CallingURL,true); xmlhttp.send(); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |