webERP Forum

Full Version: SelectCompletedOrder: header ('location:') not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Folks

When searching for sales orders:

1) if you enter an order number and search, nothing is returned
---> if you comment out line 578,579, you get a the result showing a single line of salesorder being displayed (but not the details)
Code:
header('location:' . $RootPath .'/OrderDetails.php?OrderNumber=' . $OrderNumber);
exit();
The header location does not work because the parts section has already been rendered:

if you comment out lines 469 to 508, everything works again

Code:
if (!isset($SelectedStockItem)) {
    $result1 = DB_query("SELECT categoryid,
                            categorydescription
                        FROM stockcategory
                        ORDER BY categorydescription");

   echo '<br />';
   echo '<div class="page_help_text">' . _('To search for sales orders for a specific part use the part selection facilities below') . '</div>';
   echo '<br />
        <table class="selection">';
   echo '<tr><td>' . _('Select a stock category') . ':';
   echo '<select name="StockCat">';

    while ($myrow1 = DB_fetch_array($result1)) {
        if (isset($_POST['StockCat']) AND $myrow1['categoryid'] == $_POST['StockCat']){
            echo '<option selected="selected" value="' .  $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>';
        } else {
            echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>';
        }
    }

   echo '</select></td>
        <td>' . _('Enter text extracts in the description') . ':</td>
        <td><input type="text" name="Keywords" size="20" maxlength="25" /></td>
    </tr>
    <tr>
        <td></td>
        <td><b> ' ._('OR') . ' </b>' . _('Enter extract of the Stock Code') . ':</td>
        <td><input type="text" name="StockCode" size="15" maxlength="18" /></td>
   </tr>
   <tr><td colspan="4"><div class="centre"><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" />';

   if (count($_SESSION['AllowedPageSecurityTokens'])>1){
        echo '<input type="submit" name="ResetPart" value="' . _('Show All') . '" /></div>';
   }
   echo '</td>
        </tr>
        </table>';

}



2) if you do a search by clicking "search parts now", and click on a product code (which clears the screen) and then search orders, you get the list of all orders just fine.
THEN, if you search for a single order from that screen (THAT DOES NOT SHOW THE PART NUMBER SEARCH SECTION THIS TIME, BUT ONLY THE TOP TABLE) you get your single order result to show up correctly (with header and details)

Thank you for your suggestions