<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Adding item that isn't in items list...]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=5596</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5596&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Adding item that isn't in items list....]]></description>
		<lastBuildDate>Sun, 08 Mar 2015 04:16:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Adding item that isn't in items list...]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22811#p22811</link>
			<description><![CDATA[<p>Most modern browsers have their key bindings changeable. FireFox 31.4.0esr on WinXP SP3&nbsp; did not need any changes for F4 to work as desired in FA.</p><p>Anyway, thanks. Your valuable inputs have been used to create a <a href="https://frontaccounting.com/fawiki/index.php?n=Devel.HotkeysAssignmentInFA">new Wiki page</a> to address it.</p><p>Lines 555 to 582 in <strong>includes/ui/ui_controls.inc</strong>:<br /></p><div class="codebox"><pre><code>/*
    Redirector for selector F4 calls.
    $sel_editors is array of selname=&gt;editor_page
*/
function editor_redirect($sel_editors, $save_fun=&#039;&#039;) {
    foreach ($sel_editors as $selname=&gt;$editor)
        if (isset($_POST[&#039;_&#039;.$selname.&#039;_editor&#039;])) {
            if (function_exists($save_fun))
                $save_fun();
            unset($_POST[&#039;_&#039;.$selname.&#039;_editor&#039;]);
            context_call($editor, array_keys($_POST));
        }
}
/*
    Return procedure for selector F4 calls
*/
function editor_return($vars, $restore_fun=&#039;&#039;) {
    if (function_exists($restore_fun))
        $restore_fun();

    if ($ret = context_restore()) {
        foreach ($vars as $postname=&gt;$retname)
            if (isset($ret[$retname])) {
                $_POST[$postname] = $ret[$retname];
                set_focus($postname);
            }
    }
}</code></pre></div><p>Lines 445 to 479 in the same file defines the hotkeys (key 115 =&gt; F4 for Items):<br /></p><div class="codebox"><pre><code>/* Table editor interfaces. Key is editor type
    0 =&gt; url of editor page
    1 =&gt; hotkey code
    2 =&gt; context help
*/
$popup_editors = array(
    &#039;customer&#039; =&gt; array(&#039;/sales/manage/customers.php?debtor_no=&#039;, 
        113,    _(&quot;Customers&quot;), 900, 500),
    &#039;branch&#039; =&gt; array(&#039;/sales/manage/customer_branches.php?SelectedBranch=&#039;, 
        114, _(&quot;Branches&quot;), 900, 700),
    &#039;supplier&#039; =&gt; array(&#039;/purchasing/manage/suppliers.php?supplier_id=&#039;, 
        113, _(&quot;Suppliers&quot;), 900, 700),
    &#039;item&#039; =&gt; array(&#039;/inventory/manage/items.php?stock_id=&#039;, 
        115, _(&quot;Items&quot;), 800, 600)
);
/*
    Bind editors for various selectors.
    $type - type of editor
    $input - name of related input field
    $caller - optional function key code (available values F1-F12: 112-123,
        true: default)
*/
function set_editor($type, $input, $caller=true)
{
    global $path_to_root, $Editors, $popup_editors, $Pagehelp;

    $key = $caller===true ? $popup_editors[$type][1] : $caller;

    $Editors[$key] = array( $path_to_root . $popup_editors[$type][0], $input, 
        $popup_editors[$type][3], $popup_editors[$type][4]);
    
    $help = &#039;F&#039; . ($key - 111) . &#039; - &#039;;
    $help .= $popup_editors[$type][2];
    $Pagehelp[] = $help;
}</code></pre></div><p>The file <strong>includes/ui_ui_lists.inc</strong> has several references to set_editor() function that defines the popup.<br />Lines 740 to 749 in it are:<br /></p><div class="codebox"><pre><code>function stock_items_list($name, $selected_id=null, $all_option=false, 
    $submit_on_change=false, $opts=array(), $editkey = false)
{
    global $all_items;

    $sql = &quot;SELECT stock_id, s.description, c.description, s.inactive, s.editable
            FROM &quot;.TB_PREF.&quot;stock_master s,&quot;.TB_PREF.&quot;stock_category c WHERE s.category_id=c.category_id&quot;;

    if ($editkey)
        set_editor(&#039;item&#039;, $name, $editkey);

...
...</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sun, 08 Mar 2015 04:16:04 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22811#p22811</guid>
		</item>
		<item>
			<title><![CDATA[Re: Adding item that isn't in items list...]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22809#p22809</link>
			<description><![CDATA[<p>Hi,<br />Thanks for the quick response.&nbsp; I&#039;ve just tried this but ran into to things:</p><p>1)&nbsp; This seems to work on the sales invoices/POs, but doesn&#039;t work on the purchasing side for me. <br />2)&nbsp; F4 happens to be the key for New-&gt;Tab in most modern browsers (at least the ones I can recall.&nbsp; So it in effect opens a new (blank) tab and then you have to switch tabs back to the front accounting tab.</p><p>Just an observation.&nbsp; Is it possible to change the key bindings?</p><p>Kind regards,<br />Frank</p>]]></description>
			<author><![CDATA[null@example.com (frank)]]></author>
			<pubDate>Sat, 07 Mar 2015 19:28:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22809#p22809</guid>
		</item>
		<item>
			<title><![CDATA[Re: Adding item that isn't in items list...]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22795#p22795</link>
			<description><![CDATA[<p>Adding items on the fly is done by pressing <strong>F4</strong> key when entering a Direct (Supplier) Invoice or Purchase Order Entry.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 07 Mar 2015 12:18:17 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22795#p22795</guid>
		</item>
		<item>
			<title><![CDATA[Adding item that isn't in items list...]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22783#p22783</link>
			<description><![CDATA[<p>Hi,<br />I&#039;ve been playing with the 2.3 Demo and I have a quick question:</p><p>How do I add an item or service to a supplier invoice that hasn&#039;t already been added to the items list with an item ID.&nbsp; For instance:&nbsp; I get an invoice from a vendor who performs a once-every-two-years service.&nbsp; Id like to be able to make a line item in the supplier invoice (or my PO, etc.) without an item id, but with a description, price, purchase account etc.</p><p>Is this possible?</p><p>Thanks!<br />Frank</p>]]></description>
			<author><![CDATA[null@example.com (frank)]]></author>
			<pubDate>Thu, 05 Mar 2015 15:55:16 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22783#p22783</guid>
		</item>
	</channel>
</rss>
