fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [15509] more on property


From: sigurdne
Subject: [Fmsystem-commits] [15509] more on property
Date: Thu, 25 Aug 2016 14:54:30 +0000 (UTC)

Revision: 15509
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15509
Author:   sigurdne
Date:     2016-08-25 14:54:30 +0000 (Thu, 25 Aug 2016)
Log Message:
-----------
more on property

Modified Paths:
--------------
    trunk/property/inc/class.soentity.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/admin_entity.xsl

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2016-08-25 14:53:42 UTC (rev 
15508)
+++ trunk/property/inc/class.soentity.inc.php   2016-08-25 14:54:30 UTC (rev 
15509)
@@ -335,7 +335,7 @@
                        unset($sql_cnt);
 
                        $this->total_records = $this->db->f('cnt');
-
+                       _debug_array($sql . $ordermethod);
                        $ordermethod = '';
                        if (!$allrows)
                        {
@@ -654,6 +654,18 @@
                        $__querymethod = array();
                        $_joinmethod_datatype = array();
                        $_joinmethod_datatype_custom = array();
+                       $custom_attribs = array();
+                       $this->db->query("SELECT * FROM $attribute_table WHERE 
$attribute_filter AND search='1'");
+                       while ($this->db->next_record())
+                       {
+                               $custom_attribs[$this->db->f('column_name')] = 
array(
+                                       'id'    => $this->db->f('id'),
+                                       'datatype'      => 
$this->db->f('datatype'),
+                                       'location_id'   => 
$this->db->f('location_id'),
+                                       'search'        => 
$this->db->f('search'),
+                               );
+                       }
+
                        if ($query)
                        {
                                $query = $this->db->db_addslashes($query);
@@ -688,7 +700,6 @@
                                                        case 'T':
                                                                if 
(!$criteria_id)
                                                                {
-//                                                                     
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . 
"[contains(.,''$query'')]' PASSING BY REF xml_representation)";
                                                                        
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."' 
{$this->like} '%{$query}%'";
                                                                        
$__querymethod = array(); // remove block
                                                                }
@@ -707,7 +718,6 @@
                                                                        
$this->db2->query("SELECT phpgw_cust_choice.id FROM phpgw_cust_choice 
{$_filter_choise}", __LINE__, __FILE__);
                                                                        while 
($this->db2->next_record())
                                                                        {
-//                                                                             
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . 
"[contains(.,''," . $this->db2->f('id') . ",'')]' PASSING BY REF 
xml_representation)";
                                                                                
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."' 
{$this->like} '%,{$query},%'";
                                                                        }
                                                                }
@@ -724,9 +734,7 @@
                                                                        
$__filter_choise = array();
                                                                        while 
($this->db2->next_record())
                                                                        {
-//                                                                             
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() = 
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
                                                                                
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name') 
."' AS integer) = " .(int)$this->db2->f('id');
-
                                                                        }
                                                                        
$__querymethod = array(); // remove block
                                                                }
@@ -734,9 +742,8 @@
                                                        case 'I':
                                                                if 
(ctype_digit($query) && !$criteria_id)
                                                                {
-//                                                                     
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() = 
''" . (int)$query . "'']' PASSING BY REF xml_representation)";
-                                                                       
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name') 
."' AS integer) = " .(int)$query;
-
+//                                                                     
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name') 
."' AS integer) = " .(int)$query;
+                                                                       
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."'  
{$this->like} '" .(int)$query . "%'";
                                                                        
$__querymethod = array(); // remove block
                                                                }
                                                                break;
@@ -747,7 +754,6 @@
                                                                        
$__filter_choise = array();
                                                                        while 
($this->db2->next_record())
                                                                        {
-//                                                                             
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() = 
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
                                                                                
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name') 
."' AS integer) = " .(int)$this->db2->f('id');
                                                                        }
 
@@ -761,7 +767,6 @@
                                                                        
$__filter_choise = array();
                                                                        while 
($this->db2->next_record())
                                                                        {
-//                                                                             
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() = 
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
                                                                                
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name') 
."' AS integer) = " .(int)$this->db2->f('id');
                                                                        }
 
@@ -775,7 +780,6 @@
                                                                        
$__filter_choise = array();
                                                                        while 
($this->db2->next_record())
                                                                        {
-//                                                                             
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() = 
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
                                                                                
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name') 
."' AS integer) = " .(int)$this->db2->f('id');
                                                                        }
                                                                        
$__querymethod = array(); // remove block
@@ -784,7 +788,6 @@
                                                        default:
                                                                if 
(!$criteria_id)
                                                                {
-//                                                                     
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() = 
''$query'']' PASSING BY REF xml_representation)";
                                                                        
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."' = 
'{$query}'";
                                                                        
$__querymethod = array(); // remove block
                                                                }
@@ -854,6 +857,11 @@
                                $this->uicols['classname'][] = '';
                        }
 
+                       if ($dry_run)
+                       {
+                               return array();
+                       }
+
                        $_joinmethod_datatype = 
