<div dir="ltr">I&#39;m mucking around with an aftersave handler for the Quotes module today and I started seeing some warnings getting logged.  It looks like the product stock email is causing them, but when I trace into the code [1] my jaw hit the floor.  Am I reading this right?  This function seems to think that you can get back more than one user for a given id, which is impossible, since id is the primary key for vtiger_users.  So then it passes the array(&#39;Users&#39; =&gt; ID) to getOwnerName to getOwnerNameList and eventually blows up because it tries to use an array for an array key.  To keep the blast radius small, I patched around the error [2], but I think the moral of the story is that getRecordOwnerId() should be rewritten or removed and all uses of it changed.<div>
<br></div><div>[1] <a href="http://trac.vtiger.com/cgi-bin/trac.cgi/browser/vtigercrm/branches/5.4.0/include/utils/utils.php#L1303">http://trac.vtiger.com/cgi-bin/trac.cgi/browser/vtigercrm/branches/5.4.0/include/utils/utils.php#L1303</a></div>
<div>[2]</div><div><div>Index: include/utils/InventoryUtils.php</div><div>===================================================================</div><div>--- include/utils/InventoryUtils.php<span class="" style="white-space:pre">        </span>(revision 3777)</div>
<div>+++ include/utils/InventoryUtils.php<span class="" style="white-space:pre">        </span>(working copy)</div><div>@@ -110,7 +110,7 @@</div><div> <span class="" style="white-space:pre">        </span>if($upd_qty &lt; $reorderlevel)</div>
<div> <span class="" style="white-space:pre">        </span>{</div><div> <span class="" style="white-space:pre">                </span>//send mail to the handler</div><div>-<span class="" style="white-space:pre">                </span>$handler = getRecordOwnerId($product_id);</div>
<div>+<span class="" style="white-space:pre">                </span>$handler = $adb-&gt;database-&gt;GetOne(&quot;SELECT smownerid FROM vtiger_crmentity WHERE crmid = ?&quot;, array($product_id));</div><div> <span class="" style="white-space:pre">                </span>$handler_name = getOwnerName($handler);</div>
<div> <span class="" style="white-space:pre">                </span>if(vtws_isRecordOwnerUser($handler)) {</div><div> <span class="" style="white-space:pre">                        </span>$to_address = getUserEmail($handler);</div></div><div><br></div></div>