Fixed start order in initialy sorted pagers.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 2 Feb 2009 18:43:45 +0000 (18:43 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 2 Feb 2009 18:43:45 +0000 (18:43 +0000)
dimensions/inquiry/search_dimensions.php
includes/db_pager.inc
purchasing/allocations/supplier_allocation_main.php
purchasing/inquiry/po_search_completed.php
purchasing/inquiry/supplier_allocation_inquiry.php
purchasing/inquiry/supplier_inquiry.php
sales/allocations/customer_allocation_main.php
sales/inquiry/customer_allocation_inquiry.php

index ab4d804e690a8d300d114bb15b4c14a8b3b34640..0b1a47df477b179377c1cc580011e3a474f35276 100644 (file)
@@ -172,7 +172,7 @@ $cols = array(
        _("Name"), 
        _("Type"), 
        _("Date") =>'date',
-       _("Due Date") => array('date', 'ord'=>'asc'), 
+       _("Due Date") => array('name'=>'due_date', 'date', 'ord'=>'asc'), 
        _("Closed") => array('fun'=>'is_closed'),
        _("Balance") => array('type'=>'amount', 'insert'=>true, 'fun'=>'sum_dimension'),
        array('insert'=>true, 'fun'=>'edit_link')
index 613d2921e3477d8f1024a65e382421741d25533e..ef74a95de80135fc1e6de45a37d4dfcfa40b24e7 100644 (file)
@@ -263,10 +263,10 @@ class db_pager {
                }
 
                $sql = "$select FROM $from $where";
-               if($group) $sql.= " GROUP BY $group";
+               if ($group) $sql.= " GROUP BY $group";
            $ord = array();
 
-           foreach$this->columns as $col) {
+           foreach ($this->columns as $col) {
                if (isset($col['ord'])) {
                        if ( $col['ord'] != '' && isset($col['name'])) {
                            $ord[] = $col['name'] .' '. $col['ord'];
@@ -294,6 +294,8 @@ class db_pager {
        //
        function _init() 
        {
+               global $go_debug;
+               
            if ($this->ready == false ) {
                        $sql = $this->_sql_gen(true);
                        $result = db_query($sql, 'Error reading record set');
@@ -302,6 +304,18 @@ class db_pager {
                        $row = db_fetch_row($result);
                        $this->rec_count = $row[0];
                        $this->max_page = ceil($this->rec_count/$this->page_len);
+               
+                       if ($go_debug) { // FIX - need column name parsing, but for now:
+                               // check if field names are set explicite in col def
+                               // for all initially ordered columns
+                           foreach ($this->columns as $col) {
+                               if (isset($col['ord']) && $col['ord'] != '' 
+                                               &&  !isset($col['name'])) {
+                                                       display_warning("Result field names must be set
+                                                               for all intially ordered db_pager columns.");
+                               }
+                               }
+               }
                        $this->set_page(1);
                        $this->ready = true;
            }
index e58582f7dadb735f946723ea0724e09d680a299c..0742a587dc947e52b525a0d8774241579edddb24 100644 (file)
@@ -108,7 +108,7 @@ $cols = array(
        _("Transaction Type") => array('fun'=>'systype_name'),
        _("#") => array('fun'=>'trans_view'),
        _("Reference"), 
-       _("Date") => array('type'=>'date', 'ord'=>'asc'),
+       _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'),
        _("Supplier") => array('ord'=>''),
        _("Currency") => array('align'=>'center'),
        _("Total") => 'amount', 
index 905fdc00fc74e2f5ad276662724db7c759154a77..3e239d8e9eec6ddd67a27bc63b877d885e3ac632 100644 (file)
@@ -149,7 +149,7 @@ $cols = array(
                _("Supplier") => array('ord'=>''),
                _("Location"),
                _("Supplier's Reference"), 
-               _("Order Date") => array('type'=>'date', 'ord'=>'desc'),
+               _("Order Date") => array('name'=>'ord_date', 'type'=>'date', 'ord'=>'desc'),
                _("Currency") => array('align'=>'center'), 
                _("Order Total") => 'amount',
                array('insert'=>true, 'fun'=>'prt_link'),
index 0216392f6d2624a3c2ebff68c73330d778456b1f..69e399d4fe26fa1ed73aa6f2f24b6beec9f946ae 100644 (file)
@@ -175,7 +175,7 @@ $cols = array(
        _("Reference"), 
        _("Supplier") => array('ord'=>''), 
        _("Supp Reference"),
-       _("Date") => array('type'=>'date', 'ord'=>'asc'),
+       _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'),
        _("Due Date") => array('fun'=>'due_date'),
        _("Currency") => array('align'=>'center'),
        _("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'), 
index a2f18aaae665930f784b98251649f9e338a6ad40..c3bdbcb6ddab9dc980c5c99b204de6bb32026a67 100644 (file)
@@ -211,7 +211,7 @@ $cols = array(
                        _("Reference"), 
                        _("Supplier"),
                        _("Supplier's Reference"), 
-                       _("Date") => array('type'=>'date', 'ord'=>'desc'), 
+                       _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'desc'), 
                        _("Due Date") => array('type'=>'date', 'fun'=>'due_date'), 
                        _("Currency") => array('align'=>'center'),
                        _("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'), 
index 3489004d87ce44e4854e38010bb3c8582a0690bf..cb88dd45652c4bcf1750ed701c4e6d9cbb5420c6 100644 (file)
@@ -103,7 +103,7 @@ $cols = array(
        _("Transaction Type") => array('fun'=>'systype_name'),
        _("#") => array('fun'=>'trans_view'),
        _("Reference"), 
-       _("Date") => array('type'=>'date', 'ord'=>'asc'),
+       _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'),
        _("Customer") => array('ord'=>''),
        _("Currency") => array('align'=>'center'),
        _("Total") => 'amount', 
index d7a02dc6f5e44d7461a8be01acc3bed2b318f89a..9bcab151afad562d5f89453c4227c09a83272b70 100644 (file)
@@ -203,7 +203,7 @@ $cols = array(
        _("#") => array('fun'=>'view_link'),
        _("Reference"), 
        _("Order") => array('fun'=>'order_link'), 
-       _("Date") => array('type'=>'date', 'ord'=>'asc'),
+       _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'),
        _("Due Date") => array('type'=>'date', 'fun'=>'due_date'),
        _("Customer"), 
        _("Currency") => array('align'=>'center'),