Fixed journal entry type and system type lists, code cleanup.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 15 Sep 2009 07:23:42 +0000 (07:23 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 15 Sep 2009 07:23:42 +0000 (07:23 +0000)
CHANGELOG.txt
includes/types.inc
includes/ui/ui_lists.inc

index f1d2169e31bdb50cf309139b2b10e7f8bf8b99b4..0f23316ce161147dd2c6e8be96b84556ce005b8a 100644 (file)
@@ -19,6 +19,13 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+
+15-Sep-2009 Janusz Dobrowolski
+# Fixed journal entry type and systype selectors
+$ /includes/types.inc
+! Clenaup
+$ /includes/ui/ui_lists.inc
+
 14-Sep-2009 Joe Hunt
 ! Changed all numeric constants to the new defined constants. A huge task.
 $ /admin/fiscalyears.php
index 675ecb770f5f18f0cd1ab17d1433a4d7faed5435..86dd7d72c936a93b0f1997b86141b7d51cb90326 100644 (file)
@@ -10,6 +10,8 @@
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 //----------------------------------------------------------------------------------
+//     FrontAccounting system transaction types
+//
 define('ST_JOURNAL', 0);
 
 define('ST_BANKPAYMENT', 1);
@@ -20,8 +22,10 @@ define('ST_SALESINVOICE', 10);
 define('ST_CUSTCREDIT', 11);
 define('ST_CUSTPAYMENT', 12);
 define('ST_CUSTDELIVERY', 13);
+
 define('ST_LOCTRANSFER', 16);
 define('ST_INVADJUST', 17);
+
 define('ST_PURCHORDER', 18);
 define('ST_SUPPINVOICE', 20);
 define('ST_SUPPCREDIT', 21);
@@ -29,15 +33,15 @@ define('ST_SUPPAYMENT', 22);
 define('ST_SUPPRECEIVE', 25);
 
 define('ST_WORKORDER', 26);
+define('ST_MANUISSUE', 28);
+define('ST_MANURECEIVE', 29);
+
 
 define('ST_SALESORDER', 30);
 define('ST_SALESQUOTE', 32);
 define('ST_COSTUPDATE', 35);
 define('ST_DIMENSION', 40);
 
-define('ST_MANUISSUE', 28);
-define('ST_MANURECEIVE', 29);
-
 $systypes_array = array (
        ST_JOURNAL => _("Journal Entry"),
        ST_BANKPAYMENT => _("Bank Payment"),
@@ -64,6 +68,8 @@ $systypes_array = array (
        );
 
 //----------------------------------------------------------------------------------
+//             Bank transaction types
+//
 define('BT_TRANSFER', 0);
 define('BT_CHEQUE', 1);
 define('BT_CREDIT', 2);
@@ -84,17 +90,19 @@ $bank_transfer_types = array(
        );
 
 //----------------------------------------------------------------------------------
-/* Menu tabs */
-$tabs = array('orders'=>_("Sales"), 'AP'=>_("Purchases"), 'stock'=>_("Items and Inventory"), 'manuf'=>_("Manufacturing"), 
-       'proj'=>_("Dimensions"), 'GL'=>_("Banking and General Ledger"), 'system'=>_("Setup"));
+// Core FA menu tabs (modules)
+//
+$tabs = array('orders'=>_("Sales"), 
+                       'AP'=>_("Purchases"),
+                       'stock'=>_("Items and Inventory"),
+                       'manuf'=>_("Manufacturing"), 
+                       'proj'=>_("Dimensions"),
+                       'GL'=>_("Banking and General Ledger"),
+                       'system'=>_("Setup"));
 
 //----------------------------------------------------------------------------------
-
-include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
-include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
-include_once($path_to_root . "/sales/includes/sales_db.inc");
-include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
-
+//     Payment types
+//
 define('PT_MISC', 0);
 define('PT_WORKORDER', 1);
 define('PT_CUSTOMER', 2);
@@ -110,7 +118,6 @@ $payment_person_types = array (
                                _("Quick Entry")
        );
 
-
 function payment_person_currency($type, $person_id)  {
        switch ($type)
        {
@@ -174,7 +181,8 @@ function payment_person_has_items($type) {
 }
 
 //----------------------------------------------------------------------------------
-
+//     Manufacturing types
+//
 define('WO_ASSEMBLY', 0);
 define('WO_UNASSEMBLY', 1);
 define('WO_ADVANCED', 2);
@@ -185,8 +193,17 @@ $wo_types_array = array (
        WO_ADVANCED => _("Advanced Manufacture")
        );
 
-//----------------------------------------------------------------------------------
+define('WO_LABOUR', 0);
+define('WO_OVERHEAD', 1);
 
+$wo_cost_types = array(
+               WO_LABOUR => _("Labour Cost"),
+               WO_OVERHEAD => _("Overhead Cost"),
+);
+
+//----------------------------------------------------------------------------------
+//     GL account classes
+//
 define('CL_NONE', 0); // for backward compatibility
 define('CL_ASSETS', 1);
 define('CL_LIABILITIES', 2);
@@ -212,14 +229,9 @@ function get_class_type_convert($ctype)
        else    
                return ((($ctype >= CL_LIABILITIES && $ctype <= CL_INCOME) || $ctype == CL_NONE) ? -1 : 1);
 }
-define('WO_LABOUR', 0);
-define('WO_OVERHEAD', 1);
-
-$wo_cost_types = array(
-               WO_LABOUR => _("Labour Cost"),
-               WO_OVERHEAD => _("Overhead Cost"),
-);
-
+//----------------------------------------------------------------------------------
+//     Quick entry types
+//
 $quick_actions = array(
        '=' => _('Remainder'), // post current base amount to GL account
        'a' => _('Amount'), // post amount to GL account
@@ -248,6 +260,16 @@ $quick_entry_types = array(
                QE_SUPPINV => _("Supplier Invoice/Credit")
 );
 
+//----------------------------------------------------------------------------------
+//     Special option values for various list selectors.
+//
+define('ANY_TEXT', '');
+define('ANY_NUMERIC', -1);
+define('ALL_TEXT', '');
+define('ALL_NUMERIC', -1);
+
+
+//----------------------------------------------------------------------------------
 // Types of stock items
 $stock_types = array(
                'M' => _("Manufactured"),
@@ -255,12 +277,4 @@ $stock_types = array(
                'D' => _("Service")
 );
 
-/*
-       Special option values for various list selectors.
-*/
-define('ANY_TEXT', '');
-define('ANY_NUMERIC', -1);
-define('ALL_TEXT', '');
-define('ALL_NUMERIC', -1);
-
 ?>
\ No newline at end of file
index 913b8a7967f3ad741b2cb93474e7d5e3c4ab252a..ef4825050101ebf0d3a26595f23ff975aeb60b76 100644 (file)
@@ -1796,16 +1796,8 @@ function pagesizes_list_row($label, $name, $value=null)
 function systypes_list_cells($label, $name, $value=null, $submit_on_change=false)
 {
        global $systypes_array;
-
-       if ($label != null)
-               echo "<td>$label</td>\n";
-       echo "<td>";
-
-       $items = array();
-       foreach ($systypes_array as $key=>$type)
-                       $items[$key] = $type['name'];
        
-       $str = array_selector($name, $value, $items
+       $str = array_selector($name, $value, $systypes_array
                array( 
                        'select_submit'=> $submit_on_change,
                        'async' => false
@@ -1823,11 +1815,12 @@ function journal_types_list_cells($label, $name, $value=null, $submit_on_change=
                echo "<td>$label</td>\n";
        echo "<td>";
 
-       $items = array();
-       foreach ($systypes_array as $key=>$type)
-               // exclude orders and dimensions
-               if (!in_array($key, array(18,26,30,40)))
-                       $items[$key] = $type['name'];
+       $items = $systypes_array;
+
+       // exclude quotes, orders and dimensions
+       foreach (array(ST_PURCHORDER, ST_WORKORDER, ST_SALESORDER, ST_DIMENSION, 
+                               ST_SALESQUOTE) as $excl)
+                       unset($items[$excl]);
        
        $str = array_selector($name, $value, $items, 
                array(