1 (edited by kvvaradha 05/21/2015 11:24:12 am)

Topic: Problem with Manufacturing Auto Increment reference is not working

hi,

I had problem with the  Work order auto next reference . So i discovered a solution myself. It may be useful to someone.

open your work_order_db.inc   and find the function "add_work_order" . Here you can see the function like this



$Refs->save(ST_WORKORDER, $woid, $wo_ref);

just replace with the follwing code.


save_next_reference(ST_WORKORDER, $wo_ref+1);

Re: Problem with Manufacturing Auto Increment reference is not working

@joe: include into core?

Re: Problem with Manufacturing Auto Increment reference is not working

I had problem with the  Work order auto next reference.

What was the exact problem you tried to solve?

Janusz

Re: Problem with Manufacturing Auto Increment reference is not working

Hi
Sorry for the delayed response.

Actually there is a function to save next reference number on tAble.  Which will be brought to use automatically  for the next work order.  Here the function is missed to  configure.

Re: Problem with Manufacturing Auto Increment reference is not working

The function save_next_reference defined in includes/db/references_db.inc just saves the given reference to the table without any increment using:

function save_next_reference($type, $reference)
{
    $sql = "UPDATE ".TB_PREF."sys_types SET next_reference=" . db_escape(trim($reference)) 
        . " WHERE type_id = ".db_escape($type);

    db_query($sql, "The next transaction ref for $type could not be updated");
}

The above function is called from admin/forms_setup.php to post the form variables just as is into the sys_types table.

The file includes/references.inc has defined the (class references) methods save() and restore_last() which first increment or decrement and then call the above function.

Hence in the file @kvvaradha referred to - manufacturing/includes/db/work_orders_db.inc - the save() method does not need any increment in the argument.

Furthermore, the import_transactions extension has a redundant line 250 in modules/import_transactions/import_transactions.php

           save_next_reference($type, $reference);

Hence nothing needs to be done in the FA codebase for now.