+include_once($path_to_root . "/includes/db/class.reflines_db.inc");
+include_once($path_to_root . "/includes/types.inc");
+//---------------------------------------------------------------------------------------------
+// 2.4 - further changes toward removing refs table introduced:
+// . all transactions now have references stored in trans table.
+// . all reference related moved to class (is_new_reference yet preserved)
+// . template based reflines implemented
+//
+// FIXME:
+// - implement refline field in all transaction tables (obsoletes not always accurate find_refline_id)
+// - remove save() and restore_last() - for now preserved for reflines without placeholder
+// - see fixmes below
+// - remove refs table and create view instead (need e.g. CREATE VIEW support in db_import/db_export)
+
+$refline_options = array(
+ ST_JOURNAL => array('date', 'user'),
+ ST_COSTUPDATE => array('date', 'user'),
+
+ ST_BANKPAYMENT => array('date', 'user'),
+ ST_BANKDEPOSIT => array('date', 'user'),
+ ST_BANKTRANSFER => array('date', 'user'),
+ ST_SUPPAYMENT => array('date', 'user'),
+ ST_CUSTPAYMENT => array('date', 'user'),
+
+ ST_SALESORDER => array('date', 'customer', 'branch', 'user', 'pos'),
+ ST_SALESQUOTE => array('date', 'customer', 'branch', 'user', 'pos'),
+ ST_SALESINVOICE => array('date', 'customer', 'branch', 'user', 'pos'),
+ ST_CUSTCREDIT => array('date', 'customer', 'branch', 'user', 'pos'),
+ ST_CUSTDELIVERY => array('date', 'customer', 'branch', 'user', 'pos'),
+
+ ST_LOCTRANSFER => array('date', 'location', 'user'),
+ ST_INVADJUST => array('date', 'location', 'user'),
+
+ ST_PURCHORDER => array('date', 'location', 'supplier', 'user'),
+ ST_SUPPINVOICE => array('date', 'location', 'supplier', 'user'),
+ ST_SUPPCREDIT => array('date', 'location', 'supplier', 'user'),
+ ST_SUPPRECEIVE => array('date', 'location', 'supplier', 'user'),
+
+ ST_WORKORDER => array('date', 'location', 'user'),
+ ST_MANUISSUE => array('date', 'location', 'user'),
+ ST_MANURECEIVE => array('date', 'user'),
+);
+
+$refline_placeholders = array(
+ 'MM' => 'date',
+ 'YY' => 'date',
+ 'YYYY' => 'date',
+ 'UU' => 'user',
+ 'P' => 'pos',
+// FIXME: for placeholders below all the code should work, but as the ref length is variable,
+// length specification in placeholder format should be implemented.
+// 'C' => 'customer',
+// 'B' => 'branch',
+// 'S' => 'supplier',
+// 'L' => 'location'
+);