Topic: Adding item that isn't in items list...

Hi,
I've been playing with the 2.3 Demo and I have a quick question:

How do I add an item or service to a supplier invoice that hasn't already been added to the items list with an item ID.  For instance:  I get an invoice from a vendor who performs a once-every-two-years service.  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.

Is this possible?

Thanks!
Frank

Re: Adding item that isn't in items list...

Adding items on the fly is done by pressing F4 key when entering a Direct (Supplier) Invoice or Purchase Order Entry.

Re: Adding item that isn't in items list...

Hi,
Thanks for the quick response.  I've just tried this but ran into to things:

1)  This seems to work on the sales invoices/POs, but doesn't work on the purchasing side for me.
2)  F4 happens to be the key for New->Tab in most modern browsers (at least the ones I can recall.  So it in effect opens a new (blank) tab and then you have to switch tabs back to the front accounting tab.

Just an observation.  Is it possible to change the key bindings?

Kind regards,
Frank

4 (edited by apmuthu 03/08/2015 04:43:52 am)

Re: Adding item that isn't in items list...

Most modern browsers have their key bindings changeable. FireFox 31.4.0esr on WinXP SP3  did not need any changes for F4 to work as desired in FA.

Anyway, thanks. Your valuable inputs have been used to create a new Wiki page to address it.

Lines 555 to 582 in includes/ui/ui_controls.inc:

/*
    Redirector for selector F4 calls.
    $sel_editors is array of selname=>editor_page
*/
function editor_redirect($sel_editors, $save_fun='') {
    foreach ($sel_editors as $selname=>$editor)
        if (isset($_POST['_'.$selname.'_editor'])) {
            if (function_exists($save_fun))
                $save_fun();
            unset($_POST['_'.$selname.'_editor']);
            context_call($editor, array_keys($_POST));
        }
}
/*
    Return procedure for selector F4 calls
*/
function editor_return($vars, $restore_fun='') {
    if (function_exists($restore_fun))
        $restore_fun();

    if ($ret = context_restore()) {
        foreach ($vars as $postname=>$retname)
            if (isset($ret[$retname])) {
                $_POST[$postname] = $ret[$retname];
                set_focus($postname);
            }
    }
}

Lines 445 to 479 in the same file defines the hotkeys (key 115 => F4 for Items):

/* Table editor interfaces. Key is editor type
    0 => url of editor page
    1 => hotkey code
    2 => context help
*/
$popup_editors = array(
    'customer' => array('/sales/manage/customers.php?debtor_no=', 
        113,    _("Customers"), 900, 500),
    'branch' => array('/sales/manage/customer_branches.php?SelectedBranch=', 
        114, _("Branches"), 900, 700),
    'supplier' => array('/purchasing/manage/suppliers.php?supplier_id=', 
        113, _("Suppliers"), 900, 700),
    'item' => array('/inventory/manage/items.php?stock_id=', 
        115, _("Items"), 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 = 'F' . ($key - 111) . ' - ';
    $help .= $popup_editors[$type][2];
    $Pagehelp[] = $help;
}

The file includes/ui_ui_lists.inc has several references to set_editor() function that defines the popup.
Lines 740 to 749 in it are:

function stock_items_list($name, $selected_id=null, $all_option=false, 
    $submit_on_change=false, $opts=array(), $editkey = false)
{
    global $all_items;

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

    if ($editkey)
        set_editor('item', $name, $editkey);

...
...