Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lookup field on Product Selection (SelectProduct.php)
06-18-2013, 01:12 AM
Post: #1
Lookup field on Product Selection (SelectProduct.php)
Should not the lookup field (from stockitemproperties) be plain text rather than an input field or dropdown button, as it is not within a form and therefore not updateable?
Find all posts by this user
Quote this message in a reply
06-18-2013, 06:56 AM
Post: #2
RE: Lookup field on Product Selection (SelectProduct.php)
Yes you are absolutely right - it should be

Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Visit this user's website Find all posts by this user
Quote this message in a reply
06-18-2013, 07:10 PM
Post: #3
RE: Lookup field on Product Selection (SelectProduct.php)
So now that complete "switch" block can be reduced to this :

$PropValResult = DB_query($sql,$db);
$PropValRow = DB_fetch_row($PropValResult);
$PropertyValue = $PropValRow[0];

if ($PropertyRow['controltype'] == 2) {
if ($PropertyValue == true) $PropertyValue = _('Yes');
else $PropertyValue = _('No');
}

echo <<<EOT
<tr>
<th align="left" width="20%">
{$PropertyRow['label']}
</th>
<td class="select" align="left" colspan=2>
$PropertyValue
</td>
</tr>
EOT;
Find all posts by this user
Quote this message in a reply
06-18-2013, 08:49 PM
Post: #4
RE: Lookup field on Product Selection (SelectProduct.php)
Well I reworked it a bit

Code:
    $sql = "SELECT stkcatpropid,
                    label,
                    controltype,
                    defaultvalue
                FROM stockcatproperties
                WHERE categoryid ='" . $myrow['categoryid'] . "'
                AND reqatsalesorder =0
                ORDER BY stkcatpropid";
    $PropertiesResult = DB_query($sql, $db);
    $PropertyCounter = 0;
    $PropertyWidth = array();
    while ($PropertyRow = DB_fetch_array($PropertiesResult)) {
        $PropValResult = DB_query("SELECT value
                                    FROM stockitemproperties
                                    WHERE stockid='" . $StockID . "'
                                    AND stkcatpropid ='" . $PropertyRow['stkcatpropid']."'", $db);
        $PropValRow = DB_fetch_row($PropValResult);
        if (DB_num_rows($PropValResult)==0){
            $PropertyValue = _('Not Set');
        } else {
            $PropertyValue = $PropValRow[0];
        }
        echo '<tr>
                <th align="right">' . $PropertyRow['label'] . ':</th>';
        switch ($PropertyRow['controltype']) {
            case 0:
            case 1:
                echo '<td class="select" style="width:60px">' . $PropertyValue;
            break;
            case 2; //checkbox
                echo '<td class="select" style="width:60px">';
                if ($PropertyValue == _('Not Set')){
                    echo _('Not Set');
                } elseif ($PropertyValue == 1){
                    echo _('Yes');
                } else {
                    echo _('No');
                }
            break;
        } //end switch
    echo '</td></tr>';
    $PropertyCounter++;
} //end loop round properties for the item category
echo '</table></td>'; //end of Item Category Property mod

Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)