<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — items_cart class has a logical bug, should be fixed.]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=7964</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7964&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in items_cart class has a logical bug, should be fixed..]]></description>
		<lastBuildDate>Wed, 23 Jan 2019 10:30:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: items_cart class has a logical bug, should be fixed.]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=34060#p34060</link>
			<description><![CDATA[<p>This has been fixed and committed to repo. Thanks @kvvaradha for detecting this.</p><p>A new file for replacement can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/includes/ui/items_cart.inc">here</a>.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Wed, 23 Jan 2019 10:30:14 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=34060#p34060</guid>
		</item>
		<item>
			<title><![CDATA[items_cart class has a logical bug, should be fixed.]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=34059#p34059</link>
			<description><![CDATA[<p>The items_cart.inc looks like this function</p><div class="codebox"><pre><code>function check_qoh($location, $date_, $reverse=false)
    {
        global $SysPrefs;

        $low_stock = array();

        if (!$SysPrefs-&gt;allow_negative_stock() || is_fixed_asset($line_items-&gt;mb_flag))
        {
            foreach ($this-&gt;line_items as $line_no =&gt; $line_item)
                if (has_stock_holding($line_item-&gt;mb_flag) || is_fixed_asset($line_item-&gt;mb_flag))
                {
                    $quantity = $line_item-&gt;quantity;
                    if ($reverse)
                        $quantity = -$line_item-&gt;quantity;

                    if ($quantity &gt;= 0)
                        continue;

                    if (check_negative_stock($line_item-&gt;stock_id, $quantity, $location, $date_))
                        $low_stock[] = $line_item-&gt;stock_id;
                }
        }
        return $low_stock;
    }</code></pre></div><p>But here&nbsp; is the bug,<br /></p><div class="codebox"><pre><code>if (!$SysPrefs-&gt;allow_negative_stock() || is_fixed_asset($line_items-&gt;mb_flag))</code></pre></div><p>Probably the <strong> is_fixed_asset($line_items-&gt;mb_flag)</strong> is invalid to put it here. we already checking that inside for loop.&nbsp; Also the object <strong> $line_items-&gt;mb_flag</strong> is not available.&nbsp; so change the function like this. </p><div class="codebox"><pre><code>function check_qoh($location, $date_, $reverse=false)
    {
        global $SysPrefs;

        $low_stock = array();
        if (!$SysPrefs-&gt;allow_negative_stock())
        {
            foreach ($this-&gt;line_items as $line_no =&gt; $line_item)
                if (has_stock_holding($line_item-&gt;mb_flag) || is_fixed_asset($line_item-&gt;mb_flag))
                {
                    $quantity = $line_item-&gt;quantity;
                    if ($reverse)
                        $quantity = -$line_item-&gt;quantity;

                    if ($quantity &gt;= 0)
                        continue;

                    if (check_negative_stock($line_item-&gt;stock_id, $quantity, $location, $date_))
                        $low_stock[] = $line_item-&gt;stock_id;
                }
        }
        return $low_stock;
    }</code></pre></div><p>Hope that fixes the undefined noin-object error</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Wed, 23 Jan 2019 09:45:24 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=34059#p34059</guid>
		</item>
	</channel>
</rss>
