1 (edited by apmuthu 11/28/2014 01:52:19 pm)

Topic: Significance of field sys_types.type_no

The table #_sys_types has 3 fields, viz., type_id, type_no, next_reference.

The first one - type_id - serves to be the input form field suffix for the form textbox input element's name attribute in Setup => Forms Setup.

The last one - next_reference - serves to be the next ID number available for a new record in the appropriately related table.

All references in sql statements in FA refer to only these fields in the WHERE clauses.

In includes/db/references_db.inc:

function save_next_reference($type, $reference) => Updates the next_reference field
function get_next_reference($type) => Obtains the next_reference field

In includes/systypes.inc:
function get_systypes() => "SELECT * FROM ".TB_PREF."sys_types";

Where does the middle field "type_no" get used in?

The function get_systypes() gets called in the file admin/forms_setup.php only and that too once for displaying the form and then for saving the form values.

There appears to be nowhere that the field type_no is used.

Does the sys_prefs.type_no have anything to do with the type_no and trans_no in various related tables?

case 31 refers to the non existent "service_orders" table in function get_systype_db_info() in includes/systypes.inc.

Re: Significance of field sys_types.type_no

The type_no and trans_no fields both refer to the same transaction number. The reference numbers is a better way to display the outgoing document numbers. These reference numbers can be set forward in the form setup. You can combine letters and numbers here. The invoices etc do still have the trans_no fields for secondary keys in other tables.

Joe

Re: Significance of field sys_types.type_no

Hence is it safe to ignore the type_no field in the #_sys_prefs table and assume the trans_no / type_no fields in invoices and other tables are independent of the value in the type_no field in the #_sys_prefs table?