array_merge($_joinmethod_datatype, $_joinmethod_datatype_custom);
                        foreach ($_joinmethod_datatype as $_joinmethod)
                        {
@@ -903,10 +911,6 @@
                        $this->total_records = $cache_info['total_records'];
 
 
-                       if ($dry_run)
-                       {
-                               return array();
-                       }
 
                        $ordermethod = '';
                        $xml_order = '';
@@ -914,9 +918,6 @@
                        {
                                switch ($order)
                                {
-                                       case 'user_id':
-                                               //                              
$ordermethod = " ORDER BY phpgw_accounts.account_lastname {$sort}";  // Don't 
work with LDAP.
-                                               break;
                                        case 'loc1_name':
                                                $ordermethod = " ORDER BY 
fm_location1.loc1_name {$sort}";
                                                break;
@@ -927,11 +928,22 @@
                                        case 'loc1':
                                                $ordermethod = " ORDER BY 
{$entity_table}.loc1 {$sort}";
                                                break;
+                                       case 'user_id';
+                                       case 'modified_on';
+                                       case 'entry_date':
+                                               $ordermethod = " ORDER BY 
{$entity_table}.$order {$sort}";
+                                               $xml_order = 
",fm_bim_item.{$order}";
+                                               break;
                                        default:
-                                               $ordermethod = " ORDER BY 
{$entity_table}.json_representation->>'{$order}' {$sort}";
-//                                             $xml_order = ',cast 
(_order_field[1] as text) as _order_field_text';
-//                                             $sql = str_replace('FROM 
fm_bim_item', "FROM (SELECT fm_bim_item.*, xpath('$order/text()', 
xml_representation) as _order_field FROM fm_bim_item", $sql);
-//                                             $sql .= ") as fm_bim_item ORDER 
BY _order_field_text {$sort}";
+                                               $ordermethod = " ORDER BY 
{$order} {$sort}";
+                                               
if($custom_attribs[$order]['datatype'] == 'I')
+                                               {
+                                                       $xml_order = 
",CAST(json_representation->>'{$order}' AS integer) AS {$order}";
+                                               }
+                                               else
+                                               {
+                                                       $xml_order = 
",json_representation->>'{$order}' AS {$order}";
+                                               }
                                }
                        }
                        else
@@ -953,11 +965,11 @@
 //                     _debug_array($sql_pre_run);
                        if (!$allrows)
                        {
-                               $this->db->limit_query($sql_pre_run, $start, 
__LINE__, __FILE__, $results);
+                               $this->db->limit_query($sql_pre_run. 
$ordermethod, $start, __LINE__, __FILE__, $results);
                        }
                        else
                        {
-                               $this->db->query($sql_pre_run, __LINE__, 
__FILE__);
+                               $this->db->query($sql_pre_run. $ordermethod, 
__LINE__, __FILE__);
                        }
 
                        $ids = array();

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2016-08-25 14:53:42 UTC (rev 
15508)
+++ trunk/property/setup/tables_update.inc.php  2016-08-25 14:54:30 UTC (rev 
15509)
@@ -9248,6 +9248,22 @@
                        )
                );
 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT DISTINCT 
account_id, project_id FROM fm_workorder WHERE account_id IS NOT NULL AND 
account_id != '0'");
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $projects = array();
+               while($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $projects[] = array(
+                               'id' => 
$GLOBALS['phpgw_setup']->oProc->f('project_id'),
+                               'b_account_id' => 
$GLOBALS['phpgw_setup']->oProc->f('account_id'),
+                       );
+               }
+
+               foreach ($projects as $project)
+               {
+                       $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
fm_project SET b_account_id = '{$project['b_account_id']}' WHERE id = 
{$project['id']}");
+               }
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
                        $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.704';

Modified: trunk/property/templates/base/admin_entity.xsl
===================================================================
--- trunk/property/templates/base/admin_entity.xsl      2016-08-25 14:53:42 UTC 
(rev 15508)
+++ trunk/property/templates/base/admin_entity.xsl      2016-08-25 14:54:30 UTC 
(rev 15509)
@@ -915,7 +915,7 @@
                                        </xsl:choose>
                                        <tr height="50">
                                                <td>
-                                                       <input type="submit" 
class="pure-button pure-button-primary" name="values[save]" value="{lang_save}" 
onClick="onActionsClick()">
+                                                       <input type="submit" 
class="pure-button pure-button-primary" name="values[save]" value="{lang_save}">
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="php:function('lang', 'save')"/>
                                                                </xsl:attribute>
@@ -936,21 +936,15 @@
                                        <xsl:value-of select="lang_done"/>
                                </xsl:variable>
                                <form method="post" action="{$done_action}">
-                                       <input type="submit" class="pure-button 
pure-button-primary" name="done" value="{$lang_done}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                       <input type="submit" class="pure-button 
pure-button-primary" name="done" value="{$lang_done}">
+                                               <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_done_standardtext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </form>
                        </td>
                </tr>
        </table>
-       <!--  DATATABLE DEFINITIONS-->
-       <script type="text/javascript">
-               var base_java_url = <xsl:value-of select="base_java_url"/>;
-       </script>
 </xsl:template>
 
 <!-- list attribute -->




reply via email to

[Prev in Thread] Current Thread [Next in Thread]